lkml.org 
[lkml]   [2015]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 09/11] x86, fpu: correct and check XSAVE xstate size calculations

* Dave Hansen <dave@sr71.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.

Thanks,

Ingo


\
 
 \ /
  Last update: 2015-08-28 07:41    [W:0.132 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site