From: Yosry Ahmed <yosry.ahmed@linux.dev>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, 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>,
Peter Zijlstra <peterz@infradead.org>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/6] IBPB cleanups and a fixup
Date: Thu, 20 Feb 2025 19:59:54 +0000 [thread overview]
Message-ID: <Z7eJurYbxS2kAzvk@google.com> (raw)
In-Reply-To: <20250220190444.7ytrua37fszvuouy@jpoimboe>
On Thu, Feb 20, 2025 at 11:04:44AM -0800, Josh Poimboeuf wrote:
> On Wed, Feb 19, 2025 at 10:08:20PM +0000, Yosry Ahmed wrote:
> > 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.
>
> Thanks for doing this. A few months ago I was working on patches to fix
> the same thing but I got preempted multiple times over.
>
> > I wanted to do more, but decided to stay conservative. I was mainly
> > hoping to merge indirect_branch_prediction_barrier() with entry_ibpb()
> > to have a single IBPB primitive that always stuffs the RSB if the IBPB
> > doesn't, but this would add some overhead in paths that currently use
> > indirect_branch_prediction_barrier(), and I was not sure if that's
> > acceptable.
>
> We always rely on IBPB clearing RSB, so yes, I'd say that's definitely
> needed. In fact I had a patch to do exactly that, with it ending up
> like this:
I was mainly concerned about the overhead this adds, but if it's a
requirement then yes we should do it.
>
> static inline void indirect_branch_prediction_barrier(void)
> {
> asm volatile(ALTERNATIVE("", "call write_ibpb", X86_FEATURE_IBPB)
> : ASM_CALL_CONSTRAINT
> : : "rax", "rcx", "rdx", "memory");
> }
>
> I also renamed "entry_ibpb" -> "write_ibpb" since it's no longer just
> for entry code.
Do you want me to add this in this series or do you want to do it on top
of it? If you have a patch lying around I can also include it as-is.
next prev parent reply other threads:[~2025-02-20 20:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 22:08 [PATCH 0/6] IBPB cleanups and a fixup Yosry Ahmed
2025-02-19 22:08 ` [PATCH 1/6] x86/bugs: Move the X86_FEATURE_USE_IBPB check into callers Yosry Ahmed
2025-02-25 19:47 ` Sean Christopherson
2025-02-25 21:28 ` Yosry Ahmed
2025-02-19 22:08 ` [PATCH 2/6] x86/mm: Remove X86_FEATURE_USE_IBPB checks in cond_mitigation() Yosry Ahmed
2025-02-19 22:08 ` [PATCH 3/6] x86/bugs: Remove the X86_FEATURE_USE_IBPB check in ib_prctl_set() Yosry Ahmed
2025-02-19 22:08 ` [PATCH 4/6] x86/bugs: Use a static branch to guard IBPB on vCPU load Yosry Ahmed
2025-02-25 19:49 ` Sean Christopherson
2025-02-25 21:27 ` Yosry Ahmed
2025-02-25 22:40 ` Sean Christopherson
2025-02-26 2:49 ` Yosry Ahmed
2025-02-27 0:46 ` Sean Christopherson
2025-02-27 0:54 ` Yosry Ahmed
2025-02-19 22:08 ` [PATCH 5/6] KVM: nVMX: Always use IBPB to properly virtualize IBRS Yosry Ahmed
2025-02-19 23:09 ` Jim Mattson
2025-02-25 19:50 ` Sean Christopherson
2025-02-19 22:08 ` [PATCH 6/6] x86/bugs: Remove X86_FEATURE_USE_IBPB Yosry Ahmed
2025-02-20 19:04 ` [PATCH 0/6] IBPB cleanups and a fixup Josh Poimboeuf
2025-02-20 19:59 ` Yosry Ahmed [this message]
2025-02-20 20:47 ` Josh Poimboeuf
2025-02-20 21:50 ` 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=Z7eJurYbxS2kAzvk@google.com \
--to=yosry.ahmed@linux.dev \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.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