[Intel-gfx] [PATCH 02/10] drm/i915/gt: Skip over completed active execlists, again

Andi Shyti andi at etezian.org
Thu Jan 21 15:23:24 UTC 2021


Hi Chris,

> Now that we are careful to always force-restore contexts upon rewinding
> (where necessary), we can restore our optimisation to skip over
> completed active execlists when dequeuing.
> 
> Referenecs: 35f3fd8182ba ("drm/i915/execlists: Workaround switching back to a completed context")
> References: 8ab3a3812aa9 ("drm/i915/gt: Incrementally check for rewinding")
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> ---
>  .../drm/i915/gt/intel_execlists_submission.c  | 34 +++++++++----------
>  1 file changed, 16 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
> index 524c8b54d220..ac1be7a632d3 100644
> --- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
> +++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
> @@ -1224,12 +1224,20 @@ static void set_preempt_timeout(struct intel_engine_cs *engine,
>  		     active_preempt_timeout(engine, rq));
>  }
>  
> +static bool completed(const struct i915_request *rq)
> +{
> +	if (i915_request_has_sentinel(rq))
> +		return false;
> +
> +	return __i915_request_is_complete(rq);
> +}
> +
>  static void execlists_dequeue(struct intel_engine_cs *engine)
>  {
>  	struct intel_engine_execlists * const execlists = &engine->execlists;
>  	struct i915_request **port = execlists->pending;
>  	struct i915_request ** const last_port = port + execlists->port_mask;
> -	struct i915_request *last = *execlists->active;
> +	struct i915_request *last, * const *active;
>  	struct virtual_engine *ve;
>  	struct rb_node *rb;
>  	bool submit = false;
> @@ -1266,21 +1274,13 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>  	 * i.e. we will retrigger preemption following the ack in case
>  	 * of trouble.
>  	 *
> -	 * In theory we can skip over completed contexts that have not
> -	 * yet been processed by events (as those events are in flight):
> -	 *
> -	 * while ((last = *active) && i915_request_completed(last))
> -	 *	active++;
> -	 *
> -	 * However, the GPU cannot handle this as it will ultimately
> -	 * find itself trying to jump back into a context it has just
> -	 * completed and barf.
>  	 */
> +	active = execlists->active;
> +	while ((last = *active) && completed(last))
> +		active++;

looks reasonable to me...

Reviewed-by: Andi Shyti <andi.shyti at intel.com>

Thanks,
Andi


More information about the Intel-gfx mailing list