Re: [PATCH v1 07/12] tools/x86/kcpuid: Add rudimentary CPU vendor detection

From: Ahmed S. Darwish
Date: Fri Mar 07 2025 - 08:48:27 EST


On Thu, 06 Mar 2025, Dave Hansen wrote:
>
> So, this is cute and all. But isn't it a _wee_ bit too clever for its
> own good?
>

That was funny, thanks for the laugh :)

> Why not just have a dumb array:
>
> { INTEL, "GenuineIntel" },
> { AMD, "AuthenticAMD" ],
> ...
>
> Are we really looking to save a few dozen CPU cycles in this thing? It
> took me at least a minute or two of staring at this thing to figure out
> what the heck it was doing.
>

Indeed.

For some reason I forgot that this is all little-endian and a simple
strcmp() like what the kernel does at get_cpu_vendor() would suffice.

I'll fix it in v2.

Thanks!
Ahmed