Re: [PATCH v2 3/3] PM: hibernate: log the task that initiated the power down
From: Rafael J. Wysocki (Intel)
Date: Thu Jul 23 2026 - 09:59:09 EST
On Tue, Jul 21, 2026 at 5:14 PM Bradley Morgan <include@xxxxxxxxx> wrote:
>
> Give the hibernation power down the same treatment as the reboot
> syscall commands.
Why?
> hibernate() runs in the context of the task that
> asked for it, whether through the reboot syscall or a write to
It doesn't use the reboot syscall.
> /sys/power/disk, so when power_down() runs current is still the
> initiating task.
>
> Log it once the image has been written and the machine is committed
> to going down:
>
> reboot: initiated by systemd-sleep[812]
> reboot: Power down
>
> The line comes from kernel/reboot.c so it keeps the "reboot:" prefix
> and sits right next to the final "Restarting system", "Power down"
> or "System halted" line, same as a plain reboot.
>
> The one exception is platform mode rolling back on a pending wakeup
> event after the line has been printed. The existing "Wakeup event
> detected during hibernation, rolling back." line follows immediately
> in that case, so the log stays real about what happened.
(a) Why is this information in the log useful?
(b) Do you realize that it only appears in the log when hibernation
fails or it may appear on a serial console or similar?
> Signed-off-by: Bradley Morgan <include@xxxxxxxxx>
> ---
> kernel/power/hibernate.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index d2479c69d71a..bec91bf6a63c 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -687,6 +687,8 @@ static void power_down(void)
> }
> #endif
>
> + reboot_log_initiator();
> +
> switch (hibernation_mode) {
> case HIBERNATION_REBOOT:
> kernel_restart(NULL);
> --