mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Use hibernate callbacks when shutting down the system
@ 2026-11-02 13:54 Mario Limonciello
  2026-11-02 13:54 ` [PATCH 1/2] PM: Use hibernation callbacks for system power off Mario Limonciello
  2026-11-02 13:54 ` [PATCH 2/2] PM: Add shutdown=legacy command line option Mario Limonciello
  0 siblings, 2 replies; 5+ messages in thread
From: Mario Limonciello @ 2026-11-02 13:54 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Randy Dunlap, Rafael J. Wysocki,
	Len Brown, Pavel Machek
  Cc: Denis Benato, AceLan Kao, Kai-Heng Feng, Mark Pearson,
	Merthan Karakaş,
	linux-kernel, linux-doc, linux-pm, Mario Limonciello, Eric Naim,
	Bartu Alev

OEM systems that ship with Linux preloaded need to go through energy
certifications that match regulatory bodies in the regions that they
will ship.

If any of those certifications don't pass then OEMs might not be able
to ship systems preloaded in applicable regions.

Multiple models of systems are reported to fail in Linux but pass
for Windows on the exact same hardware.

By looking at a breakdown of power consumption across devices the
issue is that some devices aren't turned off when user puts the
system into S5 (shutdown).

A few years ago when I first root caused this I submitted patches
to PCI core to change the PCI policy at shutdown [1].

But through various iterations I've come up with a better approach.
Instead of changing policy in each subsystem we can instead
change our shutdown command to run hibernate callbacks for all hardware.

In order to accomplish that the last 17 kernel cycles I've been slowly
drippping changes into the hibernate code paths of all subsystems to make
sure they behave as intended.

Those are all merged as of kernel 7.4-rc1, and thus I am now ready to
start using the hibernate codepath at shutdown. This series adds that
support.

I'm not naïve; there is definitely risk involved with this change as it
will essentially affect anything running Linux that gets turned off.

To that I will say that I have been running, rebasing and iterating this
series on my personal development tree ever since December 2023.
Various rolling distro community members have also been testing iterations
of these patches in their hardware and distros.

I've also put a few guard rails in place:

1. Don't mandate hibernate support. If not compiled with it, just use
   previous shutdown paths.
2. If hibernate callback fail, emit a `pr_emerg()` message but fallback
   to previous shutdown paths.
3. Offer a kernel command line option `shutdown=legacy` that any affected
   user could use to roll back to previous behavior while we root cause
   any issues.

I did split out the kernel command line option to a second commit.  If we
later decide that we want to keep this behavior but drop the rollback knob
we can revert that commit.

Link: https://lore.kernel.org/linux-pci/20231213182656.6165-1-mario.limonciello@amd.com/#t

Signed-off-by: Mario Limonciello <superm1@kernel.org>
---
Mario Limonciello (2):
      PM: Use hibernation callbacks for system power off
      PM: Add shutdown=legacy command line option

 Documentation/admin-guide/kernel-parameters.txt |  4 ++++
 Documentation/power/shutdown-debugging.rst      |  7 ++++++-
 kernel/reboot.c                                 | 16 ++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261006-superm1-s4-at-s5-f55b441d6c5b

Best regards,
--  
Mario Limonciello <superm1@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-02 17:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 13:54 [PATCH 0/2] Use hibernate callbacks when shutting down the system Mario Limonciello
2026-11-02 13:54 ` [PATCH 1/2] PM: Use hibernation callbacks for system power off Mario Limonciello
2026-11-02 13:54 ` [PATCH 2/2] PM: Add shutdown=legacy command line option Mario Limonciello
2026-11-02 17:17   ` Randy Dunlap
2026-11-02 17:36     ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®