Re: [PATCH 1/2] Revert "PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV"

From: Benjamin Block

Date: Fri Nov 07 2025 - 05:54:50 EST


On Thu, Oct 30, 2025 at 11:26:01AM +0100, Niklas Schnelle wrote:
> This reverts commit 05703271c3cd ("PCI/IOV: Add PCI rescan-remove
> locking when enabling/disabling SR-IOV") which causes a deadlock by
> recursively taking pci_rescan_remove_lock when sriov_del_vfs() is called
> as part of pci_stop_and_remove_bus_device(). For example with the
> following sequence of commands:
>
> $ echo <NUM> > /sys/bus/pci/devices/<pf>/sriov_numvfs
> $ echo 1 > /sys/bus/pci/devices/<pf>/remove
>
> A trimmed trace of the deadlock on a mlx5 device is as below:
>
> mutex_lock_nested+0x3c/0x50
> sriov_disable+0x34/0x140
> mlx5_sriov_disable+0x50/0x80 [mlx5_core]
> remove_one+0x5e/0xf0 [mlx5_core]
> pci_device_remove+0x3c/0xa0
> device_release_driver_internal+0x18e/0x280
> pci_stop_bus_device+0x82/0xa0
> pci_stop_and_remove_bus_device_locked+0x5e/0x80
> remove_store+0x72/0x90
>
> This is not a complete fix as it restores the issue the cited commit
> tried to solve.
>

Reviewed-by: Benjamin Block <bblock@xxxxxxxxxxxxx>

--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt / Geschäftsführung: David Faller
Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294