mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Cc: "Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Len Brown" <lenb@kernel.org>, "Pavel Machek" <pavel@kernel.org>,
	"Denis Benato" <benato.denis96@gmail.com>,
	"AceLan Kao" <acelan.kao@canonical.com>,
	"Kai-Heng Feng" <kaihengf@nvidia.com>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Merthan Karakaş" <m3rthn.k@gmail.com>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-pm@vger.kernel.org, "Eric Naim" <dnaim@cachyos.org>,
	"Bartu Alev" <bartualev@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Driver Core Devel" <driver-core@vger.kernel.org>,
	"ACPI Devel Maling List" <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH 0/2] Use hibernate callbacks when shutting down the system
Date: Fri, 6 Nov 2026 11:13:23 -0600	[thread overview]
Message-ID: <82efa7f5-c5b4-4934-a72d-7399ce52496c@kernel.org> (raw)
In-Reply-To: <CAJZ5v0i07G06GDGX76f3-ppumfNUFD0nTB-Wz8k4PS=Ra13CsA@mail.gmail.com>

On 11/6/26 10:57, Rafael J. Wysocki (Intel) wrote:
> On Mon, Nov 2, 2026 at 2:54 PM Mario Limonciello <superm1@kernel.org> wrote:
>>
>> 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
> 
> I have a couple of concerns regarding this, after looking at the patches.
> 
> First off, dpm_suspend_start() seems to be called during shutdown
> while user space is running.  That is risky because at least some
> things in the power-off code path assume that user space has been
> frozen.  I think that freezing tasks, along the lines of what system
> suspend does, before running dpm_suspend_start(), is requisite or you
> will get into trouble with people who run fuzzers across shutdown or
> similar.

Hmm.  I'll see about adding that to this path, thanks.

> 
> The other concern is that the "legacy" shutdown should be the default
> or people will get confused.  Arguably, it is not even necessary to
> try to change that in many cases.
> 
> Of course, this means that the new shutdown arrangement will not be
> used to start with, so there needs to be a plan to migrate users to
> this new order and I would start with the systems where it actually is
> an improvement.

It's improved every system I've tried and measured; but the level of 
improvement comes down to what hardware is contained.

The most demonstrable improvement comes from systems with dGPUs.

> 
> I would try to add the shutdown= option upfront in the first patch and
> make it take one of two options, "classic" (the regular shutdown
> callbacks) or "pm-aware" (hibernation callbacks etc) with the first
> one being the default at least to start with.
> 

OK.

> Then, you can add a DMI quirk table or similar with a list of systems
> where "pm-aware" works better than "classic" and expand its use going
> forward.  My expectation would be that, at one point in time, the
> majority of x86 platforms using ACPI would be better off with
> "pm-aware" than with "classic", but I'm not sure that this point in
> time is today.  Beyond that, it is really hard to say how cards will
> fall.

How would you feel about a heuristic to turn it on for anything with > 1 
GPU/accelerator for now?  I think that's the biggest bang for the buck 
right now.

But deciding when/how to turn it on for more systems than that I think 
is going to require a wider call for testing.


      reply	other threads:[~2026-11-06 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2026-11-02 17:17   ` Randy Dunlap
2026-11-02 17:36     ` Mario Limonciello
2026-11-06 16:57 ` [PATCH 0/2] Use hibernate callbacks when shutting down the system Rafael J. Wysocki (Intel)
2026-11-06 17:13   ` Mario Limonciello [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=82efa7f5-c5b4-4934-a72d-7399ce52496c@kernel.org \
    --to=superm1@kernel.org \
    --cc=acelan.kao@canonical.com \
    --cc=bartualev@gmail.com \
    --cc=benato.denis96@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dnaim@cachyos.org \
    --cc=driver-core@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kaihengf@nvidia.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m3rthn.k@gmail.com \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /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

all inboxes | Powered by JetHome®