Commit bb44f116a14c4c932f15c79acfafd46bcb43ca9a
Committed by
Linus Torvalds
1 parent
391eadeec8
Exists in
master
and in
4 other branches
[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>
Showing 1 changed file with 10 additions and 8 deletions Side-by-side Diff
lib/spinlock_debug.c
... | ... | @@ -20,7 +20,8 @@ |
20 | 20 | if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) |
21 | 21 | owner = lock->owner; |
22 | 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 | 25 | printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n", |
25 | 26 | lock, lock->magic, |
26 | 27 | owner ? owner->comm : "<none>", |
... | ... | @@ -78,8 +79,8 @@ |
78 | 79 | if (print_once) { |
79 | 80 | print_once = 0; |
80 | 81 | printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n", |
81 | - smp_processor_id(), current->comm, current->pid, | |
82 | - lock); | |
82 | + raw_smp_processor_id(), current->comm, | |
83 | + current->pid, lock); | |
83 | 84 | dump_stack(); |
84 | 85 | } |
85 | 86 | } |
... | ... | @@ -120,7 +121,8 @@ |
120 | 121 | |
121 | 122 | if (xchg(&print_once, 0)) { |
122 | 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 | 126 | dump_stack(); |
125 | 127 | #ifdef CONFIG_SMP |
126 | 128 | /* |
... | ... | @@ -148,8 +150,8 @@ |
148 | 150 | if (print_once) { |
149 | 151 | print_once = 0; |
150 | 152 | printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n", |
151 | - smp_processor_id(), current->comm, current->pid, | |
152 | - lock); | |
153 | + raw_smp_processor_id(), current->comm, | |
154 | + current->pid, lock); | |
153 | 155 | dump_stack(); |
154 | 156 | } |
155 | 157 | } |
... | ... | @@ -220,8 +222,8 @@ |
220 | 222 | if (print_once) { |
221 | 223 | print_once = 0; |
222 | 224 | printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n", |
223 | - smp_processor_id(), current->comm, current->pid, | |
224 | - lock); | |
225 | + raw_smp_processor_id(), current->comm, | |
226 | + current->pid, lock); | |
225 | 227 | dump_stack(); |
226 | 228 | } |
227 | 229 | } |