mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Jim Mattson <jmattson@google.com>
Cc: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	David Kaplan <david.kaplan@amd.com>,
	Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Asit Mallick <asit.k.mallick@intel.com>,
	Tao Zhang <tao1.zhang@intel.com>
Subject: Re: [PATCH 1/2] x86/bhi: Add BHB clearing for CPUs with larger branch history
Date: Thu, 25 Sep 2025 13:49:37 -0700	[thread overview]
Message-ID: <20250925204937.d4pabsyg3jxnw332@desk> (raw)
In-Reply-To: <CALMp9eRcDZoRza7pkCx_fmYZ9UZDGRAXQ_0QP=v+pMMBKx4gfg@mail.gmail.com>

On Thu, Sep 25, 2025 at 10:54:48AM -0700, Jim Mattson wrote:
> On Wed, Sep 24, 2025 at 8:09 PM Pawan Gupta
> <pawan.kumar.gupta@linux.intel.com> wrote:
> >
> > Add a version of clear_bhb_loop() that works on CPUs with larger branch
> > history table such as Alder Lake and newer. This could serve as a cheaper
> > alternative to IBPB mitigation for VMSCAPE.
> 
> Yay!
> 
> Can we also use this longer loop as a BHI mitigation on (virtual)
> processors with larger branch history tables that don't support
> BHI_DIS_S? Today, we just use the short BHB clearing loop and call it
> good.

I believe you are referring to guests that don't enumerate BHI_DIS_S, but
are running on a host that supports BHI_DIS_S. In that case the longer loop
would work to mitigate BHI.

You probably know it already, the longer loop is not an optimal mitigation
compared to BHI_DIS_S. And on CPUs that don't support BHI_DIS_S, short loop
is sufficient.

I think you are talking about some special use cases like a guest migrating
from a CPU that didn't support BHI_DIS_S to a CPU that does. Using the long
loop in that case would be an option.

  reply	other threads:[~2025-09-25 20:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25  3:09 [PATCH 0/2] VMSCAPE optimization for BHI variant Pawan Gupta
2025-09-25  3:09 ` [PATCH 1/2] x86/bhi: Add BHB clearing for CPUs with larger branch history Pawan Gupta
2025-09-25 17:54   ` Jim Mattson
2025-09-25 20:49     ` Pawan Gupta [this message]
2025-09-25  3:09 ` [PATCH 2/2] x86/vmscape: Replace IBPB with branch history clear on exit to userspace Pawan Gupta
2025-09-25 18:14   ` Kaplan, David
2025-09-25 22:02     ` Pawan Gupta
2025-09-25 22:26       ` Pawan Gupta
2025-09-26 13:39       ` Kaplan, David
2025-09-26 16:14         ` Pawan Gupta
2025-09-29  5:12 ` [PATCH 0/2] VMSCAPE optimization for BHI variant Jack Wang
2025-09-30  1:22 ` Pawan Gupta
2025-10-01  8:12   ` Jinpu Wang

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=20250925204937.d4pabsyg3jxnw332@desk \
    --to=pawan.kumar.gupta@linux.intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=david.kaplan@amd.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=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tao1.zhang@intel.com \
    --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

all inboxes | Powered by JetHome®