From: Keith Busch <kbusch@xxxxxxxxxx> This patch set targets a subset of pci bus scanning and removals that were shown to be problematic with deep pci topologies that support native hotplug. I've tried to capture the common pci components, but there are definitely many subsystems accessing the topology in their own way, many of which I can't possibly test, and I have not tried to convert every user to this new locking scheme. However, if I did this correctly, they should be no worse off than today! The earlier patches are just cleanups and/or making it a little easier to change the locking schemes. The real stuff happens from patches 7 and 8. I've run this with lockdep enabled, tested concurrent hotplug events on various x86 platforms with layers of pci switches. That said, as mentioned earlier, there are many paths to here that I haven't been able to test, so the final patch might be considered experimental. Manual concurrent concurrent device removals is still broken. I've sent a different patch for that here, but it does not sound like it is acceptable: https://lore.kernel.org/linux-pci/20240719185513.3376321-1-kbusch@xxxxxxxx/T/#u Keith Busch (8): pci: make pci_stop_dev concurrent safe pci: make pci_destroy_dev concurrent safe pci: move the walk bus lock to where its needed pci: walk bus recursively pci: unexport pci_walk_bus_locked pci: add helpers for stop and remove bus pci: reference count subordinate pci: use finer grain locking for bus protection drivers/pci/bus.c | 70 ++++++++++++------------- drivers/pci/hotplug/pciehp_pci.c | 21 +++++--- drivers/pci/pci-sysfs.c | 2 + drivers/pci/pci.c | 31 ++++++++--- drivers/pci/pci.h | 16 +++++- drivers/pci/pcie/aspm.c | 7 ++- drivers/pci/probe.c | 16 +++++- drivers/pci/remove.c | 90 +++++++++++++++++++------------- include/linux/pci.h | 11 ++++ 9 files changed, 175 insertions(+), 89 deletions(-) -- 2.43.0