All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/bug: make panic_on_warn available for all architectures
@ 2016-01-22 13:12 Heiko Carstens
  2016-01-22 13:41 ` Christian Borntraeger
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Heiko Carstens @ 2016-01-22 13:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christian Borntraeger, linux-kernel, Heiko Carstens, Prarit Bhargava

Christian Borntraeger reported that panic_on_warn doesn't have any
effect on s390.

The panic_on_warn feature was introduced with 9e3961a09798 ("kernel:
add panic_on_warn"). However it did care only for the case when
WANT_WARN_ON_SLOWPATH is defined. This is turn is only the case for
architectures which do not have an own __WARN_TAINT defined.

Other architectures which do have __WARN_TAINT defined call
report_bug() for warnings within lib/bug.c which does not call panic()
in case panic_on_warn is set.

Let's simply enable the panic_on_warn feature by adding the same code
like it was added to warn_slowpath_common() in panic.c.

This enables panic_on_warn also for arm64, parisc, powerpc, s390 and
sh.

Cc: Prarit Bhargava <prarit@redhat.com>
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 lib/bug.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/bug.c b/lib/bug.c
index cff145f032a5..6cde380f09de 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -175,6 +175,17 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
 			pr_warn("WARNING: at %p [verbose debug info unavailable]\n",
 				(void *)bugaddr);
 
+		if (panic_on_warn) {
+			/*
+			 * This thread may hit another WARN() in the panic path.
+			 * Resetting this prevents additional WARN() from
+			 * panicking the system on this thread.  Other threads
+			 * are blocked by the panic_mutex in panic().
+			 */
+			panic_on_warn = 0;
+			panic("panic_on_warn set ...\n");
+		}
+
 		print_modules();
 		show_regs(regs);
 		print_oops_end_marker();
-- 
2.3.9

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

* Re: [PATCH] lib/bug: make panic_on_warn available for all architectures
  2016-01-22 13:12 [PATCH] lib/bug: make panic_on_warn available for all architectures Heiko Carstens
@ 2016-01-22 13:41 ` Christian Borntraeger
  2016-01-22 13:53 ` Prarit Bhargava
  2016-01-26 23:14 ` Andrew Morton
  2 siblings, 0 replies; 5+ messages in thread
From: Christian Borntraeger @ 2016-01-22 13:41 UTC (permalink / raw)
  To: Heiko Carstens, Andrew Morton; +Cc: linux-kernel, Prarit Bhargava

On 01/22/2016 02:12 PM, Heiko Carstens wrote:
> Christian Borntraeger reported that panic_on_warn doesn't have any
> effect on s390.
> 
> The panic_on_warn feature was introduced with 9e3961a09798 ("kernel:
> add panic_on_warn"). However it did care only for the case when
> WANT_WARN_ON_SLOWPATH is defined. This is turn is only the case for
> architectures which do not have an own __WARN_TAINT defined.
> 
> Other architectures which do have __WARN_TAINT defined call
> report_bug() for warnings within lib/bug.c which does not call panic()
> in case panic_on_warn is set.
> 
> Let's simply enable the panic_on_warn feature by adding the same code
> like it was added to warn_slowpath_common() in panic.c.
> 
> This enables panic_on_warn also for arm64, parisc, powerpc, s390 and
> sh.
> 
> Cc: Prarit Bhargava <prarit@redhat.com>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

> ---
>  lib/bug.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/lib/bug.c b/lib/bug.c
> index cff145f032a5..6cde380f09de 100644
> --- a/lib/bug.c
> +++ b/lib/bug.c
> @@ -175,6 +175,17 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
>  			pr_warn("WARNING: at %p [verbose debug info unavailable]\n",
>  				(void *)bugaddr);
> 
> +		if (panic_on_warn) {
> +			/*
> +			 * This thread may hit another WARN() in the panic path.
> +			 * Resetting this prevents additional WARN() from
> +			 * panicking the system on this thread.  Other threads
> +			 * are blocked by the panic_mutex in panic().
> +			 */
> +			panic_on_warn = 0;
> +			panic("panic_on_warn set ...\n");
> +		}
> +
>  		print_modules();
>  		show_regs(regs);
>  		print_oops_end_marker();
> 

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

* Re: [PATCH] lib/bug: make panic_on_warn available for all architectures
  2016-01-22 13:12 [PATCH] lib/bug: make panic_on_warn available for all architectures Heiko Carstens
  2016-01-22 13:41 ` Christian Borntraeger
@ 2016-01-22 13:53 ` Prarit Bhargava
  2016-01-26 23:14 ` Andrew Morton
  2 siblings, 0 replies; 5+ messages in thread
From: Prarit Bhargava @ 2016-01-22 13:53 UTC (permalink / raw)
  To: Heiko Carstens, Andrew Morton; +Cc: Christian Borntraeger, linux-kernel



On 01/22/2016 08:12 AM, Heiko Carstens wrote:
> Christian Borntraeger reported that panic_on_warn doesn't have any
> effect on s390.
> 
> The panic_on_warn feature was introduced with 9e3961a09798 ("kernel:
> add panic_on_warn"). However it did care only for the case when
> WANT_WARN_ON_SLOWPATH is defined. This is turn is only the case for
> architectures which do not have an own __WARN_TAINT defined.
> 
> Other architectures which do have __WARN_TAINT defined call
> report_bug() for warnings within lib/bug.c which does not call panic()
> in case panic_on_warn is set.
> 
> Let's simply enable the panic_on_warn feature by adding the same code
> like it was added to warn_slowpath_common() in panic.c.
> 
> This enables panic_on_warn also for arm64, parisc, powerpc, s390 and
> sh.
> 
> Cc: Prarit Bhargava <prarit@redhat.com>
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Acked-by: Prarit Bhargava <prarit@redhat.com>

P.

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

* Re: [PATCH] lib/bug: make panic_on_warn available for all architectures
  2016-01-22 13:12 [PATCH] lib/bug: make panic_on_warn available for all architectures Heiko Carstens
  2016-01-22 13:41 ` Christian Borntraeger
  2016-01-22 13:53 ` Prarit Bhargava
@ 2016-01-26 23:14 ` Andrew Morton
  2016-02-01 14:06   ` Heiko Carstens
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2016-01-26 23:14 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Christian Borntraeger, linux-kernel, Prarit Bhargava

On Fri, 22 Jan 2016 14:12:16 +0100 Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> Christian Borntraeger reported that panic_on_warn doesn't have any
> effect on s390.
> 
> The panic_on_warn feature was introduced with 9e3961a09798 ("kernel:
> add panic_on_warn"). However it did care only for the case when
> WANT_WARN_ON_SLOWPATH is defined. This is turn is only the case for
> architectures which do not have an own __WARN_TAINT defined.
> 
> Other architectures which do have __WARN_TAINT defined call
> report_bug() for warnings within lib/bug.c which does not call panic()
> in case panic_on_warn is set.
> 
> Let's simply enable the panic_on_warn feature by adding the same code
> like it was added to warn_slowpath_common() in panic.c.
> 
> This enables panic_on_warn also for arm64, parisc, powerpc, s390 and
> sh.
> 

It's a bit sad to do this in two places.  You couldn't find a suitable
place which is effective for all architectures?

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

* Re: [PATCH] lib/bug: make panic_on_warn available for all architectures
  2016-01-26 23:14 ` Andrew Morton
@ 2016-02-01 14:06   ` Heiko Carstens
  0 siblings, 0 replies; 5+ messages in thread
From: Heiko Carstens @ 2016-02-01 14:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Christian Borntraeger, linux-kernel, Prarit Bhargava

On Tue, Jan 26, 2016 at 03:14:08PM -0800, Andrew Morton wrote:
> On Fri, 22 Jan 2016 14:12:16 +0100 Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> 
> > Christian Borntraeger reported that panic_on_warn doesn't have any
> > effect on s390.
> > 
> > The panic_on_warn feature was introduced with 9e3961a09798 ("kernel:
> > add panic_on_warn"). However it did care only for the case when
> > WANT_WARN_ON_SLOWPATH is defined. This is turn is only the case for
> > architectures which do not have an own __WARN_TAINT defined.
> > 
> > Other architectures which do have __WARN_TAINT defined call
> > report_bug() for warnings within lib/bug.c which does not call panic()
> > in case panic_on_warn is set.
> > 
> > Let's simply enable the panic_on_warn feature by adding the same code
> > like it was added to warn_slowpath_common() in panic.c.
> > 
> > This enables panic_on_warn also for arm64, parisc, powerpc, s390 and
> > sh.
> > 
> 
> It's a bit sad to do this in two places.  You couldn't find a suitable
> place which is effective for all architectures?

Yes, I know, it's lame. But looking at lib/bug.c:report_bug() and
kernel/panic.c:warn_slowpath_common() it looks like these functions have a
lot in common but differ in detail. It seems hard to combine them without
introducing an ifdef hell.

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

end of thread, other threads:[~2016-02-01 14:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-22 13:12 [PATCH] lib/bug: make panic_on_warn available for all architectures Heiko Carstens
2016-01-22 13:41 ` Christian Borntraeger
2016-01-22 13:53 ` Prarit Bhargava
2016-01-26 23:14 ` Andrew Morton
2016-02-01 14:06   ` Heiko Carstens

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.