[PATCH 04/91] drm/i915: Set guilty-flag on fence after detecting a hang

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 5 13:35:19 UTC 2017


On Thu, Jan 05, 2017 at 01:24:16PM +0000, Tvrtko Ursulin wrote:
> 
> On 05/01/2017 10:34, Chris Wilson wrote:
> >The struct dma_fence carries a status field exposed to userspace by
> >sync_file. This is inspected after the fence is signaled and can convey
> >whether or not the request completed successfully, or in our case if we
> >detected a hang during the request (signaled via -EIO in
> >SYNC_IOC_FILE_INFO).
> >
> >v2: Mark all cancelled requests as failed.
> >
> >Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> >Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> >---
> > drivers/gpu/drm/i915/i915_gem.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> >index 37107448a42b..1fcce2db86f2 100644
> >--- a/drivers/gpu/drm/i915/i915_gem.c
> >+++ b/drivers/gpu/drm/i915/i915_gem.c
> >@@ -2724,6 +2724,8 @@ static void reset_request(struct drm_i915_gem_request *request)
> > 		head = 0;
> > 	}
> > 	memset(vaddr + head, 0, request->postfix - head);
> >+
> >+	dma_fence_set_error(&request->fence, -EIO);
> > }
> >
> > void i915_gem_reset_prepare(struct drm_i915_private *dev_priv)
> >@@ -2754,10 +2756,12 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
> > 		ring_hung = false;
> > 	}
> >
> >-	if (ring_hung)
> >+	if (ring_hung) {
> > 		i915_gem_context_mark_guilty(request->ctx);
> >-	else
> >+		dma_fence_set_error(&request->fence, -EIO);
> >+	} else {
> > 		i915_gem_context_mark_innocent(request->ctx);
> >+	}
> >
> > 	if (!ring_hung)
> > 		return;
> >
> 
> I was thinking briefly if we could consolidate dma_fence_set_error
> only in reset_request, and call the latter in all cases instead of
> sometimes, but then decided to leave that for later.

Hmm, right simple and marginally safer (if the hw reprogam fails). The
only reason it is skipped is because we aim to skip the request entirely
and so it would seem pointless. But equally makes the ring_hung path
simpler, so...
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx-trybot mailing list