From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, mpearson-lenovo@squebb.ca
Subject: Re: [PATCH 1/2] PCI: Avoid runtime resuming devices if system is shutting down
Date: Wed, 13 Dec 2023 12:33:08 -0600 [thread overview]
Message-ID: <d03fd5a4-4f22-45e3-94b1-7ba735ea196f@amd.com> (raw)
In-Reply-To: <CAJZ5v0g0j2fpaHUdvxAkfo-3bRp=GRrKOgespUnz_BqX6timOw@mail.gmail.com>
On 12/13/2023 12:31, Rafael J. Wysocki wrote:
> On Wed, Dec 13, 2023 at 7:27 PM Mario Limonciello
> <mario.limonciello@amd.com> wrote:
>>
>> When the system is going to S5 resuming devices is unnecessary at
>> best and may cause problems for power consumption at S5 at worst.
>>
>> Check the target `system_state` in the pci driver shutdown() callback
>> and skip the runtime resume step if the system is being powered off.
>>
>> Cc: mpearson-lenovo@squebb.ca
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>> drivers/pci/pci-driver.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
>> index 51ec9e7e784f..5a6f7a786952 100644
>> --- a/drivers/pci/pci-driver.c
>> +++ b/drivers/pci/pci-driver.c
>> @@ -507,7 +507,9 @@ static void pci_device_shutdown(struct device *dev)
>> struct pci_dev *pci_dev = to_pci_dev(dev);
>> struct pci_driver *drv = pci_dev->driver;
>>
>> - pm_runtime_resume(dev);
>> + /* If system will go to S5, don't wake up PCI devices for shutdown */
>> + if (system_state != SYSTEM_POWER_OFF)
>> + pm_runtime_resume(dev);
>
> What's the guarantee that the driver's shutdown callback will not
> access MMIO regions of a runtime-suspended device?
This is something that may need to be audited.
I have an expectation that drivers will runtime resume a device before
they try to access it.
>
>> if (drv && drv->shutdown)
>> drv->shutdown(pci_dev);
>> --
next prev parent reply other threads:[~2023-12-13 18:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 18:26 [PATCH 0/2] Improvements to system power consumption at S5 Mario Limonciello
2023-12-13 18:26 ` [PATCH 1/2] PCI: Avoid runtime resuming devices if system is shutting down Mario Limonciello
2023-12-13 18:31 ` Rafael J. Wysocki
2023-12-13 18:33 ` Mario Limonciello [this message]
2023-12-13 18:39 ` Rafael J. Wysocki
2023-12-13 18:26 ` [PATCH 2/2] PCI/portdrv: Place PCIe port hierarchy into D3cold at shutdown Mario Limonciello
2023-12-13 18:38 ` Rafael J. Wysocki
2023-12-13 18:42 ` Mario Limonciello
2023-12-13 18:46 ` Rafael J. Wysocki
2023-12-14 3:46 ` Kai-Heng Feng
2023-12-14 9:00 ` Rafael J. Wysocki
2023-12-14 16:44 ` Mario Limonciello
2023-12-18 3:41 ` Kai-Heng Feng
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=d03fd5a4-4f22-45e3-94b1-7ba735ea196f@amd.com \
--to=mario.limonciello@amd.com \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
/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