drm/i915: Check for timeout completion when waiting for the rq to submitted
authorChris Wilson <[email protected]>
Wed, 8 Feb 2017 18:12:38 +0000 (18:12 +0000)
committerChris Wilson <[email protected]>
Thu, 9 Feb 2017 09:26:32 +0000 (09:26 +0000)
We first wait for a request to be submitted to hw and assigned a seqno,
before we can wait for the hw to signal completion (otherwise we don't
know the hw id we need to wait upon). Whilst waiting for the request to
be submitted, we may exceed the user's timeout and need to propagate the
error back.

v2: Make ETIME into an error from wait_for_execute for consistent exit
handling.

Reported-by: Tvrtko Ursulin <[email protected]>
Fixes: 4680816be336 ("drm/i915: Wait first for submission, before waiting for request completion")
Testcase: igt/gem_wait/basic-await
Signed-off-by: Chris Wilson <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: <[email protected]> # v4.10-rc1+
Cc: [email protected]
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Tvrtko Ursulin <[email protected]>
drivers/gpu/drm/i915/i915_gem_request.c

index 72b7f7d9461def216a4283267de74d32384bef43..f31deeb727039fe9908efd6e7af4ac0565a968b0 100644 (file)
@@ -1025,8 +1025,13 @@ __i915_request_wait_for_execute(struct drm_i915_gem_request *request,
                        break;
                }
 
+               if (!timeout) {
+                       timeout = -ETIME;
+                       break;
+               }
+
                timeout = io_schedule_timeout(timeout);
-       } while (timeout);
+       } while (1);
        finish_wait(&request->execute.wait, &wait);
 
        if (flags & I915_WAIT_LOCKED)