From ec9ee786c4ab336d8a8f13692f87c0cb75842cd3 Mon Sep 17 00:00:00 2001 From: Ketan Patil Date: Fri, 2 Dec 2022 09:52:28 +0000 Subject: [PATCH] nvmap: Add traces for big pages in page pool There are no traces present for allocating big pages from page pool, this is limiting the debug ability for some of the memory leak bugs. Hence add traces for such operations. Change-Id: I6cece3fd796c5c3e37f87647a1635274a654d727 Signed-off-by: Ketan Patil Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820607 Reviewed-by: svcacv Reviewed-by: svc_kernel_abi Reviewed-by: Sachin Nikam GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/nvmap/nvmap_pp.c | 3 ++ include/trace/events/nvmap.h | 41 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/video/tegra/nvmap/nvmap_pp.c b/drivers/video/tegra/nvmap/nvmap_pp.c index 7b0e69af..7a367572 100644 --- a/drivers/video/tegra/nvmap/nvmap_pp.c +++ b/drivers/video/tegra/nvmap/nvmap_pp.c @@ -102,6 +102,8 @@ static inline struct page *get_page_list_page_bp(struct nvmap_page_pool *pool) { struct page *page; + trace_get_page_list_page_bp(pool->big_page_count); + if (list_empty(&pool->page_list_bp)) return NULL; @@ -359,6 +361,7 @@ int nvmap_page_pool_alloc_lots_bp(struct nvmap_page_pool *pool, } rt_mutex_unlock(&pool->lock); + trace_nvmap_pp_alloc_lots_bp(ind, nr); return ind; } diff --git a/include/trace/events/nvmap.h b/include/trace/events/nvmap.h index 65a5e548..9910b368 100644 --- a/include/trace/events/nvmap.h +++ b/include/trace/events/nvmap.h @@ -683,6 +683,22 @@ DECLARE_EVENT_CLASS(nvmap_get_list_page, TP_printk("pages left in list=%u", __entry->count) ); +DECLARE_EVENT_CLASS(nvmap_get_list_page_bp, + TP_PROTO(u32 count), + + TP_ARGS(count), + + TP_STRUCT__entry( + __field(u32, count) + ), + + TP_fast_assign( + __entry->count = count; + ), + + TP_printk("pages left in big page list=%u", __entry->count) +); + DEFINE_EVENT(nvmap_get_list_page, get_zero_list_page, TP_PROTO(u32 count), TP_ARGS(count) @@ -693,6 +709,11 @@ DEFINE_EVENT(nvmap_get_list_page, get_page_list_page, TP_ARGS(count) ); +DEFINE_EVENT(nvmap_get_list_page_bp, get_page_list_page_bp, + TP_PROTO(u32 count), + TP_ARGS(count) +); + TRACE_EVENT(nvmap_pp_zero_pages, TP_PROTO(u32 count), @@ -763,6 +784,26 @@ TRACE_EVENT(nvmap_pp_alloc_lots, __entry->requested, __entry->alloced) ); +TRACE_EVENT(nvmap_pp_alloc_lots_bp, + TP_PROTO(u32 alloced, u32 requested), + + TP_ARGS(alloced, requested), + + TP_STRUCT__entry( + __field(u32, alloced) + __field(u32, requested) + ), + + TP_fast_assign( + __entry->alloced = alloced; + __entry->requested = requested; + ), + + TP_printk("requested:%u alloced:%u\n", + __entry->requested, __entry->alloced) +); + + TRACE_EVENT(nvmap_pp_fill_zero_lots, TP_PROTO(u32 save_to_zero, u32 to_zero,