linux-mips
[Top] [All Lists]

PREEMPT BUG: using smp_processor_id() in preemptible

To: linux-mips@linux-mips.org
Subject: PREEMPT BUG: using smp_processor_id() in preemptible
From: tanderson@mvista.com
Date: Tue, 16 Jun 2009 17:21:41 -0700
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
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);      \

<Prev in Thread] Current Thread [Next in Thread>
  • PREEMPT BUG: using smp_processor_id() in preemptible, tanderson <=