From: Bjorn Helgaas <helgaas@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: "David E . Box" <david.e.box@linux.intel.com>,
Jian-Hong Pan <jhp@endlessos.org>, Lukas Wunner <lukas@wunner.de>,
Bjorn Helgaas <bhelgaas@google.com>,
Alex Williamson <alex.williamson@redhat.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH 1/1] PCI: Wait for Link before restoring Downstream Buses
Date: Fri, 9 Aug 2024 15:36:21 -0500 [thread overview]
Message-ID: <20240809203621.GA214516@bhelgaas> (raw)
In-Reply-To: <20240808121708.2523-1-ilpo.jarvinen@linux.intel.com>
On Thu, Aug 08, 2024 at 03:17:07PM +0300, Ilpo Järvinen wrote:
> __pci_reset_bus() calls pci_bridge_secondary_bus_reset() to perform the
> reset and also waits for the Secondary Bus to become again accessible.
> __pci_reset_bus() then calls pci_bus_restore_locked() that restores the
> PCI devices connected to the bus, and if necessary, recursively restores
> also the subordinate buses and their devices.
>
> The logic in pci_bus_restore_locked() does not take into account that
> after restoring a device on one level, there might be another Link
> Downstream that can only start to come up after restore has been
> performed for its Downstream Port device. That is, the Link may
> require additional wait until it becomes accessible.
>
> Similarly, pci_slot_restore_locked() lacks wait.
>
> Amend pci_bus_restore_locked() and pci_slot_restore_locked() to wait
> for the Secondary Bus before recursively performing the restore of that
> bus.
>
> Fixes: 090a3c5322e9 ("PCI: Add pci_reset_slot() and pci_reset_bus()")
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Seems reasonable to me, applied to pci/reset for v6.12, thanks!
> ---
>
> NOTE TO MAINTAINER: I've not seen anything to actually trigger this issue
> but only realized this problem exist while looking into the other issues
> related to bus reset/restore. The fix regardless seems to make sense so
> sending it out.
>
> drivers/pci/pci.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index e3a49f66982d..98c7b732998a 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5671,8 +5671,10 @@ static void pci_bus_restore_locked(struct pci_bus *bus)
>
> list_for_each_entry(dev, &bus->devices, bus_list) {
> pci_dev_restore(dev);
> - if (dev->subordinate)
> + if (dev->subordinate) {
> + pci_bridge_wait_for_secondary_bus(dev, "bus reset");
> pci_bus_restore_locked(dev->subordinate);
> + }
> }
> }
>
> @@ -5706,8 +5708,10 @@ static void pci_slot_restore_locked(struct pci_slot *slot)
> if (!dev->slot || dev->slot != slot)
> continue;
> pci_dev_restore(dev);
> - if (dev->subordinate)
> + if (dev->subordinate) {
> + pci_bridge_wait_for_secondary_bus(dev, "slot reset");
> pci_bus_restore_locked(dev->subordinate);
> + }
> }
> }
>
> --
> 2.39.2
>
prev parent reply other threads:[~2024-08-09 20:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 12:17 [PATCH 1/1] PCI: Wait for Link before restoring Downstream Buses Ilpo Järvinen
2024-08-09 20:36 ` Bjorn Helgaas [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=20240809203621.GA214516@bhelgaas \
--to=helgaas@kernel.org \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=david.e.box@linux.intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jhp@endlessos.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
/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