All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Mika Kuoppala <mika.kuoppala@intel.com>
Subject: [PATCH v2] drm/i915: Stop automatically retiring requests after a GPU hang
Date: Fri, 13 May 2016 08:57:39 +0100	[thread overview]
Message-ID: <1463126259-17914-1-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1463048746-15829-2-git-send-email-chris@chris-wilson.co.uk>

Following a GPU hang, we break out of the request loop in order to
unlock the struct_mutex for use by the GPU reset. However, if we retire
all the requests at that moment, we cannot identify the guilty request
after performing the reset.

v2: Not automatically retiring requests forces us to recheck for
available ringspace.

Fixes: f4457ae71fd6 ("drm/i915: Prevent leaking of -EIO from i915_wait_request()")
Testcase: igt/gem_reset_stats
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c         | 8 ++++++--
 drivers/gpu/drm/i915/intel_ringbuffer.c | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6e61738fab31..a3d826bb216b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1462,7 +1462,10 @@ i915_wait_request(struct drm_i915_gem_request *req)
 	if (ret)
 		return ret;
 
-	__i915_gem_request_retire__upto(req);
+	/* If the GPU hung, we want to keep the requests to find the guilty. */
+	if (req->reset_counter == i915_reset_counter(&dev_priv->gpu_error))
+		__i915_gem_request_retire__upto(req);
+
 	return 0;
 }
 
@@ -1519,7 +1522,8 @@ i915_gem_object_retire_request(struct drm_i915_gem_object *obj,
 	else if (obj->last_write_req == req)
 		i915_gem_object_retire__write(obj);
 
-	__i915_gem_request_retire__upto(req);
+	if (req->reset_counter == i915_reset_counter(&req->i915->gpu_error))
+		__i915_gem_request_retire__upto(req);
 }
 
 /* A nonblocking variant of the above wait. This is a highly dangerous routine
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 0618dd34c3ec..8d35a3978f9b 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2450,6 +2450,8 @@ int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
 			return ret;
 
 		intel_ring_update_space(ringbuf);
+		if (unlikely(ringbuf->space < wait_bytes))
+			return -EAGAIN;
 	}
 
 	if (unlikely(need_wrap)) {
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-05-13  7:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 10:25 [PATCH 1/2] drm/i915: Stop retiring requests from busy-ioctl Chris Wilson
2016-05-12 10:25 ` [PATCH 2/2] drm/i915: Stop automatically retiring requests after a GPU hang Chris Wilson
2016-05-13  7:57   ` Chris Wilson [this message]
2016-05-13  8:43     ` [PATCH v2] " Mika Kuoppala
2016-05-13  9:38       ` Chris Wilson
2016-05-13  9:39       ` [PATCH 1/2] drm/i915: Move get-reset-stats ioctl from intel_uncore.c to i915_gem_context.c Chris Wilson
2016-05-13  9:39         ` [PATCH 2/2] drm/i915: Complete pending resets before get-reset-stats ioctl Chris Wilson
2016-05-13 10:12           ` Mika Kuoppala
2016-05-13  9:51         ` [PATCH 1/2] drm/i915: Move get-reset-stats ioctl from intel_uncore.c to i915_gem_context.c Mika Kuoppala
2016-05-13 10:48     ` [PATCH v2] drm/i915: Stop automatically retiring requests after a GPU hang Mika Kuoppala
2016-05-13  8:25 ` ✗ Ro.CI.BAT: failure for series starting with [1/2] drm/i915: Stop retiring requests from busy-ioctl (rev2) Patchwork
2016-05-13  8:38 ` [PATCH 1/2] drm/i915: Stop retiring requests from busy-ioctl Tvrtko Ursulin
2016-05-13  8:50   ` Chris Wilson
2016-05-13  9:01     ` Tvrtko Ursulin
2016-05-13 10:30       ` [PATCH v2] drm/i915: Stop retiring requests from busy/wait ioctls Chris Wilson
2016-05-13  9:48 ` ✗ Ro.CI.BAT: failure for series starting with [1/2] drm/i915: Stop retiring requests from busy-ioctl (rev4) Patchwork
2016-05-13 10:40 ` [PATCH 1/2] drm/i915: Stop retiring requests from busy-ioctl Mika Kuoppala
2016-05-13 11:00 ` ✗ Ro.CI.BAT: failure for series starting with [v2] drm/i915: Stop retiring requests from busy/wait ioctls (rev5) 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=1463126259-17914-1-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.