[PATCH] drm/i915: Remove refcount from intel_ring

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Sep 23 11:02:47 UTC 2021


Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c             |  4 ++--
 drivers/gpu/drm/i915/gt/intel_ring.c            |  5 +----
 drivers/gpu/drm/i915/gt/intel_ring.h            | 13 +------------
 drivers/gpu/drm/i915/gt/intel_ring_submission.c |  4 ++--
 drivers/gpu/drm/i915/gt/intel_ring_types.h      |  1 -
 drivers/gpu/drm/i915/gt/mock_engine.c           |  1 -
 drivers/gpu/drm/i915/gt/selftest_ring.c         |  1 -
 7 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 6ba8daea2f56..7fcf44f44cd3 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1008,7 +1008,7 @@ int lrc_alloc(struct intel_context *ce, struct intel_engine_cs *engine)
 	return 0;
 
 err_ring:
-	intel_ring_put(ring);
+	intel_ring_free(ring);
 err_vma:
 	i915_vma_put(vma);
 	return err;
@@ -1073,7 +1073,7 @@ void lrc_fini(struct intel_context *ce)
 	if (!ce->state)
 		return;
 
-	intel_ring_put(fetch_and_zero(&ce->ring));
+	intel_ring_free(fetch_and_zero(&ce->ring));
 	i915_vma_put(fetch_and_zero(&ce->state));
 }
 
diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c
index 7c4d5158e03b..500e67e7e03d 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring.c
@@ -152,7 +152,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size)
 	if (!ring)
 		return ERR_PTR(-ENOMEM);
 
-	kref_init(&ring->ref);
 	ring->size = size;
 	ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(size);
 
@@ -177,10 +176,8 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size)
 	return ring;
 }
 
-void intel_ring_free(struct kref *ref)
+void intel_ring_free(struct intel_ring *ring)
 {
-	struct intel_ring *ring = container_of(ref, typeof(*ring), ref);
-
 	i915_vma_put(ring->vma);
 	kfree(ring);
 }
diff --git a/drivers/gpu/drm/i915/gt/intel_ring.h b/drivers/gpu/drm/i915/gt/intel_ring.h
index 1b32dadfb8c3..f7a71edfcda0 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring.h
+++ b/drivers/gpu/drm/i915/gt/intel_ring.h
@@ -25,18 +25,7 @@ int intel_ring_pin(struct intel_ring *ring, struct i915_gem_ww_ctx *ww);
 void intel_ring_unpin(struct intel_ring *ring);
 void intel_ring_reset(struct intel_ring *ring, u32 tail);
 
-void intel_ring_free(struct kref *ref);
-
-static inline struct intel_ring *intel_ring_get(struct intel_ring *ring)
-{
-	kref_get(&ring->ref);
-	return ring;
-}
-
-static inline void intel_ring_put(struct intel_ring *ring)
-{
-	kref_put(&ring->ref, intel_ring_free);
-}
+void intel_ring_free(struct intel_ring *ring);
 
 static inline void intel_ring_advance(struct i915_request *rq, u32 *cs)
 {
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
index cc31ccc13bfb..f351f29c9814 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
@@ -1051,7 +1051,7 @@ static void ring_release(struct intel_engine_cs *engine)
 	}
 
 	intel_ring_unpin(engine->legacy.ring);
-	intel_ring_put(engine->legacy.ring);
+	intel_ring_free(engine->legacy.ring);
 
 	intel_timeline_unpin(engine->legacy.timeline);
 	intel_timeline_put(engine->legacy.timeline);
@@ -1397,7 +1397,7 @@ int intel_ring_submission_setup(struct intel_engine_cs *engine)
 		i915_gem_object_put(gen7_wa_vma->obj);
 	}
 err_ring:
-	intel_ring_put(ring);
+	intel_ring_free(ring);
 err_timeline:
 	intel_timeline_put(timeline);
 err:
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_types.h b/drivers/gpu/drm/i915/gt/intel_ring_types.h
index 49ccb76dda3b..a57ca3409b0c 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_ring_types.h
@@ -22,7 +22,6 @@
 struct i915_vma;
 
 struct intel_ring {
-	struct kref ref;
 	struct i915_vma *vma;
 	void *vaddr;
 
diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
index 805a05113e35..31a751acc7a3 100644
--- a/drivers/gpu/drm/i915/gt/mock_engine.c
+++ b/drivers/gpu/drm/i915/gt/mock_engine.c
@@ -66,7 +66,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine)
 	if (!ring)
 		return NULL;
 
-	kref_init(&ring->ref);
 	ring->size = sz;
 	ring->effective_size = sz;
 	ring->vaddr = (void *)(ring + 1);
diff --git a/drivers/gpu/drm/i915/gt/selftest_ring.c b/drivers/gpu/drm/i915/gt/selftest_ring.c
index 2a8c534dc125..69e35eb5e4a6 100644
--- a/drivers/gpu/drm/i915/gt/selftest_ring.c
+++ b/drivers/gpu/drm/i915/gt/selftest_ring.c
@@ -11,7 +11,6 @@ static struct intel_ring *mock_ring(unsigned long sz)
 	if (!ring)
 		return NULL;
 
-	kref_init(&ring->ref);
 	ring->size = sz;
 	ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(sz);
 	ring->effective_size = sz;
-- 
2.33.0



More information about the Intel-gfx-trybot mailing list