hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/gpu/arm/bifrost/mali_kbase_gpu_memory_debugfs.c
....@@ -48,18 +48,30 @@
4848
4949 kbdev = list_entry(entry, struct kbase_device, entry);
5050 /* output the total memory usage and cap for this device */
51
+ seq_printf(sfile, "<dev> <pages>\n");
5152 seq_printf(sfile, "%-16s %10u\n",
5253 kbdev->devname,
5354 atomic_read(&(kbdev->memdev.used_pages)));
5455 mutex_lock(&kbdev->kctx_list_lock);
56
+ seq_printf(sfile, " <kctx> <comm> <pid> <pages>\n");
5557 list_for_each_entry(kctx, &kbdev->kctx_list, kctx_list_link) {
58
+ struct pid *pid_struct;
59
+ struct task_struct *task;
60
+
61
+ rcu_read_lock();
62
+ pid_struct = find_get_pid(kctx->tgid);
63
+ task = pid_task(pid_struct, PIDTYPE_PID);
5664 /* output the memory usage and cap for each kctx
57
- * opened on this device
58
- */
59
- seq_printf(sfile, " %s-0x%pK %10u\n",
65
+ * opened on this device
66
+ */
67
+ seq_printf(sfile, " %s-0x%pK %-20s %-10d %10u\n",
6068 "kctx",
6169 kctx,
70
+ task ? task->comm : "[null comm]",
71
+ kctx->tgid,
6272 atomic_read(&(kctx->used_pages)));
73
+ put_pid(pid_struct);
74
+ rcu_read_unlock();
6375 }
6476 mutex_unlock(&kbdev->kctx_list_lock);
6577 }
....@@ -88,18 +100,13 @@
88100 */
89101 void kbasep_gpu_memory_debugfs_init(struct kbase_device *kbdev)
90102 {
91
- debugfs_create_file("gpu_memory", S_IRUGO,
103
+ debugfs_create_file("gpu_memory", 0444,
92104 kbdev->mali_debugfs_directory, NULL,
93105 &kbasep_gpu_memory_debugfs_fops);
94
- return;
95106 }
96
-
97107 #else
98108 /*
99109 * Stub functions for when debugfs is disabled
100110 */
101
-void kbasep_gpu_memory_debugfs_init(struct kbase_device *kbdev)
102
-{
103
- return;
104
-}
111
+void kbasep_gpu_memory_debugfs_init(struct kbase_device *kbdev) {}
105112 #endif