drm/i915: Pin the context as we work on it
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 9 Jan 2020 08:51:42 +0000 (08:51 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 9 Jan 2020 12:50:26 +0000 (12:50 +0000)
commitfeed5c7be22c25e9c777c821bcf955a13cf010ab
treeb5ae1cafdef8160c2790ce8a49c08783b64cc67f
parent921f0c47f22891c90e2eb8f8612a083669c5d1ca
drm/i915: Pin the context as we work on it

Since we now allow the intel_context_unpin() to run unserialised, we
risk our operations under the intel_context_lock_pinned() being run as
the context is unpinned (and thus invalidating our state). We can
atomically acquire the pin, testing to see if it is pinned in the
process, thus ensuring that the state remains consistent during the
course of the whole operation.

Fixes: 841350223816 ("drm/i915/gt: Drop mutex serialisation between context pin/unpin")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200109085142.871563-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gt/intel_context.h
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_perf.c