summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_request.c
diff options
context:
space:
mode:
authorChris Wilson2019-03-18 10:51:46 +0100
committerChris Wilson2019-03-18 22:00:28 +0100
commit65baf0ef046b0297a1214932d48a6b71d3d79b4c (patch)
tree5366b74868567ae514cc57d732254481dbaba83c /drivers/gpu/drm/i915/i915_request.c
parentdrm/i915: Switch to use HWS indices rather than addresses (diff)
downloadkernel-qcow2-linux-65baf0ef046b0297a1214932d48a6b71d3d79b4c.tar.gz
kernel-qcow2-linux-65baf0ef046b0297a1214932d48a6b71d3d79b4c.tar.xz
kernel-qcow2-linux-65baf0ef046b0297a1214932d48a6b71d3d79b4c.zip
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
Diffstat (limited to 'drivers/gpu/drm/i915/i915_request.c')
-rw-r--r--drivers/gpu/drm/i915/i915_request.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 9533a85cb0b3..0a3d94517d0a 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -1332,8 +1332,12 @@ void i915_retire_requests(struct drm_i915_private *i915)
if (!i915->gt.active_requests)
return;
- list_for_each_entry_safe(ring, tmp, &i915->gt.active_rings, active_link)
+ list_for_each_entry_safe(ring, tmp,
+ &i915->gt.active_rings, active_link) {
+ intel_ring_get(ring); /* last rq holds reference! */
ring_retire_requests(ring);
+ intel_ring_put(ring);
+ }
}
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)