]> Git Repo - J-linux.git/commitdiff
iommu/dma: Trace bounce buffer usage when mapping buffers
authorIsaac J. Manjarres <[email protected]>
Fri, 8 Dec 2023 23:41:40 +0000 (15:41 -0800)
committerJoerg Roedel <[email protected]>
Fri, 15 Dec 2023 08:04:16 +0000 (09:04 +0100)
When commit 82612d66d51d ("iommu: Allow the dma-iommu api to
use bounce buffers") was introduced, it did not add the logic
for tracing the bounce buffer usage from iommu_dma_map_page().

All of the users of swiotlb_tbl_map_single() trace their bounce
buffer usage, except iommu_dma_map_page(). This makes it difficult
to track SWIOTLB usage from that function. Thus, trace bounce buffer
usage from iommu_dma_map_page().

Fixes: 82612d66d51d ("iommu: Allow the dma-iommu api to use bounce buffers")
Cc: [email protected] # v5.15+
Cc: Tom Murphy <[email protected]>
Cc: Lu Baolu <[email protected]>
Cc: Saravana Kannan <[email protected]>
Signed-off-by: Isaac J. Manjarres <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
drivers/iommu/dma-iommu.c

index 85163a83df2f68f94a23c48731c45e755bf625bd..037fcf826407f4868517ab8841e47e816652a762 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/spinlock.h>
 #include <linux/swiotlb.h>
 #include <linux/vmalloc.h>
+#include <trace/events/swiotlb.h>
 
 #include "dma-iommu.h"
 
@@ -1156,6 +1157,8 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
                        return DMA_MAPPING_ERROR;
                }
 
+               trace_swiotlb_bounced(dev, phys, size);
+
                aligned_size = iova_align(iovad, size);
                phys = swiotlb_tbl_map_single(dev, phys, size, aligned_size,
                                              iova_mask(iovad), dir, attrs);
This page took 0.056084 seconds and 4 git commands to generate.