From nobody Wed Nov 6 15:27:48 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1717586881; cv=none; d=zohomail.com; s=zohoarc; b=QRREXFVbzBrwuRL+QJ9t+ozvxbD0xwFiSNEzERerrsi/83S/bT8CwsRSc/qMxzdIofHzaouRahHzoXFonIhoG6s9E14nabSDNkeLY7jNdrHOP1QlT5NHuXnmI9C+DxSgf5Ofmb3AYJNlkBq/qAwZRP5eWkqc/gSaHA281BbhnFw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717586881; h=Content-Transfer-Encoding:Cc:Cc: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; bh=AaRzhLsox3oysptViKMojdf5oerb0z9Xurwugiu/cvk=; b=gzHBOsaVvt2T+r7L3hXHfO42KFADucGPgIw904ADGzUyA5fv8l4i4d0+UMlYadURUmKNAHOEZLGomoF07CAO+OYb6Kn7XosWjRTNIXZWmYwD4JZrhAKVbkgTgSAdNfp1PcOnW9xMkKLRQaVuEVw8oG5128edEVMDITCt1x+Etds= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717586881557754.8075537846814; Wed, 5 Jun 2024 04:28:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEonC-0005Xq-KJ; Wed, 05 Jun 2024 07:26:58 -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 1sEonA-0005W1-WA for qemu-devel@nongnu.org; Wed, 05 Jun 2024 07:26:57 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEon9-0003Mf-Ex for qemu-devel@nongnu.org; Wed, 05 Jun 2024 07:26:56 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-57a7dc13aabso2699232a12.0 for ; Wed, 05 Jun 2024 04:26:55 -0700 (PDT) Received: from localhost.localdomain (89-104-8-249.customer.bnet.at. [89.104.8.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a51023af4sm7111335a12.29.2024.06.05.04.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 04:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1717586814; x=1718191614; 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=AaRzhLsox3oysptViKMojdf5oerb0z9Xurwugiu/cvk=; b=jKktJWPMws6XISdOdfLuEh7/xO0j8udE1qMjz2/3jBcPVQVD9JQ0ZE9zNQzCEU3QkW a5Uom6XB7R3ogIFo4KsyyEckwN5bMTQxqszWfkB4LWU3FzGm/PPl1rzXiDbhgWaOG5vR TETHEuE42uSdvq3OOdfFN1xo6xv3lrokw9i+nobnCb4Hi9FNhda/1zVX41HniwYAtG/P MTjTwc24HNq61R5/Lj7EQ5q40B61MqMkiChrLD9B00nWbxvwkG2EUGZTKENay9JHwv1u mjio01AxlarEy6zxkWAC6xj/OxVvdEcncnRirpnYlCOCW2GqIGhyg+UbCrssPBrO7qU5 Bxgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717586814; x=1718191614; 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=AaRzhLsox3oysptViKMojdf5oerb0z9Xurwugiu/cvk=; b=r0HEFyZl6WFdNnrY+alHC3xQJf0AtshjvS3Muw6diH/cqpQxgO7ekjuIO4ELv1msFz mkpOju5dXldFE7APurDi2HKZmt3T/2Wgsi6uGOV5tfLZXnbsI519JvxMCPxKSzu2lktB qa7AWIRo2UvwZ8w1wUpIHn29hTd4WYwfMLaF+szljnQ3TjVAdpZTVmOKk616rKYU4UcZ gk8bQocrUe8RW024pKCkJ9Not6/5ETDjNAlC7i69V0eNtwRjg56Yzo1qCuQXO45T5f4Z wSX1S1dQf2pmtX7GcJKG62dHZSRUZalX4dW+fjI+wwxkz02K3S8vjCZG8FwoqbJWSmYe +6lA== X-Gm-Message-State: AOJu0YwpI7VcRN10E2TjPSAdp3+rxOW7OF4QF2XjBYyVi9u4c8+Rf8uI 6q/uYQQA5srRmUYqC6caCVWn1bQFtmpPlbrVY4/ZQMZFNztJSTA5GEEaG8nLgkkJ7t9KZJeMd1s = X-Google-Smtp-Source: AGHT+IGuR059yOZ0yF5ATbIlW1JtQ3ghYcA21+h58g4T3dNL3WxWSxZRRdEvKI9rlP3xWovzRZH/6Q== X-Received: by 2002:a50:a696:0:b0:579:fb79:309 with SMTP id 4fb4d7f45d1cf-57a8b6a4669mr1404754a12.10.1717586813895; Wed, 05 Jun 2024 04:26:53 -0700 (PDT) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: dirty@apple.com, rbolshakov@ddn.com, lists@philjordan.eu, Phil Dennis-Jordan Subject: [PATCH v3 5/7] i386/hvf: In kick_vcpu use hv_vcpu_interrupt to force exit Date: Wed, 5 Jun 2024 13:25:54 +0200 Message-Id: <20240605112556.43193-6-phil@philjordan.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20240605112556.43193-1-phil@philjordan.eu> References: <20240605112556.43193-1-phil@philjordan.eu> MIME-Version: 1.0 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: neutral client-ip=2a00:1450:4864:20::52f; envelope-from=phil@philjordan.eu; helo=mail-ed1-x52f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1717586883015100001 Content-Type: text/plain; charset="utf-8" When interrupting a vCPU thread, this patch actually tells the hypervisor to stop running guest code on that vCPU. Calling hv_vcpu_interrupt actually forces a vCPU exit, analogously to hv_vcpus_exit on aarch64. Alternatively, if the vCPU thread is not running the VM, it will immediately cause an exit when it attempts to do so. Previously, hvf_kick_vcpu_thread relied upon hv_vcpu_run returning very frequently, including many spurious exits, which made it less of a problem = that nothing was actively done to stop the vCPU thread running guest code. The newer, more efficient hv_vcpu_run_until exits much more rarely, so a tr= ue "kick" is needed before switching to that. Signed-off-by: Phil Dennis-Jordan --- target/i386/hvf/hvf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 268c5734d5..106ac5cbf6 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -215,6 +215,7 @@ static inline bool apic_bus_freq_is_known(CPUX86State *= env) void hvf_kick_vcpu_thread(CPUState *cpu) { cpus_kick_thread(cpu); + hv_vcpu_interrupt(&cpu->accel->fd, 1); } =20 int hvf_arch_init(void) --=20 2.36.1