From: Lukas Wunner <lukas@wunner.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-pci@vger.kernel.org, linux-pm@vger.kernel.org,
Andreas Noever <andreas.noever@gmail.com>
Subject: Re: [PATCH v2 11/13] PM / sleep: Allow opt-out from runtime resume after direct-complete
Date: Fri, 12 Aug 2016 18:39:10 +0200 [thread overview]
Message-ID: <20160812163910.GA8111@wunner.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1608071105360.31680-100000@netrider.rowland.org>
On Sun, Aug 07, 2016 at 11:33:17AM -0400, Alan Stern wrote:
> On Sun, 7 Aug 2016, Lukas Wunner wrote:
>
> > Normally the device hierarchy is traversed bottom-up during suspend
> > and top-down during resume. However ->prepare and ->complete do it
> > the other way round. In the case of ->prepare, this is even documented
> > in Documentation/power/devices.txt but the reason thereof is not.
> > Could you explain this please?
>
> The purpose of ->prepare is to tell drivers that a system sleep is
> beginning and accordingly they should stop registering new children.
> This is necessary for the PM core to be able to traverse the entire
> device tree safely; we want to avoid races where a new child is added
> below a device concurrently with that device being suspended. (Or if
> you want to be more precise, races in which a new child is added below
> a device while the PM core is acquiring the device's lock just prior to
> invoking its ->suspend callback.)
>
> Telling drivers to stop registering new children below a device has to
> be done top-down, because if it were done bottom-up then it would be
> subject to the same race described above. Doing it top-down avoids
> problems; if a device registers new children while the PM core is
> acquiring its lock prior to invoking ->prepare, it doesn't matter. The
> new children will be handled later, right along with the existing ones.
Thank you for explaining the motivation to carry out ->prepare top-down.
However my problem is really that ->complete is carried out bottom-up.
What's the motivation for that? Merely to mirror the behaviour of
->prepare? Would it be possible to change it to top-down? Note that
re-enablement of device addition is already allowed in ->resume,
which is called top-down.
By the way, neither the PCI nor USB bus-level ->prepare callbacks perform
any action that would stop device addition. Same for the pciehp driver
(we don't even have a ->prepare callback defined for PCIe port services.
So it *is* possible to hotplug PCI devices after ->prepare.
Best regards,
Lukas
next prev parent reply other threads:[~2016-08-12 16:38 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 11:15 [PATCH v2 00/13] Runtime PM for Thunderbolt on Macs Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 04/13] PCI: Generalize portdrv pm iterator Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 08/13] PCI: Allow runtime PM for Thunderbolt hotplug ports on Macs Lukas Wunner
2016-06-14 9:08 ` [PATCH v2 08/13 REBASED] " Lukas Wunner
2016-06-17 21:53 ` [PATCH v2 08/13] " Bjorn Helgaas
2016-05-13 11:15 ` [PATCH v2 01/13] PCI: Recognize Thunderbolt devices Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 06/13] PCI: pciehp: Support runtime pm Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 07/13] PCI: pciehp: Ignore interrupts during D3cold Lukas Wunner
2016-06-17 22:52 ` Bjorn Helgaas
2016-08-02 16:27 ` Lukas Wunner
2016-08-05 0:29 ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 11/13] PM / sleep: Allow opt-out from runtime resume after direct-complete Lukas Wunner
2016-07-18 13:18 ` Rafael J. Wysocki
2016-08-07 9:56 ` Lukas Wunner
2016-08-07 15:33 ` Alan Stern
2016-08-12 16:39 ` Lukas Wunner [this message]
2016-08-12 17:30 ` Alan Stern
2016-08-12 22:40 ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 10/13] PCI: Avoid going from D3cold to D3hot for system sleep Lukas Wunner
2016-06-17 21:09 ` Bjorn Helgaas
2016-06-17 22:14 ` Lukas Wunner
2016-07-18 13:39 ` Rafael J. Wysocki
2016-08-03 12:28 ` Lukas Wunner
2016-08-03 23:50 ` Rafael J. Wysocki
2016-08-04 0:45 ` Lukas Wunner
2016-08-04 1:07 ` Rafael J. Wysocki
2016-08-04 8:14 ` Lukas Wunner
2016-08-04 15:30 ` Rafael J. Wysocki
2016-08-07 9:03 ` Lukas Wunner
2016-08-07 23:32 ` Rafael J. Wysocki
2016-08-11 13:20 ` Lukas Wunner
2016-08-12 0:50 ` Rafael J. Wysocki
2016-08-12 16:16 ` Lukas Wunner
2016-08-12 22:18 ` Rafael J. Wysocki
2016-08-12 22:37 ` Rafael J. Wysocki
2016-08-14 10:27 ` Lukas Wunner
2016-08-15 23:05 ` Rafael J. Wysocki
2016-05-13 11:15 ` [PATCH v2 12/13] thunderbolt: Support runtime pm on upstream bridge Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 03/13] PCI: Add Thunderbolt portdrv service type Lukas Wunner
2016-06-17 22:51 ` Bjorn Helgaas
2016-07-20 0:30 ` Rafael J. Wysocki
2016-07-20 6:59 ` Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 05/13] PCI: Use portdrv pm iterator on further callbacks Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 13/13] thunderbolt: Support runtime pm on NHI Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 02/13] PCI: Allow D3 for Thunderbolt ports Lukas Wunner
2016-05-13 11:15 ` [PATCH v2 09/13] PCI: Do not write to PM control register while in D3cold Lukas Wunner
2016-06-17 21:18 ` Bjorn Helgaas
2016-07-18 13:55 ` Rafael J. Wysocki
2016-05-21 9:48 ` [PATCH v2 00/13] Runtime PM for Thunderbolt on Macs Andreas Noever
2016-06-14 16:37 ` Bjorn Helgaas
2016-06-14 19:14 ` Andreas Noever
2016-06-14 20:22 ` Bjorn Helgaas
2016-06-15 18:40 ` Lukas Wunner
2016-06-16 1:55 ` Linus Torvalds
2016-07-07 17:39 ` Andreas Noever
2016-07-09 5:23 ` Greg KH
2016-07-12 21:46 ` Andreas Noever
2016-06-13 20:58 ` Bjorn Helgaas
2016-06-14 9:27 ` Lukas Wunner
2016-07-07 15:02 ` Lukas Wunner
2016-07-08 1:28 ` Rafael J. Wysocki
2016-07-20 7:23 ` Lukas Wunner
2016-07-20 12:48 ` 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=20160812163910.GA8111@wunner.de \
--to=lukas@wunner.de \
--cc=andreas.noever@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
/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).