We rely on ksoftirqd to run in a timely fashion in order to drain the
execlists queue. Quite frequently, it does not. In some cases we may see
latencies of over 200ms triggering our idle timeouts and forcing us to
declare the driver wedged!

Thus we can speed up idle detection by bypassing ksoftirqd in these
cases and flush our tasklet to confirm if we are indeed still waiting
for the ELSP to drain.

References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
Signed-off-by: Chris Wilson <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c 
b/drivers/gpu/drm/i915/intel_engine_cs.c
index 70325e0824e3..acf87dc73bf4 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -945,12 +945,17 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
                return true;
 
        /* Waiting to drain ELSP? */
-       if (READ_ONCE(engine->execlists.active))
-               return false;
+       if (READ_ONCE(engine->execlists.active)) {
+               struct intel_engine_execlists *execlists = &engine->execlists;
 
-       /* ELSP is empty, but there are ready requests? */
-       if (READ_ONCE(engine->execlists.first))
-               return false;
+               if (tasklet_trylock(&execlists->tasklet)) {
+                       execlists->tasklet.func(execlists->tasklet.data);
+                       tasklet_unlock(&execlists->tasklet);
+               }
+
+               if (READ_ONCE(execlists->active))
+                       return false;
+       }
 
        /* Ring stopped? */
        if (!ring_is_idle(engine))
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to