Re: [PATCH] x86/pkeys: Manually set X86_FEATURE_OSPKE to preserve existing changes

From: Jacob Keller
Date: Wed Feb 26 2020 - 18:40:37 EST




On 2/26/2020 3:32 PM, Dave Hansen wrote:
> On 2/26/20 3:16 PM, Sean Christopherson wrote:
>> Explicitly set X86_FEATURE_OSPKE via set_cpu_cap() instead of calling
>> get_cpu_cap() to pull the feature bit from CPUID after enabling CR4.PKE.
>
> First of all,
>
> Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
> I don't remember whether it was you or someone else inside Intel, but
> someone was tripping over this recently.
>
> I do think we need a bit more care in how we deal with dynamic CPUID
> bits. I think you'd agree that it's a bit haphazard. For instance, I
> went looking for where we set X86_FEATURE_OSXSAVE after the
>
> cr4_set_bits(X86_CR4_OSXSAVE);
>
> inside fpu__init_cpu_xstate() makes it appear. I couldn't find one, not
> that we would notice since we suppress it from /proc/cpuinfo.
>


I tripped over it. It's possible someone else has as well, but I haven't
heard from anyone else.

Thanks,
Jake