OSDN Git Service

drm/i915: Hold reference to intel_context over life of i915_request
authorMatthew Brost <matthew.brost@intel.com>
Tue, 27 Jul 2021 00:23:18 +0000 (17:23 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Wed, 28 Jul 2021 00:31:33 +0000 (17:31 -0700)
commit1e98d8c52ed5dfbaf273c4423c636525c2ce59e7
tree0d5fc8f28363360a0b02bc59d5cd1bf65853d5c5
parent96d3e0e1ad0af3070f0a01c72b0ecfa8c2e581b7
drm/i915: Hold reference to intel_context over life of i915_request

Hold a reference to the intel_context over life of an i915_request.
Without this an i915_request can exist after the context has been
destroyed (e.g. request retired, context closed, but user space holds a
reference to the request from an out fence). In the case of GuC
submission + virtual engine, the engine that the request references is
also destroyed which can trigger bad pointer dref in fence ops (e.g.
i915_fence_get_driver_name). We could likely change
i915_fence_get_driver_name to avoid touching the engine but let's just
be safe and hold the intel_context reference.

v2:
 (John Harrison)
  - Update comment explaining how GuC mode and execlists mode deal with
    virtual engines differently

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-4-matthew.brost@intel.com
drivers/gpu/drm/i915/i915_request.c