[PATCH 2/3] s390: Implement arch_do_panic
From: Mete Durlu
Date: Mon Jul 27 2026 - 05:02:19 EST
s390 has a custom panic handler which carries out user specified actions
during a panic scenario. This handler is invoked via the panic_notifier
call chain and executed before panic_timeout value is evaluated in
common code.
Use arch_do_panic() hook to invoke arch specific panic handling instead
of using panic_notifier call chain. The execution order of panic
handlers now allow for user specified panic_timeout value to be taken
into account.
Fixes: ff6b8ea68f4b ("[S390] ipl/dump on panic.")
Suggested-by: Sven Schnelle <svens@xxxxxxxxxxxxx>
Signed-off-by: Mete Durlu <meted@xxxxxxxxxxxxx>
---
arch/s390/include/asm/ipl.h | 1 +
arch/s390/include/asm/setup.h | 3 +++
arch/s390/kernel/ipl.c | 15 +--------------
kernel/panic.c | 3 ---
4 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index b0d00032479d..38924c4a5d1d 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -166,5 +166,6 @@ enum diag308_rc {
extern int diag308(unsigned long subcode, void *addr);
extern void store_status(void (*fn)(void *), void *data);
extern void lgr_info_log(void);
+void s390_do_panic(void);
#endif /* _ASM_S390_IPL_H */
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index cbf60ade741d..6b38017f7cf3 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -90,6 +90,9 @@ extern void (*_machine_restart)(char *command);
extern void (*_machine_halt)(void);
extern void (*_machine_power_off)(void);
+void arch_do_panic(void);
+#define arch_do_panic arch_do_panic
+
struct oldmem_data {
unsigned long start;
unsigned long size;
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 3c346b02ceb9..8ab02e821256 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -2115,7 +2115,7 @@ static ssize_t on_panic_store(struct kobject *kobj,
}
static struct kobj_attribute on_panic_attr = __ATTR_RW(on_panic);
-static void do_panic(void)
+void arch_do_panic(void)
{
lgr_info_log();
on_panic_trigger.action->fn(&on_panic_trigger);
@@ -2331,18 +2331,6 @@ static int __init vmcmd_on_poff_setup(char *str)
}
__setup("vmpoff=", vmcmd_on_poff_setup);
-static int on_panic_notify(struct notifier_block *self,
- unsigned long event, void *data)
-{
- do_panic();
- return NOTIFY_OK;
-}
-
-static struct notifier_block on_panic_nb = {
- .notifier_call = on_panic_notify,
- .priority = INT_MIN,
-};
-
void __init setup_ipl(void)
{
BUILD_BUG_ON(sizeof(struct ipl_parameter_block) != PAGE_SIZE);
@@ -2375,7 +2363,6 @@ void __init setup_ipl(void)
/* We have no info to copy */
break;
}
- atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
}
void __no_stack_protector s390_reset_system(void)
diff --git a/kernel/panic.c b/kernel/panic.c
index 1eb0cdc159d9..de0bda946cab 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -755,9 +755,6 @@ void vpanic(const char *fmt, va_list args)
pr_emerg("Press Stop-A (L1-A) from sun keyboard or send break\n"
"twice on console to return to the boot prom\n");
}
-#endif
-#if defined(CONFIG_S390)
- disabled_wait();
#endif
pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
--
2.55.0