On 24/06/2026 12:13, Christian König wrote:
Instead of dma_fence_is_signaled_locked() use
dma_fence_test_signaled_flag().

The extra polling check seems unecessary for those use cases.

I echo the comment that better commit messages are needed in this series. Also, the patch affects two really different areas so should be split in two.


Signed-off-by: Christian König <[email protected]>
---
  drivers/dma-buf/sw_sync.c | 2 +-
  include/linux/dma-fence.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 8df20b0218a9..243991bc1506 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c
@@ -262,7 +262,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline 
*obj,
        INIT_LIST_HEAD(&pt->link);
spin_lock_irq(&obj->lock);
-       if (!dma_fence_is_signaled_locked(&pt->base)) {
+       if (!dma_fence_test_signaled_flag(&pt->base)) {
                struct rb_node **p = &obj->pt_tree.rb_node;
                struct rb_node *parent = NULL;

I am not familiar with the implementation but this looks safe to me. It appears the point is to just not allow userspace inserting past fences into the internal tracking structures.

diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 158cd609f103..803e10ca76e3 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -658,7 +658,7 @@ static inline struct dma_fence *dma_fence_later(struct 
dma_fence *f1,
   */
  static inline int dma_fence_get_status_locked(struct dma_fence *fence)
  {
-       if (dma_fence_is_signaled_locked(fence))
+       if (dma_fence_test_signaled_flag(fence))
                return fence->error ?: 1;
        else
                return 0;

This one has more callers.

1. sync_fence - should be fine.
2. amdgpu - Smallish false positive race on reset? But possibly okay. Your call.
3. Selftests - single threaded so okay.
4. Nouveau - looks like some sort of a last gasp check for signaled status when wait expired. It's a 15 second timeout so I guess fine as well.

So in summary, changes look fine to me. But I would split sw_sync and get_status and improve the commit message for both.

Regards,

Tvrtko

Reply via email to