]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iommu: Change trace unmap api to report unmapped size
authorShuah Khan <shuahkh@osg.samsung.com>
Sat, 17 Jan 2015 03:53:17 +0000 (20:53 -0700)
committerJoerg Roedel <jroedel@suse.de>
Mon, 19 Jan 2015 14:19:31 +0000 (15:19 +0100)
Currently map and unmap are implemented as events under a
common trace class declaration. The common class forces
trace_unmap() to require a bogus physical address argument
that it doesn't use. Changing unmap to report unmapped size
will provide useful information for debugging. Remove common
map_unmap trace class and change map and unmap into separate
events as opposed to events under the same class to allow for
differences in the reporting information. In addition, map and
unmap are changed to handle size value as size_t instead of int
to match the passed size value and avoid overflow.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c
include/trace/events/iommu.h

index d4c3db5abf25a5b55a84772770711db7f75594de..3a4fb6274c99395d0a57d9dca56d9c786ef931fb 100644 (file)
@@ -1134,7 +1134,7 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
                unmapped += unmapped_page;
        }
 
-       trace_unmap(orig_iova, 0, size);
+       trace_unmap(orig_iova, size, unmapped);
        return unmapped;
 }
 EXPORT_SYMBOL_GPL(iommu_unmap);
index a8f5c32d174b734aad34f1529933fa5addbd317c..2c7befb10f13e3b0175385e501e40ddedaab9094 100644 (file)
@@ -83,7 +83,7 @@ DEFINE_EVENT(iommu_device_event, detach_device_from_domain,
        TP_ARGS(dev)
 );
 
-DECLARE_EVENT_CLASS(iommu_map_unmap,
+TRACE_EVENT(map,
 
        TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
 
@@ -92,7 +92,7 @@ DECLARE_EVENT_CLASS(iommu_map_unmap,
        TP_STRUCT__entry(
                __field(u64, iova)
                __field(u64, paddr)
-               __field(int, size)
+               __field(size_t, size)
        ),
 
        TP_fast_assign(
@@ -101,26 +101,31 @@ DECLARE_EVENT_CLASS(iommu_map_unmap,
                __entry->size = size;
        ),
 
-       TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=0x%x",
+       TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=%zu",
                        __entry->iova, __entry->paddr, __entry->size
        )
 );
 
-DEFINE_EVENT(iommu_map_unmap, map,
+TRACE_EVENT(unmap,
 
-       TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
-
-       TP_ARGS(iova, paddr, size)
-);
+       TP_PROTO(unsigned long iova, size_t size, size_t unmapped_size),
 
-DEFINE_EVENT_PRINT(iommu_map_unmap, unmap,
+       TP_ARGS(iova, size, unmapped_size),
 
-       TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
+       TP_STRUCT__entry(
+               __field(u64, iova)
+               __field(size_t, size)
+               __field(size_t, unmapped_size)
+       ),
 
-       TP_ARGS(iova, paddr, size),
+       TP_fast_assign(
+               __entry->iova = iova;
+               __entry->size = size;
+               __entry->unmapped_size = unmapped_size;
+       ),
 
-       TP_printk("IOMMU: iova=0x%016llx size=0x%x",
-                       __entry->iova, __entry->size
+       TP_printk("IOMMU: iova=0x%016llx size=%zu unmapped_size=%zu",
+                       __entry->iova, __entry->size, __entry->unmapped_size
        )
 );