All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: sashiko-reviews@lists.linux.dev, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Disallow EFER.LMSLE when EferLmsleUnsupported is set in guest CPUID
Date: Tue, 22 Sep 2026 10:53:57 -0700	[thread overview]
Message-ID: <arLAtdMP7LV0r-D9@google.com> (raw)
In-Reply-To: <CALMp9eQi0gm7ojijfKDZz9oZh+BK13qUkJOFrCmxjJTr5sx3Lg@mail.gmail.com>

On Tue, Sep 22, 2026, Jim Mattson wrote:
> On Tue, Sep 22, 2026 at 7:26 AM Sean Christopherson <seanjc@google.com> wrote:
> >
> > On Tue, Sep 22, 2026, Jim Mattson wrote:
> > > On Tue, Sep 22, 2026 at 6:57 AM Sean Christopherson <seanjc@google.com> wrote:
> > > > Gah, I hate the negative "feature" bits, I've gotten completely turned around
> > > > multiple times trying to sort through this.
> > >
> > > Me too!
> > >
> > > > IIUC, you're trying to "fix" setups where host CPUID.EFER_LMSLE_MBZ=0, but userspace
> > > > configured guest CPUID.EFER_LMSLE_MBZ=1?  If so, then Sashiko is right, it needs to
> > > > be declared with EMULATED_F().  I would even argue that technically this isn't a KVM
> > > > bug, because KVM won't advertise EFER_LMSLE_MBZ in KVM_GET_SUPPORTED_CPUID on such
> > > > hosts.
>
> > > I'm trying to make it possible to run a Rome vCPU on Milan or later.
> > >
> > > SInce this is a negative feature bit, it must be retained if the host
> > > reports it. That blocks running a Rome vCPU on Milan or later.
> > > However, a defeatured Rome (which reports LMSLE_MBZ as 1) can be run
> >
> > So, a partially defeatured Rome?  Because it sounds like the CPU reports LMSLE_MBZ=1,
> > but then still allows setting EFER.LMSLE=1?
> 
> No; it should not allow setting EFER.LMSLE=1. That will fail on later
> platforms and would block live migration from Rome to later platforms.

Oh, drat, I misread the "Rome vCPU" vs. "defeatured Rome" paragraph.  You want to
be able to migrate a vCPU with guest.CPUID.LMSLE_MBZ=1 between a non-defeatured,
vanilla Rome and Milan+ (or a defeatured Rome).  Correct?

If so, then Sashiko is right, the flag needs to be EMULATED_F() so that KVM will
advertise EFER_LMSLE_MBZ to userspace on the vanilla Rome host, and also do the
right thing when guest.CPUID.EFER_LMSLE_MBZ=0.

If not correct, then I'm even more confused, because ignoring clear_cpuid,
guest_cpu_cap_has() will only ever return true if boot_cpu_has() also returns
true, in which case KVM *will* reject the value because EFER_LMSLE will not be
listed as a supported EFER bit.

		if (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ))
			kvm_caps.supported_efer_bits |= EFER_LMSLE;

> I want KVM to abide by the guest CPUID bit and disallow setting
> EFER.LMSLE even on hardware that allows it.

Right, and that requires declaring EFER_LMSLE_MBZ with EMULATED_F().

  reply	other threads:[~2026-09-22 17:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 15:45 [PATCH] KVM: x86: Disallow EFER.LMSLE when EferLmsleUnsupported is set in guest CPUID Jim Mattson
2026-09-18 15:56 ` Sean Christopherson
2026-09-18 16:01 ` sashiko-bot
2026-09-22 13:57   ` Sean Christopherson
2026-09-22 14:20     ` Jim Mattson
2026-09-22 14:26       ` Sean Christopherson
2026-09-22 14:34         ` Jim Mattson
2026-09-22 17:53           ` Sean Christopherson [this message]
2026-09-22 18:08             ` Jim Mattson
2026-09-22 18:34               ` Sean Christopherson

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=arLAtdMP7LV0r-D9@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.