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

From: Dave Hansen
Date: Wed Feb 26 2020 - 18:32:24 EST


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.