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: mika.kuoppala@intel.com
Subject: [PATCH 2/6] drm/i915: Suppress busy status for engines if wedged
Date: Thu, 30 Mar 2017 15:50:37 +0100	[thread overview]
Message-ID: <20170330145041.9005-2-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20170330145041.9005-1-chris@chris-wilson.co.uk>

If the driver is wedged, HW state may be very inconsistent and
report that it is still busy, even though we have stopped using it. This
can lead to a double *ERROR* rather than a graceful cleanup after
wedging.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c        | 4 +---
 drivers/gpu/drm/i915/intel_engine_cs.c | 9 +++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index cb61cec26db5..7165f314f830 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3112,9 +3112,7 @@ i915_gem_idle_work_handler(struct work_struct *work)
 	 * Wait for last execlists context complete, but bail out in case a
 	 * new request is submitted.
 	 */
-	wait_for(READ_ONCE(dev_priv->gt.active_requests) ||
-		 intel_engines_are_idle(dev_priv),
-		 10);
+	wait_for(intel_engines_are_idle(dev_priv), 10);
 	if (READ_ONCE(dev_priv->gt.active_requests))
 		return;
 
diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 1fb97e8401de..854e8e0c836b 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1111,6 +1111,15 @@ bool intel_engines_are_idle(struct drm_i915_private *dev_priv)
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
 
+	if (READ_ONCE(dev_priv->gt.active_requests))
+		return false;
+
+	/* If the driver is wedged, HW state may be very inconsistent and
+	 * report that it is still busy, even though we have stopped using it.
+	 */
+	if (i915_terminally_wedged(&dev_priv->gpu_error))
+		return true;
+
 	for_each_engine(engine, dev_priv, id) {
 		if (!intel_engine_is_idle(engine))
 			return false;
-- 
2.11.0

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

  reply	other threads:[~2017-03-30 14:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 14:50 [PATCH 1/6] drm/i915: Do request retirement before marking engines as wedged Chris Wilson
2017-03-30 14:50 ` Chris Wilson [this message]
2017-03-30 14:50 ` [PATCH 3/6] drm/i915: Move retire-requests into i915_gem_wait_for_idle() Chris Wilson
2017-03-31  8:21   ` Joonas Lahtinen
2017-03-31 11:06     ` Chris Wilson
2017-03-30 14:50 ` [PATCH 4/6] drm/i915: Wait for all engines to be idle as part of i915_gem_wait_for_idle() Chris Wilson
2017-03-31  8:31   ` Joonas Lahtinen
2017-03-31  8:50     ` Chris Wilson
2017-03-30 14:50 ` [PATCH 5/6] drm/i915: Remove redudant wait for each engine to idle from seqno wrap Chris Wilson
2017-03-31  8:33   ` Joonas Lahtinen
2017-03-30 14:50 ` [PATCH 6/6] drm/i915: Combine reset_all_global_seqno() loops into one Chris Wilson
2017-03-31  8:39   ` Joonas Lahtinen
2017-03-30 15:50 ` ✗ Fi.CI.BAT: failure for series starting with [1/6] drm/i915: Do request retirement before marking engines as wedged 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=20170330145041.9005-2-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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.