diff options
| author | Zoltan Kiss <zoltan.kiss@citrix.com> | 2013-09-04 16:11:05 -0400 |
|---|---|---|
| committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-10-02 12:53:26 -0400 |
| commit | 2b2b614dd24e4e6474fcf2dcf69c95c908838959 (patch) | |
| tree | 9874899c477d237e1ec207834fc730c1151088f5 /include/trace | |
| parent | 04b772d2b819f0dda2163e3193fa7cd447a6245c (diff) | |
tracing/events: Add bounce tracing to swiotbl
Ftrace is currently not able to detect when SWIOTLB has to do double buffering.
Under Xen you can only see it indirectly in function_graph, when
xen_swiotlb_map_page() doesn't stop after range_straddles_page_boundary(), but
calls spinlock functions, memcpy() and xen_phys_to_bus() as well. This patch
introduces the swiotlb:swiotlb_bounced event, which also prints out the
following informations to help you find out why bouncing happened:
dev_name: 0000:08:00.0 dma_mask=ffffffffffffffff dev_addr=9149f000 size=32768
swiotlb_force=0
If you use Xen, and (dev_addr + size + 1) > dma_mask, the buffer is out of the
device's DMA range. If swiotlb_force == 1, you should really change the kernel
parameters. Otherwise, the buffer is not contiguous in mfn space.
Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
[v1: Don't print 'swiotlb_force=X', just print swiotlb_force if it is enabled]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/trace')
| -rw-r--r-- | include/trace/events/swiotlb.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/trace/events/swiotlb.h b/include/trace/events/swiotlb.h new file mode 100644 index 000000000000..7ea4c5e7c448 --- /dev/null +++ b/include/trace/events/swiotlb.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM swiotlb | ||
| 3 | |||
| 4 | #if !defined(_TRACE_SWIOTLB_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_SWIOTLB_H | ||
| 6 | |||
| 7 | #include <linux/tracepoint.h> | ||
| 8 | |||
| 9 | TRACE_EVENT(swiotlb_bounced, | ||
| 10 | |||
| 11 | TP_PROTO(struct device *dev, | ||
| 12 | dma_addr_t dev_addr, | ||
| 13 | size_t size, | ||
| 14 | int swiotlb_force), | ||
| 15 | |||
| 16 | TP_ARGS(dev, dev_addr, size, swiotlb_force), | ||
| 17 | |||
| 18 | TP_STRUCT__entry( | ||
| 19 | __string( dev_name, dev_name(dev) ) | ||
| 20 | __field( u64, dma_mask ) | ||
| 21 | __field( dma_addr_t, dev_addr ) | ||
| 22 | __field( size_t, size ) | ||
| 23 | __field( int, swiotlb_force ) | ||
| 24 | ), | ||
| 25 | |||
| 26 | TP_fast_assign( | ||
| 27 | __assign_str(dev_name, dev_name(dev)); | ||
| 28 | __entry->dma_mask = (dev->dma_mask ? *dev->dma_mask : 0); | ||
| 29 | __entry->dev_addr = dev_addr; | ||
| 30 | __entry->size = size; | ||
| 31 | __entry->swiotlb_force = swiotlb_force; | ||
| 32 | ), | ||
| 33 | |||
| 34 | TP_printk("dev_name: %s dma_mask=%llx dev_addr=%llx " | ||
| 35 | "size=%zu %s", | ||
| 36 | __get_str(dev_name), | ||
| 37 | __entry->dma_mask, | ||
| 38 | (unsigned long long)__entry->dev_addr, | ||
| 39 | __entry->size, | ||
| 40 | __entry->swiotlb_force ? "swiotlb_force" : "" ) | ||
| 41 | ); | ||
| 42 | |||
| 43 | #endif /* _TRACE_SWIOTLB_H */ | ||
| 44 | |||
| 45 | /* This part must be outside protection */ | ||
| 46 | #include <trace/define_trace.h> | ||
