]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
iommu: arm_smmu: Print total iova mapped in ptdump
authorSri Krishna chowdary <schowdary@nvidia.com>
Fri, 29 Jul 2016 09:57:49 +0000 (15:27 +0530)
committerSri Krishna Chowdary <schowdary@nvidia.com>
Mon, 1 Aug 2016 07:25:52 +0000 (00:25 -0700)
Printing total iova mapped in ptdump sysfs can help debug
memory leaks. If the total keeps increasing, then it is likely
that there is some kind of leak.

sample output:-

root@t186_int:/d/12000000.iommu/cb000 # cat ptdump
va=0x0000000080000000 pa=0x000000027396e000 *pte=0x006000027396ef43
va=0x0000000080001000 pa=0x000000027396f000 *pte=0x006000027396ff43
total mapped iova=8KB

bug 200182275

Change-Id: Ie6bed9ee954e251a6ee80b41093cd1f577583e1a
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1194365
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/iommu/arm-smmu.c

index a8449c01ab1f5be137cc1a978037d80c6371e421..12c09da697f39c28113a25cb0f9da1c292adb0ee 100644 (file)
@@ -1610,6 +1610,7 @@ static int smmu_ptdump_show(struct seq_file *s, void *unused)
        pte_t *pte;
        int i, j, k, l;
        unsigned long addr = 0;
+       unsigned long mapped = 0;
 
        pgd = cfg->pgd;
        for (i = 0; i < PTRS_PER_PGD;
@@ -1639,12 +1640,14 @@ static int smmu_ptdump_show(struct seq_file *s, void *unused)
                                        seq_printf(s,
                                                   "va=0x%016lx pa=%pap *pte=%pad\n",
                                                   addr, &pa, &(*pte));
+                                       mapped += PAGE_SIZE;
                                }
                        }
                        if ((ulong)pgd != (ulong)pud)
                                addr += PUD_SIZE;
                }
        }
+       seq_printf(s, "total mapped iova=%luKB\n", mapped / SZ_1K);
        return 0;
 }