[PATCH] PM: hibernate: Log hibernation mode at S4 entry

From: Yongxin Yang

Date: Fri Oct 09 2026 - 23:19:35 EST


The S4 path is the only place where the kernel decides whether a
completed image write ends in poweroff or reboot, but it leaves no
trace of that decision in the log. If the resume path later fails or
hangs, the tester cannot tell which outcome was requested, so a report
of "S4 rebooted instead of powering off" cannot be attributed to
configuration or to platform behavior.

Append the mode name to the existing "hibernation entry" message, so
that line reads "hibernation entry (reboot)" or "hibernation entry
(shutdown)" instead of a bare "hibernation entry". The name comes from
hibernation_mode, the same value power_down() later switches on
(1 = platform, 2 = shutdown, 3 = reboot).

No functional change.

Signed-off-by: Yongxin Yang <yangyongxin@xxxxxxxxxx>
---
kernel/power/hibernate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e365e440cd52..92808832a9ba 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -794,7 +794,11 @@ int hibernate(void)
goto Unlock;
}

- pr_info("hibernation entry\n");
+ pr_info("hibernation entry (%s)\n",
+ hibernation_mode == HIBERNATION_REBOOT ? "reboot" :
+ hibernation_mode == HIBERNATION_PLATFORM ? "platform" :
+ hibernation_mode == HIBERNATION_TEST_RESUME ? "test_resume" :
+ "shutdown");
pm_prepare_console();
error = pm_notifier_call_chain_robust(PM_HIBERNATION_PREPARE, PM_POST_HIBERNATION);
if (error)
--
2.25.1