[Intel-gfx] [PATCH v2] drm/i915: Assert breadcrumbs are correctly ordered in the signal handler

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue May 7 10:39:00 UTC 2019


On 03/05/2019 16:22, Chris Wilson wrote:
> Inside the signal handler, we expect the requests to be ordered by their
> breadcrumb such that no later request may be complete if we find an
> earlier incomplete. Add an assert to check that the next breadcrumb
> should not be logically before the current.
> 
> v2: Move the overhanging line into its own function and reuse it after
> doing the insertion.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> index 3cbffd400b1b..fe455f01aa65 100644
> --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> @@ -80,6 +80,22 @@ static inline bool __request_completed(const struct i915_request *rq)
>   	return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
>   }
>   
> +__maybe_unused static bool
> +check_signal_order(struct intel_context *ce, struct i915_request *rq)
> +{
> +	if (!list_is_last(&rq->signal_link, &ce->signals) &&
> +	    i915_seqno_passed(rq->fence.seqno,
> +			      list_next_entry(rq, signal_link)->fence.seqno))
> +		return false;
> +
> +	if (!list_is_first(&rq->signal_link, &ce->signals) &&
> +	    i915_seqno_passed(list_prev_entry(rq, signal_link)->fence.seqno,
> +			      rq->fence.seqno))
> +		return false;
> +
> +	return true;
> +}
> +
>   void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
>   {
>   	struct intel_breadcrumbs *b = &engine->breadcrumbs;
> @@ -99,6 +115,8 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
>   			struct i915_request *rq =
>   				list_entry(pos, typeof(*rq), signal_link);
>   
> +			GEM_BUG_ON(!check_signal_order(ce, rq));
> +
>   			if (!__request_completed(rq))
>   				break;
>   
> @@ -282,6 +300,7 @@ bool i915_request_enable_breadcrumb(struct i915_request *rq)
>   		list_add(&rq->signal_link, pos);
>   		if (pos == &ce->signals) /* catch transitions from empty list */
>   			list_move_tail(&ce->signal_link, &b->signalers);
> +		GEM_BUG_ON(!check_signal_order(ce, rq));
>   
>   		set_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags);
>   	}
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list