All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gt: Add delay to let engine resumes properly
@ 2025-04-16 10:36 Nitin Gote
  2025-04-16 14:54 ` ✓ i915.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Nitin Gote @ 2025-04-16 10:36 UTC (permalink / raw)
  To: intel-gfx; +Cc: andi.shyti, chris.p.wilson, nitin.r.gote

Sometimes engine reset fails because the engine resumes from an
incorrect RING_HEAD. Engine head failed to set to zero even after
writing into it. This is a timing issue and we experimented
different values and found out that 20ms delay works best based
on testing.

So, add a 20ms delay to let engine resumes from correct RING_HEAD.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13968
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
---
Hi,

Here, using wait_for_atomic() instead of any delay functions like
udelay/mdelay/flseep to avoid error "BUG: scheduling while atomic",
which observed during testing.

-Nitin

 drivers/gpu/drm/i915/gt/intel_ring_submission.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
index 6e9977b2d180..a876a34455f1 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
@@ -365,7 +365,13 @@ static void reset_prepare(struct intel_engine_cs *engine)
 			     ENGINE_READ_FW(engine, RING_HEAD),
 			     ENGINE_READ_FW(engine, RING_TAIL),
 			     ENGINE_READ_FW(engine, RING_START));
-		if (!stop_ring(engine)) {
+		/*
+		 * Sometimes engine head failed to set to zero even after writing into it.
+		 * Use wait_for_atomic() with 20ms delay to let engine resumes from
+		 * correct RING_HEAD. Experimented different values and determined
+		 * that 20ms works best based on testing.
+		 */
+		if (wait_for_atomic((!stop_ring(engine) == 0), 20)) {
 			drm_err(&engine->i915->drm,
 				"failed to set %s head to zero "
 				"ctl %08x head %08x tail %08x start %08x\n",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-04-30 15:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 10:36 [PATCH] drm/i915/gt: Add delay to let engine resumes properly Nitin Gote
2025-04-16 14:54 ` ✓ i915.CI.BAT: success for " Patchwork
2025-04-16 23:28 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-21  7:15   ` Gote, Nitin R
2025-04-21 10:55     ` Ravali, JupallyX
2025-04-21 10:53 ` ✓ i915.CI.Full: success " Patchwork
2025-04-23 14:57 ` [PATCH] " Sebastian Brzezinka
2025-04-24 12:29 ` Krzysztof Karas
2025-04-29  7:01   ` Gote, Nitin R
2025-04-29 11:51     ` Krzysztof Karas
2025-04-29 13:16       ` Gote, Nitin R
2025-04-29 20:53         ` Rodrigo Vivi
2025-04-30 15:06           ` Gote, Nitin R

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.