Skip to contentSkip to conversation

panic: make panic start/end messages consistent

RFC PATCH In review Sergey Senozhatsky 2 participants 2 messages Apr 26, 2019

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 panic: make panic start/end messages consistent

We don't have consistency:
- we always print panic header
pr_emerg("Kernel panic - not syncing:")

- but we don't always print panic footer pr_emerg("---[ end Kernel panic - not syncing:")

For instance, no panic footer (end panic) message will be printed when panic_timeout is set - the kernel will either reboot immediately after console_flush_on_panic() (emergency restart) or after panic_timeout seconds. Additionally, panic_print_sys_info() goes before panic footer line, which doesn't look very right, panic_print_sys_info() is just additional debugging into.

Let's make it consistent:

	pr_emerg("Kernel panic - not syncing:")
	dump_stack();
	console_flush_on_panic();
	pr_emerg("---[ end Kernel panic - not syncing:")

	panic_print_sys_info();
	/* the rest */
	/* panic_timeout handling */
---
 kernel/panic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/panic.c +1 -2
index 40882dad9f70..6482e4b54f0b 100644
@@ -282,6 +282,7 @@ void panic(const char *fmt, ...)
 	 */
 	debug_locks_off();
 	console_flush_on_panic(CONSOLE_FLUSH_PENDING);
+	pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
 
 	panic_print_sys_info();
 
@@ -331,8 +332,6 @@ void panic(const char *fmt, ...)
 		disabled_wait(caller);
 	}
 #endif
-	pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
-
 	/* Do not scroll important messages printed above */
 	suppress_printk = 1;
 	local_irq_enable();
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Sergey Senozhatsky

We don't have consistency:
- we always print panic header
pr_emerg("Kernel panic - not syncing:")

- but we don't always print panic footer pr_emerg("---[ end Kernel panic - not syncing:")

For instance, no panic footer (end panic) message will be printed when panic_timeout is set - the kernel will either reboot immediately after console_flush_on_panic() (emergency restart) or after panic_timeout seconds. Additionally, panic_print_sys_info() goes before panic footer line, which doesn't look very right, panic_print_sys_info() is just additional debugging into.

Let's make it consistent:

	pr_emerg("Kernel panic - not syncing:")
	dump_stack();
	console_flush_on_panic();
	pr_emerg("---[ end Kernel panic - not syncing:")

	panic_print_sys_info();
	/* the rest */
	/* panic_timeout handling */
Quoted 1 line

Makes sense to me:

Best Regards,
Petr