All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] drm/i915/gt: Skip request resubmission if lite-restore w/a already applied
Date: Sun,  8 Dec 2019 23:28:57 +0000	[thread overview]
Message-ID: <20191208232857.3067949-1-chris@chris-wilson.co.uk> (raw)

Be careful that we never submit the same request again if we have
already applied the LiteRestore w/a upon it -- as the HW may complete
the request as we submit the ELSP and so become confused by the request
to execute an empty ring.

To submit the same request in ELSP[0] three times (so triggering the
LiteRestore w/a and resubmitting with it already applied) would require
preemption, and on preemption we should be unwinding the request tail as
we know the HW hasn't advanced beyond the normal time. So in practice,
this should never occur...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index c7ea8a055005..2fb761063606 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1776,16 +1776,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 
 				return;
 			}
-
-			/*
-			 * WaIdleLiteRestore:bdw,skl
-			 * Apply the wa NOOPs to prevent
-			 * ring:HEAD == rq:TAIL as we resubmit the
-			 * request. See gen8_emit_fini_breadcrumb() for
-			 * where we prepare the padding after the
-			 * end of the request.
-			 */
-			last->tail = last->wa_tail;
 		}
 	}
 
@@ -1943,6 +1933,24 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 				    ctx_single_port_submission(rq->hw_context))
 					goto done;
 
+				/*
+				 * WaIdleLiteRestore:bdw,skl
+				 *
+				 * If we have already submitted this request
+				 * using the wa_tail, we race with the HW and
+				 * HEAD may reach wa_tail before it processes
+				 * the ELSP[]. If it sees a context with an
+				 * empty ring, the HW gets confused.
+				 *
+				 * To prevent subsequent resubmission (lite
+				 * restores) with an empty ring, we emitted a
+				 * couple of NOOPs in gen8_emit_wa_tail()
+				 * beyond the normal end of the request.
+				 */
+				if (unlikely(last->tail == last->wa_tail))
+					goto done;
+
+				last->tail = last->wa_tail;
 				merge = false;
 			}
 
-- 
2.24.0

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

             reply	other threads:[~2019-12-08 23:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-08 23:28 Chris Wilson [this message]
2019-12-08 23:33 ` [Intel-gfx] [PATCH] drm/i915/gt: Skip request resubmission if lite-restore w/a already applied Chris Wilson
2019-12-08 23:37   ` Chris Wilson
2019-12-09  0:09 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2019-12-09  0:39 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Skip request resubmission if lite-restore w/a already applied (rev2) 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=20191208232857.3067949-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.