[PATCH 1/3] panic: Introduce arch_do_panic

From: Mete Durlu

Date: Mon Jul 27 2026 - 05:01:53 EST


Introduce a hook for architectures to put their specific panic handlers.
s390 and sparc already has ifdef preprocessor checks to execute
architecture specific code. Pave the way for vpanic() cleanup.

Suggested-by: Sven Schnelle <svens@xxxxxxxxxxxxx>
Signed-off-by: Mete Durlu <meted@xxxxxxxxxxxxx>
---
kernel/panic.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/panic.c b/kernel/panic.c
index 213725b612aa..1eb0cdc159d9 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -567,6 +567,11 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
crash_smp_send_stop();
}

+#ifndef arch_do_panic
+#define arch_do_panic arch_do_panic
+static inline void arch_do_panic(void) {}
+#endif
+
/**
* vpanic - halt the system
* @fmt: The text string to print
@@ -756,6 +761,7 @@ void vpanic(const char *fmt, va_list args)
#endif
pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);

+ arch_do_panic();
/* Do not scroll important messages printed above */
suppress_printk = 1;


--
2.55.0