From patchwork Fri Dec 8 11:35:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 751612 Delivered-To: patch@linaro.org Received: by 2002:adf:a499:0:b0:333:3a04:f257 with SMTP id g25csp941566wrb; Fri, 8 Dec 2023 03:37:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeM0DDLEt0bhw4ohyLmWaHRa1PzexlK1SAUb+YVw6ZdUPC3Z7W86BGbaVo1ZPRgKvl+P3/ X-Received: by 2002:ac8:5b89:0:b0:417:95e7:a2f7 with SMTP id a9-20020ac85b89000000b0041795e7a2f7mr5736737qta.19.1702035447115; Fri, 08 Dec 2023 03:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702035447; cv=none; d=google.com; s=arc-20160816; b=Lt6nnIUMs/jeBvowGmcOCPEVAFgeyA2F+ftvYQ6Fyu+Si58mXSWTGMRdznQferQPms SSfdUZMqQM+YzBwEqvRK+YbregItgyh+B/Fz9pk21MEextUdqEXY3ZPkh2GExZBDJKAA 596Uf3VCigcfl7R4UBnB2aOfeYBgneJxSf4XcO2BETUNyiw0X3+hRRFR8mf0JagAV19u 2MyknqHSZPbNKVEuZQouX7sFQ5QJWHrT2MOGgS1qt7wy2FLWeIfcXY6rNlsf94E1j8iN IU3ebh6qh0notgDHcsP2JX3um3ilZpNnZfucCAFeKv/vaWfj98aJdI/b3e5x7qd8VY3U wz7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VVurd634A6d7jfTmu56SsLNYdI1euektVunJFK5bAB4=; fh=QdevGGL2LydCvB/btUcdJnXEA7h6h6ICE8REXL8PVZU=; b=bh+hSHM1KOWFv1U+2dW2Ah8Zp3Umg6COo/LvV9X9MbEsspIwGO2Hr2uBHYKorg1jsf RU9eStGIFan9qsHzxwTPzUdYQmWk1DvovK54JPFFsmzsGVUGRkqcyT3OSNo4b/xPn/Pv egipX6bFxMC0kSmlC04XVroqZWVoX/y8Af1a4xbXGS+WxL3ya9GcQ1rbEwjB89/F/+Bj MP/l3TsnQsAzP+ZlThV6a05y/R/AA0JsSW7UAeES63ps+SqDH6LDzHVO70rYsV9suTLN ijeq6QvNB8KZCABsRU/A/lfLV1RAFx3dQDbWf7s6+nHgCs4fd3GQGOD3Zm3tL1WgbK2J YQdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mETiaTtk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g5-20020ac81245000000b004236dbb5cc8si1765945qtj.476.2023.12.08.03.37.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Dec 2023 03:37:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mETiaTtk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBZ9N-0004Rw-CK; Fri, 08 Dec 2023 06:36:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBZ9K-0004FM-Q1 for qemu-devel@nongnu.org; Fri, 08 Dec 2023 06:36:06 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBZ9I-0004U3-7r for qemu-devel@nongnu.org; Fri, 08 Dec 2023 06:36:06 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-332fd81fc8dso1879989f8f.3 for ; Fri, 08 Dec 2023 03:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702035362; x=1702640162; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VVurd634A6d7jfTmu56SsLNYdI1euektVunJFK5bAB4=; b=mETiaTtkWBmuG4oPJMm+dKQt6UqhhzDCzBH/UTajH+ubYJOSDnNHWRkXDJnLCsBhkV My1ILds0NK5V4u3n9Gin+Sk/xzsZ/Bib8zf77cYeg4xofFWzf57TtR0hQz3HY2YyHdeq uhqkR9vbjy6IM/nP2DsQyMcNlad+HksdKCWllIDVM/0mlKeB/lGDtyX0057jCE2+a/Fs iTWINlYhxHW0m2DQilLaOcic+UUt7A5wrkRWNZH3+fGNxkFEomPR5ip/Nxgi7frfI13H SNZwruHuzgqkBDA+J3p8M1KJdDqMeCux6RUgwC5RvE2tk0uz9OihyFWmoYYSxpDBVTQF dkNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702035362; x=1702640162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VVurd634A6d7jfTmu56SsLNYdI1euektVunJFK5bAB4=; b=pfKQnn3k8y1LZ/elidXSN1uwMkJjw/sDKj9BFgkVkT5J62+cA/k2/rjeyJ7c6saLwY mFyjKj5TY/bmEyPFFcIlqEOroWBPnkgklbphaU5pJVyLJuCmHVmc9OmxcTQv3xpviFlX 4TpE/WfTpAJg3QBY1anyLGHJdQvxp0Sc04NDv/tUJsG5kAYhGJhwQOWBLB2yfLoLNzJ9 afrbU2uthbgV3fUh4LUftYO7JlGLnO3o/fVy9Df7RVvNszrS/VOAN2wRIoTKkgaRRbhl tCOYleQ1u8LosnPCjSCTcabSyA/8089YVQdzBsuLpr9xkxGtEOpGzle/3MgTmBOr+Xqj WOlQ== X-Gm-Message-State: AOJu0YywOnjf8tzdgX3o0vjwbK52fnO93fgzskqiFiNiLuZy39kU+iWx eCFhZO3exYyIx9BuZxA/ATQwuRgv5gjgj1DORK8= X-Received: by 2002:adf:fc52:0:b0:333:2fd2:68d3 with SMTP id e18-20020adffc52000000b003332fd268d3mr2309689wrs.102.1702035362697; Fri, 08 Dec 2023 03:36:02 -0800 (PST) Received: from m1x-phil.lan ([176.176.146.181]) by smtp.gmail.com with ESMTPSA id q18-20020adff952000000b0033609b71825sm1357263wrr.35.2023.12.08.03.36.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 08 Dec 2023 03:36:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Maydell , qemu-block@nongnu.org, Pavel Dovgalyuk , Fam Zheng , Richard Henderson , qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 5/6] util/async: Only call icount_notify_exit() if icount is enabled Date: Fri, 8 Dec 2023 12:35:27 +0100 Message-ID: <20231208113529.74067-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231208113529.74067-1-philmd@linaro.org> References: <20231208113529.74067-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/icount-common.c | 4 +++- stubs/icount.c | 2 +- util/async.c | 16 +++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c index f0f8fc7f1c..a4a747d1dc 100644 --- a/accel/tcg/icount-common.c +++ b/accel/tcg/icount-common.c @@ -495,7 +495,9 @@ bool icount_configure(QemuOpts *opts, Error **errp) void icount_notify_exit(void) { - if (icount_enabled() && current_cpu) { + assert(icount_enabled()); + + if (current_cpu) { qemu_cpu_kick(current_cpu); qemu_clock_notify(QEMU_CLOCK_VIRTUAL); } diff --git a/stubs/icount.c b/stubs/icount.c index 7055c13725..b060b03a73 100644 --- a/stubs/icount.c +++ b/stubs/icount.c @@ -37,7 +37,7 @@ void icount_account_warp_timer(void) { abort(); } - void icount_notify_exit(void) { + abort(); } diff --git a/util/async.c b/util/async.c index 8f90ddc304..9007642c27 100644 --- a/util/async.c +++ b/util/async.c @@ -94,13 +94,15 @@ static void aio_bh_enqueue(QEMUBH *bh, unsigned new_flags) } aio_notify(ctx); - /* - * Workaround for record/replay. - * vCPU execution should be suspended when new BH is set. - * This is needed to avoid guest timeouts caused - * by the long cycles of the execution. - */ - icount_notify_exit(); + if (unlikely(icount_enabled())) { + /* + * Workaround for record/replay. + * vCPU execution should be suspended when new BH is set. + * This is needed to avoid guest timeouts caused + * by the long cycles of the execution. + */ + icount_notify_exit(); + } } /* Only called from aio_bh_poll() and aio_ctx_finalize() */