aboutsummaryrefslogtreecommitdiffstats
path: root/lib/spinlock_debug.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2005-12-20 05:54:17 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-20 13:47:55 -0500
commitbb44f116a14c4c932f15c79acfafd46bcb43ca9a (patch)
treed8f5dc090cef75f22e7ca152298096bb2877b6b8 /lib/spinlock_debug.c
parent391eadeec836463a4e6e3843953bbe40f6522593 (diff)
[PATCH] fix spinlock-debugging smp_processor_id() usage
When a spinlock debugging check hits, we print the CPU number as an informational thing - but there is no guarantee that preemption is off at that point - hence we should use raw_smp_processor_id(). Otherwise DEBUG_PREEMPT will print a warning. With this fix the warning goes away and only the spinlock-debugging info is printed. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib/spinlock_debug.c')
-rw-r--r--lib/spinlock_debug.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
index 906ad101eab3..dcd4be9bd4e5 100644
--- a/lib/spinlock_debug.c
+++ b/lib/spinlock_debug.c
@@ -20,7 +20,8 @@ static void spin_bug(spinlock_t *lock, const char *msg)
20 if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) 20 if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
21 owner = lock->owner; 21 owner = lock->owner;
22 printk("BUG: spinlock %s on CPU#%d, %s/%d\n", 22 printk("BUG: spinlock %s on CPU#%d, %s/%d\n",
23 msg, smp_processor_id(), current->comm, current->pid); 23 msg, raw_smp_processor_id(),
24 current->comm, current->pid);
24 printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n", 25 printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n",
25 lock, lock->magic, 26 lock, lock->magic,
26 owner ? owner->comm : "<none>", 27 owner ? owner->comm : "<none>",
@@ -78,8 +79,8 @@ static void __spin_lock_debug(spinlock_t *lock)
78 if (print_once) { 79 if (print_once) {
79 print_once = 0; 80 print_once = 0;
80 printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n", 81 printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n",
81 smp_processor_id(), current->comm, current->pid, 82 raw_smp_processor_id(), current->comm,
82 lock); 83 current->pid, lock);
83 dump_stack(); 84 dump_stack();
84 } 85 }
85 } 86 }
@@ -120,7 +121,8 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
120 121
121 if (xchg(&print_once, 0)) { 122 if (xchg(&print_once, 0)) {
122 printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg, 123 printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg,
123 smp_processor_id(), current->comm, current->pid, lock); 124 raw_smp_processor_id(), current->comm,
125 current->pid, lock);
124 dump_stack(); 126 dump_stack();
125#ifdef CONFIG_SMP 127#ifdef CONFIG_SMP
126 /* 128 /*
@@ -148,8 +150,8 @@ static void __read_lock_debug(rwlock_t *lock)
148 if (print_once) { 150 if (print_once) {
149 print_once = 0; 151 print_once = 0;
150 printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n", 152 printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n",
151 smp_processor_id(), current->comm, current->pid, 153 raw_smp_processor_id(), current->comm,
152 lock); 154 current->pid, lock);
153 dump_stack(); 155 dump_stack();
154 } 156 }
155 } 157 }
@@ -220,8 +222,8 @@ static void __write_lock_debug(rwlock_t *lock)
220 if (print_once) { 222 if (print_once) {
221 print_once = 0; 223 print_once = 0;
222 printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n", 224 printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n",
223 smp_processor_id(), current->comm, current->pid, 225 raw_smp_processor_id(), current->comm,
224 lock); 226 current->pid, lock);
225 dump_stack(); 227 dump_stack();
226 } 228 }
227 } 229 }