drm/i915/gt: Avoid resetting ring->head outside of its timeline mutex
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 11 Feb 2020 12:01:31 +0000 (12:01 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 11 Feb 2020 12:03:22 +0000 (12:03 +0000)
commit42827350f75c56d0fe9f15d8425a1390528958b6
tree6d95174187051452b79595f1d26d7fe4229beffc
parent3d9c13a6a722fe780a657bd01e480e611c113b4e
drm/i915/gt: Avoid resetting ring->head outside of its timeline mutex

We manipulate ring->head while active in i915_request_retire underneath
the timeline manipulation. We cannot rely on a stable ring->head outside
of the timeline->mutex, in particular while setting up the context for
resume and reset.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/1126
Fixes: 0881954965e3 ("drm/i915: Introduce intel_context.pin_mutex for pin management")
Fixes: e5dadff4b093 ("drm/i915: Protect request retirement with timeline->mutex")
References: f3c0efc9fe7a ("drm/i915/execlists: Leave resetting ring to intel_ring")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200211120131.958949-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/intel_ring_types.h
drivers/gpu/drm/i915/gt/selftest_lrc.c