]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gem: Don't leak non-persistent requests on changing engines
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 11 Feb 2020 14:48:31 +0000 (14:48 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 11 Feb 2020 21:58:39 +0000 (21:58 +0000)
commitcffd2585555679e0ea2d1ce715c81df9863ea403
tree97df241bc3c870323e38572ac2e507d41230cd3e
parentf626b71e06c31eed73fc0d49e3056423b019e8c0
drm/i915/gem: Don't leak non-persistent requests on changing engines

If we have a set of active engines marked as being non-persistent, we
lose track of those if the user replaces those engines with
I915_CONTEXT_PARAM_ENGINES. As part of our uABI contract is that
non-persistent requests are terminated if they are no longer being
tracked by the user's context (in order to prevent a lost request
causing an untracked and so unstoppable GPU hang), we need to apply the
same context cancellation upon changing engines.

v2: Track stale engines[] so we only reap at context closure.
v3: Tvrtko spotted races with closing contexts and set-engines, so add a
veneer of kill-everything paranoia to clean up after losing a race.

Fixes: d047fead96ec ("drm/i915/gem: Make context persistence optional")
Testcase: igt/gem_ctx_peristence/replace
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200211144831.1011498-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_context_types.h
drivers/gpu/drm/i915/i915_sw_fence.c
drivers/gpu/drm/i915/i915_sw_fence.h