Re: [PATCH v3 1/2] x86/cpufeatures: Add macros for Intel's new fast rep string features

Borislav Petkov
2022-09-02T05:48:46Z

On Thu, Sep 01, 2022 at 09:14:24PM -0700, H. Peter Anvin wrote:
> Any reason why these bits are hidden from /proc/cpuinfo?

Yes, we aim to hide such purely CPUID bits from /proc/cpuinfo because it
becomes a dumping ground for "enablement" of new features. But

1. those features are not really used - most userspace like binutils and
gcc, etc do their own detection. (Yes, yes, I'd like to have ubiquitous
CPUID faulting).

2. /proc/cpuinfo is an ABI so we have to carry *all* those gazillion
flags for no good reason

So we have tools/arch/x86/kcpuid/ which we control and we can extend
with all the CPUID querying needs we have.

These kvm enablement things are kinda needed because guest userspace
gets an emulated CPUID so in order to detect features on its own, it
needs them. And kvm has tied features to x86's X86_FEATURE stuff and
there are sometimes weird interactions with it too but that's another
topic...

Oh and we still do add visible flags to /proc/cpuinfo but only when
they're features which need and have received non-trivial kernel
enablement like TDX or SNP or so.

--
Regards/Gruss,
Boris.