]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gt: Make intel_ring_unpin() safe for concurrent pint
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 18 Nov 2019 23:02:40 +0000 (23:02 +0000)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Tue, 26 Nov 2019 07:50:25 +0000 (09:50 +0200)
commitf868dbe8f13d07a811e62568a2d0e01bedefe0a6
tree4c46f8b02e0f9d27a5b4b997c6168b37ec337556
parentfee3e9f60b02656a755f43d0f8f1d3b461ad5607
drm/i915/gt: Make intel_ring_unpin() safe for concurrent pint

In order to avoid some nasty mutex inversions, commit baf4b170accf
("drm/i915: Keep rings pinned while the context is active") allowed the
intel_ring unpinning to be run concurrently with the next context
pinning it. Thus each step in intel_ring_unpin() needed to be atomic and
ordered in a nice onion with intel_ring_pin() so that the lifetimes
overlapped and were always safe.

Sadly, a few steps in intel_ring_unpin() were overlooked, such as
closing the read/write pointers of the ring and discarding the
intel_ring.vaddr, as these steps were not serialised with
intel_ring_pin() and so could leave the ring in disarray.

Fixes: baf4b170accf ("drm/i915: Keep rings pinned while the context is active")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191118230254.2615942-6-chris@chris-wilson.co.uk
(cherry picked from commit a266bf42006004306dd48a9082c35dfbff153307)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/gt/intel_ring.c