Skip to contentSkip to conversation

drm/etnaviv: etnaviv_fence: Put base class first

PATCH Applied Philipp Stanner 4 participants 6 messages Oct 28 – Oct 30

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/etnaviv: etnaviv_fence: Put base class first

struct etnaviv_fence contains a struct dma_fence, which is its base class. The base class should always be the first member of a class.

This allows for removing a deprecated callback in a subsequent patch.

Make struct dma_fence base the first member of struct etnaviv_fence.

---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +1 -1
index 5c23182f4d33..e51a310c8d70 100644
@@ -1148,8 +1148,8 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
 
 /* fence object management */
 struct etnaviv_fence {
-	struct etnaviv_gpu *gpu;
 	struct dma_fence base;
+	struct etnaviv_gpu *gpu;
 };
 
 static inline struct etnaviv_fence *to_etnaviv_fence(struct dma_fence *fence)

base-commit: 731ba09867520c047c7de53f92e384808e0b638e

Signature · 1 line
2.56.0
#1 lore raw

PATCH 2/2 drm/etnaviv: Remove deprecated fence_ops->release()

The dma_fence->ops->release() callback is deprecated because it prevents drivers from unloading. All etnaviv does in its implementation is invoke a kfree_rcu() on the fence.

The fence backend by now also frees fences with kfree_rcu() if ops->release() is not implemented.

Remove the deprecated callback.

---
Just compile-tested.

---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0 -8
index e51a310c8d70..e75dab5e407d 100644
@@ -1176,18 +1176,10 @@ static bool etnaviv_fence_signaled(struct dma_fence *fence)
 	return (s32)(f->gpu->completed_fence - f->base.seqno) >= 0;
 }
 
-static void etnaviv_fence_release(struct dma_fence *fence)
-{
-	struct etnaviv_fence *f = to_etnaviv_fence(fence);
-
-	kfree_rcu(f, base.rcu);
-}
-
 static const struct dma_fence_ops etnaviv_fence_ops = {
 	.get_driver_name = etnaviv_fence_get_driver_name,
 	.get_timeline_name = etnaviv_fence_get_timeline_name,
 	.signaled = etnaviv_fence_signaled,
-	.release = etnaviv_fence_release,
 };
 
 static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
Signature · 1 line
2.56.0
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/etnaviv: Remove deprecated fence_ops->release()

Am Mittwoch, dem 28.10.2026 um 11:31 +0100 schrieb Philipp Stanner:

Quoted 10 lines

The dma_fence->ops->release() callback is deprecated because it prevents drivers from unloading. All etnaviv does in its implementation is invoke a kfree_rcu() on the fence.

The fence backend by now also frees fences with kfree_rcu() if ops->release() is not implemented.

Remove the deprecated callback.

Please take this through drm-misc or whatever tree is convenient.

Regards,
Lucas

Quoted 29 lines

---
Just compile-tested.

---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0 -8
index e51a310c8d70..e75dab5e407d 100644
@@ -1176,18 +1176,10 @@ static bool etnaviv_fence_signaled(struct dma_fence *fence)
 	return (s32)(f->gpu->completed_fence - f->base.seqno) >= 0;
 }
 
-static void etnaviv_fence_release(struct dma_fence *fence)
-{
-	struct etnaviv_fence *f = to_etnaviv_fence(fence);
-
-	kfree_rcu(f, base.rcu);
-}
-
 static const struct dma_fence_ops etnaviv_fence_ops = {
 	.get_driver_name = etnaviv_fence_get_driver_name,
 	.get_timeline_name = etnaviv_fence_get_timeline_name,
 	.signaled = etnaviv_fence_signaled,
-	.release = etnaviv_fence_release,
 };
 
 static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
Reviewed-by on v1 1/2
#3 lore raw
In reply to Philipp Stanner
Quoted 8 lines · Philipp Stanner

struct etnaviv_fence contains a struct dma_fence, which is its base class. The base class should always be the first member of a class.

This allows for removing a deprecated callback in a subsequent patch.

Make struct dma_fence base the first member of struct etnaviv_fence.

Quoted 20 lines
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +1 -1
index 5c23182f4d33..e51a310c8d70 100644
@@ -1148,8 +1148,8 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
 
 /* fence object management */
 struct etnaviv_fence {
-	struct etnaviv_gpu *gpu;
 	struct dma_fence base;
+	struct etnaviv_gpu *gpu;
 };
 
 static inline struct etnaviv_fence *to_etnaviv_fence(struct dma_fence *fence)

base-commit: 731ba09867520c047c7de53f92e384808e0b638e

maintainer Reviewed-by on v1 1/2
#4 lore raw
In reply to Philipp Stanner

Am Mittwoch, dem 28.10.2026 um 11:31 +0100 schrieb Philipp Stanner:

Quoted 8 lines

struct etnaviv_fence contains a struct dma_fence, which is its base class. The base class should always be the first member of a class.

This allows for removing a deprecated callback in a subsequent patch.

Make struct dma_fence base the first member of struct etnaviv_fence.

Quoted 20 lines
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +1 -1
index 5c23182f4d33..e51a310c8d70 100644
@@ -1148,8 +1148,8 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
 
 /* fence object management */
 struct etnaviv_fence {
-	struct etnaviv_gpu *gpu;
 	struct dma_fence base;
+	struct etnaviv_gpu *gpu;
 };
 
 static inline struct etnaviv_fence *to_etnaviv_fence(struct dma_fence *fence)

base-commit: 731ba09867520c047c7de53f92e384808e0b638e

#5 lore raw
In reply to Philipp Stanner
Quoted 6 lines · Philipp Stanner

struct etnaviv_fence contains a struct dma_fence, which is its base class. The base class should always be the first member of a class.

This allows for removing a deprecated callback in a subsequent patch.

Make struct dma_fence base the first member of struct etnaviv_fence.

Applied this and the following one to drm-misc-next

Thx guys