From c20759506b3075c76b215ffeeed5854673242b9f Mon Sep 17 00:00:00 2001 From: Ketan Patil Date: Wed, 2 Apr 2025 10:07:56 +0000 Subject: [PATCH] video: tegra: nvmap: Add field to indicate hugetlbfs based memory Hugetlbfs memory handles are shown under the IOVMM debugfs as the memory comes from the system memory and not from any carveout. But it is causing confusion among the customers. Hence add a field to indicate if the buffer was allocated from hugetlbfs or not. Bug 5169776 Change-Id: Ide70b7f746519ed528b5face5b91d9a4c2f9f7ca Signed-off-by: Ketan Patil Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3332021 Reviewed-by: svc-mobile-coverity Reviewed-by: Sachin Nikam Reviewed-by: Pritesh Raithatha GVS: buildbot_gerritrpt --- drivers/video/tegra/nvmap/nvmap_debug.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/video/tegra/nvmap/nvmap_debug.c b/drivers/video/tegra/nvmap/nvmap_debug.c index 94d0c97d..2f42ecba 100644 --- a/drivers/video/tegra/nvmap/nvmap_debug.c +++ b/drivers/video/tegra/nvmap/nvmap_debug.c @@ -95,8 +95,8 @@ next_page: } seq_printf(s, - "%-18s %-18s %8llx %10zuK %8x %6u %6u %6u %6u %6u %6u %8pK %s\n", - "", "", + "%-18s %-18s %8llx %10zuK %8x %6u %6u %6u %6u %6u %6u %8pK %6u %s\n" + , "", "", (unsigned long long)base, size, handle->userflags, atomic_read(&handle->ref), @@ -106,6 +106,7 @@ next_page: atomic_read(&handle->umap_count), atomic_read(&handle->share_count), handle, + handle->has_hugetlbfs_pages, __nvmap_tag_name(dev, handle->userflags >> 16)); if ((heap_type == NVMAP_HEAP_CARVEOUT_VPR) && handle->heap_pgalloc) { @@ -358,9 +359,9 @@ static int nvmap_debug_allocations_show(struct seq_file *s, void *unused) mutex_lock(&nvmap_dev->clients_lock); seq_printf(s, "%-18s %18s %8s %11s\n", "CLIENT", "PROCESS", "PID", "SIZE"); - seq_printf(s, "%-18s %18s %8s %11s %8s %6s %6s %6s %6s %6s %6s %8s\n", + seq_printf(s, "%-18s %18s %8s %11s %8s %6s %6s %6s %6s %6s %6s %8s %6s\n", "", "", "BASE", "SIZE", "FLAGS", "REFS", - "DUPES", "PINS", "KMAPS", "UMAPS", "SHARE", "UID"); + "DUPES", "PINS", "KMAPS", "UMAPS", "SHARE", "UID", "FROM_HUGETLBFS"); list_for_each_entry(client, &nvmap_dev->clients, list) { u64 client_total; @@ -444,9 +445,9 @@ static int nvmap_debug_all_allocations_show(struct seq_file *s, void *unused) struct rb_node *n; spin_lock(&nvmap_dev->handle_lock); - seq_printf(s, "%8s %11s %9s %6s %6s %6s %6s %8s\n", + seq_printf(s, "%8s %11s %9s %6s %6s %6s %6s %8s %6s\n", "BASE", "SIZE", "USERFLAGS", "REFS", - "KMAPS", "UMAPS", "SHARE", "UID"); + "KMAPS", "UMAPS", "SHARE", "UID", "FROM_HUGETLBFS"); /* for each handle */ n = rb_first(&nvmap_dev->handles); @@ -473,14 +474,15 @@ next_page: } seq_printf(s, - "%8llx %10zuK %9x %6u %6u %6u %6u %8p\n", + "%8llx %10zuK %9x %6u %6u %6u %6u %8p %6u\n", (unsigned long long)base, K(handle->size), handle->userflags, atomic_read(&handle->ref), atomic_read(&handle->kmap_count), atomic_read(&handle->umap_count), atomic_read(&handle->share_count), - handle); + handle, + handle->has_hugetlbfs_pages); if ((heap_type == NVMAP_HEAP_CARVEOUT_VPR) && handle->heap_pgalloc) { i++;