* [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic
@ 2026-03-09 12:43 Boris Brezillon
2026-03-09 12:50 ` Christian König
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Boris Brezillon @ 2026-03-09 12:43 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Adrián Larumbe
Cc: dri-devel, kernel, Nicolas Frattaroli, Tvrtko Ursulin,
Philipp Stanner, Christian König
After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
dma_fence::ops == NULL can't be used to check if the fence is initialized.
Use dma_fence_was_initialized() instead.
v2:
- Use dma_fence_was_initialized() instead of open-coding it
Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Philipp Stanner <phasta@kernel.org>
Cc: Christian König <christian.koenig@amd.com>
Reported-by: Steven Price <steven.price@arm.com>
Reported-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index bd703a2904a1..c15941ebe07a 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -3915,7 +3915,7 @@ static void job_release(struct kref *ref)
if (job->base.s_fence)
drm_sched_job_cleanup(&job->base);
- if (job->done_fence && job->done_fence->ops)
+ if (dma_fence_was_initialized(job->done_fence))
dma_fence_put(job->done_fence);
else
dma_fence_free(job->done_fence);
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
@ 2026-03-09 12:50 ` Christian König
2026-03-09 13:11 ` Nicolas Frattaroli
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2026-03-09 12:50 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Adrián Larumbe
Cc: dri-devel, kernel, Nicolas Frattaroli, Tvrtko Ursulin,
Philipp Stanner
On 3/9/26 13:43, Boris Brezillon wrote:
> After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> dma_fence::ops == NULL can't be used to check if the fence is initialized.
> Use dma_fence_was_initialized() instead.
>
> v2:
> - Use dma_fence_was_initialized() instead of open-coding it
>
> Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> Cc: Christian König <christian.koenig@amd.com>
> Reported-by: Steven Price <steven.price@arm.com>
> Reported-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index bd703a2904a1..c15941ebe07a 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3915,7 +3915,7 @@ static void job_release(struct kref *ref)
> if (job->base.s_fence)
> drm_sched_job_cleanup(&job->base);
>
> - if (job->done_fence && job->done_fence->ops)
> + if (dma_fence_was_initialized(job->done_fence))
> dma_fence_put(job->done_fence);
> else
> dma_fence_free(job->done_fence);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
2026-03-09 12:50 ` Christian König
@ 2026-03-09 13:11 ` Nicolas Frattaroli
2026-03-09 15:11 ` Steven Price
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Nicolas Frattaroli @ 2026-03-09 13:11 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Adrián Larumbe,
Boris Brezillon
Cc: dri-devel, kernel, Tvrtko Ursulin, Philipp Stanner,
Christian König
On Monday, 9 March 2026 13:43:18 Central European Standard Time Boris Brezillon wrote:
> After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> dma_fence::ops == NULL can't be used to check if the fence is initialized.
> Use dma_fence_was_initialized() instead.
>
> v2:
> - Use dma_fence_was_initialized() instead of open-coding it
>
> Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> Cc: Christian König <christian.koenig@amd.com>
> Reported-by: Steven Price <steven.price@arm.com>
> Reported-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index bd703a2904a1..c15941ebe07a 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3915,7 +3915,7 @@ static void job_release(struct kref *ref)
> if (job->base.s_fence)
> drm_sched_job_cleanup(&job->base);
>
> - if (job->done_fence && job->done_fence->ops)
> + if (dma_fence_was_initialized(job->done_fence))
> dma_fence_put(job->done_fence);
> else
> dma_fence_free(job->done_fence);
>
Tested-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
This also fixes the refcount underflow for me. Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
2026-03-09 12:50 ` Christian König
2026-03-09 13:11 ` Nicolas Frattaroli
@ 2026-03-09 15:11 ` Steven Price
2026-03-09 17:30 ` Liviu Dudau
2026-03-11 8:54 ` Steven Price
4 siblings, 0 replies; 6+ messages in thread
From: Steven Price @ 2026-03-09 15:11 UTC (permalink / raw)
To: Boris Brezillon, Liviu Dudau, Adrián Larumbe
Cc: dri-devel, kernel, Nicolas Frattaroli, Tvrtko Ursulin,
Philipp Stanner, Christian König
On 09/03/2026 12:43, Boris Brezillon wrote:
> After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> dma_fence::ops == NULL can't be used to check if the fence is initialized.
> Use dma_fence_was_initialized() instead.
>
> v2:
> - Use dma_fence_was_initialized() instead of open-coding it
>
> Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> Cc: Christian König <christian.koenig@amd.com>
> Reported-by: Steven Price <steven.price@arm.com>
> Reported-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index bd703a2904a1..c15941ebe07a 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3915,7 +3915,7 @@ static void job_release(struct kref *ref)
> if (job->base.s_fence)
> drm_sched_job_cleanup(&job->base);
>
> - if (job->done_fence && job->done_fence->ops)
> + if (dma_fence_was_initialized(job->done_fence))
> dma_fence_put(job->done_fence);
> else
> dma_fence_free(job->done_fence);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
` (2 preceding siblings ...)
2026-03-09 15:11 ` Steven Price
@ 2026-03-09 17:30 ` Liviu Dudau
2026-03-11 8:54 ` Steven Price
4 siblings, 0 replies; 6+ messages in thread
From: Liviu Dudau @ 2026-03-09 17:30 UTC (permalink / raw)
To: Boris Brezillon
Cc: Steven Price, Adrián Larumbe, dri-devel, kernel,
Nicolas Frattaroli, Tvrtko Ursulin, Philipp Stanner,
Christian König
On Mon, Mar 09, 2026 at 01:43:18PM +0100, Boris Brezillon wrote:
> After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> dma_fence::ops == NULL can't be used to check if the fence is initialized.
> Use dma_fence_was_initialized() instead.
>
> v2:
> - Use dma_fence_was_initialized() instead of open-coding it
>
> Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> Cc: Christian König <christian.koenig@amd.com>
> Reported-by: Steven Price <steven.price@arm.com>
> Reported-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index bd703a2904a1..c15941ebe07a 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3915,7 +3915,7 @@ static void job_release(struct kref *ref)
> if (job->base.s_fence)
> drm_sched_job_cleanup(&job->base);
>
> - if (job->done_fence && job->done_fence->ops)
> + if (dma_fence_was_initialized(job->done_fence))
> dma_fence_put(job->done_fence);
> else
> dma_fence_free(job->done_fence);
> --
> 2.53.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
` (3 preceding siblings ...)
2026-03-09 17:30 ` Liviu Dudau
@ 2026-03-11 8:54 ` Steven Price
4 siblings, 0 replies; 6+ messages in thread
From: Steven Price @ 2026-03-11 8:54 UTC (permalink / raw)
To: Boris Brezillon, Liviu Dudau, Adrián Larumbe
Cc: dri-devel, kernel, Nicolas Frattaroli, Tvrtko Ursulin,
Philipp Stanner, Christian König
On 09/03/2026 12:43, Boris Brezillon wrote:
> After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"),
> dma_fence::ops == NULL can't be used to check if the fence is initialized.
> Use dma_fence_was_initialized() instead.
>
> v2:
> - Use dma_fence_was_initialized() instead of open-coding it
>
> Cc: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> Cc: Christian König <christian.koenig@amd.com>
> Reported-by: Steven Price <steven.price@arm.com>
> Reported-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Applied to drm-misc-next.
Thanks,
Steve
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index bd703a2904a1..c15941ebe07a 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -3915,7 +3915,7 @@ static void job_release(struct kref *ref)
> if (job->base.s_fence)
> drm_sched_job_cleanup(&job->base);
>
> - if (job->done_fence && job->done_fence->ops)
> + if (dma_fence_was_initialized(job->done_fence))
> dma_fence_put(job->done_fence);
> else
> dma_fence_free(job->done_fence);
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-11 8:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
2026-03-09 12:50 ` Christian König
2026-03-09 13:11 ` Nicolas Frattaroli
2026-03-09 15:11 ` Steven Price
2026-03-09 17:30 ` Liviu Dudau
2026-03-11 8:54 ` Steven Price
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.