Commit 2d1070b2 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Make debugfs/i915_gem_request more friendly

Count the number of requests in a ring for the user and show who
submitted them.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent f61cccf3
...@@ -643,31 +643,44 @@ static int i915_gem_request_info(struct seq_file *m, void *data) ...@@ -643,31 +643,44 @@ static int i915_gem_request_info(struct seq_file *m, void *data)
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_engine_cs *ring; struct intel_engine_cs *ring;
struct drm_i915_gem_request *gem_request; struct drm_i915_gem_request *rq;
int ret, count, i; int ret, any, i;
ret = mutex_lock_interruptible(&dev->struct_mutex); ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret) if (ret)
return ret; return ret;
count = 0; any = 0;
for_each_ring(ring, dev_priv, i) { for_each_ring(ring, dev_priv, i) {
if (list_empty(&ring->request_list)) int count;
count = 0;
list_for_each_entry(rq, &ring->request_list, list)
count++;
if (count == 0)
continue; continue;
seq_printf(m, "%s requests:\n", ring->name); seq_printf(m, "%s requests: %d\n", ring->name, count);
list_for_each_entry(gem_request, list_for_each_entry(rq, &ring->request_list, list) {
&ring->request_list, struct task_struct *task;
list) {
seq_printf(m, " %x @ %d\n", rcu_read_lock();
gem_request->seqno, task = NULL;
(int) (jiffies - gem_request->emitted_jiffies)); if (rq->pid)
task = pid_task(rq->pid, PIDTYPE_PID);
seq_printf(m, " %x @ %d: %s [%d]\n",
rq->seqno,
(int) (jiffies - rq->emitted_jiffies),
task ? task->comm : "<unknown>",
task ? task->pid : -1);
rcu_read_unlock();
} }
count++;
any++;
} }
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (count == 0) if (any == 0)
seq_puts(m, "No requests\n"); seq_puts(m, "No requests\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment