PREEMPT BUG: using smp_processor_id() in preemptible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ralf,

We saw the using smp_processor_id() in preemptible and thought
this my be a good correction.


--- arch/mips/include/asm/r4kcache.h_org	2009-06-09 22:25:19.000000000 +0400
+++ arch/mips/include/asm/r4kcache.h	2009-06-10 01:08:03.000000000 +0400
@@ -344,14 +344,17 @@
 static inline void blast_##pfx##cache##lsize(void)			\
 {									\
 	unsigned long start = INDEX_BASE;				\
-	unsigned long end = start + current_cpu_data.desc.waysize;	\
-	unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit;	\
-	unsigned long ws_end = current_cpu_data.desc.ways <<		\
-	                       current_cpu_data.desc.waybit;		\
-	unsigned long ws, addr;						\
+	unsigned long end, ws_inc, ws_end, ws, addr;			\
 									\
 	__##pfx##flush_prologue						\
 									\
+	preempt_disable();						\
+	end = start + current_cpu_data.desc.waysize;			\
+	ws_inc = 1UL << current_cpu_data.desc.waybit;			\
+	ws_end = current_cpu_data.desc.ways <<				\
+			current_cpu_data.desc.waybit;			\
+	preempt_enable();						\
+									\
 	for (ws = 0; ws < ws_end; ws += ws_inc)				\
 		for (addr = start; addr < end; addr += lsize * 32)	\
 			cache##lsize##_unroll32(addr|ws, indexop);	\
@@ -376,16 +379,19 @@
 									\
 static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
 {									\
-	unsigned long indexmask = current_cpu_data.desc.waysize - 1;	\
-	unsigned long start = INDEX_BASE + (page & indexmask);		\
-	unsigned long end = start + PAGE_SIZE;				\
-	unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit;	\
-	unsigned long ws_end = current_cpu_data.desc.ways <<		\
-	                       current_cpu_data.desc.waybit;		\
-	unsigned long ws, addr;						\
+	unsigned long indexmask, ws_inc, ws_end, ws, addr, start, end;	\
 									\
 	__##pfx##flush_prologue						\
 									\
+	preempt_disable();						\
+	indexmask = current_cpu_data.desc.waysize - 1;			\
+	start = INDEX_BASE + (page & indexmask);			\
+	end = start + PAGE_SIZE;					\
+	ws_inc = 1UL << current_cpu_data.desc.waybit;			\
+	ws_end = current_cpu_data.desc.ways <<				\
+			current_cpu_data.desc.waybit;			\
+	preempt_enable();						\
+									\
 	for (ws = 0; ws < ws_end; ws += ws_inc)				\
 		for (addr = start; addr < end; addr += lsize * 32)	\
 			cache##lsize##_unroll32(addr|ws, indexop);	\


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux