Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413465

Re: [PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set

From "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
Newsgroups linux.kernel
Subject Re: [PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set
Date 2016-06-03 22:50 +0200
Message-ID <rG4cy-7ZV-11@gated-at.bofh.it> (permalink)
References <rG3Jv-7Qb-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jun 03, 2016 at 05:10:18PM -0300, Daniel Bristot de Oliveira wrote:
| 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.
| 
| Cc: Ingo Molnar <mingo@redhat.com>
| Cc: Peter Zijlstra <peterz@infradead.org>
| Cc: Christian Borntraeger <borntraeger@de.ibm.com>
| Cc: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>
| Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
| ---
|  kernel/sched/core.c | 3 +++
|  1 file changed, 3 insertions(+)
| 
| diff --git a/kernel/sched/core.c b/kernel/sched/core.c
| index 7f2cae4..7d07ed9 100644
| --- a/kernel/sched/core.c
| +++ b/kernel/sched/core.c
| @@ -3146,6 +3146,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);
|  }
| -- 
| 2.5.5

Reviewed-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set Daniel Bristot de Oliveira <bristot@redhat.com> - 2016-06-03 22:20 +0200
  Re: [PATCH] sched: Panic on scheduling while atomic if  kernel.panic_on_warn is set "Luis Claudio R. Goncalves" <lclaudio@uudg.org> - 2016-06-03 22:50 +0200

csiph-web