From patchwork Thu Dec 7 10:26:29 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: 751061 Delivered-To: patch@linaro.org Received: by 2002:adf:a499:0:b0:333:3a04:f257 with SMTP id g25csp344861wrb; Thu, 7 Dec 2023 02:27:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIWZufs4Rrp5p2VtVavd/k35qOjideya0CEiQzKRZoPKuCSsQIPieiOu7COjHLSTJekKTZ X-Received: by 2002:a05:622a:1213:b0:417:f85b:5a5a with SMTP id y19-20020a05622a121300b00417f85b5a5amr2372346qtx.5.1701944866525; Thu, 07 Dec 2023 02:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701944866; cv=none; d=google.com; s=arc-20160816; b=vdz7Eu63td4kHUJ1cBrXmp7tGAEozqyCA5nuGCYWW7dexLNiavWDGA5caPD6c6D6YN fEy6vj6goLTSmp43oHPu5xdep1py4xOhDGRNxmmAvdvcJncS7XSbXbUAgJ0uNpYRD9oY /i19cGRYCAQKoRkuQfjp5YbHmCyORAc3VZnJ668oy7973gNT0N/bBsSuCkhz6kGML8SK NyZtxuFnAUJKWf7B4zMaDRrxERqoY42jn4u2Gc/odGWSx5JL7axJBfROZM5lcsWsc/W+ F0+bvHmgorq5iIvMfAa/8gIGIkpIW+uTrdxw/3VqjFQrKc81NUzqy+jMaI2sI+HtnnsS BWRQ== 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=ZZpBZ1VJe1txisZ3T5aUZfE6odH/PADS2VLpythQ8NQ=; fh=Wwzqfz/G0LPj8Oasa7SYmxwpyyV6ogvrMIS9R1LpZE0=; b=Jgb/Rmv3gxTlC3jEtoEk/MTuf7VfMETZBwr9eRmw6h0FHDehs/ruP7HVMIcLfWaizf X+hCnTM9twZDV1XbXoGCrRAwF2l/DsT7NS8nHn/1VL/y5IjgjOWyC8xLpjfvJOsLIJa/ ajErs6F3FeQUFAZkF3HpJzIjlaQ3yUdha+JkZGazf0ubsRNqwuR3oTRN4qchVYUS0BFS kykiuXqlWk9TB++q5r8r7Og4kD1hlYLEhk9klrFPoCBXAqej13BFRaj89O1ujusx0EXr WKMmKWxw3j4JWgH5KoGch2K3qDxsDYHlNPduw4QZB+1OyiJB/L9Gw7fHCSwGk9+kMC+K K37g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=djxDQFuH; 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 bs27-20020ac86f1b000000b004239a83db71si1095129qtb.634.2023.12.07.02.27.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Dec 2023 02:27:46 -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=djxDQFuH; 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 1rBBal-0004eR-Ps; Thu, 07 Dec 2023 05:26:53 -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 1rBBai-0004e8-0b for qemu-devel@nongnu.org; Thu, 07 Dec 2023 05:26:48 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBBaf-0001YL-JJ for qemu-devel@nongnu.org; Thu, 07 Dec 2023 05:26:46 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40b27726369so8656595e9.0 for ; Thu, 07 Dec 2023 02:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701944800; x=1702549600; 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=ZZpBZ1VJe1txisZ3T5aUZfE6odH/PADS2VLpythQ8NQ=; b=djxDQFuHqOCVA49KJ+mdchwsmaUYEGm5f6I/Y5PqdEkyxi7beZwbOHAQn5ls0IseKF V1A8OWih8rj4v+rZLIWl3P9RtOqqEaU9p6lQCbd5cklWnRxeTnkEnL1G1xNIA5mb15pX kBcpCD1xbLdg8TMMXwhK6lucs+1LE9kh8PCDbAVTnXgX2h88OoU+e72I3vIEcZwvEKWg NsFVJojuqbbXaakAvTB3jDiPptQyD+PJ/ICko2XLpPjgL0XWa9uu4gbBF+Rew7cTAcJJ cD+zJA31FPQystfBAtJpKUBc1LzMGZu5ghxFd4BW448MZjl29ctKqvs4h43+DdbXDX0V XrHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701944800; x=1702549600; 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=ZZpBZ1VJe1txisZ3T5aUZfE6odH/PADS2VLpythQ8NQ=; b=Y6g/IQN934FvMyQxTmy/SvFise3TMpqAXpJ7XpTXJPxq3VohZfpCoiABxHM9bmuMkH R1pMurvhO/nJxqgp0xb5LASVLUtFLc7AMVDQ3v+6Unuz65bxRVrbwFmcsild/qdKVoQq ukC5W7KfT51WiHj5xI42WVs/TNPO/Yv9KECXsh+XhWHntha/Vf8GtqsQQO+nvQH7FOMb K8s6XALxAnFr5O8Q1Fjqf9vjAXfPwJIDk+diDNEXm7fLTp423QNJJEeZDljGKRV02Zzc iAly8cHkdTOlH2dy3yAoVDBsx0nN+n7FCBSRPSPgOqd+34oKSTUrH4d6W/UCY41VEwNA +Ocw== X-Gm-Message-State: AOJu0YyCOSZmiIY2hBSz+y2ux2gXm9sSLenDdd/uAqpTxBRGy6Nx7JbO AoafXO901WKnEoP9KRl/8T2G+zVI/fslgASB3pc= X-Received: by 2002:a05:600c:501e:b0:40b:5e1c:af31 with SMTP id n30-20020a05600c501e00b0040b5e1caf31mr1416336wmr.55.1701944799949; Thu, 07 Dec 2023 02:26:39 -0800 (PST) Received: from m1x-phil.lan ([176.187.202.111]) by smtp.gmail.com with ESMTPSA id q9-20020adff949000000b0033342338a24sm1077287wrr.6.2023.12.07.02.26.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Dec 2023 02:26:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Fam Zheng , qemu-block@nongnu.org, Paolo Bonzini , Pavel Dovgalyuk , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 1/3] util/async: Only call icount_notify_exit() if icount is enabled Date: Thu, 7 Dec 2023 11:26:29 +0100 Message-ID: <20231207102632.33634-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231207102632.33634-1-philmd@linaro.org> References: <20231207102632.33634-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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=ham 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é --- stubs/icount.c | 2 +- util/async.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/stubs/icount.c b/stubs/icount.c index 6df8c2bf7d..fc3beac003 100644 --- a/stubs/icount.c +++ b/stubs/icount.c @@ -43,7 +43,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() */ From patchwork Thu Dec 7 10:26:30 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: 751062 Delivered-To: patch@linaro.org Received: by 2002:adf:a499:0:b0:333:3a04:f257 with SMTP id g25csp344863wrb; Thu, 7 Dec 2023 02:27:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSPt3l+lCqyDaSOhYHwVLWBT4K5q4kfaD60MiEBAOOeh+cCc9DW8Giv1SoK8cCmXB8F7X7 X-Received: by 2002:a05:620a:8008:b0:77e:fba3:58c9 with SMTP id ee8-20020a05620a800800b0077efba358c9mr995217qkb.90.1701944866655; Thu, 07 Dec 2023 02:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701944866; cv=none; d=google.com; s=arc-20160816; b=eF80kJck/CZ43bQNs6LHunj+iewwfRcGjZc8XALh0clWG177mdiAffJEoJiIOToQw0 FwdAnyN43rKiBAazvP7YNxXROWBT5Lq7AVJjJHBfivYJfzEJQo8APLxeQCT6d0aJpcDM fAeMMOoFBe9b0iniz1Tt+vTWQq+9QzdY2GFrjg/VrD90Hfby1Ma3/As1ismVdv5ay8A9 xGZt3ypiJyuWB1qwRvZMl8Bhu/FlrtMH5otMFcP/X04+ID+s19VnHFAFbz5ucAD8bjKP bx/QLkGiwruXd41vKvFOIvXRif9x6M/0tiqhv+xm/qCav/G0Sl85vcdl6zkDcL9d14Lg Xi8g== 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=k3NowGfQ+Uh8kFkQHiDEgo2KSzDvk36tqOsqfMg+nHw=; fh=Wwzqfz/G0LPj8Oasa7SYmxwpyyV6ogvrMIS9R1LpZE0=; b=IlQxtszwQBkOi5JtxZ+iKrMrKULMG9ie4kg5JRXDNP6bke75YzC6Z3CWji5vXtbfS3 nj5ikdWUYwOY4VIRP8hpYkldsWfGrCx5roB207orzZb3e5RCRm3QwvyMh5PnnL3LZa06 7dup65UM2S+8In+kPpaXXhSuXlUgnUMkenVzv5LeA20pMIR9vFKq0MYBWCwyJwj9br4e KUVOZNlfpF97PiOovqe1nHdqAb4wmnZ1k6wxJPRU2MbhiY7+c6NScRA+eUuaDXF1ESLQ GHkjORs0nxXGuGEFkrq3+o3mZBJXrvw2QCyM2wcNf94kSkVwOg5ljMYDzdSaeuSuRg7Y MgQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UHoUid5O; 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 u22-20020a05620a455600b0077d72ae1615si1101791qkp.265.2023.12.07.02.27.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Dec 2023 02:27:46 -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=UHoUid5O; 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 1rBBap-0004fq-Dh; Thu, 07 Dec 2023 05:26:55 -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 1rBBaj-0004eV-Tk for qemu-devel@nongnu.org; Thu, 07 Dec 2023 05:26:51 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBBag-0001Yw-Ti for qemu-devel@nongnu.org; Thu, 07 Dec 2023 05:26:49 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40c09f5a7cfso9051495e9.0 for ; Thu, 07 Dec 2023 02:26:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701944805; x=1702549605; 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=k3NowGfQ+Uh8kFkQHiDEgo2KSzDvk36tqOsqfMg+nHw=; b=UHoUid5OxExp9gtgboFVFjy7u1FGS9SNgaEowrG2YGoOMFq7LJdqrvqvauTlcwENoJ 1oujlxOmVc+f+5IUOYF8V6Y+rH2Zb+3QoibqRstehXhmwY7pCi/cxWTJml11NR77NbJX zs3WgBN8Bfy98X87Z5z87lBP2+YgYQw31Z+aFQO4hcr8AVgoZAVYF9/cykNAyKzZtoQf kHt2fQTL5P6nLpqfZhw5MX9Jj9J/00APZVYmBZ+q79on6Nnu2iEPvhtFS9g+gAu6DOjd yTwYMuV+Zqj+t8/fRZM+Rs0Nszrg91loWM8ZllbyxjBzXYUQSWHcptXY5b2v0vmqdXyz fKgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701944805; x=1702549605; 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=k3NowGfQ+Uh8kFkQHiDEgo2KSzDvk36tqOsqfMg+nHw=; b=KVbsv4jA5O9oZUadxFGqjLCGNL8vjB3maVp5nZkydxm38F683tjMdiX2zph8H2ag8T eO1CZP0Tt810ueuERicaoK/Fp39D9tDxqhdoRBlkUGooX9eKC3r1tQLj4CfvfvkrCZL5 D9lz5NpsGd9uJrwRE76v9XTM6ULTR+YKQR/VMdZK7uhC8qJGEJQXj52W8hy2kG2lylfu G5p+DAruTFPzlC/fWNhpcSyFFlOaD40adfw7lsA75dg08l041vrl6upotXv3u3JJ1JLR smNGYpcKLoDBmFwtdet+QHUosxan5jQhgiGNKYwJRkfx5truIkD2F0cNsJSe4aSVCL6H 25vQ== X-Gm-Message-State: AOJu0Yw6hhVsXtOa8fNGUvUd8sMCh+F5tQu563WbJHcu0VjDG8+h0nRy Jattft05raVe6zhbsOyMJ7UwUquxjAW7UWjIzJw= X-Received: by 2002:a05:600c:4512:b0:40b:383a:ebc7 with SMTP id t18-20020a05600c451200b0040b383aebc7mr1351527wmo.34.1701944805241; Thu, 07 Dec 2023 02:26:45 -0800 (PST) Received: from m1x-phil.lan ([176.187.202.111]) by smtp.gmail.com with ESMTPSA id j15-20020a05600c1c0f00b0040b4c59f133sm1435364wms.1.2023.12.07.02.26.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Dec 2023 02:26:44 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Fam Zheng , qemu-block@nongnu.org, Paolo Bonzini , Pavel Dovgalyuk , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 2/3] sysemu/replay: Restrict icount to TCG emulation Date: Thu, 7 Dec 2023 11:26:30 +0100 Message-ID: <20231207102632.33634-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231207102632.33634-1-philmd@linaro.org> References: <20231207102632.33634-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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=ham 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é --- include/sysemu/replay.h | 2 ++ stubs/icount.c | 6 ------ system/vl.c | 6 +++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 08aae5869f..02fa75c783 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -79,12 +79,14 @@ int64_t replay_save_clock(ReplayClockKind kind, int64_t clock, int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount); /*! Saves or reads the clock depending on the current replay mode. */ #define REPLAY_CLOCK(clock, value) \ + !icount_enabled() ? (value) : \ (replay_mode == REPLAY_MODE_PLAY \ ? replay_read_clock((clock), icount_get_raw()) \ : replay_mode == REPLAY_MODE_RECORD \ ? replay_save_clock((clock), (value), icount_get_raw()) \ : (value)) #define REPLAY_CLOCK_LOCKED(clock, value) \ + !icount_enabled() ? (value) : \ (replay_mode == REPLAY_MODE_PLAY \ ? replay_read_clock((clock), icount_get_raw_locked()) \ : replay_mode == REPLAY_MODE_RECORD \ diff --git a/stubs/icount.c b/stubs/icount.c index fc3beac003..c39a65da92 100644 --- a/stubs/icount.c +++ b/stubs/icount.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include "qapi/error.h" #include "sysemu/cpu-timers.h" /* icount - Instruction Counter API */ @@ -10,11 +9,6 @@ void icount_update(CPUState *cpu) { abort(); } -void icount_configure(QemuOpts *opts, Error **errp) -{ - /* signal error */ - error_setg(errp, "cannot configure icount, TCG support not available"); -} int64_t icount_get_raw(void) { abort(); diff --git a/system/vl.c b/system/vl.c index 2bcd9efb9a..8c99c5f681 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2270,7 +2270,11 @@ static void user_register_global_props(void) static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp) { - icount_configure(opts, errp); + if (tcg_enabled()) { + icount_configure(opts, errp); + } else { + error_setg(errp, "cannot configure icount, TCG support not available"); + } return 0; } From patchwork Thu Dec 7 10:26:31 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: 751064 Delivered-To: patch@linaro.org Received: by 2002:adf:a499:0:b0:333:3a04:f257 with SMTP id g25csp344931wrb; Thu, 7 Dec 2023 02:28:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0891Ory3ex9umXmv0cNQuqauDy64FGIIXkvhRCraog0k6GAAoeN6+oWCaEQun0XtrRwvu X-Received: by 2002:a05:622a:54b:b0:425:4054:bc5d with SMTP id m11-20020a05622a054b00b004254054bc5dmr6784379qtx.57.1701944880535; Thu, 07 Dec 2023 02:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701944880; cv=none; d=google.com; s=arc-20160816; b=r7QXSbU4YmjQ6Tzq+ApRcbhamRZadFxMiR7hAXSB3pKAseIjrcmgfZJ2Y2EtBxuYAI boRNX3n0Qbm9Ka9xvp4VVJ6gf/0Ps4buoVobfZJ2R5xH7LEOdpWiLXDQKKE9Ft0hqe8y twQsZK6SXy5TtZLrOp0cNDPZa9I2WqGV2DQL0MDujZ6YvP8eH8bcF4I6FRSMR5SsY3yd GJwbqfLXH+Ptq80+hKeNE4YY6nQyeb6THZKIXf8i+exMtm/ek9xMiyecKigc10fwQwuf BlXsoujL/IhD7bYySGJMzpQYzbpFQtoZTtIpyTNABwU6QE9oWAsKhT7dJdWVQSa35GZF eb6A== 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=BgIxy79UZseNDiD3U1SZgYUkivqTyyMr1op/QHIJsqs=; fh=Wwzqfz/G0LPj8Oasa7SYmxwpyyV6ogvrMIS9R1LpZE0=; b=jv3Zx/6iV5DiY4oG9WX42InPRT2F20Cq9pezNzhrjU4cCsp0R7k8dSILiQjjsJKOsy 8F72dhpjZf6c26jyHGPUvaNp6nSeFC6LbFTbBTvnbyEPIZ++HdoqOfOvZM29RuFW5LX4 VtkTa/ElFsmVyiC2GxjS5geTd4u8GVLn0NCgrIFlmbDFfA96HGETf8UdUsahcaSoLnQg DVlujhZ3Tmyz67LFGmzkIVRd4K7RwTAVKsIthCaj2+Xp1ttAXxUgVdJvuK03pNPDTllD JziX2VjpWCVKF9vJwcDjQC5Pa8g8uOqOO/n9fzVfukI3HhGsLHkQquKFHmTNoX5ZidAt Z+eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CZ9nnxAB; 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 i4-20020a05622a08c400b004237bccb729si1041399qte.752.2023.12.07.02.28.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Dec 2023 02:28:00 -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=CZ9nnxAB; 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 1rBBat-0004hN-5v; Thu, 07 Dec 2023 05:26:59 -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 1rBBar-0004gm-QZ for qemu-devel@nongnu.org; Thu, 07 Dec 2023 05:26:57 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBBan-0001Zo-DL for qemu-devel@nongnu.org; Thu, 07 Dec 2023 05:26:56 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c2308faedso8173445e9.1 for ; Thu, 07 Dec 2023 02:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701944810; x=1702549610; 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=BgIxy79UZseNDiD3U1SZgYUkivqTyyMr1op/QHIJsqs=; b=CZ9nnxAB1PxCVyCIfUFYXuO1DiAWPsnNNBoh4BC8+Mz7KWd7PFLD6GaC1Zd0QYuv4r W3fO8fqcwSwkbtbI97/raIMOwwLGhxY0/p1Jv1HQn368EtQ6nq0W5voAfk3QbzJVV4mQ MotgY6Dpng8Uq/dELkCndU+LCscYSTF6D/UmoQNs+OSdrlFT1L+41VNAgIQfvdXyQVdj KVoAG83ikKyqsQD6rrIbKIwUO1xP0OreeS3Er+qu+pDPwiRAxSQ8zxsDw+lANDOzC/PL o0OLmZH2uCuIT9OArV0ZIIE5TPsoX+jf35Nj8/U7A80c2GMNbK6jVNwTTSNfsfb50ZPr 01wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701944810; x=1702549610; 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=BgIxy79UZseNDiD3U1SZgYUkivqTyyMr1op/QHIJsqs=; b=uQ0vIU/nEqkwpPnQnoHGBxo+S/bfgKY3ApExPFoRA4GHb1tVl7w0EvklxPa6xYRG2c 4Ga1A9nRg2aKuOiGDpNhaHBWLCBNg/OZ3d6B/GHnB2pGPXWvdFj6IuXNkG0STymDJSkU wcxGZVniZMRPdeXuScDCvWKsP80DdnBeRGby2XCxUqLPDZwP3ScLPPPITfbZNJT0u24d v76K8W33xzxH1OGJqEA4ohMQryEEfDgif0w5UCYwXiHTk2XPm5vTGhfI4Fx1kZtZ3txn BVI2uCYY2/xPGXG14C8HqVX7oa6W7hXSon55eo5xDrTR5CmLT/yEs/7tIg8phDcXLKGZ OTSw== X-Gm-Message-State: AOJu0Yw6ttlh2BUQb6ETND33n50QjuwgsKUZ3vTRqzOPZRKA3v+lKOwS wfuL5gSxxArysMaGGn/D3u1ezJzL5c/tNdPlmxg= X-Received: by 2002:a05:600c:4fd5:b0:40b:5e21:d351 with SMTP id o21-20020a05600c4fd500b0040b5e21d351mr1394153wmq.90.1701944810654; Thu, 07 Dec 2023 02:26:50 -0800 (PST) Received: from m1x-phil.lan ([176.187.202.111]) by smtp.gmail.com with ESMTPSA id fa11-20020a05600c518b00b0040b360cc65csm1443849wmb.0.2023.12.07.02.26.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Dec 2023 02:26:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Fam Zheng , qemu-block@nongnu.org, Paolo Bonzini , Pavel Dovgalyuk , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 3/3] sysemu/replay: Restrict icount to system emulation Date: Thu, 7 Dec 2023 11:26:31 +0100 Message-ID: <20231207102632.33634-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231207102632.33634-1-philmd@linaro.org> References: <20231207102632.33634-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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é --- include/sysemu/cpu-timers.h | 2 +- include/sysemu/replay.h | 9 ++++++--- stubs/icount.c | 19 ------------------- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/include/sysemu/cpu-timers.h b/include/sysemu/cpu-timers.h index 2e786fe7fb..188f67ee90 100644 --- a/include/sysemu/cpu-timers.h +++ b/include/sysemu/cpu-timers.h @@ -24,7 +24,7 @@ void cpu_timers_init(void); * 1 = Enabled - Fixed conversion of insn to ns via "shift" option * 2 = Enabled - Runtime adaptive algorithm to compute shift */ -#ifdef CONFIG_TCG +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) extern int use_icount; #define icount_enabled() (use_icount) #else diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 02fa75c783..8102fa54f0 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -1,6 +1,3 @@ -#ifndef SYSEMU_REPLAY_H -#define SYSEMU_REPLAY_H - /* * QEMU replay (system interface) * @@ -11,6 +8,12 @@ * See the COPYING file in the top-level directory. * */ +#ifndef SYSEMU_REPLAY_H +#define SYSEMU_REPLAY_H + +#ifdef CONFIG_USER_ONLY +#error Cannot include this header from user emulation +#endif #include "exec/replay-core.h" #include "qapi/qapi-types-misc.h" diff --git a/stubs/icount.c b/stubs/icount.c index c39a65da92..ec8d150069 100644 --- a/stubs/icount.c +++ b/stubs/icount.c @@ -5,30 +5,11 @@ int use_icount; -void icount_update(CPUState *cpu) -{ - abort(); -} int64_t icount_get_raw(void) { abort(); return 0; } -int64_t icount_get(void) -{ - abort(); - return 0; -} -int64_t icount_to_ns(int64_t icount) -{ - abort(); - return 0; -} -int64_t icount_round(int64_t count) -{ - abort(); - return 0; -} void icount_start_warp_timer(void) { abort();