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


Groups > linux.kernel > #1314970 > unrolled thread

[PATCH] lib/bug: make panic_on_warn available for all architectures

Started byHeiko Carstens <heiko.carstens@de.ibm.com>
First post2016-01-22 14:20 +0100
Last post2016-01-27 00:20 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] lib/bug: make panic_on_warn available for all architectures Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-22 14:20 +0100
    Re: [PATCH] lib/bug: make panic_on_warn available for all  architectures Christian Borntraeger <borntraeger@de.ibm.com> - 2016-01-22 14:50 +0100
    Re: [PATCH] lib/bug: make panic_on_warn available for all architectures Prarit Bhargava <prarit@redhat.com> - 2016-01-22 15:00 +0100
    Re: [PATCH] lib/bug: make panic_on_warn available for all  architectures Andrew Morton <akpm@linux-foundation.org> - 2016-01-27 00:20 +0100

#1314970 — [PATCH] lib/bug: make panic_on_warn available for all architectures

FromHeiko Carstens <heiko.carstens@de.ibm.com>
Date2016-01-22 14:20 +0100
Subject[PATCH] lib/bug: make panic_on_warn available for all architectures
Message-ID<qTJN7-4wP-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1314996 — Re: [PATCH] lib/bug: make panic_on_warn available for all architectures

FromChristian Borntraeger <borntraeger@de.ibm.com>
Date2016-01-22 14:50 +0100
SubjectRe: [PATCH] lib/bug: make panic_on_warn available for all architectures
Message-ID<qTKga-4IT-37@gated-at.bofh.it>
In reply to#1314970
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();
> 

[toc] | [prev] | [next] | [standalone]


#1315000

FromPrarit Bhargava <prarit@redhat.com>
Date2016-01-22 15:00 +0100
Message-ID<qTKpP-4M4-1@gated-at.bofh.it>
In reply to#1314970

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.

[toc] | [prev] | [next] | [standalone]


#1318463 — Re: [PATCH] lib/bug: make panic_on_warn available for all architectures

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-01-27 00:20 +0100
SubjectRe: [PATCH] lib/bug: make panic_on_warn available for all architectures
Message-ID<qVl3Y-2ZP-17@gated-at.bofh.it>
In reply to#1314970
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?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web