drm/i915/gt: Only swap to a random sibling once upon creation
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 13 Jul 2020 16:05:49 +0000 (17:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jul 2020 07:34:27 +0000 (09:34 +0200)
commitb99382de1233866a7eea4a016029d417bdcc0fe7
tree24103120d7d52ab00d01e1ef35c08b0877ad2de8
parentefce4c5bf8873329a578b70c4b5b0df0fee73e2d
drm/i915/gt: Only swap to a random sibling once upon creation

commit 110f9efa858f584c6bed177cd48d0c0f526940e1 upstream.

The danger in switching at random upon intel_context_pin is that the
context may still actually be inflight, as it will not be scheduled out
until a context switch after it is complete -- that may be a long time
after we do a final intel_context_unpin.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2118
Fixes: 6d06779e8672 ("drm/i915: Load balancing across a virtual engine")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: <stable@vger.kernel.org> # v5.3+
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200713160549.17344-1-chris@chris-wilson.co.uk
(cherry picked from commit 90a987205c6cf74116a102ed446d22d92cdaf915)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/gt/intel_lrc.c