RE: [PATCH 2/2] iommu/vt-d: Serialize SVA unbind teardown with intel_mm_release()

From: Tian, Kevin

Date: Thu Nov 12 2026 - 00:59:02 EST


> From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Sent: Wednesday, November 4, 2026 1:11 PM
>
> intel_mm_release() can run concurrently with an unbind of the same PASID.
> The unbind clears the Present bit, drops iommu->lock and then invalidates
> the PASID cache, IOTLB and device TLB:
>
> iommu_sva_unbind_device() exit_mmap()
> blocking_domain_set_dev_pasid() intel_mm_release()
> intel_pasid_tear_down_entry()
> pasid_clear_present()
> spin_unlock(&iommu->lock)
> intel_pasid_tear_down_entry()
> !present && !FPD -> return
> ... free page tables ...
> ... invalidate caches ...
>
> intel_mm_release() then returns before the invalidations complete, and
> exit_mmap() can free the page tables while the IOMMU and the device still
> hold translations that reference them.
>
> intel_mm_release() walks domain->dev_pasids and tears down each entry
> under domain->lock. Do the same in the blocking attach for an SVA domain:
> tear down the entry with fault_ignore under domain->lock, so that either
> intel_mm_release() completes the invalidations first, or it waits for the
> unbind to complete them.
>
> Fixes: 4f0bdab175d6 ("iommu/vt-d: Make the blocked domain support PASID")
> Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>