Skip to contentSkip to conversation

printk/panic: deduplicate backtrace on PANIC_PRINT_ALL_CPU_BT

PATCH In review Kevin Mitchell 3 participants 3 messages Apr 23, 2025 – May 1, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk/panic: deduplicate backtrace on PANIC_PRINT_ALL_CPU_BT

On panic, the backtrace of the panicking CPU will be printed either from within panic() itself or by the oops handling. Previously, when PANIC_PRINT_ALL_CPU_BT was enabled, the backtrace of the panicking CPU would be printed again.

To avoid cluttering up the crash log or console with this redundant information, this commit omits the panicking CPU from the all-cpu backtrace printed by panic_printk=PANIC_PRINT_ALL_CPU_BT.

---
 kernel/panic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/panic.c +1 -1
index a3889f38153d..e53b23449fcf 100644
@@ -258,7 +258,7 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
 	if (panic_print & PANIC_PRINT_ALL_CPU_BT) {
 		/* Temporary allow non-panic CPUs to write their backtraces. */
 		panic_triggering_all_cpu_backtrace = true;
-		trigger_all_cpu_backtrace();
+		trigger_allbutcpu_cpu_backtrace(raw_smp_processor_id());
 		panic_triggering_all_cpu_backtrace = false;
 	}
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Kevin Mitchell

On panic, the backtrace of the panicking CPU will be printed either from within panic() itself or by the oops handling. Previously, when PANIC_PRINT_ALL_CPU_BT was enabled, the backtrace of the panicking CPU would be printed again.

To avoid cluttering up the crash log or console with this redundant information, this commit omits the panicking CPU from the all-cpu backtrace printed by panic_printk=PANIC_PRINT_ALL_CPU_BT.

Makes sense. The patch looks good to me.

Best Regards,
Petr

Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Mitchell
Quoted 5 lines · Kevin Mitchell

On panic, the backtrace of the panicking CPU will be printed either from within panic() itself or by the oops handling. Previously, when PANIC_PRINT_ALL_CPU_BT was enabled, the backtrace of the panicking CPU would be printed again.

Quoted 8 lines

To avoid cluttering up the crash log or console with this redundant information, this commit omits the panicking CPU from the all-cpu backtrace printed by panic_printk=PANIC_PRINT_ALL_CPU_BT.

---
 kernel/panic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Makes total sense - thanks for the improvement!
Feel free to add my:

Cheers!