RE: [PATCH v2 1/6] x86/cpufeature: add cpu feature bit for LKGS
From: Li, Xin3
Date: Thu Oct 13 2022 - 15:35:34 EST
> > diff --git a/arch/x86/include/asm/cpufeatures.h
> > b/arch/x86/include/asm/cpufeatures.h
> > index ef4775c6db01..459fb0c21dd4 100644
> > --- a/arch/x86/include/asm/cpufeatures.h
> > +++ b/arch/x86/include/asm/cpufeatures.h
> > @@ -308,6 +308,7 @@
> > /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
> > #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI
> instructions */
> > #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512
> BFLOAT16 instructions */
> > +#define X86_FEATURE_LKGS (12*32+ 18) /* Load "kernel"
> (userspace) gs */
>
> The spec says [1]:
> "Execution of LKGS causes an invalid-opcode exception (#UD) if CPL >
> 0."
>
> Perhaps userspace has no interest in this. Then, we can add "" not to show
> "lkgs" in /proc/cpuinfo:
> +#define X86_FEATURE_LKGS (12*32+ 18) /* "" Load "kernel"
> (userspace) gs */
Good point!
>
> Thanks,
> Chang
>
> [1] https://cdrdv2.intel.com/v1/dl/getContent/678938