Linux Power Management development
 help / color / mirror / Atom feed
From: Bradley Morgan <include@grrlz.net>
To: akpm@linux-foundation.org
Cc: baoquan.he@linux.dev, rppt@kernel.org, pasha.tatashin@soleen.com,
	pratyush@kernel.org, rafael@kernel.org, lenb@kernel.org,
	pavel@kernel.org, kees@kernel.org, tony.luck@intel.com,
	gpiccoli@igalia.com, linux-kernel@vger.kernel.org,
	kexec@lists.infradead.org, linux-pm@vger.kernel.org,
	Bradley Morgan <include@grrlz.net>
Subject: [PATCH v2 3/3] PM: hibernate: log the task that initiated the power down
Date: Tue, 21 Jul 2026 16:13:58 +0100	[thread overview]
Message-ID: <20260721151358.4185467-4-include@grrlz.net> (raw)
In-Reply-To: <20260721151358.4185467-1-include@grrlz.net>

Give the hibernation power down the same treatment as the reboot
syscall commands. hibernate() runs in the context of the task that
asked for it, whether through the reboot syscall or a write to
/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.

Signed-off-by: Bradley Morgan <include@grrlz.net>
---
 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);
-- 
2.50.1


      parent reply	other threads:[~2026-07-21 15:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 15:13 [PATCH v2 0/3] reboot: log the task that initiated Bradley Morgan
2026-07-21 15:13 ` [PATCH v2 1/3] reboot: log the task that initiated the reboot Bradley Morgan
2026-07-21 15:13 ` [PATCH v2 2/3] kexec: log the task that initiated the kexec reboot Bradley Morgan
2026-07-21 15:13 ` Bradley Morgan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260721151358.4185467-4-include@grrlz.net \
    --to=include@grrlz.net \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=gpiccoli@igalia.com \
    --cc=kees@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pavel@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rppt@kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox