[PATCH 2/2] kexec: log the task that initiated the kexec reboot
From: Bradley Morgan
Date: Thu Aug 27 2026 - 18:57:51 EST
From: Bradley Morgan <brads@xxxxxxxxxxxxxx>
Give the kexec path the same treatment as the reboot syscall.
Log the comm and pid of the calling task after kexec_in_progress is set
to true but before kernel_restart_prepare() shuts down devices, so the
message survives even if device shutdown hangs, e.g:
reboot: initiated by systemd-shutdow[1]
kexec: Starting new kernel
The existing "Starting new kernel" line is left untouched, so anything
parsing dmesg today keeps working.
Signed-off-by: Bradley Morgan <brads@xxxxxxxxxxxxxx>
---
kernel/kexec_core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index dc770b9a6d05..d940b0c29f86 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1189,6 +1189,7 @@ int kernel_kexec(void)
#endif
{
kexec_in_progress = true;
+ reboot_log_initiator();
kernel_restart_prepare("kexec reboot");
migrate_to_reboot_cpu();
syscore_shutdown();
--
2.47.3