[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3u1Rx/kFjE5/FFR@google.com>
Date: Mon, 21 Nov 2022 17:28:39 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...el.com>,
Jiaxi Chen <jiaxi.chen@...ux.intel.com>, kvm@...r.kernel.org,
tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
x86@...nel.org, hpa@...or.com, pbonzini@...hat.com,
ndesaulniers@...gle.com, alexandre.belloni@...tlin.com,
peterz@...radead.org, jpoimboe@...nel.org,
chang.seok.bae@...el.com, pawan.kumar.gupta@...ux.intel.com,
babu.moger@....com, jmattson@...gle.com, sandipan.das@....com,
tony.luck@...el.com, sathyanarayanan.kuppuswamy@...ux.intel.com,
fenghua.yu@...el.com, keescook@...omium.org, nathan@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/6] x86: KVM: Advertise CMPccXADD CPUID to user space
On Mon, Nov 21, 2022, Borislav Petkov wrote:
> On Mon, Nov 21, 2022 at 03:48:06PM +0000, Sean Christopherson wrote:
> > Actually, for these features that don't require additional KVM enabling, KVM isn't
> > making the feature avaiable to the guest. KVM is just advertising to userspace
> > that KVM "supports" these features. Userspace ultimately controls guest CPUID;
> > outside of a few special cases, KVM neither rejects nor filters unsupported bits
> > in CPUID.
>
> So is there any point to those "enable it in KVM" patches streaming constantly?
Yes. Most userspace VMMs sanitize their CPUID models based on KVM_GET_SUPPORTED_CPUID,
e.g. by default, QEMU will refuse to enable features in guest CPUID that aren't
reported as supported by KVM.
Another use case is for userspace to blindly use the result of KVM_GET_SUPPORTED_CPUID
as the guest's CPUID model, e.g. for using KVM to isolate code as opposed to standing
up a traditional virtual machine. For that use case, userspace again relies on KVM to
enumerate support.
What I was trying to call out in the above is that the KVM "enabling" technically
doesn't expose the feature to the guest. E.g. a clever guest could ignore CPUID
and probe the relevant instructions manually by seeing whether or not they #UD.
Powered by blists - more mailing lists