public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] iommu/dma: Trace bounce buffer usage when mapping buffers
@ 2023-12-08 23:41 Isaac J. Manjarres
  2023-12-15  8:04 ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Isaac J. Manjarres @ 2023-12-08 23:41 UTC (permalink / raw)
  To: Robin Murphy, Joerg Roedel, Will Deacon, Tom Murphy, Lu Baolu
  Cc: Isaac J. Manjarres, stable, Saravana Kannan, kernel-team, iommu,
	linux-kernel

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: stable@vger.kernel.org # v5.15+
Cc: Tom Murphy <murphyt7@tcd.ie>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
---
 drivers/iommu/dma-iommu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 85163a83df2f..037fcf826407 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -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);
-- 
2.43.0.472.g3155946c3a-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] iommu/dma: Trace bounce buffer usage when mapping buffers
  2023-12-08 23:41 [PATCH v1] iommu/dma: Trace bounce buffer usage when mapping buffers Isaac J. Manjarres
@ 2023-12-15  8:04 ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2023-12-15  8:04 UTC (permalink / raw)
  To: Isaac J. Manjarres
  Cc: Robin Murphy, Will Deacon, Tom Murphy, Lu Baolu, stable,
	Saravana Kannan, kernel-team, iommu, linux-kernel

On Fri, Dec 08, 2023 at 03:41:40PM -0800, Isaac J. Manjarres wrote:
>  drivers/iommu/dma-iommu.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-15  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-08 23:41 [PATCH v1] iommu/dma: Trace bounce buffer usage when mapping buffers Isaac J. Manjarres
2023-12-15  8:04 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox