diff options
Diffstat (limited to 'drivers/gpu/drm/drm_info.c')
-rw-r--r-- | drivers/gpu/drm/drm_info.c | 89 |
1 files changed, 25 insertions, 64 deletions
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index ecaf0fa2eec8..51efebd434f3 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -35,6 +35,9 @@ | |||
35 | 35 | ||
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <drm/drmP.h> | 37 | #include <drm/drmP.h> |
38 | #include <drm/drm_gem.h> | ||
39 | |||
40 | #include "drm_legacy.h" | ||
38 | 41 | ||
39 | /** | 42 | /** |
40 | * Called when "/proc/dri/.../name" is read. | 43 | * Called when "/proc/dri/.../name" is read. |
@@ -183,15 +186,32 @@ int drm_clients_info(struct seq_file *m, void *data) | |||
183 | struct drm_device *dev = node->minor->dev; | 186 | struct drm_device *dev = node->minor->dev; |
184 | struct drm_file *priv; | 187 | struct drm_file *priv; |
185 | 188 | ||
189 | seq_printf(m, | ||
190 | "%20s %5s %3s master a %5s %10s\n", | ||
191 | "command", | ||
192 | "pid", | ||
193 | "dev", | ||
194 | "uid", | ||
195 | "magic"); | ||
196 | |||
197 | /* dev->filelist is sorted youngest first, but we want to present | ||
198 | * oldest first (i.e. kernel, servers, clients), so walk backwardss. | ||
199 | */ | ||
186 | mutex_lock(&dev->struct_mutex); | 200 | mutex_lock(&dev->struct_mutex); |
187 | seq_printf(m, "a dev pid uid magic\n\n"); | 201 | list_for_each_entry_reverse(priv, &dev->filelist, lhead) { |
188 | list_for_each_entry(priv, &dev->filelist, lhead) { | 202 | struct task_struct *task; |
189 | seq_printf(m, "%c %3d %5d %5d %10u\n", | 203 | |
190 | priv->authenticated ? 'y' : 'n', | 204 | rcu_read_lock(); /* locks pid_task()->comm */ |
191 | priv->minor->index, | 205 | task = pid_task(priv->pid, PIDTYPE_PID); |
206 | seq_printf(m, "%20s %5d %3d %c %c %5d %10u\n", | ||
207 | task ? task->comm : "<unknown>", | ||
192 | pid_vnr(priv->pid), | 208 | pid_vnr(priv->pid), |
209 | priv->minor->index, | ||
210 | priv->is_master ? 'y' : 'n', | ||
211 | priv->authenticated ? 'y' : 'n', | ||
193 | from_kuid_munged(seq_user_ns(m), priv->uid), | 212 | from_kuid_munged(seq_user_ns(m), priv->uid), |
194 | priv->magic); | 213 | priv->magic); |
214 | rcu_read_unlock(); | ||
195 | } | 215 | } |
196 | mutex_unlock(&dev->struct_mutex); | 216 | mutex_unlock(&dev->struct_mutex); |
197 | return 0; | 217 | return 0; |
@@ -223,62 +243,3 @@ int drm_gem_name_info(struct seq_file *m, void *data) | |||
223 | 243 | ||
224 | return 0; | 244 | return 0; |
225 | } | 245 | } |
226 | |||
227 | #if DRM_DEBUG_CODE | ||
228 | |||
229 | int drm_vma_info(struct seq_file *m, void *data) | ||
230 | { | ||
231 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
232 | struct drm_device *dev = node->minor->dev; | ||
233 | struct drm_vma_entry *pt; | ||
234 | struct vm_area_struct *vma; | ||
235 | unsigned long vma_count = 0; | ||
236 | #if defined(__i386__) | ||
237 | unsigned int pgprot; | ||
238 | #endif | ||
239 | |||
240 | mutex_lock(&dev->struct_mutex); | ||
241 | list_for_each_entry(pt, &dev->vmalist, head) | ||
242 | vma_count++; | ||
243 | |||
244 | seq_printf(m, "vma use count: %lu, high_memory = %pK, 0x%pK\n", | ||
245 | vma_count, high_memory, | ||
246 | (void *)(unsigned long)virt_to_phys(high_memory)); | ||
247 | |||
248 | list_for_each_entry(pt, &dev->vmalist, head) { | ||
249 | vma = pt->vma; | ||
250 | if (!vma) | ||
251 | continue; | ||
252 | seq_printf(m, | ||
253 | "\n%5d 0x%pK-0x%pK %c%c%c%c%c%c 0x%08lx000", | ||
254 | pt->pid, | ||
255 | (void *)vma->vm_start, (void *)vma->vm_end, | ||
256 | vma->vm_flags & VM_READ ? 'r' : '-', | ||
257 | vma->vm_flags & VM_WRITE ? 'w' : '-', | ||
258 | vma->vm_flags & VM_EXEC ? 'x' : '-', | ||
259 | vma->vm_flags & VM_MAYSHARE ? 's' : 'p', | ||
260 | vma->vm_flags & VM_LOCKED ? 'l' : '-', | ||
261 | vma->vm_flags & VM_IO ? 'i' : '-', | ||
262 | vma->vm_pgoff); | ||
263 | |||
264 | #if defined(__i386__) | ||
265 | pgprot = pgprot_val(vma->vm_page_prot); | ||
266 | seq_printf(m, " %c%c%c%c%c%c%c%c%c", | ||
267 | pgprot & _PAGE_PRESENT ? 'p' : '-', | ||
268 | pgprot & _PAGE_RW ? 'w' : 'r', | ||
269 | pgprot & _PAGE_USER ? 'u' : 's', | ||
270 | pgprot & _PAGE_PWT ? 't' : 'b', | ||
271 | pgprot & _PAGE_PCD ? 'u' : 'c', | ||
272 | pgprot & _PAGE_ACCESSED ? 'a' : '-', | ||
273 | pgprot & _PAGE_DIRTY ? 'd' : '-', | ||
274 | pgprot & _PAGE_PSE ? 'm' : 'k', | ||
275 | pgprot & _PAGE_GLOBAL ? 'g' : 'l'); | ||
276 | #endif | ||
277 | seq_printf(m, "\n"); | ||
278 | } | ||
279 | mutex_unlock(&dev->struct_mutex); | ||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | #endif | ||
284 | |||