summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@citrix.com>2013-09-04 22:11:05 +0200
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-10-02 18:53:26 +0200
commit2b2b614dd24e4e6474fcf2dcf69c95c908838959 (patch)
tree9874899c477d237e1ec207834fc730c1151088f5 /lib
parentxen/hvc: If we use xen_raw_printk let it also work on HVM guests. (diff)
downloadlinux-2b2b614dd24e4e6474fcf2dcf69c95c908838959.tar.xz
linux-2b2b614dd24e4e6474fcf2dcf69c95c908838959.zip
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 'lib')
-rw-r--r--lib/swiotlb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 4e8686c7e5a4..f0d841907da6 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -38,6 +38,8 @@
#include <linux/bootmem.h>
#include <linux/iommu-helper.h>
+#include <trace/events/swiotlb.h>
+
#define OFFSET(val,align) ((unsigned long) \
( (val) & ( (align) - 1)))
@@ -726,6 +728,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
return dev_addr;
+ trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
+
/* Oh well, have to allocate and map a bounce buffer. */
map = map_single(dev, phys, size, dir);
if (map == SWIOTLB_MAP_ERROR) {