OSDN Git Service

drm/i915: Hold a ref to the ring while retiring
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 18 Mar 2019 09:51:46 +0000 (09:51 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 18 Mar 2019 21:00:28 +0000 (21:00 +0000)
commit65baf0ef046b0297a1214932d48a6b71d3d79b4c
tree5366b74868567ae514cc57d732254481dbaba83c
parent54939ea0bd85e128bdd5bca579508dd4701c5ce9
drm/i915: Hold a ref to the ring while retiring

As the final request on a ring may hold the reference to this ring (via
retiring the last pinned context), we may find ourselves chasing a
dangling pointer on completion of the list.

A quick solution is to hold a reference to the ring itself as we retire
along it so that we only free it after we stop dereferencing it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190318095204.9913-4-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_request.c
drivers/gpu/drm/i915/intel_engine_types.h
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h
drivers/gpu/drm/i915/selftests/mock_engine.c