summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-08-21 16:29:46 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-28 11:54:36 -0400
commit8f2f979428e1e5a4ff71d91e30ba17813e6ee7be (patch)
treedd7ce212363bea8b3547811109f01b2397804613 /drivers/gpu/nvgpu/common
parentc49160127acfa5a9f550ecfa2d61c054060dbab3 (diff)
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 <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1544439 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_allocator.c6
-rw-r--r--drivers/gpu/nvgpu/common/mm/bitmap_allocator.c4
-rw-r--r--drivers/gpu/nvgpu/common/mm/buddy_allocator.c4
-rw-r--r--drivers/gpu/nvgpu/common/mm/lockless_allocator.c4
-rw-r--r--drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c8
-rw-r--r--drivers/gpu/nvgpu/common/mm/page_allocator.c4
6 files changed, 16 insertions, 14 deletions
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 @@
20 20
21#include <nvgpu/allocator.h> 21#include <nvgpu/allocator.h>
22 22
23void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a,
24 struct seq_file *s, int lock)
25{
26 __a->ops->print_stats(__a, s, lock);
27}
28
29static int __alloc_show(struct seq_file *s, void *unused) 23static int __alloc_show(struct seq_file *s, void *unused)
30{ 24{
31 struct nvgpu_allocator *a = s->private; 25 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)
311 nvgpu_kfree(nvgpu_alloc_to_gpu(__a), a); 311 nvgpu_kfree(nvgpu_alloc_to_gpu(__a), a);
312} 312}
313 313
314#ifdef CONFIG_DEBUG_FS 314#ifdef __KERNEL__
315static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a, 315static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a,
316 struct seq_file *s, int lock) 316 struct seq_file *s, int lock)
317{ 317{
@@ -347,7 +347,7 @@ static const struct nvgpu_allocator_ops bitmap_ops = {
347 347
348 .fini = nvgpu_bitmap_alloc_destroy, 348 .fini = nvgpu_bitmap_alloc_destroy,
349 349
350#ifdef CONFIG_DEBUG_FS 350#ifdef __KERNEL__
351 .print_stats = nvgpu_bitmap_print_stats, 351 .print_stats = nvgpu_bitmap_print_stats,
352#endif 352#endif
353}; 353};
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)
1076 return space; 1076 return space;
1077} 1077}
1078 1078
1079#ifdef CONFIG_DEBUG_FS 1079#ifdef __KERNEL__
1080/* 1080/*
1081 * Print the buddy allocator top level stats. If you pass @s as NULL then the 1081 * Print the buddy allocator top level stats. If you pass @s as NULL then the
1082 * stats are printed to the kernel log. This lets this code be used for 1082 * 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 = {
1174 1174
1175 .fini = nvgpu_buddy_allocator_destroy, 1175 .fini = nvgpu_buddy_allocator_destroy,
1176 1176
1177#ifdef CONFIG_DEBUG_FS 1177#ifdef __KERNEL__
1178 .print_stats = nvgpu_buddy_print_stats, 1178 .print_stats = nvgpu_buddy_print_stats,
1179#endif 1179#endif
1180}; 1180};
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)
116 nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa); 116 nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa);
117} 117}
118 118
119#ifdef CONFIG_DEBUG_FS 119#ifdef __KERNEL__
120static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, 120static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a,
121 struct seq_file *s, int lock) 121 struct seq_file *s, int lock)
122{ 122{
@@ -146,7 +146,7 @@ static const struct nvgpu_allocator_ops pool_ops = {
146 146
147 .fini = nvgpu_lockless_alloc_destroy, 147 .fini = nvgpu_lockless_alloc_destroy,
148 148
149#ifdef CONFIG_DEBUG_FS 149#ifdef __KERNEL__
150 .print_stats = nvgpu_lockless_print_stats, 150 .print_stats = nvgpu_lockless_print_stats,
151#endif 151#endif
152}; 152};
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)
114 memset(a, 0, sizeof(*a)); 114 memset(a, 0, sizeof(*a));
115} 115}
116 116
117#ifdef __KERNEL__
118void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a,
119 struct seq_file *s, int lock)
120{
121 __a->ops->print_stats(__a, s, lock);
122}
123#endif
124
117/* 125/*
118 * Handle the common init stuff for a nvgpu_allocator. 126 * Handle the common init stuff for a nvgpu_allocator.
119 */ 127 */
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)
756 alloc_unlock(__a); 756 alloc_unlock(__a);
757} 757}
758 758
759#ifdef CONFIG_DEBUG_FS 759#ifdef __KERNEL__
760static void nvgpu_page_print_stats(struct nvgpu_allocator *__a, 760static void nvgpu_page_print_stats(struct nvgpu_allocator *__a,
761 struct seq_file *s, int lock) 761 struct seq_file *s, int lock)
762{ 762{
@@ -833,7 +833,7 @@ static const struct nvgpu_allocator_ops page_ops = {
833 833
834 .fini = nvgpu_page_allocator_destroy, 834 .fini = nvgpu_page_allocator_destroy,
835 835
836#ifdef CONFIG_DEBUG_FS 836#ifdef __KERNEL__
837 .print_stats = nvgpu_page_print_stats, 837 .print_stats = nvgpu_page_print_stats,
838#endif 838#endif
839}; 839};