Commit d548a928 authored by Ben Collins's avatar Ben Collins

SPARC64: Fix debug spinlocks to not trash random memory with > 4 cpus's (or sparse cpu's).

parent da57b2aa
......@@ -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
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment