From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Make debugfs/i915_gem_request more friendly
Date: Wed, 01 Apr 2015 18:04:01 +0300 [thread overview]
Message-ID: <87oan7lwke.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <1427881016-7421-1-git-send-email-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> Count the number of requests in a ring for the user and show who
> submitted them.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 39 ++++++++++++++++++++++++-------------
> 1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9edc3f692256..6ff12ca147aa 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -671,31 +671,44 @@ static int i915_gem_request_info(struct seq_file *m, void *data)
> struct drm_device *dev = node->minor->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_engine_cs *ring;
> - struct drm_i915_gem_request *gem_request;
> - int ret, count, i;
> + struct drm_i915_gem_request *rq;
> + int ret, any, i;
>
> ret = mutex_lock_interruptible(&dev->struct_mutex);
> if (ret)
> return ret;
>
> - count = 0;
> + any = 0;
> 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;
>
> - seq_printf(m, "%s requests:\n", ring->name);
> - list_for_each_entry(gem_request,
> - &ring->request_list,
> - list) {
> - seq_printf(m, " %x @ %d\n",
> - gem_request->seqno,
> - (int) (jiffies - gem_request->emitted_jiffies));
> + seq_printf(m, "%s requests: %d\n", ring->name, count);
> + list_for_each_entry(rq, &ring->request_list, list) {
> + struct task_struct *task;
> +
> + rcu_read_lock();
> + task = NULL;
> + 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);
>
> - if (count == 0)
> + if (any == 0)
> seq_puts(m, "No requests\n");
>
> return 0;
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-04-01 15:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 9:36 [PATCH] drm/i915: Make debugfs/i915_gem_request more friendly Chris Wilson
2015-04-01 15:04 ` Mika Kuoppala [this message]
2015-04-01 15:32 ` Daniel Vetter
2015-04-02 10:07 ` shuang.he
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oan7lwke.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox