]> git.neil.brown.name Git - history.git/commitdiff
SPARC64: Fix debug spinlocks to not trash random memory with > 4 cpus's (or sparse...
authorBen Collins <bcollins@debian.org>
Tue, 24 Feb 2004 14:28:21 +0000 (09:28 -0500)
committerBen Collins <bcollins@debian.org>
Tue, 24 Feb 2004 14:28:21 +0000 (09:28 -0500)
arch/sparc64/lib/debuglocks.c
include/asm-sparc64/spinlock.h

index 8a7c0f77ff2e8166f137fd172574c5bb661c1ea8..341cce76b773237ec16c572fa442c14506b3dd50 100644 (file)
@@ -35,14 +35,17 @@ static inline void show_read (char *str, rwlock_t *lock, unsigned long caller)
 static inline void show_write (char *str, rwlock_t *lock, unsigned long caller)
 {
        int cpu = smp_processor_id();
+       int i;
 
        printk("%s(%p) CPU#%d stuck at %08x\n",
               str, lock, cpu, (unsigned int) caller);
        printk("Writer: PC(%08x):CPU(%x)\n",
               lock->writer_pc, lock->writer_cpu);
-       printk("Readers: 0[%08x] 1[%08x] 2[%08x] 4[%08x]\n",
-              lock->reader_pc[0], lock->reader_pc[1],
-              lock->reader_pc[2], lock->reader_pc[3]);
+       printk("Readers:");
+       for (i = 0; i < NR_CPUS; i++)
+               if (lock->reader_pc[i])
+                       printk(" %d[%08x]", i, lock->reader_pc[i]);
+       printk("\n");
 }
 
 #undef INIT_STUCK
index 201472fc01bcf01f0096a57dcee7709aae32cb2e..8387816e4ac247b7771a7a7cf627a6628830103f 100644 (file)
@@ -7,6 +7,7 @@
 #define __SPARC64_SPINLOCK_H
 
 #include <linux/config.h>
+#include <linux/threads.h>     /* For NR_CPUS */
 
 #ifndef __ASSEMBLY__
 
@@ -131,7 +132,7 @@ extern int __write_trylock(rwlock_t *);
 typedef struct {
        unsigned long lock;
        unsigned int writer_pc, writer_cpu;
-       unsigned int reader_pc[4];
+       unsigned int reader_pc[NR_CPUS];
 } rwlock_t;
 #define RW_LOCK_UNLOCKED       (rwlock_t) { 0, 0, 0xff, { 0, 0, 0, 0 } }
 #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)