From: Lukas Wunner <lukas@wunner.de>
To: Guanghui Feng <guanghuifeng@linux.alibaba.com>
Cc: bhelgaas@google.com, alikernel-developer@linux.alibaba.com,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] [RFC] PCI: fix pcie secondary bus reset readiness check
Date: Mon, 18 Aug 2025 08:32:26 +0200 [thread overview]
Message-ID: <aKLI-qrOpvkbJTwx@wunner.de> (raw)
In-Reply-To: <20250818040641.3848174-1-guanghuifeng@linux.alibaba.com>
On Mon, Aug 18, 2025 at 12:06:40PM +0800, Guanghui Feng wrote:
> When executing a secondary bus reset on a bridge downstream port, all
> downstream devices and switches will be reseted. Before
> pci_bridge_secondary_bus_reset returns, ensure that all available
> devices have completed reset and initialization. Otherwise, using a
> device before initialization completed will result in errors or even
> device offline.
I recently received a report off-list for what looks like the same issue
and came up with the patch below.
Would it fix the issue for you?
It's not yet a properly fleshed-out patch, just a proof of concept.
But it's smaller and simpler than the approach you've taken.
This patch is for a Secondary Bus Reset issued by AER. Is the bus reset
likewise happening through AER in your case or what's the code path
leading to the bus reset?
-- >8 --
diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index fa83ebd..8b427a9 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -761,6 +761,10 @@ static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev)
pci_restore_state(dev);
pci_save_state(dev);
+
+ if (pci_bridge_wait_for_secondary_bus(dev, "hot reset"))
+ return PCI_ERS_RESULT_DISCONNECT;
+
return PCI_ERS_RESULT_RECOVERED;
}
next prev parent reply other threads:[~2025-08-18 6:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 4:06 [PATCH] [RFC] PCI: fix pcie secondary bus reset readiness check Guanghui Feng
2025-08-18 6:32 ` Lukas Wunner [this message]
2025-08-19 7:01 ` guanghui.fgh
2025-08-19 7:09 ` guanghui.fgh
2025-08-29 6:53 ` guanghui.fgh
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=aKLI-qrOpvkbJTwx@wunner.de \
--to=lukas@wunner.de \
--cc=alikernel-developer@linux.alibaba.com \
--cc=bhelgaas@google.com \
--cc=guanghuifeng@linux.alibaba.com \
--cc=linux-pci@vger.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