Re: [RFC PATCH] x86/cpufeatures: Flip the /proc/cpuinfo appearance logic
From: Borislav Petkov
Date: Tue Jun 18 2024 - 14:37:10 EST
On Tue, Jun 18, 2024 at 07:06:13AM -0700, Sean Christopherson wrote:
> If we're going to churn the whole file, why not take the opportunity make it more
> structured? E.g. use a variadic macro so the name doesn't need to be buried in a
> string inside a comment, and so that each feature doesn't have to open code the
> math. Lack of third input omits the flag from /proc/cpuinfo, and a magic keyword,
> e.g. AUTO, uses the feature name.
>
> There are quite a few games that could be played with macros, and IMO pretty much
> all of them would be better than comment+string shenanigans.
>
> #define X86F(word, bit, abi_name...) ((word) * 32 + bit)
>
> #define X86_FEATURE_FPU X86F(0, 0, AUTO)
>
> #define X86_FEATURE_XMM X86F(0, 25, SSE2)
>
> #define X86_FEATURE_K8 X86F(3, 4)
I'm always open to those things, sure. But it'll have to go ontop ofc.
"X86F(3, 4)" is not very readable but we'll get used to it. I like the aspect of
not having to open code the word math. But then having it opencoded is
maximally readable...
Yeah, we'll see what the others say too.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette