Messages in this thread | | | Date | Thu, 17 Nov 2011 15:12:35 +0100 | Subject | Re: your patch "crypto: sha1 - SSSE3 based SHA1 implementation for x86-64" vs xsave | From | Mathias Krause <> |
| |
On Thu, Nov 17, 2011 at 2:09 PM, Jan Beulich <JBeulich@suse.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
| |