Improve WARN_ON_ONCE() output by adding the condition string
cover Improve WARN_ON_ONCE() output by adding the condition string
This series improves the current WARN_ON_ONCE() output from:
WARN_ON_ONCE(idx < 0 && ptr); ...
WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
to (on all __WARN_FLAGS() using architectures except S390):
WARNING: [idx < 0 && ptr] kernel/sched/core.c:8511 at sched_init+0x20/0x410 CPU#0: swapper/0
(Note the addition of the '[condition string]', and a reorganized CPU/comm/PID trailer.)
... and on S390 and non-__WARN_FLAGS architectures to:
WARNING: kernel/sched/core.c:8511 at sched_init+0x20/0x410 CPU#0: swapper/0
and on non-x86 architectures (the CPU/PID fields in the WARNING line are skipped):
WARNING: kernel/sched/core.c:8511 sched_init+0x20/0x410 CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.14.0-01616-g94d7af2844aa #4 PREEMPT(undef)
The motivation behind this series is the SCHED_WARN_ON() primitive that got removed in this merge window:
f7d2728cc032 ("sched/debug: Change SCHED_WARN_ON() to WARN_ON_ONCE()")
... which produced more informative debug output, as it included the WARN_ON_ONCE() condition string - at the expense of worse code generation.
This series, based on Linus's latest Git tree, merges the code generation benefits of modern WARN_ON_ONCE() bug_entry architecture code with the expanded information content of SCHED_WARN_ON().
The cost is about +100K more .data on a defconfig kernel, and no runtime code generation impact:
text data bss dec hex filename 29523998 7926322 1389904 38840224 250a7a0 vmlinux.x86.defconfig.before 29523998 8024626 1389904 38938528 25227a0 vmlinue.x86.defconfig.after
The series was build and boot tested on x86, with an expectation for it to work on other architectures (with limited cross-testing on the affected architectures).
This tree can also be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip WIP.core/bugs
Thanks,
Ingo
================>
Ingo Molnar (14):
bugs/core: Extend __WARN_FLAGS() with the 'cond_str' parameter
bugs/core: Pass down the condition string of WARN_ON_ONCE(cond) warnings to __WARN_FLAGS() bugs/x86: Extend _BUG_FLAGS() with the 'cond_str' parameter
bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS() bugs/powerpc: Pass in 'cond_str' to BUG_ENTRY()
bugs/powerpc: Concatenate 'cond_str' with '__FILE__' in BUG_ENTRY(), to extend WARN_ON/BUG_ON output bugs/LoongArch: Pass in 'cond_str' to __BUG_ENTRY()
bugs/LoongArch: Concatenate 'cond_str' with '__FILE__' in __BUG_ENTRY(), to extend WARN_ON/BUG_ON output bugs/s390: Pass in 'cond_str' to __EMIT_BUG()
bugs/riscv: Pass in 'cond_str' to __BUG_FLAGS()
bugs/riscv: Concatenate 'cond_str' with '__FILE__' in __BUG_FLAGS(), to extend WARN_ON/BUG_ON output bugs/parisc: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output bugs/sh: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output bugs/core: Reorganize fields in the first line of WARNING output, add ->comm[] output
arch/arm64/include/asm/bug.h | 2 +- arch/loongarch/include/asm/bug.h | 25 ++++++++++++------------- arch/parisc/include/asm/bug.h | 6 +++--- arch/powerpc/include/asm/bug.h | 12 ++++++------ arch/riscv/include/asm/bug.h | 10 +++++----- arch/s390/include/asm/bug.h | 10 +++++----- arch/sh/include/asm/bug.h | 4 ++-- arch/x86/include/asm/bug.h | 14 +++++++------- include/asm-generic/bug.h | 7 ++++--- kernel/panic.c | 16 +++++++++------- 10 files changed, 54 insertions(+), 52 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/14 bugs/core: Extend __WARN_FLAGS() with the 'cond_str' parameter
Push the new parameter down into every architecture that defines __WARN_FLAGS():
arm64
loongarch
parisc
powerpc
riscv
s390
sh
x86
Don't pass anything substantial down yet, just propagate the new parameter with empty strings, without generating it or using it.
( The string is never NULL, so it can be concatenated at the
preprocessor level. )
--- arch/arm64/include/asm/bug.h | 2 +- arch/loongarch/include/asm/bug.h | 2 +- arch/parisc/include/asm/bug.h | 4 ++-- arch/powerpc/include/asm/bug.h | 2 +- arch/riscv/include/asm/bug.h | 2 +- arch/s390/include/asm/bug.h | 2 +- arch/sh/include/asm/bug.h | 2 +- arch/x86/include/asm/bug.h | 2 +- include/asm-generic/bug.h | 7 ++++--- 9 files changed, 13 insertions(+), 12 deletions(-)
arch/arm64/include/asm/bug.h +1 -1
@@ -19,7 +19,7 @@unreachable (); \ } while (0) -#define __WARN_FLAGS (flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) +#define __WARN_FLAGS (cond_str, flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))#define HAVE_ARCH_BUG
arch/loongarch/include/asm/bug.h +1 -1
@@ -42,7 +42,7 @@asm_inline volatile (__stringify (ASM_BUG_FLAGS (flags )) \ extra); -#define __WARN_FLAGS (flags) \ +#define __WARN_FLAGS (cond_str, flags) \ do { \ instrumentation_begin(); \ __BUG_FLAGS(BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b));\
arch/parisc/include/asm/bug.h +2 -2
@@ -50,7 +50,7 @@#endif #ifdef CONFIG_DEBUG_BUGVERBOSE -#define __WARN_FLAGS (flags) \ +#define __WARN_FLAGS (cond_str, flags) \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \
@@ -66,7 +66,7 @@ "i" (sizeof(struct bug_entry)) ); \ } while(0) #else -#define __WARN_FLAGS (flags) \ +#define __WARN_FLAGS (cond_str, flags) \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \
arch/powerpc/include/asm/bug.h +1 -1
@@ -72,7 +72,7 @@ } while (0)#define HAVE_ARCH_BUG -#define __WARN_FLAGS (flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags)) +#define __WARN_FLAGS (cond_str, flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))#ifdef CONFIG_PPC64 #define BUG_ON (x) do { \
arch/riscv/include/asm/bug.h +1 -1
@@ -76,7 +76,7 @@ do { \unreachable (); \ } while (0) -#define __WARN_FLAGS (flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) +#define __WARN_FLAGS (cond_str, flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))#define HAVE_ARCH_BUG
arch/s390/include/asm/bug.h +1 -1
@@ -46,7 +46,7 @@unreachable (); \ } while (0) -#define __WARN_FLAGS (flags) do { \ +#define __WARN_FLAGS (cond_str, flags) do { \ __EMIT_BUG(BUGFLAG_WARNING|(flags)); \ } while (0)
arch/sh/include/asm/bug.h +1 -1
@@ -52,7 +52,7 @@ do { \unreachable (); \ } while (0) -#define __WARN_FLAGS (flags) \ +#define __WARN_FLAGS (cond_str, flags) \ do { \ __asm__ __volatile__ ( \ "1:\t.short %O0\n" \
arch/x86/include/asm/bug.h +1 -1
@@ -92,7 +92,7 @@ do { \* were to trigger, we'd rather wreck the machine in an attempt to get the * message out than not know about it. */ -#define __WARN_FLAGS (flags) \ +#define __WARN_FLAGS (cond_str, flags) \ do { \ __auto_type __flags = BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \
include/asm-generic/bug.h +4 -3
@@ -100,17 +100,18 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);instrumentation_end (); \ } while (0) #else -#define __WARN () __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) +#define __WARN () __WARN_FLAGS("", BUGFLAG_TAINT(TAINT_WARN)) #define __WARN_printf(taint, arg...) do { \ instrumentation_begin(); \ __warn_printk(arg); \ - __WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\ + __WARN_FLAGS("", BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\ instrumentation_end(); \ } while (0)#define WARN_ON_ONCE (condition) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ - __WARN_FLAGS(BUGFLAG_ONCE | \ + __WARN_FLAGS("", \ + BUGFLAG_ONCE | \ BUGFLAG_TAINT(TAINT_WARN)); \ unlikely(__ret_warn_on); \ })
Signature · 1 line
2.45.2
PATCH 2/14 bugs/core: Pass down the condition string of WARN_ON_ONCE(cond) warnings to __WARN_FLAGS()
In reply to Ingo MolnarDoing this will allow architecture code to store and print out this information as part of the WARN_ON and BUG_ON facilities.
The format of the string is '[condition]', for example:
WARN_ON_ONCE(idx < 0 && ptr);
Will get the '[idx < 0 && ptr]' string literal passed down as 'cond_str' in __WARN_FLAGS().
--- include/asm-generic/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/bug.h +1 -1
@@ -110,7 +110,7 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);#define WARN_ON_ONCE (condition) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ - __WARN_FLAGS("", \ + __WARN_FLAGS("["#condition"] ", \ BUGFLAG_ONCE | \ BUGFLAG_TAINT(TAINT_WARN)); \ unlikely(__ret_warn_on); \
Signature · 1 line
2.45.2
PATCH 3/14 bugs/x86: Extend _BUG_FLAGS() with the 'cond_str' parameter
In reply to Ingo MolnarJust pass down the parameter, don't do anything with it yet.
--- arch/x86/include/asm/bug.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/include/asm/bug.h +5 -5
@@ -39,7 +39,7 @@#ifdef CONFIG_DEBUG_BUGVERBOSE -#define _BUG_FLAGS (ins, flags, extra) \ +#define _BUG_FLAGS (cond_str, ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \
@@ -57,7 +57,7 @@ do { \#else /* !CONFIG_DEBUG_BUGVERBOSE */ -#define _BUG_FLAGS (ins, flags, extra) \ +#define _BUG_FLAGS (cond_str, ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \
@@ -74,7 +74,7 @@ do { \#else -#define _BUG_FLAGS (ins, flags, extra) asm volatile(ins) +#define _BUG_FLAGS (cond_str, ins, flags, extra) asm volatile(ins)#endif /* CONFIG_GENERIC_BUG */
@@ -82,7 +82,7 @@ do { \#define BUG () \ do { \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, 0, ""); \ + _BUG_FLAGS("", ASM_UD2, 0, ""); \ __builtin_unreachable(); \ } while (0)
@@ -96,7 +96,7 @@ do { \do { \__auto_type __flags =BUGFLAG_WARNING |(flags); \instrumentation_begin (); \ -_BUG_FLAGS (ASM_UD2 , __flags,ANNOTATE_REACHABLE (1b )); \ +_BUG_FLAGS (cond_str,ASM_UD2 , __flags,ANNOTATE_REACHABLE (1b )); \instrumentation_end (); \ }while (0 )
Signature · 1 line
2.45.2
PATCH 4/14 bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS()
In reply to Ingo MolnarThis allows the reuse of the UD2 based 'struct bug_entry' low-overhead _BUG_FLAGS() implementation and string-printing backend, without having to add a new field.
An example:
If we have the following WARN_ON_ONCE() in kernel/sched/core.c:
WARN_ON_ONCE(idx < 0 && ptr);
Then previously _BUG_FLAGS() would store this string in bug_entry::file:
"kernel/sched/core.c"
After this patch, it would store and print:
"[idx < 0 && ptr] kernel/sched/core.c"
Which is an extended string that will be printed in warnings.
--- arch/x86/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/bug.h +1 -1
@@ -50,7 +50,7 @@ do { \ "\t.org 2b+%c3\n" \ ".popsection\n" \ extra \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (cond_str __FILE__), "i" (__LINE__), \" i" (flags), \ " i" (sizeof(struct bug_entry))); \ } while (0)
Signature · 1 line
2.45.2
PATCH 5/14 bugs/powerpc: Pass in 'cond_str' to BUG_ENTRY()
In reply to Ingo MolnarPass in the condition string from __WARN_FLAGS(), WARN_ON() and BUG_ON(), but don't use it yet.
--- arch/powerpc/include/asm/bug.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/bug.h +5 -5
@@ -51,7 +51,7 @@ ".previous\n"#endif -#define BUG_ENTRY (insn, flags, ...) \ +#define BUG_ENTRY (cond_str, insn, flags, ...) \ __asm__ __volatile__( \ "1: " insn "\n" \ _EMIT_BUG_ENTRY \
@@ -67,12 +67,12 @@*/ #define BUG () do { \ - BUG_ENTRY("twi 31, 0, 0", 0); \ + BUG_ENTRY("", "twi 31, 0, 0", 0); \ unreachable(); \ } while (0)#define HAVE_ARCH_BUG -#define __WARN_FLAGS (cond_str, flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags)) +#define __WARN_FLAGS (cond_str, flags) BUG_ENTRY(cond_str, "twi 31, 0, 0", BUGFLAG_WARNING | (flags))#ifdef CONFIG_PPC64 #define BUG_ON (x) do { \
@@ -80,7 +80,7 @@if (x) \BUG (); \ } else { \ -BUG_ENTRY (PPC_TLNEI " %4, 0" ,0 ,"r" ((__force long )(x))); \ + BUG_ENTRY(#x, PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ } \ } while (0)
@@ -90,7 +90,7 @@if (__ret_warn_on) \__WARN (); \ }else { \ -BUG_ENTRY (PPC_TLNEI " %4, 0" , \ + BUG_ENTRY(#x, PPC_TLNEI " %4, 0", \ BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ "r" (__ret_warn_on)); \ } \
Signature · 1 line
2.45.2
PATCH 6/14 bugs/powerpc: Concatenate 'cond_str' with '__FILE__' in BUG_ENTRY(), to extend WARN_ON/BUG_ON output
In reply to Ingo MolnarExtend WARN_ON and BUG_ON style output from:
WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
to:
WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched_init+0x20/0x410
Note that the output will be further reorganized later in this series.
--- arch/powerpc/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/bug.h +1 -1
@@ -55,7 +55,7 @@ __asm__ __volatile__( \"1: " insn"\n" \ _EMIT_BUG_ENTRY \ - : :"i" (__FILE__),"i" (__LINE__), \ + : : "i" (cond_str __FILE__), "i" (__LINE__), \"i" (flags), \ "i" (sizeof(struct bug_entry)), \ ##__VA_ARGS__)
Signature · 1 line
2.45.2
PATCH 7/14 bugs/LoongArch: Pass in 'cond_str' to __BUG_ENTRY()
In reply to Ingo MolnarPass in the condition string from __WARN_FLAGS(), but don't use it yet.
--- arch/loongarch/include/asm/bug.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
arch/loongarch/include/asm/bug.h +10 -11
@@ -20,39 +20,38 @@#endif #ifndef CONFIG_GENERIC_BUG -#define __BUG_ENTRY (flags) +#define __BUG_ENTRY (cond_str, flags)#else -#define __BUG_ENTRY (flags) \ +#define __BUG_ENTRY (cond_str, flags) \ .pushsection __bug_table, "aw"; \ .align 2; \ 10000: .long 10001f - .; \ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ - .short flags; \ + .short flags; \ .popsection; \ 10001:#endif -#define ASM_BUG_FLAGS (flags) \ - __BUG_ENTRY(flags) \ +#define ASM_BUG_FLAGS (cond_str, flags) \ + __BUG_ENTRY(cond_str, flags) \ break BRK_BUG; -#define ASM_BUG () ASM_BUG_FLAGS(0) +#define ASM_BUG () ASM_BUG_FLAGS("", 0) -#define __BUG_FLAGS (flags, extra) \ - asm_inline volatile (__stringify(ASM_BUG_FLAGS(flags)) \ - extra); +#define __BUG_FLAGS (cond_str, flags, extra) \ + asm_inline volatile (__stringify(ASM_BUG_FLAGS(cond_str, flags)) extra);#define __WARN_FLAGS (cond_str, flags) \ do { \ instrumentation_begin(); \ - __BUG_FLAGS(BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b));\ + __BUG_FLAGS(cond_str, BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b));\ instrumentation_end(); \ } while (0)#define BUG () \ do { \ instrumentation_begin(); \ - __BUG_FLAGS(0, ""); \ + __BUG_FLAGS("", 0, ""); \ unreachable(); \ } while (0)
Signature · 1 line
2.45.2
PATCH 8/14 bugs/LoongArch: Concatenate 'cond_str' with '__FILE__' in __BUG_ENTRY(), to extend WARN_ON/BUG_ON output
In reply to Ingo MolnarExtend WARN_ON and BUG_ON style output from:
WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
to:
WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched_init+0x20/0x410
Note that the output will be further reorganized later in this series.
--- arch/loongarch/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/bug.h +1 -1
@@ -26,7 +26,7 @@ .pushsection __bug_table, "aw"; \ .align 2; \ 10000: .long 10001f - .; \ - _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ + _BUGVERBOSE_LOCATION(cond_str __FILE__, __LINE__) \ .short flags; \ .popsection; \ 10001:
Signature · 1 line
2.45.2
PATCH 9/14 bugs/s390: Pass in 'cond_str' to __EMIT_BUG()
In reply to Ingo MolnarPass in the condition string from __WARN_FLAGS(), but do not concatenate it with __FILE__, because the __bug_table is apparently indexed by 16 bits and increasing string size overflows it on defconfig builds.
--- arch/s390/include/asm/bug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/include/asm/bug.h +4 -4
@@ -8,7 +8,7 @@#ifdef CONFIG_DEBUG_BUGVERBOSE -#define __EMIT_BUG (x) do { \ +#define __EMIT_BUG (cond_str, x) do { \ asm_inline volatile( \ "0: mc 0,0\n" \ ".section .rodata.str,\"aMS\",@progbits,1\n" \
@@ -27,7 +27,7 @@#else /* CONFIG_DEBUG_BUGVERBOSE */ -#define __EMIT_BUG (x) do { \ +#define __EMIT_BUG (cond_str, x) do { \ asm_inline volatile( \ "0: mc 0,0\n" \ ".section __bug_table,\"aw\"\n" \
@@ -42,12 +42,12 @@#endif /* CONFIG_DEBUG_BUGVERBOSE */ #define BUG () do { \ - __EMIT_BUG(0); \ + __EMIT_BUG("", 0); \ unreachable(); \ } while (0)#define __WARN_FLAGS (cond_str, flags) do { \ - __EMIT_BUG(BUGFLAG_WARNING|(flags)); \ + __EMIT_BUG(cond_str, BUGFLAG_WARNING|(flags)); \ } while (0)#define WARN_ON (x) ({ \
Signature · 1 line
2.45.2
PATCH 10/14 bugs/riscv: Pass in 'cond_str' to __BUG_FLAGS()
In reply to Ingo MolnarPass in the condition string from __WARN_FLAGS() to __BUG_FLAGS(), but don't use it yet.
--- arch/riscv/include/asm/bug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/riscv/include/asm/bug.h +4 -4
@@ -50,7 +50,7 @@ typedef u32 bug_insn_t;#endif #ifdef CONFIG_GENERIC_BUG -#define __BUG_FLAGS (flags) \ +#define __BUG_FLAGS (cond_str, flags) \ do { \ __asm__ __volatile__ ( \ "1:\n\t" \
@@ -66,17 +66,17 @@ do { \ "i" (sizeof(struct bug_entry))); \ } while (0)#else /* CONFIG_GENERIC_BUG */ -#define __BUG_FLAGS (flags) do { \ +#define __BUG_FLAGS (cond_str, flags) do { \ __asm__ __volatile__ ("ebreak\n"); \ } while (0)#endif /* CONFIG_GENERIC_BUG */ #define BUG () do { \ - __BUG_FLAGS(0); \ + __BUG_FLAGS("", 0); \ unreachable(); \ } while (0) -#define __WARN_FLAGS (cond_str, flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) +#define __WARN_FLAGS (cond_str, flags) __BUG_FLAGS(cond_str, BUGFLAG_WARNING|(flags))#define HAVE_ARCH_BUG
Signature · 1 line
2.45.2
PATCH 11/14 bugs/riscv: Concatenate 'cond_str' with '__FILE__' in __BUG_FLAGS(), to extend WARN_ON/BUG_ON output
In reply to Ingo MolnarExtend WARN_ON and BUG_ON style output from:
WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
to:
WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched_init+0x20/0x410
Note that the output will be further reorganized later in this series.
--- arch/riscv/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/bug.h +1 -1
@@ -61,7 +61,7 @@ do { \ ".org 2b + %3\n\t" \ ".popsection" \ : \ - : "i" (__FILE__), "i" (__LINE__), \ + : "i" (cond_str __FILE__), "i" (__LINE__), \" i" (flags), \ " i" (sizeof(struct bug_entry))); \ } while (0)
Signature · 1 line
2.45.2
PATCH 12/14 bugs/parisc: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output
In reply to Ingo MolnarExtend WARN_ON and BUG_ON style output from:
WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
to:
WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched_init+0x20/0x410
Note that the output will be further reorganized later in this series.
--- arch/parisc/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/include/asm/bug.h +1 -1
@@ -61,7 +61,7 @@ "\t.short %1, %2\n" \ "\t.blockz %3-2*4-2*2\n" \ "\t.popsection" \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (cond_str __FILE__), "i" (__LINE__), \" i" (BUGFLAG_WARNING|(flags)), \ " i" (sizeof(struct bug_entry)) ); \ } while(0)
Signature · 1 line
2.45.2
PATCH 13/14 bugs/sh: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output
In reply to Ingo MolnarExtend WARN_ON and BUG_ON style output from:
WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410
to:
WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched_init+0x20/0x410
Note that the output will be further reorganized later in this series.
--- arch/sh/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/asm/bug.h +1 -1
@@ -59,7 +59,7 @@ do { \ _EMIT_BUG_ENTRY \ : \ : "n" (TRAPA_BUG_OPCODE), \ -"i" (__FILE__), \ + "i" (cond_str __FILE__), \"i" (__LINE__), \"i" (BUGFLAG_WARNING |(flags)), \ "i" (sizeof(struct bug_entry))); \
Signature · 1 line
2.45.2
Re: [PATCH 13/14] bugs/sh: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output
Quoted 6 lines · Ingo Molnar
Cc Yoshinori Sato <[email protected]>Cc Rich Felker <[email protected]>Cc John Paul Adrian Glaubitz <[email protected]>Cc <[email protected]>
You say that, but I don't see that in the actual email, which only went to lkml...
So the sh maintainers (and riscv and s390 etc: same issue with those emails) probably never saw this.
The patches look fine to me, fwiw.
Linus
Re: [PATCH 13/14] bugs/sh: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output
Quoted 10 lines · Linus Torvalds
Quoted 6 lines · Ingo Molnar
Cc Yoshinori Sato <[email protected]>Cc Rich Felker <[email protected]>Cc John Paul Adrian Glaubitz <[email protected]>Cc <[email protected]>You say that, but I don't see that in the actual email, which only went to lkml...
Indeed, usually I rely on the tip-bot picking up Cc: lines, but here it would be useful to have earlier Cc:s and my script had, for some stupid reason:
--suppress-cc=all
... which certainly suppressed the Cc: lines :-/
Will take a careful look at a --dry-run output next time around and make sure the --signed-off-by-cc auto-cc logic picks up all the Cc:
lines in the individual commits.
Quoted 2 lines
So the sh maintainers (and riscv and s390 etc: same issue with those emails) probably never saw this.
Yeah, will iterate it once more just to make sure.
Thanks,
Ingo
Re: [PATCH 13/14] bugs/sh: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output
In reply to Linus TorvaldsQuoted 1 line · Linus Torvalds
The patches look fine to me, fwiw.
So I've changed the series slightly to add a new Kconfig option to trigger these extra strings:
CONFIG_DEBUG_BUGVERBOSE_DETAILED=y
Disabled by default.
This should address concerns over the +100K kernel size increase that some have raised.
I'll send out a -v2 series, which should have the Cc: problems fixed as well, so that all architecture people see it too.
Thanks,
Ingo
PATCH 14/14 bugs/core: Reorganize fields in the first line of WARNING output, add ->comm[] output
In reply to Ingo MolnarWith the introduction of the condition string as part of the 'file' string output of kernel warnings, the first line has become a bit harder to read:
WARNING: CPU: 0 PID: 0 at [ptr == 0 && 1] kernel/sched/core.c:8511 sched_init+0x20/0x410
Re-order the fields by importance (higher to lower), make the 'at' meaningful again, and add '->comm[]' output which is often more valuable than a PID.
Also, remove the 'PID' prefix - in combination with comm it's clear what it is.
These changes make the output only slightly longer:
WARNING: [ptr == 0 && 1] kernel/sched/core.c:8511 at sched_init+0x20/0x410 CPU#0: swapper/0
While adding more information and making it better organized.
--- kernel/panic.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
kernel/panic.c +9 -7
@@ -724,13 +724,15 @@ void __warn(const char *file, int line, void *caller, unsigned taint,disable_trace_on_warning (); -if (file) -pr_warn ("WARNING: CPU: %d PID: %d at %s:%d %pS\n" , -raw_smp_processor_id (), current->pid, file, line, - caller); -else -pr_warn ("WARNING: CPU: %d PID: %d at %pS\n" , -raw_smp_processor_id (), current->pid, caller); +if (file) { +pr_warn ("WARNING: %s:%d at %pS, CPU#%d: %s/%d\n" , + file, line, caller, +raw_smp_processor_id (), current->comm, current->pid); + }else { +pr_warn ("WARNING: at %pS, CPU#%d: %s/%d\n" , + caller, +raw_smp_processor_id (), current->comm, current->pid); + }#pragma GCC diagnostic push#ifndef __clang__
Signature · 1 line
2.45.2