Re: [PATCH v3 1/3] panic: Introduce arch_do_panic

Bradley Morgan <[email protected]> Thu, 30 Jul 2026 14:03:14 +0100
Newsgroups gmane.linux.ports.sparc,gmane.linux.kernel
Message-ID <[email protected]>
On 30 July 2026 10:23:27 BST, Mete Durlu <[email protected]> wrote:
>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 <[email protected]>

Nice.

Reviewed-by: Bradley Morgan <[email protected]>

>Signed-off-by: Mete Durlu <[email protected]>
>---
> include/linux/panic.h | 2 ++
> kernel/panic.c        | 3 +++
> 2 files changed, 5 insertions(+)
>
>diff --git a/include/linux/panic.h b/include/linux/panic.h
>index f1dd417e54b2..98dd7dfd27de 100644
>--- a/include/linux/panic.h
>+++ b/include/linux/panic.h
>@@ -110,4 +110,6 @@ extern void add_taint(unsigned flag, enum lockdep_ok);
> extern int test_taint(unsigned flag);
> extern unsigned long get_taint(void);
> 
>+void arch_do_panic(void);
>+
> #endif	/* _LINUX_PANIC_H */
>diff --git a/kernel/panic.c b/kernel/panic.c
>index 213725b612aa..726a97842232 100644
>--- a/kernel/panic.c
>+++ b/kernel/panic.c
>@@ -567,6 +567,8 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
> 		crash_smp_send_stop();
> }
> 
>+void __weak arch_do_panic(void) {}
>+
> /**
>  * vpanic - halt the system
>  * @fmt: The text string to print
>@@ -756,6 +758,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;
> 
>
>


Thanks!