arm: tegra: iovmm: add tracing support for iovmm.
Krishna Reddy [Wed, 7 Nov 2012 00:46:27 +0000 (16:46 -0800)]
Change-Id: Iea1c776a66f35b10bb182220dab8db99ff5d4e64
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/161824
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>

arch/arm/mach-tegra/iovmm.c
include/trace/events/nvmap_iovmm.h [new file with mode: 0644]

index 488c6a6..b4675d6 100644 (file)
@@ -30,6 +30,9 @@
 
 #include <mach/iovmm.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/nvmap_iovmm.h>
+
 /*
  * after the best-fit block is located, the remaining pages not needed
  * for the allocation will be split into a new free block if the
@@ -512,6 +515,9 @@ struct tegra_iovmm_area *tegra_iovmm_create_vm(
        }
        up_read(&b->vm_area.domain->map_lock);
 
+       trace_tegra_iovmm_create_vm(current ? current->comm:"No process ctx",
+               iovmm_start(b), iovmm_end(b));
+
        return &b->vm_area;
 }
 
@@ -576,6 +582,10 @@ void tegra_iovmm_free_vm(struct tegra_iovmm_area *vm)
                return;
 
        b = container_of(vm, struct tegra_iovmm_block, vm_area);
+
+       trace_tegra_iovmm_free_vm(current ? current->comm:"No process ctx",
+               iovmm_start(b), iovmm_end(b));
+
        domain = vm->domain;
        down_read(&domain->map_lock);
        if (!test_and_clear_bit(BK_MAP_DIRTY, &b->flags))
diff --git a/include/trace/events/nvmap_iovmm.h b/include/trace/events/nvmap_iovmm.h
new file mode 100644 (file)
index 0000000..1a08fca
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * include/trace/events/nvmap.h
+ *
+ * NvMap event logging to ftrace.
+ *
+ * Copyright (c) 2012, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM nvmap_iovmm
+
+#if !defined(_TRACE_NVMAP_IOVMM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_NVMAP_IOVMM_H
+
+#include <linux/nvmap.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(tegra_iovmm_create_vm,
+       TP_PROTO(const char *name, u32 iova_start, u32 iova_end),
+
+       TP_ARGS(name, iova_start, iova_end),
+
+       TP_STRUCT__entry(
+               __field(const char *, name)
+               __field(u32, iova_start)
+               __field(u32, iova_end)
+       ),
+
+       TP_fast_assign(
+               __entry->name = name;
+               __entry->iova_start = iova_start;
+               __entry->iova_end = iova_end;
+       ),
+
+       TP_printk("name=%s, iova_start=0x%x, iova_end=0x%x",
+               __entry->name, __entry->iova_start, __entry->iova_end)
+);
+
+TRACE_EVENT(tegra_iovmm_free_vm,
+       TP_PROTO(const char *name, u32 iova_start, u32 iova_end),
+
+       TP_ARGS(name, iova_start, iova_end),
+
+       TP_STRUCT__entry(
+               __field(const char *, name)
+               __field(u32, iova_start)
+               __field(u32, iova_end)
+       ),
+
+       TP_fast_assign(
+               __entry->name = name;
+               __entry->iova_start = iova_start;
+               __entry->iova_end = iova_end;
+       ),
+
+       TP_printk("name=%s, iova_start=0x%x, iova_end=0x%x",
+               __entry->name, __entry->iova_start, __entry->iova_end)
+);
+
+#endif /* _TRACE_NVMAP_IOVMM_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>