From nobody Sun Feb 8 07:50:05 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AA04DDB6; Tue, 20 Feb 2024 01:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708390929; cv=none; b=SHaJSlDm0l+ilJgwT9QfmlsK6CLXjvRbp7mKGlrPsDP7a1mIeho4vdendFhapphBerc39AAQ9OMpoJNXujyR5e7mu3plTXl8SglJq9g47RCZiQbGsQfgWGGCL3m1ZGLzvwFxVhr3lBXG6Db7IOqs0uhL0Jix+cYX6QxSWv9/aAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708390929; c=relaxed/simple; bh=MWU4tAOkZxnfVsHtsJGyE83hwWPNf7tGeFBVThuHmao=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=ewMc3nNX9s8YAh0YePCfck0NzF/vn1tSgH2sR11Pgr8x+e6UdaGgCUHRJs8DD67GJgDg6OzqZL8N+ItdfedQoo4UAIXO1fEGYiwaJdoq1bhwGSBhfTW0cBqetBQdhXcHEmfP4qA7+g2WtfUwizitAs80DnTsNF+a9WVMqXe+15M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BnG6h76A; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=crEO3lhX; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BnG6h76A"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="crEO3lhX" Date: Tue, 20 Feb 2024 01:02:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708390926; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=naxJG67HWKeoUWiOJOwjAZ+fEPgw794Xipfep4lDgKg=; b=BnG6h76AP07so8Rg39tol2KIeMcyftUuR+I8RsmQHbHqxPO66Qn0uFvsdsbAmPmAaJ+s78 xOM8EDt3l7+cRnNqNIpFuYiqZy8LPdq6WwLipVnYAZpQRiGoL0aHFubE36wQZZdhvF8AGq ioQTWZNsxsqBLhdMRwEv7DRy8/1gjU2PtQzYL6dv1G9IeonaodcQrh8Bs9ENrqpf6Eu/iA Mu46h3rROE78VON4Mf9QzdoT4u13MtK39O6ucG5BzqaLD3rmyNy6OmEZmsgsVu5vqB9mTN XZ3rYO8CzuL6pMbArHYYVAroqpfhcwH1TqwjzHgai/S9DAOLU1ix8uOEVGFPsQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708390926; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=naxJG67HWKeoUWiOJOwjAZ+fEPgw794Xipfep4lDgKg=; b=crEO3lhXyZqvOqI16dZqt28KavWCy+5c8cvy35vSKDCgqLDmAx1a1dd53cvw3KG8r7FkgN qOLFKB/7h4NIWeBw== From: "tip-bot2 for Sean Christopherson" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] KVM/VMX: Use BT+JNC, i.e. EFLAGS.CF to select VMRESUME vs. VMLAUNCH Cc: Sean Christopherson , Pawan Gupta , Dave Hansen , Nikolay Borisov , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170839092535.398.18040794761968853501.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 706a189dcf74d3b3f955e9384785e726ed6c7c80 Gitweb: https://git.kernel.org/tip/706a189dcf74d3b3f955e9384785e726e= d6c7c80 Author: Sean Christopherson AuthorDate: Tue, 13 Feb 2024 18:22:40 -08:00 Committer: Dave Hansen CommitterDate: Mon, 19 Feb 2024 16:31:54 -08:00 KVM/VMX: Use BT+JNC, i.e. EFLAGS.CF to select VMRESUME vs. VMLAUNCH Use EFLAGS.CF instead of EFLAGS.ZF to track whether to use VMRESUME versus VMLAUNCH. Freeing up EFLAGS.ZF will allow doing VERW, which clobbers ZF, for MDS mitigations as late as possible without needing to duplicate VERW for both paths. Signed-off-by: Sean Christopherson Signed-off-by: Pawan Gupta Signed-off-by: Dave Hansen Reviewed-by: Nikolay Borisov Link: https://lore.kernel.org/all/20240213-delay-verw-v8-5-a6216d83edb7%40l= inux.intel.com --- arch/x86/kvm/vmx/run_flags.h | 7 +++++-- arch/x86/kvm/vmx/vmenter.S | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx/run_flags.h b/arch/x86/kvm/vmx/run_flags.h index edc3f16..6a9bfdf 100644 --- a/arch/x86/kvm/vmx/run_flags.h +++ b/arch/x86/kvm/vmx/run_flags.h @@ -2,7 +2,10 @@ #ifndef __KVM_X86_VMX_RUN_FLAGS_H #define __KVM_X86_VMX_RUN_FLAGS_H =20 -#define VMX_RUN_VMRESUME (1 << 0) -#define VMX_RUN_SAVE_SPEC_CTRL (1 << 1) +#define VMX_RUN_VMRESUME_SHIFT 0 +#define VMX_RUN_SAVE_SPEC_CTRL_SHIFT 1 + +#define VMX_RUN_VMRESUME BIT(VMX_RUN_VMRESUME_SHIFT) +#define VMX_RUN_SAVE_SPEC_CTRL BIT(VMX_RUN_SAVE_SPEC_CTRL_SHIFT) =20 #endif /* __KVM_X86_VMX_RUN_FLAGS_H */ diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S index 906ecd0..ef7cfba 100644 --- a/arch/x86/kvm/vmx/vmenter.S +++ b/arch/x86/kvm/vmx/vmenter.S @@ -139,7 +139,7 @@ SYM_FUNC_START(__vmx_vcpu_run) mov (%_ASM_SP), %_ASM_AX =20 /* Check if vmlaunch or vmresume is needed */ - test $VMX_RUN_VMRESUME, %ebx + bt $VMX_RUN_VMRESUME_SHIFT, %ebx =20 /* Load guest registers. Don't clobber flags. */ mov VCPU_RCX(%_ASM_AX), %_ASM_CX @@ -161,8 +161,8 @@ SYM_FUNC_START(__vmx_vcpu_run) /* Load guest RAX. This kills the @regs pointer! */ mov VCPU_RAX(%_ASM_AX), %_ASM_AX =20 - /* Check EFLAGS.ZF from 'test VMX_RUN_VMRESUME' above */ - jz .Lvmlaunch + /* Check EFLAGS.CF from the VMX_RUN_VMRESUME bit test above. */ + jnc .Lvmlaunch =20 /* * After a successful VMRESUME/VMLAUNCH, control flow "magically"