Blob Blame History Raw
From 3db12a8a0511e903366148320db4f2941aea9427 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue, 18 Feb 2020 21:12:15 +0000
Subject: drm/i915/selftests: Flush tasklet on wait_for_submit()
Git-commit: d30d3d5f58c4b328513204dfb7dd7ed1a125195f
Patch-mainline: v5.7-rc1
References: jsc#SLE-12680, jsc#SLE-12880, jsc#SLE-12882, jsc#SLE-12883, jsc#SLE-13496, jsc#SLE-15322

Always flush the tasklet if we have pending submissions in
wait_for_submit(), so that even if we see the HW has started before we
process its ack, when we return the execlists state is well defined.

Fixes: 06289949b8dd ("drm/i915/selftests: Check for any sign of request starting in wait_for_submit()")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200218211215.1336341-1-chris@chris-wilson.co.uk
Signed-off-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 7b303d5fd5b8..a9c9cfb2def8 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -77,11 +77,11 @@ static int wait_for_submit(struct intel_engine_cs *engine,
 		cond_resched();
 		intel_engine_flush_submission(engine);
 
-		if (i915_request_is_active(rq) &&
-		    !READ_ONCE(engine->execlists.pending[0])) {
-			tasklet_unlock_wait(&engine->execlists.tasklet);
+		if (READ_ONCE(engine->execlists.pending[0]))
+			continue;
+
+		if (i915_request_is_active(rq))
 			return 0;
-		}
 
 		if (i915_request_started(rq)) /* that was quick! */
 			return 0;
-- 
2.28.0