[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+rthh_Qg91ciZMoctAtzSH-q01XTdkDu37Y7fYOvFOswZQDRQ@mail.gmail.com>
Date: Thu, 17 Nov 2011 15:12:35 +0100
From: Mathias Krause <minipli@...glemail.com>
To: Jan Beulich <JBeulich@...e.com>
Cc: herbert@...dor.apana.org.au, linux-kernel@...r.kernel.org
Subject: Re: your patch "crypto: sha1 - SSSE3 based SHA1 implementation for
x86-64" vs xsave
On Thu, Nov 17, 2011 at 2:09 PM, Jan Beulich <JBeulich@...e.com> wrote:
>> I don't see where X86_CR4_OSXSAVE would get reset after xsave init.
>> Can you give me a pointer to that code?
>
> I didn't say it would get cleared. I said it should be used in favor of
> cpu_has_osxsave.
>
>>> Additionally, under a hypervisor, CPUID.OSXSAVE may be set (due to
>>> the hypervisor having enabled xsave), while the kernel may be running
>>> with xsave disabled (e.g. due to a command line option saying so).
>>
>> When noxsave is given on the kernel command line, X86_FEATURE_XSAVE
>> will be cleared and xsave_init() won't call xstate_enable(), so not
>> setting X86_CR4_OSXSAVE. All fine.
>
> But you're not looking at this bit, you're looking at cpu_has_osxsave,
> which is a CPUID bit (not a CR4 one).
You're right. But that's no problem at all, as the cpu_has_* tests are
only to error out early. They also ensure it is save to execute the
next instruction -- xsetbv(). This instruction actually does the xsave
runtime support check by looking at the extended control register XCR0
and the enabled features in there.
So you're right that the cpu_has_osxsave might be superfluous here but
it doesn't hurt either.
Mathias
--
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