* [RFC][PATCH] iommu/dma: Do not call swiotlb tracepoint when not defined
@ 2025-06-11 0:24 Steven Rostedt
2025-06-11 3:26 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2025-06-11 0:24 UTC (permalink / raw)
To: LKML; +Cc: Robin Murphy, Joerg Roedel, Will Deacon, iommu
I'm working on code that will warn when a tracepoint is defined but not
used. As the TRACE_EVENT() logic still creates all the code regardless if
something calls the trace_<event>() function. It wastes around 5K per trace
event (less for tracepoints).
But it seems that the code in drivers/iommu/dma-iommu.c does the opposite.
It calls the trace_swiotlb_bounced() tracepoint without it being defined.
The tracepoint is defined in kernel/dma/swiotlb.c when CONFIG_SWIOTLB is
defined, but this code exists when that config is not defined.
This now fails with my work because I have all the callers reference the
tracepoint that they will call.
Thanks to the kernel test robot, it found this:
https://lore.kernel.org/all/202506091015.7zd87kI7-lkp@intel.com/
Currently, I made this patch and it makes it build. But I don't like the
patch. It's in the middle of a function that has a lot of things called
swiotlb which seems like the #ifdef should be around much more than the
tracepoint hook that has no tracepoint attached to it.
Hopefully someone else can make a proper patch. I will be pushing my work
to linux-next during this cycle.
Not-signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index ea2ef53bd4fe..7c0ada27e66f 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1153,8 +1153,9 @@ static phys_addr_t iommu_dma_map_swiotlb(struct device *dev, phys_addr_t phys,
return (phys_addr_t)DMA_MAPPING_ERROR;
}
+#ifdef CONFIG_SWIOTLB
trace_swiotlb_bounced(dev, phys, size);
-
+#endif
phys = swiotlb_tbl_map_single(dev, phys, size, iova_mask(iovad), dir,
attrs);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC][PATCH] iommu/dma: Do not call swiotlb tracepoint when not defined
2025-06-11 0:24 [RFC][PATCH] iommu/dma: Do not call swiotlb tracepoint when not defined Steven Rostedt
@ 2025-06-11 3:26 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2025-06-11 3:26 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Robin Murphy, Joerg Roedel, Will Deacon, iommu
On Tue, Jun 10, 2025 at 08:24:57PM -0400, Steven Rostedt wrote:
> Hopefully someone else can make a proper patch. I will be pushing my work
> to linux-next during this cycle.
Just move the trace point into swiotlb_tbl_map_single.
Note that the current callers can't agree if they want to trace the
physical or dma address, so that'll force standardize that as well.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-11 3:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 0:24 [RFC][PATCH] iommu/dma: Do not call swiotlb tracepoint when not defined Steven Rostedt
2025-06-11 3:26 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox