All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set
@ 2016-06-03 20:10 Daniel Bristot de Oliveira
  2016-06-03 20:41 ` Luis Claudio R. Goncalves
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-06-03 20:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Peter Zijlstra, Christian Borntraeger,
	Luis Claudio R. Goncalves

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set
  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:sched/core] sched/core: Panic on scheduling while atomic bugs " tip-bot for Daniel Bristot de Oliveira
  2 siblings, 0 replies; 4+ messages in thread
From: Luis Claudio R. Goncalves @ 2016-06-03 20:41 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Christian Borntraeger

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched: Panic on scheduling while atomic if kernel.panic_on_warn is set
  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:sched/core] sched/core: Panic on scheduling while atomic bugs " tip-bot for Daniel Bristot de Oliveira
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Bristot de Oliveira @ 2016-07-07 20:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Peter Zijlstra, Christian Borntraeger,
	Luis Claudio R. Goncalves

On 06/03/2016 05:10 PM, 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.

A gentle ping...

Thoughts about this patch? or, should I resend the patch that implements
a specific sysctl to panic on scheduling while atomic?

Thanks in advance,
-- Daniel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:sched/core] sched/core: Panic on scheduling while atomic bugs if kernel.panic_on_warn is set
  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
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Daniel Bristot de Oliveira @ 2016-07-10 19:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, linux-kernel, peterz, torvalds, bristot, tglx, lgoncalv,
	borntraeger, mingo

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);
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-10 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:sched/core] sched/core: Panic on scheduling while atomic bugs " tip-bot for Daniel Bristot de Oliveira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.