Commit 838225b4 authored by Satyam Sharma's avatar Satyam Sharma Committed by Ingo Molnar

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: default avatarSatyam Sharma <satyam@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4dcf6aff
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <asm/tlb.h> #include <asm/tlb.h>
#include <asm/irq_regs.h>
/* /*
* Scheduler clock - returns current time in nanosec units. * Scheduler clock - returns current time in nanosec units.
...@@ -3507,11 +3508,18 @@ EXPORT_SYMBOL(sub_preempt_count); ...@@ -3507,11 +3508,18 @@ EXPORT_SYMBOL(sub_preempt_count);
*/ */
static noinline void __schedule_bug(struct task_struct *prev) static noinline void __schedule_bug(struct task_struct *prev)
{ {
printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n", struct pt_regs *regs = get_irq_regs();
prev->comm, preempt_count(), task_pid_nr(prev));
printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
prev->comm, prev->pid, preempt_count());
debug_show_held_locks(prev); debug_show_held_locks(prev);
if (irqs_disabled()) if (irqs_disabled())
print_irqtrace_events(prev); print_irqtrace_events(prev);
if (regs)
show_regs(regs);
else
dump_stack(); dump_stack();
} }
......
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