]> Git Repo - linux.git/commitdiff
sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set
authorDaniel Bristot de Oliveira <[email protected]>
Fri, 3 Jun 2016 20:10:18 +0000 (17:10 -0300)
committerIngo Molnar <[email protected]>
Sun, 10 Jul 2016 18:17:27 +0000 (20:17 +0200)
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: Daniel Bristot de Oliveira <[email protected]>
Reviewed-by: Luis Claudio R. Goncalves <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Luis Claudio R. Goncalves <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/e8f7b80f353aa22c63bd8557208163989af8493d.1464983675.git.bristot@redhat.com
Signed-off-by: Ingo Molnar <[email protected]>
kernel/sched/core.c

index 28da50a5bc769d4e73247406bd257a12d969ef25..4e9617a7e7d95718fb58aecc1175013a7aae8b2d 100644 (file)
@@ -3168,6 +3168,9 @@ static noinline void __schedule_bug(struct task_struct *prev)
                pr_cont("\n");
        }
 #endif
+       if (panic_on_warn)
+               panic("scheduling while atomic\n");
+
        dump_stack();
        add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
 }
This page took 0.071043 seconds and 4 git commands to generate.