[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241129182747.GEZ0oHo1eR0l7sREJY@fat_crate.local>
Date: Fri, 29 Nov 2024 19:27:47 +0100
From: Borislav Petkov <bp@...en8.de>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>, linux-kernel@...r.kernel.org,
x86@...nel.org, tglx@...utronix.de, rafael@...nel.org,
lenb@...nel.org
Subject: Re: [PATCH 11/11] x86/cpu: Make all all CPUID leaf names consistent
On Thu, Oct 31, 2024 at 10:19:37AM -0700, Dave Hansen wrote:
> >> -#define CPUID_MWAIT_LEAF 0x5
> >> -#define CPUID_DCA_LEAF 0x9
> >> -#define XSTATE_CPUID 0x0d
> >> -#define CPUID_TSC_LEAF 0x15
> >> -#define CPUID_FREQ_LEAF 0x16
> >> -#define TILE_CPUID 0x1d
> >> +#define CPUID_LEAF_MWAIT 0x5
> >> +#define CPUID_LEAF_DCA 0x9
> >> +#define CPUID_LEAF_XSTATE 0x0d
> >> +#define CPUID_LEAF_TSC 0x15
> >> +#define CPUID_LEAF_FREQ 0x16
> >> +#define CPUID_LEAF_TILE 0x1d
> >
> > ... and just to confuse things even more, there's enum cpuid_leafs too which
> > start with the "CPUID_" prefix too.
> >
> > Pfff.
>
> Yeah, lovely. 'enum cpuid_leafs' does appear misnamed though. It is a
> list of *words*, not actual leaf numbers. There's also very little
> overlap between those leafs and the newly-renamed ones in this series.
> I think that's because most of the leaves we dump into the CPU caps have
> random feature bits that aren't logically grouped and resist naming.
>
> The one exception to that is the CPUID_D_1_EAX aka. CPUID_LEAF_XSTATE.
> We could do something like the attached patch, but I don't think it
> really helps much.
>
> > I'd like to unify them and I *think* kvm_cpu_cap_mask() should be able to
> > stomach that (or fixed if not)...
>
> Do you mean we could unify the CPUID_8000_0001_EDX enum values and the
> CPUID_LEAF_* defines from this series?
Well, enum cpuid_leafs as it is now is the *indices* into the cap flags array:
struct cpuinfo_x86 {
...
__u32 x86_capability[NCAPINTS + NBUGINTS];
And having a "CPUID_" prefixed thing and a "CPUID_LEAF_" prefixed other thing
is going to cause confusion.
And renaming enum cpuid_leafs is going to cause a massive churn...
IOW:
[ Rock ] <-- us --> [ Hard Place ]
:-\
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists