linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] make raid5 checksums preempt-safe
@ 2002-08-26 20:06 Robert Love
  2002-08-26 21:09 ` Thunder from the hill
  2002-08-26 22:33 ` [PATCH] make raid5 checksums preempt-safe Brian Gerst
  0 siblings, 2 replies; 11+ messages in thread
From: Robert Love @ 2002-08-26 20:06 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Linus,

The raid5 xor checksums use MMX/SSE state and are not preempt-safe.

Attached patch disables preemption in FPU_SAVE and XMMS_SAVE and
restores it in FPU_RESTORE and XMMS_RESTORE - preventing preemption
while in fp mode.

Please, apply.

	Robert Love

diff -urN linux-2.5.31/include/asm-i386/xor.h linux/include/asm-i386/xor.h
--- linux-2.5.31/include/asm-i386/xor.h	Sat Aug 10 21:41:20 2002
+++ linux/include/asm-i386/xor.h	Sat Aug 24 20:14:43 2002
@@ -20,6 +20,7 @@
 
 #define FPU_SAVE							\
   do {									\
+	preempt_disable();						\
 	if (!test_thread_flag(TIF_USEDFPU))				\
 		__asm__ __volatile__ (" clts;\n");			\
 	__asm__ __volatile__ ("fsave %0; fwait": "=m"(fpu_save[0]));	\
@@ -30,6 +31,7 @@
 	__asm__ __volatile__ ("frstor %0": : "m"(fpu_save[0]));		\
 	if (!test_thread_flag(TIF_USEDFPU))				\
 		stts();							\
+	preempt_enable();						\
   } while (0)
 
 #define LD(x,y)		"       movq   8*("#x")(%1), %%mm"#y"   ;\n"
@@ -543,6 +545,7 @@
  */
 
 #define XMMS_SAVE				\
+	preempt_disable();			\
 	__asm__ __volatile__ ( 			\
 		"movl %%cr0,%0		;\n\t"	\
 		"clts			;\n\t"	\
@@ -564,7 +567,8 @@
 		"movl 	%0,%%cr0	;\n\t"	\
 		:				\
 		: "r" (cr0), "r" (xmm_save)	\
-		: "memory")
+		: "memory")			\
+	preempt_enable();
 
 #define ALIGN16 __attribute__((aligned(16)))
 
diff -urN linux-2.5.31/include/asm-x86_64/xor.h linux/include/asm-x86_64/xor.h
--- linux-2.5.31/include/asm-x86_64/xor.h	Sat Aug 10 21:41:23 2002
+++ linux/include/asm-x86_64/xor.h	Sat Aug 24 20:05:41 2002
@@ -38,7 +38,8 @@
 /* Doesn't use gcc to save the XMM registers, because there is no easy way to 
    tell it to do a clts before the register saving. */
 #define XMMS_SAVE				\
-	asm volatile ( 			\
+	preempt_disable();			\
+	asm volatile (				\
 		"movq %%cr0,%0		;\n\t"	\
 		"clts			;\n\t"	\
 		"movups %%xmm0,(%1)	;\n\t"	\
@@ -59,7 +60,8 @@
 		"movq 	%0,%%cr0	;\n\t"	\
 		:				\
 		: "r" (cr0), "r" (xmm_save)	\
-		: "memory")
+		: "memory")			\
+	preempt_enable();
 
 #define OFFS(x)		"16*("#x")"
 #define PF_OFFS(x)	"256+16*("#x")"




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-08-28  8:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-26 20:06 [PATCH] make raid5 checksums preempt-safe Robert Love
2002-08-26 21:09 ` Thunder from the hill
2002-08-26 21:15   ` Robert Love
2002-08-27  1:38     ` Horst von Brand
2002-08-27 15:25       ` Thunder from the hill
2002-08-27 15:34       ` How can a process easily get a list of all it's open fd? Mark Atwood
2002-08-27 16:08         ` Alex Riesen
2002-08-27 21:26           ` Mike Touloumtzis
2002-08-28  8:28             ` Alex Riesen
2002-08-27 23:21         ` DervishD
2002-08-26 22:33 ` [PATCH] make raid5 checksums preempt-safe Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).