[PATCH RFC v2] PCI: pciehp: Fix AB-BA deadlocks between reset_lock, pci_rescan_remove_lock and pci_slot_mutex
Lukas Wunner
lukas at wunner.de
Tue Dec 1 03:24:49 PST 2026
On Tue, Dec 01, 2026 at 02:29:15AM -0800, Qiang Yu wrote:
> On Sun, Nov 29, 2026 at 10:06:33PM +0100, Lukas Wunner wrote:
> > On Thu, Nov 26, 2026 at 12:26:45AM -0800, Qiang Yu wrote:
> > > A Root Port reset from link-down recovery takes them the other way
> > > round, pci_rescan_remove_lock -> reset_lock (the boot path, via
> > > pci_host_probe(), takes the same reverse order):
> > >
> > > qcom_pcie_global_irq_thread()
> > > pci_host_handle_link_down()
> > > pci_host_reset_root_port()
> > > pci_lock_rescan_remove() # pci_rescan_remove_lock
> > > pci_bus_error_reset()
> > > pci_reset_bridge()
> > > pci_slot_reset()
> > > pci_reset_hotplug_slot()
> > > pciehp_reset_slot() # down_write(reset_lock)
> >
> > Why is it necessary to lock rescan/remove for a reset?
> > This looks wrong. I suggest removing pci_lock_rescan_remove()
> > from pci_host_reset_root_port().
>
> It's needed because on qcom the reset goes through host->reset_root_port()
> -> qcom_pcie_reset_root_port() which powers down the PHY, disables clocks
> and regulators before re-training. So a concurrent bus scan would access
> config space and lead to NOC error in that window.
Doesn't that apply to *any* access to the devices during reset?
Why prevent a bus scan specifically?
If this is Qualcomm-specific, why is it in a generic helper?
If the Root Port is hotplug-capable, pciehp is prevented from
de-enumeration and re-enumeration by the mechanism introduced by
2af781a9edc4, so why acquire an extra lock to prevent the same thing?
I assume the NOC error causes an NMI? Shouldn't the NMI handler catch
that and handle it gracefully?
Thanks,
Lukas
More information about the linux-arm-kernel
mailing list