Skip to contentSkip to conversation

amd/ttm: test fence->ops->signaled before use

RFC PATCH In review James Zhu 3 participants 3 messages Jan 7, 2025 – Jan 8, 2025

Subsystems (3)
lore
Share & tools
lore

James Zhu

author
#0 lore raw

RFC PATCH 1/1 amd/ttm: test fence->ops->signaled before use

this original test condition is unclear.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index 48c5365efca1..d40f07802c4f 100644
@@ -218,7 +218,7 @@ static void ttm_bo_flush_all_fences(struct ttm_buffer_object *bo)
 
 	dma_resv_iter_begin(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP);
 	dma_resv_for_each_fence_unlocked(&cursor, fence) {
-		if (!fence->ops->signaled)
+		if (fence->ops->signaled && !fence->ops->signaled(fence))
 			dma_fence_enable_sw_signaling(fence);
 	}
 	dma_resv_iter_end(&cursor);
Signature · 1 line
2.34.1
#1 lore raw

Am 07.01.25 um 21:01 schrieb James Zhu:

Quoted 1 line

this original test condition is unclear.

No that is completely unnecessary.

The point is that with fence->ops->signaled provided the fence should make progress even without enabling signaling.

Why would you want to add this?

Regards,
Christian.

Quoted 19 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index 48c5365efca1..d40f07802c4f 100644
@@ -218,7 +218,7 @@ static void ttm_bo_flush_all_fences(struct ttm_buffer_object *bo)
 
  	dma_resv_iter_begin(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP);
  	dma_resv_for_each_fence_unlocked(&cursor, fence) {
-		if (!fence->ops->signaled)
+		if (fence->ops->signaled && !fence->ops->signaled(fence))
  			dma_fence_enable_sw_signaling(fence);
  	}
  	dma_resv_iter_end(&cursor);
#2 lore raw

MyQorAisinline.

Thanks!

JamesZhu

Quoted 8 lines · Christian König

Am 07.01.25 um 21:01 schrieb James Zhu:

Quoted 1 line

this original test condition is unclear.

No that is completely unnecessary.

The point is that with fence->ops->signaled provided the fence should make progress even without enabling signaling.

Why would you want to add this?

[JZ]Nothing happened.  just for clarification. So the code can be interpreted , if this fence has no signal op defined, we need try to use enable_signaling

to flush this fence. implicitly, if signal op is defined, then this fence is flushed early or later around.

Quoted 24 lines

Regards,
Christian.

Quoted 19 lines

---
  drivers/gpu/drm/ttm/ttm_bo.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index 48c5365efca1..d40f07802c4f 100644
@@ -218,7 +218,7 @@ static void ttm_bo_flush_all_fences(struct 
 ttm_buffer_object *bo)
         dma_resv_iter_begin(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP);
       dma_resv_for_each_fence_unlocked(&cursor, fence) {
-        if (!fence->ops->signaled)
+        if (fence->ops->signaled && !fence->ops->signaled(fence))
               dma_fence_enable_sw_signaling(fence);
       }
       dma_resv_iter_end(&cursor);