drm/i915/selftests: Check for the error interrupt before we wait!

Sometimes the error interrupt can fire even before we have seen the
request go active -- in which case, we end up waiting until the timeout
as the request is already completed. Double check for this case!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200214120659.3888735-1-chris@chris-wilson.co.uk
This commit is contained in:
Chris Wilson 2020-02-14 12:06:59 +00:00
parent 926b005cd8
commit fcf7df7aae

View File

@ -76,11 +76,15 @@ static int wait_for_submit(struct intel_engine_cs *engine,
do { do {
cond_resched(); cond_resched();
intel_engine_flush_submission(engine); intel_engine_flush_submission(engine);
if (i915_request_is_active(rq) && if (i915_request_is_active(rq) &&
!READ_ONCE(engine->execlists.pending[0])) { !READ_ONCE(engine->execlists.pending[0])) {
tasklet_unlock_wait(&engine->execlists.tasklet); tasklet_unlock_wait(&engine->execlists.tasklet);
return 0; return 0;
} }
if (i915_request_completed(rq)) /* that was quick! */
return 0;
} while (time_before(jiffies, timeout)); } while (time_before(jiffies, timeout));
return -ETIME; return -ETIME;