video: tegra: nvmap: Add pin, unpin trace events
Krishna Reddy [Thu, 11 Oct 2012 02:05:23 +0000 (19:05 -0700)]
Change-Id: I62deda9d607476e3dc82428b872ad1a3e396e37e
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/143421
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

drivers/video/tegra/nvmap/nvmap.c
include/trace/events/nvmap.h

index 5209c41..c78aad4 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <mach/iovmm.h>
 #include <linux/nvmap.h>
+#include <trace/events/nvmap.h>
 
 #include "nvmap.h"
 #include "nvmap_mru.h"
@@ -86,6 +87,7 @@ static int pin_locked(struct nvmap_client *client, struct nvmap_handle *h)
                        h->pgalloc.area = area;
                }
        }
+       trace_handle_pin(client, h, atomic_read(&h->pin));
        nvmap_mru_unlock(client->share);
        return 0;
 }
@@ -99,6 +101,7 @@ static int handle_unpin(struct nvmap_client *client,
        nvmap_mru_lock(client->share);
 
        if (atomic_read(&h->pin) == 0) {
+               trace_handle_unpin_error(client, h, atomic_read(&h->pin));
                nvmap_err(client, "%s unpinning unpinned handle %p\n",
                          current->group_leader->comm, h);
                nvmap_mru_unlock(client->share);
@@ -124,6 +127,7 @@ static int handle_unpin(struct nvmap_client *client,
                }
        }
 
+       trace_handle_unpin(client, h, atomic_read(&h->pin));
        nvmap_mru_unlock(client->share);
        nvmap_handle_put(h);
        return ret;
index d42ae8d..3ee2f5d 100644 (file)
@@ -298,6 +298,55 @@ TRACE_EVENT(nvmap_ioctl_pinop,
 );
 
 
+DECLARE_EVENT_CLASS(pin_unpin,
+       TP_PROTO(struct nvmap_client *client,
+                struct nvmap_handle *h,
+                u32 pin_count
+       ),
+
+       TP_ARGS(client, h, pin_count),
+
+       TP_STRUCT__entry(
+               __field(struct nvmap_client *, client)
+               __field(struct nvmap_handle *, h)
+               __field(u32, pin_count)
+       ),
+
+       TP_fast_assign(
+               __entry->client = client;
+               __entry->h = h;
+               __entry->pin_count = pin_count;
+       ),
+
+       TP_printk("client=%p, name=%s, h=%p, pin_count=%d",
+               __entry->client, __entry->client->name,
+               __entry->h, __entry->pin_count)
+);
+
+DEFINE_EVENT(pin_unpin, handle_pin,
+       TP_PROTO(struct nvmap_client *client,
+                struct nvmap_handle *h,
+                u32 pin_count
+       ),
+       TP_ARGS(client, h, pin_count)
+);
+
+DEFINE_EVENT(pin_unpin, handle_unpin,
+       TP_PROTO(struct nvmap_client *client,
+                struct nvmap_handle *h,
+                u32 pin_count
+       ),
+       TP_ARGS(client, h, pin_count)
+);
+
+DEFINE_EVENT(pin_unpin, handle_unpin_error,
+       TP_PROTO(struct nvmap_client *client,
+                struct nvmap_handle *h,
+                u32 pin_count
+       ),
+       TP_ARGS(client, h, pin_count)
+);
+
 #endif /* _TRACE_NVMAP_H */
 
 /* This part must be outside protection */