]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/guc: Take context ref when cancelling request
authorMatthew Brost <matthew.brost@intel.com>
Thu, 9 Sep 2021 16:47:33 +0000 (09:47 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Mon, 13 Sep 2021 18:30:41 +0000 (11:30 -0700)
A context can get destroyed after cancelling a request, if a context or
GT reset occurs, so take a reference to context when cancelling a
request.

Fixes: 62eaf0ae217d ("drm/i915/guc: Support request cancellation")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210909164744.31249-13-matthew.brost@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

index 5970c54a2e729932ce1610e0260fb3c6103e570b..e036a171ff179bc49c1d0c4f31d56a2d74b7f93d 100644 (file)
@@ -1624,8 +1624,10 @@ static void guc_context_cancel_request(struct intel_context *ce,
                                       struct i915_request *rq)
 {
        if (i915_sw_fence_signaled(&rq->submit)) {
-               struct i915_sw_fence *fence = guc_context_block(ce);
+               struct i915_sw_fence *fence;
 
+               intel_context_get(ce);
+               fence = guc_context_block(ce);
                i915_sw_fence_wait(fence);
                if (!i915_request_completed(rq)) {
                        __i915_request_skip(rq);
@@ -1640,6 +1642,7 @@ static void guc_context_cancel_request(struct intel_context *ce,
                flush_work(&ce_to_guc(ce)->ct.requests.worker);
 
                guc_context_unblock(ce);
+               intel_context_put(ce);
        }
 }