From nobody Fri Nov 14 18:21:31 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1761936149; cv=none; d=zohomail.com; s=zohoarc; b=oHS3lKVcXNS3vT5wdoSBReezZxyQjHHD5SISFz7uTKxXpgILhxseCm1mL+gwcrmrH0pWbTxCEzCDrQu69jpFzJKlTrlYXAn2Z+i0eD8M9xpX4olCcNCXwdBvNhpwZMqcqJz7H3rhj8P8IbjsB1uVsZJIDPkmEGIPJHRcHAv6oI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761936149; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=0H/Qs0aq5jkMkZf4wHt7jLxhKz1DXfAE2FEms7PGAtg=; b=L8zWUQUA++Far9wNZ3Erw+eVlfeTjBuNOKeP9gRVcC/lJeNjBJIIgCxOiEB52D+eWxIs/3pfg9rqvJWGdN/57kev/mNJosGMEJZyKtlyTzQxzwI4ryekJ0M8PWsz13ftLBnbkaRf/muFazOXm9im+kkfsa8GRSEOMH3zqjoeYfY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17619361495921.6436055214478529; Fri, 31 Oct 2025 11:42:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEtx8-0004wL-BI; Fri, 31 Oct 2025 14:34:23 -0400 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 1vEtx6-0004vT-3k for qemu-devel@nongnu.org; Fri, 31 Oct 2025 14:34:20 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vEtwb-0006H5-70 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 14:34:17 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-429c19b5de4so855097f8f.3 for ; Fri, 31 Oct 2025 11:33:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429c114c944sm4859142f8f.20.2025.10.31.11.33.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Oct 2025 11:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761935622; x=1762540422; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0H/Qs0aq5jkMkZf4wHt7jLxhKz1DXfAE2FEms7PGAtg=; b=ZAxFFXfsMcz2LBDGT8SDqSfkWh5yXi46d7XGQwCWjbGgfo/wKH732EEPt0kUAgbWZl 5QJu7DP4Uu1dONlVL3oe6RbRlCD0acV8Onh4I8CSKh6eOko3wMwaz9FG52UVLCT1HeMd +dTCVjDwPJhrtbxIpflYyYV5+R0y8X4yn+sZQokJjPfwBeyLHXiEa0LRnoSqaBJkIq8e YNT+8Y6c2mqrhLBghYOXbVB5N1j00HdBZYNAuAud+U6NAVs+sGltDcQgXYu/Fdrpt2tO c5OfCsDXb8PuOEc13rGoW+1+KVn/xCHhBJtCYO/kk/Bt69txevZ94pHtqMZdYA0HStGK w+RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761935622; x=1762540422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0H/Qs0aq5jkMkZf4wHt7jLxhKz1DXfAE2FEms7PGAtg=; b=edLu4V7W/T6TGx8tCdGdogzdjuv/auOdx9ksqyapElW36NRODkDlG1pUyksD4/zlJR t0uDEuX8EizNIS+5fNvKdxwos9VCBWmLGHaTeqIvVDTCh19Q2hcCiMC1idIFOmUYVPtc cMWDxmULPkq+bDFXlN9kIgrBow2vSOe75VA+PItFVwtA58A9Bou4A63SNML91Afhs0WP tXK08AB+CT2wJWHA71ctHgTm4KAS0I/DZ+ErLsAwqFRfV+0yeDNoqlLdmu9khDsbNooK 9NalXNzhy7jEzwXmq2+oQm7LoRDE3xexPN6CbAZw3YsJyzvGLr0CysmvpwaHH9bwozaw N6wA== X-Gm-Message-State: AOJu0YzBLxg4reykhFK/VpFYlwc3zSCO5O/nGfPU8nC1UGLR1gEURx8S TQrLhdXSsoqGQ9q8MLUnTynRXRfD0ZPxRi8ji2m+EQIHAGGqHt8fH8qb+/wGsoKLbydJrKyp6wh PvROT X-Gm-Gg: ASbGncuM9Wqq4jvlzHnYefUj7EvfVTIsKqMX0WyclTbIDIoYOGktlOdP++iU3a20GKE MyolYivwaE6DhFKnpvEUOpA72mOfhRBHDx6CkQPNgQIWHe+Ti+xWYTjzueUK2qiDIm0s1hmeaO/ EP8P4US4Vnc/RCVi1zUCGS2zXT92+/0Y4TVh1dl+uMly5834RWdsYsYjsOXlyxmms3u4HTIxG7c J5Yb6hnOjThL41PNVq7bP1oMZDkMjuSHAcr4uYjGkfvKoVy0r5sXmkIjDHap25FMgXhsMRUGEx+ 6IGuIQvzaBveNuMZfugg6g7bqZGyaY1Z0y79CRmbf4Lk95TPOFeQVZNVyH9Qtv3ehVkscQFEzVL VIllpe8YDsckHb+LkuHh9nWxWlACle2ySjmcLwQi3tHC8XgReMO60UQvYblF4PiIGhlNmxQTKdo Kab+b9rKBGHgkVQiDH X-Google-Smtp-Source: AGHT+IF67bW1b8DCVK0JHjNT79W6Uw/Ls0Duh7QiNJ3XLp3IXOUw8bGsTZ2KhZQKeGZo/+Yio55vtg== X-Received: by 2002:a05:6000:1846:b0:3f9:bc33:2fab with SMTP id ffacd0b85a97d-429bd6c18a5mr4401201f8f.60.1761935621646; Fri, 31 Oct 2025 11:33:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/38] accel/hvf: Guard hv_vcpu_run() between cpu_exec_start/end() calls Date: Fri, 31 Oct 2025 18:33:02 +0000 Message-ID: <20251031183310.3778349-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251031183310.3778349-1-peter.maydell@linaro.org> References: <20251031183310.3778349-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1761936150754154100 From: Philippe Mathieu-Daud=C3=A9 Similarly to 1d78a3c3ab8 for KVM, wrap hv_vcpu_run() with cpu_exec_start/end(), so that the accelerator can perform pending operations while all vCPUs are quiescent. See also explanation in commit c265e976f46 ("cpus-common: lock-free fast path for cpu_exec_start/end"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell --- target/arm/hvf/hvf.c | 2 ++ target/i386/hvf/hvf.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 79861dcacf9..c882f4c89cf 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2026,7 +2026,9 @@ int hvf_arch_vcpu_exec(CPUState *cpu) } =20 bql_unlock(); + cpu_exec_start(cpu); r =3D hv_vcpu_run(cpu->accel->fd); + cpu_exec_end(cpu); bql_lock(); switch (r) { case HV_SUCCESS: diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 28d98659ec2..16febbac48f 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -992,9 +992,13 @@ int hvf_arch_vcpu_exec(CPUState *cpu) return EXCP_HLT; } =20 + cpu_exec_start(cpu); + hv_return_t r =3D hv_vcpu_run_until(cpu->accel->fd, HV_DEADLINE_FO= REVER); assert_hvf_ok(r); =20 + cpu_exec_end(cpu); + ret =3D hvf_handle_vmexit(cpu); } while (ret =3D=3D 0); =20 --=20 2.43.0