[PATCH v2] x86/dumpstack: uniform die messages prompt

alexs@kernel.org posted 1 patch 2 years ago
There is a newer version of this series
arch/x86/kernel/dumpstack.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH v2] x86/dumpstack: uniform die messages prompt
Posted by alexs@kernel.org 2 years ago
From: Alex Shi <alexs@kernel.org>

panic() has a uniform prompt, like "Kernel panic - not syncing:". That's
easy to indicate a panic there. But die() message doesn't have.

We died thousands machine with very different reasons weekly. w/o a prompt
in dmesg, it's hard to write scripts to collect and anaylis the die reasons.
That makes admins' life pretty hard.

A uniform die() prompt could make the life of system administrators far more
easier.

Signed-off-by: Alex Shi <alexs@kernel.org>
To: linux-kernel@vger.kernel.org
To: "H. Peter Anvin" <hpa@zytor.com>
To: x86@kernel.org
To: Dave Hansen <dave.hansen@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>
To: Ingo Molnar <mingo@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
---
 arch/x86/kernel/dumpstack.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index f18ca44c904b..e9ad413d21f8 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -393,6 +393,8 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
 }
 NOKPROBE_SYMBOL(oops_end);
 
+#define DIE_PROMPT	"DIE:\n"
+
 static void __die_header(const char *str, struct pt_regs *regs, long err)
 {
 	const char *pr = "";
@@ -405,8 +407,8 @@ static void __die_header(const char *str, struct pt_regs *regs, long err)
 		pr = IS_ENABLED(CONFIG_PREEMPT_RT) ? " PREEMPT_RT" : " PREEMPT";
 
 	printk(KERN_DEFAULT
-	       "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, ++die_counter,
-	       pr,
+	       DIE_PROMPT "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff,
+	       ++die_counter, pr,
 	       IS_ENABLED(CONFIG_SMP)     ? " SMP"             : "",
 	       debug_pagealloc_enabled()  ? " DEBUG_PAGEALLOC" : "",
 	       IS_ENABLED(CONFIG_KASAN)   ? " KASAN"           : "",
-- 
2.43.0
Re: [PATCH v2] x86/dumpstack: uniform die messages prompt
Posted by Borislav Petkov 1 year, 10 months ago
On Fri, Feb 02, 2024 at 03:45:12PM +0800, alexs@kernel.org wrote:
> @@ -405,8 +407,8 @@ static void __die_header(const char *str, struct pt_regs *regs, long err)
>  		pr = IS_ENABLED(CONFIG_PREEMPT_RT) ? " PREEMPT_RT" : " PREEMPT";
>  
>  	printk(KERN_DEFAULT
> -	       "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, ++die_counter,
> -	       pr,
> +	       DIE_PROMPT "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff,

Why do you need this DIE_PROMPT if you can simply do:

		"Oops: %s: %04lx... "

?

And yes, I think I'd prefer having an "oops" in there as it is a lot
more prominent. It is called a "kernel oops" everywhere.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH v2] x86/dumpstack: uniform die messages prompt
Posted by Alex Shi 1 year, 10 months ago

On 3/26/24 6:43 PM, Borislav Petkov wrote:
> On Fri, Feb 02, 2024 at 03:45:12PM +0800, alexs@kernel.org wrote:
>> @@ -405,8 +407,8 @@ static void __die_header(const char *str, struct pt_regs *regs, long err)
>>  		pr = IS_ENABLED(CONFIG_PREEMPT_RT) ? " PREEMPT_RT" : " PREEMPT";
>>  
>>  	printk(KERN_DEFAULT
>> -	       "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, ++die_counter,
>> -	       pr,
>> +	       DIE_PROMPT "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff,
> 
> Why do you need this DIE_PROMPT if you can simply do:
> 
> 		"Oops: %s: %04lx... "
> 
> ?
> 
> And yes, I think I'd prefer having an "oops" in there as it is a lot
> more prominent. It is called a "kernel oops" everywhere.

Uh, 'Oops' is also a good preempt. If no other objection, I'd like to change this. :)

Thank a lot!

> 
> Thx.
>