[Intel-gfx] [PATCH] drm/i915/gt: Decouple obj<->fence reference cycles on freeing the GT pool

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 31 14:12:45 UTC 2020


Make sure that the obj->base.resv does not hold a reference to a fence
that itself has an active reference on the object. There is no automatic
pruning, so we must decouple such reference cycles (just in case they
exist) before discarding the pool->obj.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c
index 4b7671ac5dca..6411ebdf9468 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c
@@ -31,9 +31,18 @@ bucket_for_size(struct intel_gt_buffer_pool *pool, size_t sz)
 	return &pool->cache_list[n];
 }
 
+static void dma_resv_prune(struct dma_resv *resv)
+{
+	dma_resv_lock(resv, NULL);
+	dma_resv_add_excl_fence(resv, NULL);
+	dma_resv_unlock(resv);
+}
+
 static void node_free(struct intel_gt_buffer_pool_node *node)
 {
+	dma_resv_prune(node->obj->base.resv);
 	i915_gem_object_put(node->obj);
+
 	i915_active_fini(&node->active);
 	kfree_rcu(node, rcu);
 }
-- 
2.20.1



More information about the Intel-gfx mailing list