Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm/i915: Dump the ringbuffer of the active request for debugging
Date: Thu, 14 Jun 2018 18:13:59 +0300	[thread overview]
Message-ID: <87fu1pwgco.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180613145901.29306-2-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Sometimes we need to see what instructions we emitted for a request to
> try and gather a glimmer of insight into what the GPU is doing when it
> stops responding.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_engine_cs.c | 35 ++++++++++++++++++++++----
>  1 file changed, 30 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index d278fed8cb31..d7f757fb8401 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1443,12 +1443,10 @@ void intel_engine_dump(struct intel_engine_cs *engine,
>  
>  	rq = i915_gem_find_active_request(engine);
>  	if (rq) {
> +		void *ring;
> +		int size;
> +
>  		print_request(m, rq, "\t\tactive ");
> -		drm_printf(m,
> -			   "\t\t[head %04x, postfix %04x, tail %04x, batch 0x%08x_%08x]\n",
> -			   rq->head, rq->postfix, rq->tail,
> -			   rq->batch ? upper_32_bits(rq->batch->node.start) : ~0u,
> -			   rq->batch ? lower_32_bits(rq->batch->node.start) : ~0u);
>  		drm_printf(m, "\t\tring->start:  0x%08x\n",
>  			   i915_ggtt_offset(rq->ring->vma));
>  		drm_printf(m, "\t\tring->head:   0x%08x\n",
> @@ -1459,6 +1457,33 @@ void intel_engine_dump(struct intel_engine_cs *engine,
>  			   rq->ring->emit);
>  		drm_printf(m, "\t\tring->space:  0x%08x\n",
>  			   rq->ring->space);
> +
> +		drm_printf(m,
> +			   "[head %04x, postfix %04x, tail %04x, batch 0x%08x_%08x]:\n",
> +			   rq->head, rq->postfix, rq->tail,
> +			   rq->batch ? upper_32_bits(rq->batch->node.start) : ~0u,
> +			   rq->batch ? lower_32_bits(rq->batch->node.start) : ~0u);

While you are here, you might want to add the new rq->infix to the mix.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> +
> +		size = rq->tail - rq->head;
> +		if (rq->tail < rq->head)
> +			size += rq->ring->size;
> +
> +		ring = kmalloc(size, GFP_ATOMIC);
> +		if (ring) {
> +			const void *vaddr = rq->ring->vaddr;
> +			unsigned int head = rq->head;
> +			unsigned int len = 0;
> +
> +			if (rq->tail < head) {
> +				len = rq->ring->size - head;
> +				memcpy(ring, vaddr + head, len);
> +				head = 0;
> +			}
> +			memcpy(ring + len, vaddr + head, size - len);
> +
> +			hexdump(m, ring, size);
> +			kfree(ring);
> +		}
>  	}
>  
>  	rcu_read_unlock();
> -- 
> 2.17.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-06-14 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 14:58 [PATCH 1/5] drm/i915: Supply the extended state flags for forced context load Chris Wilson
2018-06-13 14:58 ` [PATCH 2/5] drm/i915: Dump the ringbuffer of the active request for debugging Chris Wilson
2018-06-14 15:13   ` Mika Kuoppala [this message]
2018-06-13 14:58 ` [PATCH 3/5] drm/i915: Make the hexdump row offset visually distinct Chris Wilson
2018-06-14 15:16   ` Mika Kuoppala
2018-06-13 14:59 ` [PATCH 4/5] drm/i915: Show CCID in engine dumps Chris Wilson
2018-06-14 15:21   ` Mika Kuoppala
2018-06-13 14:59 ` [PATCH 5/5] drm/i915/gtt: Only keep gen6 page directories pinned while active Chris Wilson
2018-06-13 15:36 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] drm/i915: Supply the extended state flags for forced context load Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-06-14  9:40 [PATCH 1/5] drm/i915: Move GEM sanitize from resume_early to resume Chris Wilson
2018-06-14  9:41 ` [PATCH 2/5] drm/i915: Dump the ringbuffer of the active request for debugging Chris Wilson
2018-06-14 12:10   ` Joonas Lahtinen

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=87fu1pwgco.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