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

From: Baolu Lu
Date: Tue Oct 18 2022 - 20:55:55 EST


On 9/27/22 1:31 PM, Lu Baolu wrote:
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

Patches has been queued for v6.1.

https://lore.kernel.org/linux-iommu/20221019004447.4563-1-baolu.lu@xxxxxxxxxxxxxxx/

Best regards,
baolu