On Mon, Jun 15, 2020 at 08:56:50PM +0200, Lukas Wunner wrote: > On Mon, Jun 15, 2020 at 09:32:49AM -0500, Ian May wrote: > > Currently when a hotplug interrupt and AER recovery triggers simultaneously > > the following deadlock can occur. > > > > Hotplug AER > > ---------------------------- --------------------------- > > device_lock(&dev->dev) down_write(&ctrl->reset_lock) > > down_read(&ctrl->reset_lock) device_lock(&dev->dev) > > > > This patch adds a reset_lock and reset_unlock hotplug_slot_op. > > This would allow the controller reset_lock/reset_unlock to be moved > > from pciehp_reset_slot to pci_slot_reset function allowing the controller > > reset_lock to be acquired before the device lock allowing for both hotplug > > and AER to grab the reset_lock and device lock in proper order. > > I've posted a patch to address such issues on Mar 31, just haven't > gotten around to respin it with a proper commit message: > > https://lore.kernel.org/linux-pci/20200331130139.46oxbade6rcbaicb@xxxxxxxxx/ > > I've solved it by moving the reset lock into struct pci_slot. > I think that's simpler than adding two callbacks. > > Do you think the AER deadlock could be fixed based on my approach? How should we proceed on this?