RE: [PATCH 01/74] x86/cpu/vfm: Add/initialize x86_vfm field to struct cpuinfo_x86

From: Luck, Tony
Date: Thu Mar 28 2024 - 14:32:54 EST


> And frankly, the x86 vendor is a Linux thing so I wouldn't mind if
> checks are
>
> if (c->x86_vendor == X86_VENDOR... &&
> c->cpuid_1_eax == MACRO_BUILD_CPUID_1_EAX(fam, model, stepping))

That hurts my eyes compared to:

if (c->x86_vfm == INTEL_DOUGLASCOVE)

>
> Anyway, using CPUID(1).EAX is just a suggestion so that we don't have to
> invent our own format and convert to and fro.

All the conversion is at compile time to generate the values for the CPU model
name #defines.

> And that would be advantageous when we convert to dealing with
> CPUID(1).EAX values everywhere and we compare them straightaway. We'd
> need macros only when we need only some data elements from that leaf.

It's a humungous amount more code churn. Most of the changes in this set were
achieved with some simple sed scripts (followed by hand massage to adjust TABs
to make things pretty because lengths of strings are different).

Take a look at a few of the patches that implement this change and consider
how they would look based on a CPUID(1).EAX value.

> And since that leaf's layout is commonly known, the conversion errors
> should be at a minimum...
>
> I'd say.

I don't think the format is really that big an issue. Including stepping in the
format adds complexity to a thousand places these checks are made while
only being useful in a few dozen.

-Tony