From: Yosry Ahmed <yosry.ahmed@linux.dev>
To: x86@kernel.org, Sean Christopherson <seanjc@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Jim Mattson <jmattson@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: [PATCH v2 0/6] IBPB cleanups and a fixup
Date: Thu, 27 Feb 2025 01:27:06 +0000 [thread overview]
Message-ID: <20250227012712.3193063-1-yosry.ahmed@linux.dev> (raw)
This series removes X86_FEATURE_USE_IBPB, and fixes a KVM nVMX bug in
the process. The motivation is mostly the confusing name of
X86_FEATURE_USE_IBPB, which sounds like it controls IBPBs in general,
but it only controls IBPBs for spectre_v2_mitigation. A side effect of
this confusion is the nVMX bug, where virtualizing IBRS correctly
depends on the spectre_v2_user mitigation.
The feature bit is mostly redundant, except in controlling the IBPB in
the vCPU load path. For that, a separate static branch is introduced,
similar to switch_mm_*_ibpb.
We should also unify indirect_branch_prediction_barrier() with
entry_ibpb() to have a single IBPB primitive that always stuffs the RSB
if needed. Josh will be sending follow up changes for that.
v1 -> v2:
- Collected Ack/Review tags (thanks everyone!).
- Combined the if statements in vmx_vcpu_load_vmcs() and moved the
static branch check ahead (Sean Christopherson).
- Renamed the static branch to switch_vcpu_ibpb (Sean Christopherson).
- Fixed a typo in the commit message (Jim Mattson).
Yosry Ahmed (6):
x86/bugs: Move the X86_FEATURE_USE_IBPB check into callers
x86/mm: Remove X86_FEATURE_USE_IBPB checks in cond_mitigation()
x86/bugs: Remove the X86_FEATURE_USE_IBPB check in ib_prctl_set()
x86/bugs: Use a static branch to guard IBPB on vCPU switch
KVM: nVMX: Always use IBPB to properly virtualize IBRS
x86/bugs: Remove X86_FEATURE_USE_IBPB
arch/x86/include/asm/cpufeatures.h | 1 -
arch/x86/include/asm/nospec-branch.h | 4 +++-
arch/x86/kernel/cpu/bugs.c | 6 +++++-
arch/x86/kvm/svm/svm.c | 3 ++-
arch/x86/kvm/vmx/vmx.c | 3 ++-
arch/x86/mm/tlb.c | 3 +--
tools/arch/x86/include/asm/cpufeatures.h | 1 -
7 files changed, 13 insertions(+), 8 deletions(-)
--
2.48.1.658.g4767266eb4-goog
next reply other threads:[~2025-02-27 1:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 1:27 Yosry Ahmed [this message]
2025-02-27 1:27 ` [PATCH v2 1/6] x86/bugs: Move the X86_FEATURE_USE_IBPB check into callers Yosry Ahmed
2025-02-27 1:41 ` Sean Christopherson
2025-02-27 1:27 ` [PATCH v2 2/6] x86/mm: Remove X86_FEATURE_USE_IBPB checks in cond_mitigation() Yosry Ahmed
2025-02-27 1:27 ` [PATCH v2 3/6] x86/bugs: Remove the X86_FEATURE_USE_IBPB check in ib_prctl_set() Yosry Ahmed
2025-02-27 1:27 ` [PATCH v2 4/6] x86/bugs: Use a static branch to guard IBPB on vCPU switch Yosry Ahmed
2025-02-27 1:42 ` Sean Christopherson
2025-02-27 1:27 ` [PATCH v2 5/6] KVM: nVMX: Always use IBPB to properly virtualize IBRS Yosry Ahmed
2025-02-27 1:27 ` [PATCH v2 6/6] x86/bugs: Remove X86_FEATURE_USE_IBPB Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250227012712.3193063-1-yosry.ahmed@linux.dev \
--to=yosry.ahmed@linux.dev \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=jpoimboe@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox