video: tegra: nvmap: Use trace points in NvMap.
Krishna Reddy [Tue, 5 Jun 2012 17:18:13 +0000 (10:18 -0700)]
Change-Id: I2a5f0c9305bd53c42df181556d97efa5d6792ad7
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/106500
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bo Yan <byan@nvidia.com>

drivers/video/tegra/nvmap/nvmap_dev.c
drivers/video/tegra/nvmap/nvmap_handle.c
drivers/video/tegra/nvmap/nvmap_ioctl.c

index 9ecce7e..aed98f5 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
+#include <linux/nvmap.h>
 
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 
 #include <mach/iovmm.h>
-#include <linux/nvmap.h>
+
+#define CREATE_TRACE_POINTS
+#include <trace/events/nvmap.h>
 
 #include "nvmap.h"
 #include "nvmap_ioctl.h"
@@ -761,6 +764,7 @@ static int nvmap_open(struct inode *inode, struct file *filp)
        priv = nvmap_create_client(dev, "user");
        if (!priv)
                return -ENOMEM;
+       trace_nvmap_open(priv);
 
        priv->super = (filp->f_op == &nvmap_super_fops);
 
@@ -772,6 +776,7 @@ static int nvmap_open(struct inode *inode, struct file *filp)
 
 static int nvmap_release(struct inode *inode, struct file *filp)
 {
+       trace_nvmap_release(filp->private_data);
        nvmap_client_put(filp->private_data);
        return 0;
 }
index 56e2dab..0cdac92 100644 (file)
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
+#include <linux/shrinker.h>
+#include <linux/moduleparam.h>
+#include <linux/nvmap.h>
 
 #include <asm/cacheflush.h>
 #include <asm/outercache.h>
 #include <asm/pgtable.h>
 
 #include <mach/iovmm.h>
-#include <linux/nvmap.h>
+#include <trace/events/nvmap.h>
 
-#include <linux/shrinker.h>
-#include <linux/moduleparam.h>
 #include "nvmap.h"
 #include "nvmap_mru.h"
 #include "nvmap_common.h"
@@ -737,6 +738,7 @@ int nvmap_alloc_handle_id(struct nvmap_client *client,
        if (h->alloc)
                goto out;
 
+       trace_nvmap_alloc_handle_id(client, id, heap_mask, align, flags);
        h->userflags = flags;
        nr_page = ((h->size + PAGE_SIZE - 1) >> PAGE_SHIFT);
        h->secure = !!(flags & NVMAP_HANDLE_SECURE);
@@ -819,6 +821,7 @@ void nvmap_free_handle_id(struct nvmap_client *client, unsigned long id)
                return;
        }
 
+       trace_nvmap_free_handle_id(client, id);
        BUG_ON(!ref->handle);
        h = ref->handle;
 
@@ -919,6 +922,7 @@ struct nvmap_handle_ref *nvmap_create_handle(struct nvmap_client *client,
        ref->handle = h;
        atomic_set(&ref->pin, 0);
        add_handle_ref(client, ref);
+       trace_nvmap_create_handle(client, h, size, ref);
        return ref;
 }
 
@@ -992,5 +996,6 @@ struct nvmap_handle_ref *nvmap_duplicate_handle_id(struct nvmap_client *client,
        ref->handle = h;
        atomic_set(&ref->pin, 0);
        add_handle_ref(client, ref);
+       trace_nvmap_duplicate_handle_id(client, id, ref);
        return ref;
 }
index 7a10231..44f00d2 100644 (file)
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/nvmap.h>
 
 #include <asm/cacheflush.h>
 #include <asm/outercache.h>
 #include <asm/tlbflush.h>
 
 #include <mach/iovmm.h>
-#include <linux/nvmap.h>
+#include <trace/events/nvmap.h>
 
 #include "nvmap_ioctl.h"
 #include "nvmap.h"
@@ -83,6 +84,7 @@ int nvmap_ioctl_pinop(struct file *filp, bool is_pin, void __user *arg)
                on_stack[0] = (unsigned long)op.handles;
        }
 
+       trace_nvmap_ioctl_pinop(filp->private_data, is_pin, op.count, refs);
        if (is_pin)
                err = nvmap_pin_ids(filp->private_data, op.count, refs);
        else
@@ -234,6 +236,8 @@ int nvmap_map_into_caller_ptr(struct file *filp, void __user *arg)
        if (!h)
                return -EPERM;
 
+       trace_nvmap_map_into_caller_ptr(client, h, op.offset,
+                                       op.length, op.flags);
        down_read(&current->mm->mmap_sem);
 
        vma = find_vma(current->mm, op.addr);
@@ -409,6 +413,9 @@ int nvmap_ioctl_rw_handle(struct file *filp, int is_read, void __user* arg)
 
        nvmap_usecount_inc(h);
 
+       trace_nvmap_ioctl_rw_handle(client, h, is_read, op.offset,
+                                   op.addr, op.hmem_stride,
+                                   op.user_stride, op.elem_size, op.count);
        copied = rw_handle(client, h, is_read, op.offset,
                           (unsigned long)op.addr, op.hmem_stride,
                           op.user_stride, op.elem_size, op.count);
@@ -582,6 +589,7 @@ static int cache_maint(struct nvmap_client *client, struct nvmap_handle *h,
                goto out;
        }
 
+       trace_cache_maint(client, h, start, end, op);
        wmb();
        if (h->flags == NVMAP_HANDLE_UNCACHEABLE ||
            h->flags == NVMAP_HANDLE_WRITE_COMBINE || start == end)