public inbox for intel-gfx@lists.freedesktop.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/3] drm/i915/execlists: Move request unwinding	to a separate function
Date: Mon, 25 Sep 2017 17:54:40 +0300	[thread overview]
Message-ID: <87poaezv4f.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170925124929.16974-2-chris@chris-wilson.co.uk>

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

> In the future, we will want to unwind requests following a preemption
> point. This requires the same steps as for unwinding upon a reset, so
> extract the existing code to a separate function for later use.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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

> ---
>  drivers/gpu/drm/i915/intel_lrc.c | 53 +++++++++++++++++++++++++---------------
>  1 file changed, 33 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 2c07f3c08bd3..c84831c7ea4a 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -348,6 +348,37 @@ lookup_priolist(struct intel_engine_cs *engine,
>  	return ptr_pack_bits(p, first, 1);
>  }
>  
> +static void unwind_wa_tail(struct drm_i915_gem_request *rq)
> +{
> +	rq->tail = intel_ring_wrap(rq->ring,
> +				   rq->wa_tail - WA_TAIL_DWORDS*sizeof(u32));
> +	assert_ring_tail_valid(rq->ring, rq->tail);
> +}
> +
> +static void unwind_incomplete_requests(struct intel_engine_cs *engine)
> +{
> +	struct drm_i915_gem_request *rq, *rn;
> +
> +	lockdep_assert_held(&engine->timeline->lock);
> +	list_for_each_entry_safe_reverse(rq, rn,
> +					 &engine->timeline->requests,
> +					 link) {
> +		struct i915_priolist *p;
> +
> +		if (i915_gem_request_completed(rq))
> +			return;
> +
> +		__i915_gem_request_unsubmit(rq);
> +		unwind_wa_tail(rq);
> +
> +		p = lookup_priolist(engine,
> +				    &rq->priotree,
> +				    rq->priotree.priority);
> +		list_add(&rq->priotree.link,
> +			 &ptr_mask_bits(p, 1)->requests);
> +	}
> +}
> +
>  static inline void
>  execlists_context_status_change(struct drm_i915_gem_request *rq,
>  				unsigned long status)
> @@ -1378,7 +1409,6 @@ static void reset_common_ring(struct intel_engine_cs *engine,
>  			      struct drm_i915_gem_request *request)
>  {
>  	struct intel_engine_execlists * const execlists = &engine->execlists;
> -	struct drm_i915_gem_request *rq, *rn;
>  	struct intel_context *ce;
>  	unsigned long flags;
>  
> @@ -1396,21 +1426,7 @@ static void reset_common_ring(struct intel_engine_cs *engine,
>  	execlist_cancel_port_requests(execlists);
>  
>  	/* Push back any incomplete requests for replay after the reset. */
> -	list_for_each_entry_safe_reverse(rq, rn,
> -					 &engine->timeline->requests, link) {
> -		struct i915_priolist *p;
> -
> -		if (i915_gem_request_completed(rq))
> -			break;
> -
> -		__i915_gem_request_unsubmit(rq);
> -
> -		p = lookup_priolist(engine,
> -				    &rq->priotree,
> -				    rq->priotree.priority);
> -		list_add(&rq->priotree.link,
> -			 &ptr_mask_bits(p, 1)->requests);
> -	}
> +	unwind_incomplete_requests(engine);
>  
>  	spin_unlock_irqrestore(&engine->timeline->lock, flags);
>  
> @@ -1447,10 +1463,7 @@ static void reset_common_ring(struct intel_engine_cs *engine,
>  	intel_ring_update_space(request->ring);
>  
>  	/* Reset WaIdleLiteRestore:bdw,skl as well */
> -	request->tail =
> -		intel_ring_wrap(request->ring,
> -				request->wa_tail - WA_TAIL_DWORDS*sizeof(u32));
> -	assert_ring_tail_valid(request->ring, request->tail);
> +	unwind_wa_tail(request);
>  }
>  
>  static int intel_logical_ring_emit_pdps(struct drm_i915_gem_request *req)
> -- 
> 2.14.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

  parent reply	other threads:[~2017-09-25 14:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 12:49 [PATCH 1/3] drm/i915/execlists: Microoptimise execlists_cancel_port_request() Chris Wilson
2017-09-25 12:49 ` [PATCH 2/3] drm/i915/execlists: Move request unwinding to a separate function Chris Wilson
2017-09-25 12:55   ` Mika Kuoppala
2017-09-25 13:18     ` Chris Wilson
2017-09-25 14:54   ` Mika Kuoppala [this message]
2017-09-25 12:49 ` [PATCH 3/3] drm/i915/execlists: Cache the last priolist lookup Chris Wilson
2017-09-25 12:54   ` Chris Wilson
2017-09-25 13:59   ` [PATCH v2] " Chris Wilson
2017-09-25 13:00 ` [PATCH 1/3] drm/i915/execlists: Microoptimise execlists_cancel_port_request() Mika Kuoppala
2017-09-25 13:08   ` Chris Wilson
2017-09-25 19:38   ` Chris Wilson
2017-09-25 13:36 ` ✗ Fi.CI.BAT: failure for series starting with [1/3] " Patchwork
2017-09-25 15:04 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915/execlists: Microoptimise execlists_cancel_port_request() (rev2) Patchwork
2017-09-25 18:01 ` ✓ Fi.CI.IGT: success for series starting with [1/3] drm/i915/execlists: Microoptimise execlists_cancel_port_request() Patchwork
2017-09-25 20:34 ` ✓ Fi.CI.IGT: success for series starting with [1/3] drm/i915/execlists: Microoptimise execlists_cancel_port_request() (rev2) Patchwork

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