Commit 748c7201 authored by Daniel Bristot de Oliveira's avatar Daniel Bristot de Oliveira Committed by Ingo Molnar

sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set

Currently, a schedule while atomic error prints the stack trace to the
kernel log and the system continue running.

Although it is possible to collect the kernel log messages and analyze
it, often more information are needed. Furthermore, keep the system
running is not always the best choice. For example, when the preempt
count underflows the system will not stop to complain about scheduling
while atomic, so the kernel log can wrap around overwriting the first
stack trace, tuning the analysis even more challenging.

This patch uses the kernel.panic_on_warn sysctl to help out on these
more complex situations.

When kernel.panic_on_warn is set to 1, the kernel will panic() in the
schedule while atomic detection.

The default value of the sysctl is 0, maintaining the current behavior.
Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
Reviewed-by: default avatarLuis Claudio R. Goncalves <lgoncalv@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/e8f7b80f353aa22c63bd8557208163989af8493d.1464983675.git.bristot@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 277a13e4
...@@ -3168,6 +3168,9 @@ static noinline void __schedule_bug(struct task_struct *prev) ...@@ -3168,6 +3168,9 @@ static noinline void __schedule_bug(struct task_struct *prev)
pr_cont("\n"); pr_cont("\n");
} }
#endif #endif
if (panic_on_warn)
panic("scheduling while atomic\n");
dump_stack(); dump_stack();
add_taint(TAINT_WARN, LOCKDEP_STILL_OK); add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
} }
......
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