public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] IBPB cleanups and a fixup
@ 2025-02-27  1:27 Yosry Ahmed
  2025-02-27  1:27 ` [PATCH v2 1/6] x86/bugs: Move the X86_FEATURE_USE_IBPB check into callers Yosry Ahmed
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Yosry Ahmed @ 2025-02-27  1:27 UTC (permalink / raw)
  To: x86, Sean Christopherson
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Pawan Gupta, Andy Lutomirski, Peter Zijlstra,
	Josh Poimboeuf, Paolo Bonzini, Jim Mattson, kvm, linux-kernel,
	Yosry Ahmed

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-27  1:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27  1:27 [PATCH v2 0/6] IBPB cleanups and a fixup Yosry Ahmed
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox