Re: [RFC PATCH] KVM: x86: Advertise PCID based on hardware support (with an asterisk)

From: Sean Christopherson
Date: Thu Apr 11 2024 - 15:21:57 EST


On Thu, Apr 11, 2024, Paolo Bonzini wrote:
> On 4/11/24 18:31, Sean Christopherson wrote:
> > Force set a synthetic feature, GUEST_PCID, if PCID can be safely used in
> > virtual machines, even if the kernel itself disables PCID support, and
> > advertise PCID support in KVM if GUEST_PCID is set.
> >
> > When running on a CPU that is affected by Intel's "Global INVLPG" erratum,
> > which does NOT affect VMX non-root mode, it is safe to virtualize PCID for
> > KVM guests, even though it is not safe for the kernel itself to enable PCID.
> > Ditto for if the kernel disables PCID because CR4.PGE isn't supported.
>
> But the guest would not use it if the f/m/s matches, right?

Maybe? There's another in-flight patch for dealing with the guest side of
things.

https://lore.kernel.org/all/20240411144322.14585-2-xry111@xxxxxxxxxxx

> If the advantage is basically not splitting the migration pool, is that a
> concern for the affected Alder Lake/Gracemont/Raptor Lake processors?

I have put _zero_ thought into what value this actually adds (another reason I
tagged it RFC). This was purely a "it's easy, so why not".