From 8f2f979428e1e5a4ff71d91e30ba17813e6ee7be Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 21 Aug 2017 13:29:46 -0700 Subject: gpu: nvgpu: cleanup allocator debugging Remove debugging features that did not really get used and make the debugging code use the nvgpu_log() functionality. This ties the allocator debugging into the larger nvgpu debug framework. Also modify many of the places CONFIG_DEBUG_FS was used to conditionally compile allocator debug code to use __KERNEL__ instead. This is because that debug code can still be called even when debugfs is not present in Linux. Change-Id: I112ebe1cae22d6f8db96d023993498093e18d74a Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1544439 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/debug_allocator.c | 6 ------ drivers/gpu/nvgpu/common/mm/bitmap_allocator.c | 4 ++-- drivers/gpu/nvgpu/common/mm/buddy_allocator.c | 4 ++-- drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 4 ++-- drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c | 8 ++++++++ drivers/gpu/nvgpu/common/mm/page_allocator.c | 4 ++-- 6 files changed, 16 insertions(+), 14 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/debug_allocator.c b/drivers/gpu/nvgpu/common/linux/debug_allocator.c index 766c8486..91ae0512 100644 --- a/drivers/gpu/nvgpu/common/linux/debug_allocator.c +++ b/drivers/gpu/nvgpu/common/linux/debug_allocator.c @@ -20,12 +20,6 @@ #include -void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a, - struct seq_file *s, int lock) -{ - __a->ops->print_stats(__a, s, lock); -} - static int __alloc_show(struct seq_file *s, void *unused) { struct nvgpu_allocator *a = s->private; diff --git a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c index 274e9c93..9b3fccf1 100644 --- a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c @@ -311,7 +311,7 @@ static void nvgpu_bitmap_alloc_destroy(struct nvgpu_allocator *__a) nvgpu_kfree(nvgpu_alloc_to_gpu(__a), a); } -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a, struct seq_file *s, int lock) { @@ -347,7 +347,7 @@ static const struct nvgpu_allocator_ops bitmap_ops = { .fini = nvgpu_bitmap_alloc_destroy, -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ .print_stats = nvgpu_bitmap_print_stats, #endif }; diff --git a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c index a2e6c44a..2938bfac 100644 --- a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c @@ -1076,7 +1076,7 @@ static u64 nvgpu_buddy_alloc_space(struct nvgpu_allocator *a) return space; } -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ /* * Print the buddy allocator top level stats. If you pass @s as NULL then the * stats are printed to the kernel log. This lets this code be used for @@ -1174,7 +1174,7 @@ static const struct nvgpu_allocator_ops buddy_ops = { .fini = nvgpu_buddy_allocator_destroy, -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ .print_stats = nvgpu_buddy_print_stats, #endif }; diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index 8f712a14..04df7e3f 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c @@ -116,7 +116,7 @@ static void nvgpu_lockless_alloc_destroy(struct nvgpu_allocator *a) nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa); } -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, struct seq_file *s, int lock) { @@ -146,7 +146,7 @@ static const struct nvgpu_allocator_ops pool_ops = { .fini = nvgpu_lockless_alloc_destroy, -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ .print_stats = nvgpu_lockless_print_stats, #endif }; diff --git a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c index 1646d2b1..bc8d1b55 100644 --- a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c @@ -114,6 +114,14 @@ void nvgpu_alloc_destroy(struct nvgpu_allocator *a) memset(a, 0, sizeof(*a)); } +#ifdef __KERNEL__ +void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a, + struct seq_file *s, int lock) +{ + __a->ops->print_stats(__a, s, lock); +} +#endif + /* * Handle the common init stuff for a nvgpu_allocator. */ diff --git a/drivers/gpu/nvgpu/common/mm/page_allocator.c b/drivers/gpu/nvgpu/common/mm/page_allocator.c index 0eda13ec..72ff8f2d 100644 --- a/drivers/gpu/nvgpu/common/mm/page_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/page_allocator.c @@ -756,7 +756,7 @@ static void nvgpu_page_allocator_destroy(struct nvgpu_allocator *__a) alloc_unlock(__a); } -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ static void nvgpu_page_print_stats(struct nvgpu_allocator *__a, struct seq_file *s, int lock) { @@ -833,7 +833,7 @@ static const struct nvgpu_allocator_ops page_ops = { .fini = nvgpu_page_allocator_destroy, -#ifdef CONFIG_DEBUG_FS +#ifdef __KERNEL__ .print_stats = nvgpu_page_print_stats, #endif }; -- cgit v1.2.2