public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] PCI/IOV: Fix deadlock when removing PF with enabled SR-IOV
@ 2025-12-16 22:14 Niklas Schnelle
  2025-12-16 22:14 ` [PATCH v3 1/2] Revert "PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV" Niklas Schnelle
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Niklas Schnelle @ 2025-12-16 22:14 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Lukas Wunner, Keith Busch, Gerd Bayer, Matthew Rosato,
	Benjamin Block, Halil Pasic, Farhan Ali, Julian Ruess,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-pci,
	linux-kernel, Niklas Schnelle

Hi Bjorn,

Doing additional testing for a distribution backport of commit
05703271c3cd ("PCI/IOV: Add PCI rescan-remove locking when
enabling/disabling SR-IOV") Benjamin found a hang with s390's
recover attribute. Further investigation showed this to be a deadlock by
recursively trying to take pci_rescan_remove lock when removing a PF
with enabled SR-IOV.

The issue can be reproduced on both s390 and x86_64 with:

    $ echo <NUM> > /sys/bus/pci/devices/<pf>/sriov_numvfs
    $ echo 1 > /sys/bus/pci/devices/<pf>/remove

As this seems worse than the original, hard to hit, race fixed by the
cited commit I think we first want to revert the broken fix.

Following that patch 2 attempts to fix the original issue by taking the
PCI rescan/remove lock directly before calling into the driver's
sriov_configure() callback enforcing the rule that this should only
be called with the pci_rescan_remove_lock held.

Thanks,
Niklas

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Changes in v3:
- Rebased on v6.19-rc1, also verified issue is still there and the fix
  still works
- Added more of the lockdep splat for better context
- Link to v2: https://lore.kernel.org/r/20251119-revert_sriov_lock-v2-0-ea50eb1e8f96@linux.ibm.com

Changes in v2:
- Collected R-b from Benjamin
- Link to v1: https://lore.kernel.org/r/20251030-revert_sriov_lock-v1-0-70f82ade426f@linux.ibm.com

---
Niklas Schnelle (2):
      Revert "PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV"
      PCI/IOV: Fix race between SR-IOV enable/disable and hotplug

 drivers/pci/iov.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251029-revert_sriov_lock-aef4557f360f

Best regards,
-- 
Niklas Schnelle


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-03-17 17:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 22:14 [PATCH v3 0/2] PCI/IOV: Fix deadlock when removing PF with enabled SR-IOV Niklas Schnelle
2025-12-16 22:14 ` [PATCH v3 1/2] Revert "PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV" Niklas Schnelle
2025-12-16 22:14 ` [PATCH v3 2/2] PCI/IOV: Fix race between SR-IOV enable/disable and hotplug Niklas Schnelle
2026-03-17  1:57   ` Guenter Roeck
2026-03-17  9:01     ` Benjamin Block
2026-03-17  9:46       ` Benjamin Block
2026-03-17 11:33         ` Benjamin Block
2026-03-17 13:08           ` Lukas Wunner
2026-03-17 13:18             ` Lukas Wunner
2026-03-17 17:09               ` Benjamin Block
2026-02-01 15:56 ` [PATCH v3 0/2] PCI/IOV: Fix deadlock when removing PF with enabled SR-IOV Thorsten Leemhuis
2026-02-02 15:47   ` Niklas Schnelle
2026-02-03  0:48 ` Bjorn Helgaas
2026-02-23 14:10   ` Dragos Tatulea
2026-02-23 17:33     ` Benjamin Block
2026-02-23 18:34       ` Dragos Tatulea
2026-02-25 14:59         ` Dragos Tatulea
2026-02-25 18:32           ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox