x86/fpu: Disable XGETBV1 when no XSAVE
authoryu-cheng yu <[email protected]>
Wed, 6 Jan 2016 22:24:52 +0000 (14:24 -0800)
committerIngo Molnar <[email protected]>
Tue, 12 Jan 2016 10:51:21 +0000 (11:51 +0100)
When "noxsave" is given as a command-line input, the kernel
should disable XGETBV1. This issue currently does not cause any
actual problems. XGETBV1 is only useful if we have something
using the 'init optimization' (i.e. xsaveopt, xsaves). We
already clear both of those in fpu__xstate_clear_all_cpu_caps().
But this is good for completeness.

Signed-off-by: Yu-cheng Yu <[email protected]>
Reviewed-by: Dave Hansen <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Quentin Casasnovas <[email protected]>
Cc: Ravi V. Shankar <[email protected]>
Cc: Sai Praneeth Prakhya <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: yu-cheng yu <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/fpu/xstate.c

index 40f100285984eb9f73876115f263c53c85f86a59..d489f277a8a0cc6b9820a0bcf099ccc5f332e63f 100644 (file)
@@ -52,6 +52,7 @@ void fpu__xstate_clear_all_cpu_caps(void)
        setup_clear_cpu_cap(X86_FEATURE_AVX512ER);
        setup_clear_cpu_cap(X86_FEATURE_AVX512CD);
        setup_clear_cpu_cap(X86_FEATURE_MPX);
+       setup_clear_cpu_cap(X86_FEATURE_XGETBV1);
 }
 
 /*