Re: [PATCH v3 2/2] PCI: pciehp: Prevent deadlock on disconnect

From: Lukas Wunner
Date: Wed Nov 13 2019 - 01:35:25 EST


On Tue, Nov 12, 2019 at 09:17:52PM -0600, Bjorn Helgaas wrote:
> On Tue, Oct 29, 2019 at 08:00:22PM +0300, Mika Westerberg wrote:
> > parent PCIe downstream port, who got the hot-remove event, starts
> > removing devices below it taking pci_lock_rescan_remove() lock. When the
> > child PCIe port is runtime resumed it calls pciehp_check_presence()
> > which ends up calling pciehp_card_present() and pciehp_check_link_active().
>
> Oh, I see, pciehp_resume() calls pciehp_check_presence(), which
> schedules the IRQ thread via pciehp_request(). So does this deadlock
> only happen if the port(s) have been runtime suspended?

No, there is a multitude of situations when the deadlock may occur and
this is just one of them. See my comment on v1 of this patch:

https://patchwork.ozlabs.org/patch/1117870/#2230798

Thanks,

Lukas