[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b98933fd-e424-1a14-6591-7ba598ab90c6@intel.com>
Date: Mon, 12 Oct 2020 13:48:42 -0700
From: "Yu, Yu-cheng" <yu-cheng.yu@...el.com>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-mm@...ck.org,
linux-arch@...r.kernel.org, linux-api@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>,
Andy Lutomirski <luto@...nel.org>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Eugene Syromiatnikov <esyr@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
"H.J. Lu" <hjl.tools@...il.com>, Jann Horn <jannh@...gle.com>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Nadav Amit <nadav.amit@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Pavel Machek <pavel@....cz>,
Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Dave Martin <Dave.Martin@....com>,
Weijiang Yang <weijiang.yang@...el.com>,
Pengfei Xu <pengfei.xu@...el.com>
Subject: Re: [PATCH v14 03/26] x86/fpu/xstate: Introduce CET MSR XSAVES
supervisor states
On 10/12/2020 12:58 PM, Cyrill Gorcunov wrote:
> On Mon, Oct 12, 2020 at 08:38:27AM -0700, Yu-cheng Yu wrote:
> ...
>> /*
>> * x86-64 Task Priority Register, CR8
>> diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
>> index 038e19c0019e..705fd9b94e31 100644
>> --- a/arch/x86/kernel/fpu/xstate.c
>> +++ b/arch/x86/kernel/fpu/xstate.c
>> @@ -38,6 +38,9 @@ static const char *xfeature_names[] =
>> "Processor Trace (unused)" ,
>> "Protection Keys User registers",
>> "unknown xstate feature" ,
>> + "Control-flow User registers" ,
>> + "Control-flow Kernel registers" ,
>> + "unknown xstate feature" ,
>> };
>>
>> static short xsave_cpuid_features[] __initdata = {
>> @@ -51,6 +54,9 @@ static short xsave_cpuid_features[] __initdata = {
>> X86_FEATURE_AVX512F,
>> X86_FEATURE_INTEL_PT,
>> X86_FEATURE_PKU,
>> + -1, /* Unused */
>> + X86_FEATURE_SHSTK, /* XFEATURE_CET_USER */
>> + X86_FEATURE_SHSTK, /* XFEATURE_CET_KERNEL */
>> };
>
> Why do you need "-1" here in the array? The only 1:1 mapping is between
> the names itselves and values, not indices of arrays so i don't understand
> why we need this unused value. Sorry if it is a dumb questions and
> been discussed already.
>
The indices are used indirectly in fpu__init_system_xstate() to set bits
in xfeatures_mask_all, i.e.
xfeatures_mask_all &= ~BIT_ULL(i).
So they need to match the xstate feature bits.
Yu-cheng
Powered by blists - more mailing lists