Skip to content

iommu/vt-d: Fix lockdep splat in intel_iommu_init()

Lu Baolu linux-iommu lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iommu: Add gfp parameter to iommu_alloc_resv_regiondrivers/acpi/arm64/iort.c drivers/iommu/amd/iommu.c drivers/iommu/apple-dart.c +7 more+27 -180 replies
2/2iommu/vt-d: Use rcu_lock in get_resv_regionsdrivers/iommu/intel/iommu.c+3 -30 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchAlex Williamson
SeriesT-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] iommu/vt-d: Fix lockdep splat in intel_iommu_init()

Hi folks,

As commit c919739ce472 ("iommu/vt-d: Handle race between registration and device probe") highlights, a lockdep splat issue happens after moving iommu probing device process into iommu_device_register().

This is due to a conflict that get_resv_regions wants hold the dmar_global_lock, but it's also possible to be called from within a section where intel_iommu_init() already holds the lock.

Historically, before commit 5f64ce5411b46 ("iommu/vt-d: Duplicate iommu_resv_region objects per device list"), the rcu_lock is used in get_resv_regions. This commit converted it to dmar_global_lock in order to allowing sleeping in iommu_alloc_resv_region().

This aims to fix the lockdep issue by making iommu_alloc_resv_region() available in critical section and rolling dmar_global_lock back to rcu lock in get_resv_regions of the Intel IOMMU driver.

Best regards,
baolu

Lu Baolu (2):
iommu: Add gfp parameter to iommu_alloc_resv_region iommu/vt-d: Use rcu_lock in get_resv_regions

 include/linux/iommu.h                       |  2 +-
 drivers/acpi/arm64/iort.c                   |  3 ++-
 drivers/iommu/amd/iommu.c                   |  7 ++++---
 drivers/iommu/apple-dart.c                  |  2 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  2 +-
 drivers/iommu/arm/arm-smmu/arm-smmu.c       |  2 +-
 drivers/iommu/intel/iommu.c                 | 12 +++++++-----
 drivers/iommu/iommu.c                       |  7 ++++---
 drivers/iommu/mtk_iommu.c                   |  3 ++-
 drivers/iommu/virtio-iommu.c                |  9 ++++++---
 10 files changed, 29 insertions(+), 20 deletions(-)
Signature · 1 line
2.34.1