[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55E070D3.1060208@sr71.net>
Date: Fri, 28 Aug 2015 07:31:47 -0700
From: Dave Hansen <dave@...1.net>
To: Ingo Molnar <mingo@...nel.org>
CC: dave.hansen@...ux.intel.com, bp@...en8.de, fenghua.yu@...el.com,
hpa@...or.com, x86@...nel.org, tim.c.chen@...ux.intel.com,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Kleen, Andi" <andi.kleen@...el.com>
Subject: Re: [PATCH 09/11] x86, fpu: correct and check XSAVE xstate size calculations
On 08/27/2015 09:54 PM, Ingo Molnar wrote:
>
> * Dave Hansen <dave@...1.net> wrote:
>
>> +static int xfeature_is_supervisor(int xfeature_nr)
>> +{
>> + /*
>> + * We currently do not suport supervisor states, but if
>> + * we did, we could find out like this.
>> + *
>> + * SDM says: If state component i is a user state component,
>> + * ECX[0] return 0; if state component i is a supervisor
>> + * state component, ECX[0] returns 1.
>> + u32 eax, ebx, ecx, edx;
>> + cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx);
>> + return !!(ecx & 1);
>> + */
>> + return 0;
>> +}
>
> So if this CPUID is documented to work, why not use it to sanity check things?
>
> I.e. do something like:
>
> u32 eax, ebx, ecx, edx;
>
> cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx);
>
> /* Linux doesn't support supervisor states (yet): */
> WARN_ON_ONCE(ecx & 1);
>
> return 0;
>
> That would give us a gentle way to double check our assumptions here.
Actually, the newest state that you will see in the wild is for
Processor Trace, and it _is_ a supervisor state. However, we don't use
it in Linux for our Processor Trace support, and Andi says we probably
never will.
So we probably shouldn't warn on it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists