mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 15:29:16 +00:00
[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>
This commit is contained in:
parent
391eadeec8
commit
bb44f116a1
@ -20,7 +20,8 @@ static void spin_bug(spinlock_t *lock, const char *msg)
|
|||||||
if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
|
if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
|
||||||
owner = lock->owner;
|
owner = lock->owner;
|
||||||
printk("BUG: spinlock %s on CPU#%d, %s/%d\n",
|
printk("BUG: spinlock %s on CPU#%d, %s/%d\n",
|
||||||
msg, smp_processor_id(), current->comm, current->pid);
|
msg, raw_smp_processor_id(),
|
||||||
|
current->comm, current->pid);
|
||||||
printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n",
|
printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n",
|
||||||
lock, lock->magic,
|
lock, lock->magic,
|
||||||
owner ? owner->comm : "<none>",
|
owner ? owner->comm : "<none>",
|
||||||
@ -78,8 +79,8 @@ static void __spin_lock_debug(spinlock_t *lock)
|
|||||||
if (print_once) {
|
if (print_once) {
|
||||||
print_once = 0;
|
print_once = 0;
|
||||||
printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n",
|
printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n",
|
||||||
smp_processor_id(), current->comm, current->pid,
|
raw_smp_processor_id(), current->comm,
|
||||||
lock);
|
current->pid, lock);
|
||||||
dump_stack();
|
dump_stack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +121,8 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
|
|||||||
|
|
||||||
if (xchg(&print_once, 0)) {
|
if (xchg(&print_once, 0)) {
|
||||||
printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg,
|
printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg,
|
||||||
smp_processor_id(), current->comm, current->pid, lock);
|
raw_smp_processor_id(), current->comm,
|
||||||
|
current->pid, lock);
|
||||||
dump_stack();
|
dump_stack();
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/*
|
/*
|
||||||
@ -148,8 +150,8 @@ static void __read_lock_debug(rwlock_t *lock)
|
|||||||
if (print_once) {
|
if (print_once) {
|
||||||
print_once = 0;
|
print_once = 0;
|
||||||
printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n",
|
printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n",
|
||||||
smp_processor_id(), current->comm, current->pid,
|
raw_smp_processor_id(), current->comm,
|
||||||
lock);
|
current->pid, lock);
|
||||||
dump_stack();
|
dump_stack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,8 +222,8 @@ static void __write_lock_debug(rwlock_t *lock)
|
|||||||
if (print_once) {
|
if (print_once) {
|
||||||
print_once = 0;
|
print_once = 0;
|
||||||
printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n",
|
printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n",
|
||||||
smp_processor_id(), current->comm, current->pid,
|
raw_smp_processor_id(), current->comm,
|
||||||
lock);
|
current->pid, lock);
|
||||||
dump_stack();
|
dump_stack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user