diff options
author | Satyam Sharma <satyam@infradead.org> | 2007-10-24 12:23:50 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-24 12:23:50 -0400 |
commit | 838225b48edc971620cbeb292034dabd2b0d7d1d (patch) | |
tree | c4248521fead10f50f4539b6859339aeeef118d7 /kernel | |
parent | 4dcf6aff023d9934630fb3649284951831c51f8f (diff) |
sched: use show_regs() to improve __schedule_bug() output
A full register dump along with stack backtrace would make the
"scheduling while atomic" message more helpful. Use show_regs() instead
of dump_stack() for this. We already know we're atomic in here (that is
why this function was called) so show_regs()'s atomicity expectations
are guaranteed.
Also, modify the output of the "BUG: scheduling while atomic:" header a
bit to keep task->comm and task->pid together and preempt_count() after
them.
Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index af02a4de069..d1e6663d3ab 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/pagemap.h> | 66 | #include <linux/pagemap.h> |
67 | 67 | ||
68 | #include <asm/tlb.h> | 68 | #include <asm/tlb.h> |
69 | #include <asm/irq_regs.h> | ||
69 | 70 | ||
70 | /* | 71 | /* |
71 | * Scheduler clock - returns current time in nanosec units. | 72 | * Scheduler clock - returns current time in nanosec units. |
@@ -3507,12 +3508,19 @@ EXPORT_SYMBOL(sub_preempt_count); | |||
3507 | */ | 3508 | */ |
3508 | static noinline void __schedule_bug(struct task_struct *prev) | 3509 | static noinline void __schedule_bug(struct task_struct *prev) |
3509 | { | 3510 | { |
3510 | printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n", | 3511 | struct pt_regs *regs = get_irq_regs(); |
3511 | prev->comm, preempt_count(), task_pid_nr(prev)); | 3512 | |
3513 | printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n", | ||
3514 | prev->comm, prev->pid, preempt_count()); | ||
3515 | |||
3512 | debug_show_held_locks(prev); | 3516 | debug_show_held_locks(prev); |
3513 | if (irqs_disabled()) | 3517 | if (irqs_disabled()) |
3514 | print_irqtrace_events(prev); | 3518 | print_irqtrace_events(prev); |
3515 | dump_stack(); | 3519 | |
3520 | if (regs) | ||
3521 | show_regs(regs); | ||
3522 | else | ||
3523 | dump_stack(); | ||
3516 | } | 3524 | } |
3517 | 3525 | ||
3518 | /* | 3526 | /* |