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

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 31 22:22:57 UTC 2020


Make sure that the obj->base.resv does not hold any fence references may
be keeping other objects alive. There is no automatic pruning of the
dma_rev, so we must decouple any such reference cycle before discarding
the pool->obj to ensure that the associated memory is released in a
timely manner.

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-trybot mailing list