From: Lukas Wunner <lukas@wunner.de>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org,
linux-acpi@vger.kernel.org, Peter Wu <peter@lekensteyn.nl>,
Andreas Noever <andreas.noever@gmail.com>
Subject: Re: [PATCH 4/4] PCI: Avoid unnecessary resume on shutdown
Date: Thu, 15 Sep 2016 15:11:25 +0200 [thread overview]
Message-ID: <20160915131125.GA2196@wunner.de> (raw)
In-Reply-To: <2217882.yevB8EWaHc@vostro.rjw.lan>
On Wed, Sep 14, 2016 at 02:29:52AM +0200, Rafael J. Wysocki wrote:
> On Wednesday, August 31, 2016 08:15:18 AM Lukas Wunner wrote:
> > We currently perform a mandatory runtime resume of all PCI devices on
> > ->shutdown. However it is pointless to wake devices only to immediately
> > power them down afterwards. (Or have the firmware reset them, in case
> > of a reboot.)
> >
> > It seems there are only two cases when a runtime resume is actually
> > necessary: If the driver has declared a ->shutdown callback or if kexec
> > is in progress.
> >
> > Constrain resume of a device to these cases and let it slumber
> > otherwise, thereby conserving energy and speeding up shutdown.
> >
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> > ---
> > drivers/pci/pci-driver.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> > index fd4b9c4..09a4e56 100644
> > --- a/drivers/pci/pci-driver.c
> > +++ b/drivers/pci/pci-driver.c
> > @@ -459,6 +459,11 @@ static void pci_device_shutdown(struct device *dev)
> > struct pci_dev *pci_dev = to_pci_dev(dev);
> > struct pci_driver *drv = pci_dev->driver;
> >
> > + /* Fast path for suspended devices */
> > + if (pm_runtime_suspended(dev) && (!drv || !drv->shutdown) &&
> > + !kexec_in_progress)
>
> What happens if runtime suspend or resume of the device happens here?
You're right, good point. How about disabling runtime PM then, like this:
/* Fast path for suspended devices */
if (pm_runtime_status_suspended(dev) && (!drv || !drv->shutdown) &&
!kexec_in_progress) {
pm_runtime_disable(dev);
if (pm_runtime_status_suspended(dev))
return;
pm_runtime_enable(dev);
}
All dependents (children, and in the future, consumers) should already
have been treated at that point, due to the ordering of devices_kset->list.
Thanks!
Lukas
next prev parent reply other threads:[~2016-09-15 13:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 6:15 [PATCH 0/4] PCI PM refinements Lukas Wunner
2016-08-31 6:15 ` [PATCH 1/4] PCI: Afford direct-complete to devices with nonstandard PM Lukas Wunner
2016-09-14 0:05 ` Rafael J. Wysocki
2016-08-31 6:15 ` [PATCH 2/4] PCI: Query platform firmware for device power state Lukas Wunner
2016-09-14 0:21 ` Rafael J. Wysocki
2016-09-14 10:50 ` Lukas Wunner
2016-09-14 13:01 ` Rafael J. Wysocki
2016-09-14 16:47 ` Rafael J. Wysocki
2016-09-14 21:36 ` Rafael J. Wysocki
2016-09-14 21:47 ` Rafael J. Wysocki
2016-09-14 22:58 ` Lukas Wunner
2016-09-15 0:49 ` Rafael J. Wysocki
2016-09-17 13:49 ` Lukas Wunner
2016-09-18 1:09 ` Rafael J. Wysocki
2016-08-31 6:15 ` [PATCH 4/4] PCI: Avoid unnecessary resume on shutdown Lukas Wunner
2016-09-14 0:29 ` Rafael J. Wysocki
2016-09-15 13:11 ` Lukas Wunner [this message]
2016-09-15 13:57 ` Rafael J. Wysocki
2016-08-31 6:15 ` [PATCH 3/4] PCI: Avoid unnecessary resume after direct-complete Lukas Wunner
2016-09-14 0:29 ` Rafael J. Wysocki
2016-09-14 0:43 ` Rafael J. Wysocki
2016-09-14 0:50 ` Rafael J. Wysocki
2016-09-14 9:56 ` Lukas Wunner
2016-09-14 13:14 ` Rafael J. Wysocki
2016-09-18 12:43 ` Lukas Wunner
2016-09-12 22:07 ` [PATCH 0/4] PCI PM refinements Bjorn Helgaas
2016-09-12 22:15 ` Rafael J. Wysocki
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=20160915131125.GA2196@wunner.de \
--to=lukas@wunner.de \
--cc=andreas.noever@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peter@lekensteyn.nl \
--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;
as well as URLs for NNTP newsgroup(s).