Re: [PATCH net v2] net/mlx5: Avoid deadlock between PCI error recovery and health reporter
From: Gerd Bayer
Date: Wed Oct 08 2025 - 12:47:19 EST
On Tue, 2025-10-07 at 13:21 -0300, Jason Gunthorpe wrote:
> On Tue, Oct 07, 2025 at 04:48:26PM +0200, Gerd Bayer wrote:
> > - task: kmcheck
> > mlx5_unload_one() tries to acquire devlink lock while the PCI
> > error
> > recovery code has set pdev->block_cfg_access by way of
> > pci_cfg_access_lock()
>
> This seems wrong, arch code shouldn't invoke the driver's error
> handler while hodling pci_dev_lock().
Seeing how powerpc's EEH is also just acquiring the device_lock while
executing the PCI error recovery call-back, I'll be investigating that
route by "demoting" pci_dev_lock() to device_lock() (i.e. not including
the blockage of PCI config accesses)
Initial tests look promising, but I need to do more experimenting and
want to check the AER path in passing, too.
> Or at least if we do want to do this the locking should be documented
> and some lockdep map should be added to pci_cfg_access_lock() and the
> normal AER path..
This change of contract sounds a lot more intrusive to device drivers -
so I'm not actually pursuing this.
>
> Jason
Thanks, Gerd