Re: [PATCH v4 1/6] x86: KVM: Advertise CMPccXADD CPUID to user space
From: Jiaxi Chen
Date: Wed Nov 23 2022 - 02:47:24 EST
On 11/21/2022 11:38 PM, Borislav Petkov wrote:
> On Mon, Nov 21, 2022 at 10:46:21PM +0800, Jiaxi Chen wrote:
>> Features which has been enabled in kernel usually should be added to
>> /proc/cpuinfo.
>
> No, pls read this first: Documentation/x86/cpuinfo.rst
>
> If something's not clear, we will extend it so that it is.
>
> /proc/cpuinfo - a user ABI - is not a dumping ground for CPUID bits.
>
Thanks. Sorry for the miss understanding.
For those feature bits who have truly kernel usage, their flags should
appear in /proc/cpuinfo. For others, they are not generally show up
here, it depends.
As for features in this patch series:
The first-way defined bits are on an expected-dense cpuid leaf[1] and
some of their siblings have kernel usages[2]. Given that, define them
like X86_FEATURE_* in arch/x86/include/asm/cpufeatures.h. But due to
their complicated and unreadable feature name[3], prefer to hide them in
/proc/cpuinfo.
The second-way defined bits are on a new and sparse cpuid leaf. Besides,
these bits have no turly kernel use case. Therefore, move these new bits
to kvm-only leaves to achieve the purpose for advertising these bits to
kvm userspace[4]. Then of course they will not show up in /proc/cpuinfo.
[1] https://lore.kernel.org/all/Y3O7UYWfOLfJkwM%2F@xxxxxxx/
[2]
https://lore.kernel.org/all/f8607d23-afaa-2670-dd03-2ae8ec1e79a0@xxxxxxxxx/
[3]
https://lore.kernel.org/all/6d7fae50-ef3c-dc1e-336c-691095007117@xxxxxxxxx/
[4] https://lore.kernel.org/all/Y1ATKF2xjERFbspn@xxxxxxxxxx/
--
Regards,
Jiaxi