drm/i915/selftests: Exercise potential false lite-restore
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 2 Oct 2019 18:34:59 +0000 (19:34 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 2 Oct 2019 23:26:02 +0000 (00:26 +0100)
commitfcde8c7eea6004e92f8b329a84c2a520a1a71bc0
tree19ecc9d3e8e6ccbfe28ea63a395b509a55988d5f
parentf21e8b80b79d77872e88d853032294ba5bde0bc4
drm/i915/selftests: Exercise potential false lite-restore

If execlists's lite-restore is based on the common GEM context tag
rather than the per-intel_context LRCA, then a context switch between
two intel_contexts on the same engine derived from the same GEM context
will perform a lite-restore instead of a full context switch. We can
exploit this by poisoning the ringbuffer of the first context and trying
to trick a simple RING_TAIL update (i.e. lite-restore)

v2: Also check what happens if preempt ce[0] with ce[1] (both instances
on the same engine from the same parent context) [Tvrtko]

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/20191002183459.26614-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/selftest_lrc.c