Skip to contentSkip to conversation

x86/fpu: Revert earlier patch of Disable AVX when eagerfpu is off

PATCH Superseded Yu-cheng Yu 3 participants 5 messages Jan 23, 2016 – Mar 9, 2016 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/fpu: Revert earlier patch of Disable AVX when eagerfpu is off

AVX was mistakenly believed to be dependent on eagerfpu switch. This turns out to be false. The earlier patch should be reverted.

Original patch:

    http://git.kernel.org/tip/394db20ca240741a08d472173db13d6f6a6e5a28

Reported_by: Leonid Shatz <[email protected]>
Cc: [email protected]
Cc: H. Peter Anvin <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Sai Praneeth Prakhya <[email protected]>
Cc: Ravi V. Shankar <[email protected]>
Cc: Leonid Shatz <[email protected]>
Cc: Fenghua Yu <[email protected]>

---
 arch/x86/include/asm/fpu/xstate.h | 9 ++++-----
 arch/x86/kernel/fpu/init.c        | 6 ------
 2 files changed, 4 insertions(+), 11 deletions(-)
arch/x86/include/asm/fpu/xstate.h +4 -5
index af30fde..f23cd8c 100644
@@ -20,16 +20,15 @@
 
 /* Supported features which support lazy state saving */
 #define XFEATURE_MASK_LAZY	(XFEATURE_MASK_FP | \
-				 XFEATURE_MASK_SSE)
-
-/* Supported features which require eager state saving */
-#define XFEATURE_MASK_EAGER	(XFEATURE_MASK_BNDREGS | \
-				 XFEATURE_MASK_BNDCSR | \
+				 XFEATURE_MASK_SSE | \
 				 XFEATURE_MASK_YMM | \
 				 XFEATURE_MASK_OPMASK | \
 				 XFEATURE_MASK_ZMM_Hi256 | \
 				 XFEATURE_MASK_Hi16_ZMM)
 
+/* Supported features which require eager state saving */
+#define XFEATURE_MASK_EAGER	(XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)
+
 /* All currently supported features */
 #define XCNTXT_MASK	(XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER)
 
arch/x86/kernel/fpu/init.c +0 -6
index 6d9f0a7..f0ab368 100644
@@ -300,12 +300,6 @@ u64 __init fpu__get_supported_xfeatures_mask(void)
 static void __init fpu__clear_eager_fpu_features(void)
 {
 	setup_clear_cpu_cap(X86_FEATURE_MPX);
-	setup_clear_cpu_cap(X86_FEATURE_AVX);
-	setup_clear_cpu_cap(X86_FEATURE_AVX2);
-	setup_clear_cpu_cap(X86_FEATURE_AVX512F);
-	setup_clear_cpu_cap(X86_FEATURE_AVX512PF);
-	setup_clear_cpu_cap(X86_FEATURE_AVX512ER);
-	setup_clear_cpu_cap(X86_FEATURE_AVX512CD);
 }
 
 /*
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · Yu-cheng Yu

AVX was mistakenly believed to be dependent on eagerfpu switch. This turns out to be false. The earlier patch should be reverted.

Original patch:

    http://git.kernel.org/tip/394db20ca240741a08d472173db13d6f6a6e5a28

So the original patch had a whole host of explanations of why that change is correct. This revert should explain where that argumentation was wrong.

Also note that eagerfpu=off is on the way out, on v4.6 we'll switch all CPUs to eagerfpu:

58122bf1d856 x86/fpu: Default eagerfpu=on on all CPUs

and in the not so distant future, if everything goes fine with the eager mode, I'd like to drop the lazy FPU context switching code altogether - which will simplify a lot of code. At that point the 'eagerfpu' boot option will go away as well.

Thanks,

Ingo

#2 lore raw
Quoted 11 lines · Ingo Molnar
Quoted 5 lines · Yu-cheng Yu

AVX was mistakenly believed to be dependent on eagerfpu switch. This turns out to be false. The earlier patch should be reverted.

Original patch:

    http://git.kernel.org/tip/394db20ca240741a08d472173db13d6f6a6e5a28

So the original patch had a whole host of explanations of why that change is correct. This revert should explain where that argumentation was wrong.

I will send out another version that includes more details.

Thanks,
Yu-cheng

#3 lore raw
Quoted 7 lines · Yu-cheng Yu
Quoted 6 lines · Ingo Molnar
Quoted 3 lines · Yu-cheng Yu

AVX was mistakenly believed to be dependent on eagerfpu switch. This turns out to be false. The earlier patch should be reverted.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Original patch:

    http://git.kernel.org/tip/394db20ca240741a08d472173db13d6f6a6e5a28

So the original patch had a whole host of explanations of why that change is correct. This revert should explain where that argumentation was wrong.

I will send out another version that includes more details.

Great, thanks!

Ingo

#4 lore raw
In reply to Ingo Molnar
Quoted 12 lines · Ingo Molnar
Quoted 5 lines · Yu-cheng Yu

AVX was mistakenly believed to be dependent on eagerfpu switch. This turns out to be false. The earlier patch should be reverted.

Original patch:

    http://git.kernel.org/tip/394db20ca240741a08d472173db13d6f6a6e5a28

So the original patch had a whole host of explanations of why that change is correct. This revert should explain where that argumentation was wrong.

Quoted 9 lines

Also note that eagerfpu=off is on the way out, on v4.6 we'll switch all CPUs to eagerfpu:

58122bf1d856 x86/fpu: Default eagerfpu=on on all CPUs

and in the not so distant future, if everything goes fine with the eager mode, I'd like to drop the lazy FPU context switching code altogether - which will simplify a lot of code. At that point the 'eagerfpu' boot option will go away as well.

Last I heard the only use case which was seeing trouble with eagerfpu was KVM during service of I/O events. Might be worth checking into...

-hpa