| .. | .. |
|---|
| 48 | 48 | |
|---|
| 49 | 49 | kbdev = list_entry(entry, struct kbase_device, entry); |
|---|
| 50 | 50 | /* output the total memory usage and cap for this device */ |
|---|
| 51 | + seq_printf(sfile, "<dev> <pages>\n"); |
|---|
| 51 | 52 | seq_printf(sfile, "%-16s %10u\n", |
|---|
| 52 | 53 | kbdev->devname, |
|---|
| 53 | 54 | atomic_read(&(kbdev->memdev.used_pages))); |
|---|
| 54 | 55 | mutex_lock(&kbdev->kctx_list_lock); |
|---|
| 56 | + seq_printf(sfile, " <kctx> <comm> <pid> <pages>\n"); |
|---|
| 55 | 57 | 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); |
|---|
| 56 | 64 | /* 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", |
|---|
| 60 | 68 | "kctx", |
|---|
| 61 | 69 | kctx, |
|---|
| 70 | + task ? task->comm : "[null comm]", |
|---|
| 71 | + kctx->tgid, |
|---|
| 62 | 72 | atomic_read(&(kctx->used_pages))); |
|---|
| 73 | + put_pid(pid_struct); |
|---|
| 74 | + rcu_read_unlock(); |
|---|
| 63 | 75 | } |
|---|
| 64 | 76 | mutex_unlock(&kbdev->kctx_list_lock); |
|---|
| 65 | 77 | } |
|---|
| .. | .. |
|---|
| 88 | 100 | */ |
|---|
| 89 | 101 | void kbasep_gpu_memory_debugfs_init(struct kbase_device *kbdev) |
|---|
| 90 | 102 | { |
|---|
| 91 | | - debugfs_create_file("gpu_memory", S_IRUGO, |
|---|
| 103 | + debugfs_create_file("gpu_memory", 0444, |
|---|
| 92 | 104 | kbdev->mali_debugfs_directory, NULL, |
|---|
| 93 | 105 | &kbasep_gpu_memory_debugfs_fops); |
|---|
| 94 | | - return; |
|---|
| 95 | 106 | } |
|---|
| 96 | | - |
|---|
| 97 | 107 | #else |
|---|
| 98 | 108 | /* |
|---|
| 99 | 109 | * Stub functions for when debugfs is disabled |
|---|
| 100 | 110 | */ |
|---|
| 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) {} |
|---|
| 105 | 112 | #endif |
|---|