mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel: panic: make panic() local lock raw
@ 2016-03-11 17:48 Sebastian Andrzej Siewior
  2016-03-11 20:08 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-03-11 17:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Thomas Gleixner, linux-kernel, Steven Rostedt, Sebastian Andrzej Siewior

The lock is taken with disabled interrupts and therefore it must be
a RAW lock. Otherwise -RT will convert it into a sleeping lock and
complain about it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/panic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 50d4ae2e7d1b..8ae7dc943f91 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -71,7 +71,7 @@ void __weak panic_smp_self_stop(void)
  */
 void panic(const char *fmt, ...)
 {
-	static DEFINE_SPINLOCK(panic_lock);
+	static DEFINE_RAW_SPINLOCK(panic_lock);
 	static char buf[1024];
 	va_list args;
 	long i, i_next = 0;
@@ -95,7 +95,7 @@ void panic(const char *fmt, ...)
 	 * stop themself or will wait until they are stopped by the 1st CPU
 	 * with smp_send_stop().
 	 */
-	if (!spin_trylock(&panic_lock))
+	if (!raw_spin_trylock(&panic_lock))
 		panic_smp_self_stop();
 
 	console_verbose();
-- 
2.7.0

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

* Re: [PATCH] kernel: panic: make panic() local lock raw
  2016-03-11 17:48 [PATCH] kernel: panic: make panic() local lock raw Sebastian Andrzej Siewior
@ 2016-03-11 20:08 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2016-03-11 20:08 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Thomas Gleixner, linux-kernel, Steven Rostedt

On Fri, 11 Mar 2016 18:48:25 +0100 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> The lock is taken with disabled interrupts and therefore it must be
> a RAW lock. Otherwise -RT will convert it into a sleeping lock and
> complain about it.

panic_lock doesn't exist in current kernels.

However you may want to take a look at pause_on_oops_lock - strange
things are happening with IRQs there.

> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -71,7 +71,7 @@ void __weak panic_smp_self_stop(void)
>   */
>  void panic(const char *fmt, ...)
>  {
> -	static DEFINE_SPINLOCK(panic_lock);
> +	static DEFINE_RAW_SPINLOCK(panic_lock);

This should have had a comment explaining why a raw spinlock was chosen.

>  	static char buf[1024];
>  	va_list args;
>  	long i, i_next = 0;
> @@ -95,7 +95,7 @@ void panic(const char *fmt, ...)
>  	 * stop themself or will wait until they are stopped by the 1st CPU
>  	 * with smp_send_stop().
>  	 */
> -	if (!spin_trylock(&panic_lock))
> +	if (!raw_spin_trylock(&panic_lock))
>  		panic_smp_self_stop();
>  
>  	console_verbose();

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

end of thread, other threads:[~2016-03-11 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 17:48 [PATCH] kernel: panic: make panic() local lock raw Sebastian Andrzej Siewior
2016-03-11 20:08 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®