From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757318AbcGJTC3 (ORCPT ); Sun, 10 Jul 2016 15:02:29 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54970 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756506AbcGJTC1 (ORCPT ); Sun, 10 Jul 2016 15:02:27 -0400 Date: Sun, 10 Jul 2016 12:01:56 -0700 From: tip-bot for Daniel Bristot de Oliveira Message-ID: 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 Reply-To: lgoncalv@redhat.com, mingo@kernel.org, borntraeger@de.ibm.com, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de, bristot@redhat.com, torvalds@linux-foundation.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set Git-Commit-ID: 748c7201e622d1c24abb4f85072d2e74d12f295f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 748c7201e622d1c24abb4f85072d2e74d12f295f Gitweb: http://git.kernel.org/tip/748c7201e622d1c24abb4f85072d2e74d12f295f Author: Daniel Bristot de Oliveira AuthorDate: Fri, 3 Jun 2016 17:10:18 -0300 Committer: Ingo Molnar 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 Reviewed-by: Luis Claudio R. Goncalves Cc: Christian Borntraeger Cc: Linus Torvalds Cc: Luis Claudio R. Goncalves Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/e8f7b80f353aa22c63bd8557208163989af8493d.1464983675.git.bristot@redhat.com Signed-off-by: Ingo Molnar --- 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); }