From: Lukas Wunner <lukas@wunner.de>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Feng Kan <fkan@apm.com>, Linux PM <linux-pm@vger.kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
linux-arm-kernel@lists.infradead.org,
Linux PCI <linux-pci@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH] PCIe bridge deferred probe breaks suspend resume
Date: Sat, 24 Feb 2018 14:59:46 +0100 [thread overview]
Message-ID: <20180224135946.GA1735@wunner.de> (raw)
In-Reply-To: <CAJZ5v0jJMODOsZV41Jn18LCtttMemFQyXonJxZnUgXday8_4iw@mail.gmail.com>
On Sat, Feb 24, 2018 at 10:47:26AM +0100, Rafael J. Wysocki wrote:
> On Sat, Feb 24, 2018 at 10:35 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > On Sat, Feb 24, 2018 at 1:46 AM, Feng Kan <fkan@apm.com> wrote:
> >> This is not a patch, but rather a question regarding the deferred
> >> probe's effect on PCIe PM ordering. This happens on our system
> >> which defer the probing of root bridge due to the IOMMU not being
> >> ready. Because of the deferred action, the bridge is moved to the
> >> end of the dpm_list which results in incorrect suspend and resume
> >> sequence.
> >>
> >> In the cases I have seen, the bridge is always reordered because of
> >> startup sequence. They are always place after the endpoint. If that
> >> is the case the following code should be able to prevent such cases.
> >> However, is there some cases here that would violate such situation?
> >
> > The code in dd.c assumes that the device being probed has no children
> > (or consumers, for that matter) and so it is safe to move it to the
> > end of the list.
> >
> > If the device has children (or consumers), moving it to the end of the
> > list by itself doesn't work, which is the case for you.
> >
> > You can try to replace the device_pm_move_last(dev) in
> > deferred_probe_work_func(struct() with device_reorder_to_tail(), but
> > that has to be called under device_links_read_lock/unloc () and
> > device_pm_lock/unloc() (in the right order).
>
> Alternatively, you can replace your !dev_is_pci(dev) check with a
> check for the presence of children or consumers and only move the
> device to the end of the PM list if there are not any. That would
> kind of make sense, but it may break other assumptions in the deferred
> probing mechanism which I don't recall ATM.
>
> Or avoid deferred probing of the host bridge driver entirely. I guess
> you can use it with limited functionality until the IOMMU driver is
> ready and switch over to the fully functional operation mode when that
> happens, but that would need to hook into the IOMMU code somehow.
Or model the root bridge's dependency on the iommu using a device link:
https://www.kernel.org/doc/html/latest/driver-api/device_link.html
Thanks,
Lukas
next prev parent reply other threads:[~2018-02-24 13:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-24 0:46 [PATCH] PCIe bridge deferred probe breaks suspend resume Feng Kan
2018-02-24 9:35 ` Rafael J. Wysocki
2018-02-24 9:47 ` Rafael J. Wysocki
2018-02-24 13:59 ` Lukas Wunner [this message]
2018-02-25 9:29 ` Rafael J. Wysocki
2018-02-25 16:28 ` Feng Kan
2018-02-26 9:38 ` 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=20180224135946.GA1735@wunner.de \
--to=lukas@wunner.de \
--cc=bhelgaas@google.com \
--cc=fkan@apm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael@kernel.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