[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z76BTqmAJPV7lBbA@google.com>
Date: Wed, 26 Feb 2025 02:49:50 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Sean Christopherson <seanjc@...gle.com>
Cc: x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] x86/bugs: Use a static branch to guard IBPB on vCPU
load
On Tue, Feb 25, 2025 at 02:40:24PM -0800, Sean Christopherson wrote:
> On Tue, Feb 25, 2025, Yosry Ahmed wrote:
> > February 25, 2025 at 11:49 AM, "Sean Christopherson" <seanjc@...gle.com> wrote:
> > >
> > > On Wed, Feb 19, 2025, Yosry Ahmed wrote:
> > > >
> > > > Instead of using X86_FEATURE_USE_IBPB to guard the IBPB execution in the
> > > > vCPU load path, introduce a static branch, similar to switch_mm_*_ibpb.
> > > >
> > > > This makes it obvious in spectre_v2_user_select_mitigation() what
> > > > exactly is being toggled, instead of the unclear X86_FEATURE_USE_IBPB
> > > > (which will be shortly removed). It also provides more fine-grained
> > > > control, making it simpler to change/add paths that control the IBPB in
> > > > the vCPU load path without affecting other IBPBs.
> > > >
> > > > Signed-off-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
> > > >
> > > > ---
> > > >
> > > > arch/x86/include/asm/nospec-branch.h | 2 ++
> > > > arch/x86/kernel/cpu/bugs.c | 5 +++++
> > > > arch/x86/kvm/svm/svm.c | 2 +-
> > > > arch/x86/kvm/vmx/vmx.c | 2 +-
> > > > 4 files changed, 9 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> > > > index 7cbb76a2434b9..a22836c5fb338 100644
> > > > --- a/arch/x86/include/asm/nospec-branch.h
> > > > +++ b/arch/x86/include/asm/nospec-branch.h
> > > > @@ -552,6 +552,8 @@ DECLARE_STATIC_KEY_FALSE(switch_to_cond_stibp);
> > > > DECLARE_STATIC_KEY_FALSE(switch_mm_cond_ibpb);
> > > >
> > DECLARE_STATIC_KEY_FALSE(switch_mm_always_ibpb);
> > > >
> > +DECLARE_STATIC_KEY_FALSE(vcpu_load_ibpb);
> > > >
> > >
> > > How about ibpb_on_vcpu_load? To make it easy for readers to understand exactly
> > > what the knob controls.
> >
> > I was trying to remain consistent with the existing static branches' names,
> > but I am fine with ibpb_on_vcpu_load if others don't object.
>
> I assumed as much :-) I'm ok with vcpu_load_ibpb if that's what others prefer.
To be honest looking at this again I think I prefer consistency, so if
you don't mind and others don't chime in I'd rather keep it as-is.
Alternatively I can rename all the static branches (e.g.
ibpb_always_on_switch_mm) :P
Powered by blists - more mailing lists