Skip to content

Commit 16a75bb

Browse files
Jacob Panjoergroedel
authored andcommitted
iommu/vt-d: Avoid superfluous IOTLB tracking in lazy mode
Intel IOMMU driver implements IOTLB flush queue with domain selective or PASID selective invalidations. In this case there's no need to track IOVA page range and sync IOTLBs, which may cause significant performance hit. This patch adds a check to avoid IOVA gather page and IOTLB sync for the lazy path. The performance difference on Sapphire Rapids 100Gb NIC is improved by the following (as measured by iperf send): w/o this fix~48 Gbits/s. with this fix ~54 Gbits/s Cc: <[email protected]> Fixes: 2a2b8ea ("iommu: Handle freelists when using deferred flushing in iommu drivers") Reviewed-by: Robin Murphy <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Tested-by: Sanjay Kumar <[email protected]> Signed-off-by: Sanjay Kumar <[email protected]> Signed-off-by: Jacob Pan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 60b1daa commit 16a75bb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4348,7 +4348,12 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain,
43484348
if (dmar_domain->max_addr == iova + size)
43494349
dmar_domain->max_addr = iova;
43504350

4351-
iommu_iotlb_gather_add_page(domain, gather, iova, size);
4351+
/*
4352+
* We do not use page-selective IOTLB invalidation in flush queue,
4353+
* so there is no need to track page and sync iotlb.
4354+
*/
4355+
if (!iommu_iotlb_gather_queued(gather))
4356+
iommu_iotlb_gather_add_page(domain, gather, iova, size);
43524357

43534358
return size;
43544359
}

0 commit comments

Comments
 (0)