drm/ttm: reserve the move fence space first
Subsystems (3)
PATCH 1/1 drm/ttm: reserve the move fence space first
Reserve the move fence space before adding the fence to reserve objection.
Signed-off-by Prike Liang <[email protected]>
--- drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +7 -1
@@ -646,9 +646,15 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,return ret; } + ret =dma_resv_reserve_fences (bo->base.resv,1 ); +if (ret) { +pr_err ("Resv shared move fence space failed\n" ); + goto err_resv; + } +dma_resv_add_fence (bo->base.resv, fence,DMA_RESV_USAGE_KERNEL ); - ret =dma_resv_reserve_fences (bo->base.resv,1 ); +err_resv:dma_fence_put (fence);return ret; }
Signature · 1 line
2.34.1
Christian König
NAKAm 25.03.25 um 07:46 schrieb Prike Liang:
Quoted 2 lines
Reserve the move fence space before adding the fence to reserve objection.
NAK, the caller is doing this. We are just reserving a new slot for the next move here.
Aborting without noting the fence is illegal and would lead to memory corruption.
Regards,
Christian.
Quoted 27 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_bo.c +7
-1@@ -646,9 +646,15 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,return ret; } + ret =dma_resv_reserve_fences (bo->base.resv,1 ); +if (ret) { +pr_err ("Resv shared move fence space failed\n" ); + goto err_resv; + } +dma_resv_add_fence (bo->base.resv, fence,DMA_RESV_USAGE_KERNEL ); - ret =dma_resv_reserve_fences (bo->base.resv,1 ); +err_resv:dma_fence_put (fence);return ret; }