diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index a40b825763a3e9232edc28de478f610cec1e9e7e..80142a6027da368ffd1cdd7c828f859d75df8b81 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -1097,6 +1097,9 @@ long i915_wait_request(struct drm_i915_gem_request *req, trace_i915_gem_request_wait_begin(req, flags); + if (flags & I915_WAIT_LOCKED) + add_wait_queue(errq, &reset); + if (!i915_sw_fence_done(&req->execute)) { timeout = __i915_request_wait_for_execute(req, flags, timeout); if (timeout < 0) @@ -1112,9 +1115,6 @@ long i915_wait_request(struct drm_i915_gem_request *req, goto complete; set_current_state(state); - if (flags & I915_WAIT_LOCKED) - add_wait_queue(errq, &reset); - intel_wait_init(&wait, req->global_seqno); if (intel_engine_add_wait(req->engine, &wait)) /* In order to check that we haven't missed the interrupt @@ -1174,11 +1174,11 @@ long i915_wait_request(struct drm_i915_gem_request *req, } intel_engine_remove_wait(req->engine, &wait); - if (flags & I915_WAIT_LOCKED) - remove_wait_queue(errq, &reset); __set_current_state(TASK_RUNNING); complete: + if (flags & I915_WAIT_LOCKED) + remove_wait_queue(errq, &reset); trace_i915_gem_request_wait_end(req); return timeout;