Skip to contentSkip to conversation

xor: add missing vzeroupper to AVX code

PATCH New Eric Biggers 1 participant 1 message Nov 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xor: add missing vzeroupper to AVX code

commit 7b8fc26c40d6cf4c6751a045c9e42bbb7e78d81b upstream.

Since the AVX optimized XOR code uses YMM registers, execute vzeroupper before returning from it. This is needed to avoid degrading the performance of any later SSE code that may happen to be executed.

(Backported to the old organization of the XOR code.)

Fixes ea4d26ae24e5 ("raid5: add AVX optimized RAID5 checksumming")
Cc Christoph Hellwig <[email protected]>
---
 arch/x86/include/asm/xor_avx.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/include/asm/xor_avx.h +4 -0
index 7f81dd5897f41..c6450acd055d1 100644
@@ -50,6 +50,7 @@ do { \
 		p1 = (unsigned long *)((uintptr_t)p1 + 512);
 	}
 
+	asm volatile("vzeroupper");
 	kernel_fpu_end();
 }
 
@@ -81,6 +82,7 @@ do { \
 		p2 = (unsigned long *)((uintptr_t)p2 + 512);
 	}
 
+	asm volatile("vzeroupper");
 	kernel_fpu_end();
 }
 
@@ -116,6 +118,7 @@ do { \
 		p3 = (unsigned long *)((uintptr_t)p3 + 512);
 	}
 
+	asm volatile("vzeroupper");
 	kernel_fpu_end();
 }
 
@@ -155,6 +158,7 @@ do { \
 		p4 = (unsigned long *)((uintptr_t)p4 + 512);
 	}
 
+	asm volatile("vzeroupper");
 	kernel_fpu_end();
 }
 

base-commit: c3f63d70f236bb7685e6d11d1d9b5b351552e600

Signature · 1 line
2.56.0