drm/i915/gem: Reduce ctx->engine_mutex for reading the clone source
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 14 Jan 2021 13:56:10 +0000 (13:56 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 15 Jan 2021 08:00:03 +0000 (08:00 +0000)
commit1a72e7414d15ca417e60649b5dc7375f302e4cdf
treece3adc436f24368bc14819347f430ce10e80c77b
parentb2fe00bbb2b6bf06929dc300a4e3e91d9c12a3c9
drm/i915/gem: Reduce ctx->engine_mutex for reading the clone source

When cloning the engines from the source context, we need to ensure that
the engines are not freed as we copy them, and that the flags we clone
from the source correspond with the engines we copy across. To do this
we need only take a reference to the src->engines, rather than hold the
src->engine_mutex, so long as we verify that nothing changed under the
read.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210114135612.13210-3-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_context.c