Re: [RFC PATCH 2/3] x86/cpufeatures: Combine word 11 and 12 into new scattered features word 11

From: Sean Christopherson
Date: Fri Jun 14 2019 - 12:25:15 EST


On Fri, Jun 14, 2019 at 06:10:12PM +0200, Borislav Petkov wrote:
> On Fri, Jun 14, 2019 at 08:24:58AM -0700, Sean Christopherson wrote:
> > On Fri, Jun 14, 2019 at 04:57:34PM +0200, Borislav Petkov wrote:
> > > On Fri, Jun 14, 2019 at 07:39:12AM -0700, Sean Christopherson wrote:
> > > > KVM can't handle Linux-defined leafs without extra tricks
> > >
> > > and that's what I'm proposing - an extra trick.
> >
> > It's not a trick, it's bug suppression.
> >
> > Try running a kernel built with only patches 1/2 and 2/2 applied, along
> > with KVM's assertions removed. It'll probably boot fine since most of the
> > affected features are option things, but Linux's feature reporting will be
> > all kinds of screwed up.
> >
> > E.g. this WARN triggers because CPUID_7_EDX is 17, not 18 as expected,
>
> We can decrement NCAPINTS and word 18 in the header. The BUILD_BUG_ONs
> should not fire then too.
>
> But the easier thing is to not remove any defines in the enum
> cpuid_leafs thing so that the capabilities array has the proper size for
> after patch 2.

Agreed, Fenghua's proposed CPUID_DUMMY is way easier.