public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix device_lock deadlock on two probe() paths
@ 2023-08-08 17:27 Jason Gunthorpe
  2023-08-08 17:27 ` [PATCH 1/3] iommu: Provide iommu_probe_device_locked() Jason Gunthorpe
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Jason Gunthorpe @ 2023-08-08 17:27 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Len Brown, linux-acpi, Rafael J. Wysocki,
	Robin Murphy, Will Deacon
  Cc: Lu Baolu, Kevin Tian, Marek Szyprowski, Chen-Yu Tsai

I missed two paths where __iommu_probe_device() can be called while
already holding the device_lock() for the device that is to be probed.

This causes a deadlock because __iommu_probe_device() will attempt to
re-acquire the lock.

Organize things so that these two paths can re-use the existing already
held device_lock by marking the call chains based on if the lock is held
or not.

This is an incremental on top of Joerg's next, but it could also be handled by
respinning the last patch in that series. Please let me know.

Jason Gunthorpe (3):
  iommu: Provide iommu_probe_device_locked()
  iommu: Pass in the iommu_device to probe for in bus_iommu_probe()
  iommu: Do not attempt to re-lock the iommu device when probing

 drivers/acpi/scan.c        |  5 ++--
 drivers/iommu/iommu.c      | 60 +++++++++++++++++++++++++++-----------
 drivers/iommu/of_iommu.c   |  2 +-
 drivers/iommu/omap-iommu.c | 12 ++++++--
 include/linux/iommu.h      |  6 +++-
 5 files changed, 61 insertions(+), 24 deletions(-)


base-commit: 8d3740021d5d461e1ec4c17fc5625b9b4237c2f8
-- 
2.41.0


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

end of thread, other threads:[~2023-08-09 14:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 17:27 [PATCH 0/3] Fix device_lock deadlock on two probe() paths Jason Gunthorpe
2023-08-08 17:27 ` [PATCH 1/3] iommu: Provide iommu_probe_device_locked() Jason Gunthorpe
2023-08-09  3:55   ` Tian, Kevin
2023-08-09  9:14   ` Joerg Roedel
2023-08-08 17:27 ` [PATCH 2/3] iommu: Pass in the iommu_device to probe for in bus_iommu_probe() Jason Gunthorpe
2023-08-09  3:57   ` Tian, Kevin
2023-08-08 17:27 ` [PATCH 3/3] iommu: Do not attempt to re-lock the iommu device when probing Jason Gunthorpe
2023-08-09  4:01   ` Tian, Kevin
2023-08-09 12:15     ` Jason Gunthorpe
2023-08-09 13:38       ` Marek Szyprowski
2023-08-09 14:33         ` Jason Gunthorpe
2023-08-08 20:18 ` [PATCH 0/3] Fix device_lock deadlock on two probe() paths Mark Brown
2023-08-08 22:26   ` Jason Gunthorpe
2023-08-09  6:37 ` Chen-Yu Tsai

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