nvmap: expose refs, dupes, pins in debugfs
Kirill Artamonov [Tue, 23 Oct 2012 11:34:48 +0000 (14:34 +0300)]
Expose data needed for debugging memory leaks in nvmap.

Change-Id: I7011ea63eceb6a2de9cd8363c78555dee680ae04
Signed-off-by: Kirill Artamonov <kartamonov@nvidia.com>
Reviewed-on: http://git-master/r/171178
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Antoine Chauveau <achauveau@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>

drivers/video/tegra/nvmap/nvmap_dev.c

index bdb0f8b..2545cb4 100644 (file)
@@ -1027,9 +1027,14 @@ static void allocations_stringify(struct nvmap_client *client,
                if (handle->alloc && handle->heap_pgalloc == iovmm) {
                        phys_addr_t base = iovmm ? 0 :
                                           (handle->carveout->base);
-                       seq_printf(s, "%-18s %-18s %8llx %10u %8x\n", "", "",
-                                       (unsigned long long)base,
-                                       handle->size, handle->userflags);
+                       seq_printf(s,
+                               "%-18s %-18s %8llx %10u %8x %6u %6u %6u\n",
+                               "", "",
+                               (unsigned long long)base, handle->size,
+                               handle->userflags,
+                               atomic_read(&handle->ref),
+                               atomic_read(&ref->dupes),
+                               atomic_read(&ref->pin));
                }
        }
 }
@@ -1042,10 +1047,11 @@ static int nvmap_debug_allocations_show(struct seq_file *s, void *unused)
        unsigned int total = 0;
 
        spin_lock_irqsave(&node->clients_lock, flags);
-       seq_printf(s, "%-18s %18s %8s %10s %8s\n", "CLIENT", "PROCESS", "PID",
-               "SIZE", "FLAGS");
-       seq_printf(s, "%-18s %18s %8s %10s\n", "", "",
-                                       "BASE", "SIZE");
+       seq_printf(s, "%-18s %18s %8s %10s\n",
+               "CLIENT", "PROCESS", "PID", "SIZE");
+       seq_printf(s, "%-18s %18s %8s %10s %8s %6s %6s %6s\n",
+                       "", "", "BASE", "SIZE", "FLAGS", "REFS",
+                       "DUPES", "PINS");
        list_for_each_entry(commit, &node->clients, list) {
                struct nvmap_client *client =
                        get_client_from_carveout_commit(node, commit);
@@ -1151,10 +1157,11 @@ static int nvmap_debug_iovmm_allocations_show(struct seq_file *s, void *unused)
        struct nvmap_device *dev = s->private;
 
        spin_lock_irqsave(&dev->clients_lock, flags);
-       seq_printf(s, "%-18s %18s %8s %10s %8s\n", "CLIENT", "PROCESS", "PID",
-               "SIZE", "FLAGS");
-       seq_printf(s, "%-18s %18s %8s %10s\n", "", "",
-                                       "BASE", "SIZE");
+       seq_printf(s, "%-18s %18s %8s %10s\n",
+               "CLIENT", "PROCESS", "PID", "SIZE");
+       seq_printf(s, "%-18s %18s %8s %10s %8s %6s %6s %6s\n",
+                       "", "", "BASE", "SIZE", "FLAGS", "REFS",
+                       "DUPES", "PINS");
        list_for_each_entry(client, &dev->clients, list) {
                client_stringify(client, s);
                seq_printf(s, " %10u\n", atomic_read(&client->iovm_commit));