Skip to content

Commit a65050c

Browse files
yyu-intel-comIngo Molnar
authored andcommitted
x86/fpu: Revert ("x86/fpu: Disable AVX when eagerfpu is off")
Leonid Shatz noticed that the SDM interpretation of the following recent commit: 394db20 ("x86/fpu: Disable AVX when eagerfpu is off") ... is incorrect and that the original behavior of the FPU code was correct. Because AVX is not stated in CR0 TS bit description, it was mistakenly believed to be not supported for lazy context switch. This turns out to be false: Intel Software Developer's Manual Vol. 3A, Sec. 2.5 Control Registers: 'TS Task Switched bit (bit 3 of CR0) -- Allows the saving of the x87 FPU/ MMX/SSE/SSE2/SSE3/SSSE3/SSE4 context on a task switch to be delayed until an x87 FPU/MMX/SSE/SSE2/SSE3/SSSE3/SSE4 instruction is actually executed by the new task.' Intel Software Developer's Manual Vol. 2A, Sec. 2.4 Instruction Exception Specification: 'AVX instructions refer to exceptions by classes that include #NM "Device Not Available" exception for lazy context switch.' So revert the commit. Reported-by: Leonid Shatz <leonid.shatz@ravellosystems.com> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@suse.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi V. Shankar <ravi.v.shankar@intel.com> Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1457569734-3785-1-git-send-email-yu-cheng.yu@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f363938 commit a65050c

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

arch/x86/include/asm/fpu/xstate.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@
2020

2121
/* Supported features which support lazy state saving */
2222
#define XFEATURE_MASK_LAZY (XFEATURE_MASK_FP | \
23-
XFEATURE_MASK_SSE)
24-
25-
/* Supported features which require eager state saving */
26-
#define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | \
27-
XFEATURE_MASK_BNDCSR | \
23+
XFEATURE_MASK_SSE | \
2824
XFEATURE_MASK_YMM | \
2925
XFEATURE_MASK_OPMASK | \
3026
XFEATURE_MASK_ZMM_Hi256 | \
3127
XFEATURE_MASK_Hi16_ZMM)
3228

29+
/* Supported features which require eager state saving */
30+
#define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)
31+
3332
/* All currently supported features */
3433
#define XCNTXT_MASK (XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER)
3534

arch/x86/kernel/fpu/init.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,6 @@ u64 __init fpu__get_supported_xfeatures_mask(void)
302302
static void __init fpu__clear_eager_fpu_features(void)
303303
{
304304
setup_clear_cpu_cap(X86_FEATURE_MPX);
305-
setup_clear_cpu_cap(X86_FEATURE_AVX);
306-
setup_clear_cpu_cap(X86_FEATURE_AVX2);
307-
setup_clear_cpu_cap(X86_FEATURE_AVX512F);
308-
setup_clear_cpu_cap(X86_FEATURE_AVX512PF);
309-
setup_clear_cpu_cap(X86_FEATURE_AVX512ER);
310-
setup_clear_cpu_cap(X86_FEATURE_AVX512CD);
311305
}
312306

313307
/*

0 commit comments

Comments
 (0)