From: Brian Norris <briannorris@chromium.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Marek Szyprowski" <m.szyprowski@samsung.com>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lukas Wunner" <lukas@wunner.de>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-pm@vger.kernel.org,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH v4] PCI/PM: Prevent runtime suspend before devices are fully initialized
Date: Thu, 22 Jan 2026 09:49:41 -0800 [thread overview]
Message-ID: <aXJjNfqcZrXw1_h2@google.com> (raw)
In-Reply-To: <CAJZ5v0hWt63=0yjFrbTY8zXubh-Uc6ZwAndT73VL7itMkTe81A@mail.gmail.com>
Hi Rafael,
Thanks for your thoughts!
On Sun, Jan 18, 2026 at 12:53:21PM +0100, Rafael J. Wysocki wrote:
> On Sat, Jan 17, 2026 at 2:19 AM Brian Norris <briannorris@chromium.org> wrote:
> > I suppose one way to "solve" that is (untested):
> >
> > --- a/drivers/pci/bus.c
> > +++ b/drivers/pci/bus.c
> > @@ -380,8 +380,12 @@ void pci_bus_add_device(struct pci_dev *dev)
> > put_device(&pdev->dev);
> > }
> >
> > + if (dev->dev.parent)
> > + pm_runtime_get_sync(dev->dev.parent);
> > pm_runtime_set_active(&dev->dev);
> > pm_runtime_enable(&dev->dev);
> > + if (dev->dev.parent)
> > + pm_runtime_put(dev->dev.parent);
> >
> > if (!dn || of_device_is_available(dn))
> > pci_dev_allow_binding(dev);
> >
> > Personally, I'm more inclined to go back to v1, since it prepares the
> > runtime PM status when the device is first discovered. That way, its
> > ancestors are still active, avoiding these sorts of problems. I'm
> > frankly not sure of all the reasons Rafael recommended I make the
> > v1->v3->v4 changes, and now that they cause problems, I'm inclined to
> > question them again.
> >
> > Rafael, do you have any thoughts?
>
> Yeah.
>
> Move back pm_runtime_set_active(&dev->dev) back to pm_runtime_init()
> because that would prevent the parent from suspending and keep
> pm_runtime_enable() here because that would prevent the device itself
> from suspending between pm_runtime_init() and this place.
I'll admit, I was a little fuzzy on the details of the first part of the
sentence here -- specifically, that an "active" (but still "disabled")
device will prevent suspend of its parent. I suppose I'm more familiar
with the typical "disabled and suspended" device, which essentially has
no effect on its parent.
Anyway, that's basically v3, so I rerolled a v5 that looks similar.
> And I would add comments in both places.
I tried to add a short comment to each. It's an art form to write
exactly the right size of comment to make everyone happy (people
complain about too much commenting, and then others complain about
non-obvious behaviors that could have used more comments), especially
when it comes to something as tricky as runtime PM. At least I tried...
Brian
prev parent reply other threads:[~2026-01-22 17:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 21:09 [PATCH v4] PCI/PM: Prevent runtime suspend before devices are fully initialized Brian Norris
2025-11-25 16:14 ` Brian Norris
2026-01-06 22:27 ` Bjorn Helgaas
2026-01-14 9:46 ` Marek Szyprowski
2026-01-14 16:45 ` Bjorn Helgaas
2026-01-14 20:10 ` Brian Norris
2026-01-15 11:14 ` Marek Szyprowski
2026-01-17 1:19 ` Brian Norris
2026-01-18 11:53 ` Rafael J. Wysocki
2026-01-18 11:59 ` Rafael J. Wysocki
2026-01-19 10:00 ` Marek Szyprowski
2026-01-19 12:26 ` Rafael J. Wysocki
2026-01-19 13:13 ` Marek Szyprowski
2026-01-19 16:10 ` Rafael J. Wysocki
2026-01-22 17:49 ` Brian Norris [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=aXJjNfqcZrXw1_h2@google.com \
--to=briannorris@chromium.org \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=m.szyprowski@samsung.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