diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2012-03-28 20:10:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-03-29 02:34:45 -0400 |
commit | 6135fc1eb4b1c9ae5f535507ed59591bab51e630 (patch) | |
tree | d77513f138b94550b27394c907e9caf9f3d990a9 | |
parent | 160594e99dbbb0a5600ad922c630952c7c1c14bf (diff) |
sched: Fix __schedule_bug() output when called from an interrupt
If schedule is called from an interrupt handler __schedule_bug()
will call show_regs() with the registers saved during the
interrupt handling done in do_IRQ(). This means we'll see the
registers and the backtrace for the process that was interrupted
and not the full backtrace explaining who called schedule().
This is due to 838225b ("sched: use show_regs() to improve
__schedule_bug() output", 2007-10-24) which improperly assumed
that get_irq_regs() would return the registers for the current
stack because it is being called from within an interrupt
handler. Simply remove the show_reg() code so that we dump a
backtrace for the interrupt handler that called schedule().
[ I ran across this when I was presented with a scheduling while
atomic log with a stacktrace pointing at spin_unlock_irqrestore().
It made no sense and I had to guess what interrupt handler could
be called and poke around for someone calling schedule() in an
interrupt handler. A simple test of putting an msleep() in
an interrupt handler works better with this patch because you
can actually see the msleep() call in the backtrace. ]
Also-reported-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Satyam Sharma <satyam@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1332979847-27102-1-git-send-email-sboyd@codeaurora.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | kernel/sched/core.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9c1629c90b2d..929fd857ef88 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3099,8 +3099,6 @@ EXPORT_SYMBOL(sub_preempt_count); | |||
3099 | */ | 3099 | */ |
3100 | static noinline void __schedule_bug(struct task_struct *prev) | 3100 | static noinline void __schedule_bug(struct task_struct *prev) |
3101 | { | 3101 | { |
3102 | struct pt_regs *regs = get_irq_regs(); | ||
3103 | |||
3104 | if (oops_in_progress) | 3102 | if (oops_in_progress) |
3105 | return; | 3103 | return; |
3106 | 3104 | ||
@@ -3111,11 +3109,7 @@ static noinline void __schedule_bug(struct task_struct *prev) | |||
3111 | print_modules(); | 3109 | print_modules(); |
3112 | if (irqs_disabled()) | 3110 | if (irqs_disabled()) |
3113 | print_irqtrace_events(prev); | 3111 | print_irqtrace_events(prev); |
3114 | 3112 | dump_stack(); | |
3115 | if (regs) | ||
3116 | show_regs(regs); | ||
3117 | else | ||
3118 | dump_stack(); | ||
3119 | } | 3113 | } |
3120 | 3114 | ||
3121 | /* | 3115 | /* |