From: tip-bot for Daniel Bristot de Oliveira <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, linux-kernel@vger.kernel.org,
peterz@infradead.org, torvalds@linux-foundation.org,
bristot@redhat.com, tglx@linutronix.de, lgoncalv@redhat.com,
borntraeger@de.ibm.com, mingo@kernel.org
Subject: [tip:sched/core] sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set
Date: Sun, 10 Jul 2016 12:01:56 -0700 [thread overview]
Message-ID: <tip-748c7201e622d1c24abb4f85072d2e74d12f295f@git.kernel.org> (raw)
In-Reply-To: <e8f7b80f353aa22c63bd8557208163989af8493d.1464983675.git.bristot@redhat.com>
Commit-ID: 748c7201e622d1c24abb4f85072d2e74d12f295f
Gitweb: http://git.kernel.org/tip/748c7201e622d1c24abb4f85072d2e74d12f295f
Author: Daniel Bristot de Oliveira <bristot@redhat.com>
AuthorDate: Fri, 3 Jun 2016 17:10:18 -0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 10 Jul 2016 20:17:27 +0200
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: Daniel Bristot de Oliveira <bristot@redhat.com>
Reviewed-by: Luis 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.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 28da50a..4e9617a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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);
}
prev parent reply other threads:[~2016-07-10 19:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 20:10 [PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set Daniel Bristot de Oliveira
2016-06-03 20:41 ` Luis Claudio R. Goncalves
2016-07-07 20:25 ` Daniel Bristot de Oliveira
2016-07-10 19:01 ` tip-bot for Daniel Bristot de Oliveira [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-748c7201e622d1c24abb4f85072d2e74d12f295f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=borntraeger@de.ibm.com \
--cc=bristot@redhat.com \
--cc=hpa@zytor.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox