Re: [PATCH] PCI: pciehp: Fix system hang on resume after hot-unplug during suspend
From: Lukas Wunner
Date: Thu Sep 26 2024 - 09:29:44 EST
On Thu, Sep 26, 2024 at 08:59:09PM +0800, Chia-Lin Kao (AceLan) wrote:
> Remove unnecessary pci_walk_bus() call in pciehp_resume_noirq(). This
> fixes a system hang that occurs when resuming after a Thunderbolt dock
> with attached thunderbolt storage is unplugged during system suspend.
>
> The PCI core already handles setting the disconnected state for devices
> under a port during suspend/resume.
Please explain in the commit message where the PCI core does that.
> The redundant bus walk was
> interfering with proper hardware state detection during resume, causing
> a system hang when hot-unplugging daisy-chained Thunderbolt devices.
Please explain what "proper hardware state detection" means.
Did you get a hung task stacktrace? If so, please include it in the
commit message.
If you're getting a system hang, it means there's a deadlock
involving pci_bus_sem. I don't quite see how that could happen,
so a more verbose explanation would be appreciated.
Thanks,
Lukas
> Fixes: 9d573d19547b ("PCI: pciehp: Detect device replacement during system sleep")
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@xxxxxxxxxxxxx>
> ---
> drivers/pci/hotplug/pciehp_core.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
> index ff458e692fed..c1c3f7e2bc43 100644
> --- a/drivers/pci/hotplug/pciehp_core.c
> +++ b/drivers/pci/hotplug/pciehp_core.c
> @@ -330,8 +330,6 @@ static int pciehp_resume_noirq(struct pcie_device *dev)
> */
> if (pciehp_device_replaced(ctrl)) {
> ctrl_dbg(ctrl, "device replaced during system sleep\n");
> - pci_walk_bus(ctrl->pcie->port->subordinate,
> - pci_dev_set_disconnected, NULL);
> pciehp_request(ctrl, PCI_EXP_SLTSTA_PDC);
> }
> }
> --
> 2.43.0