On 5/26/26 11:32, Prike Liang wrote:
> The eviction rearming does not cover possible TTM move fences. If TTM
> moves the BO and consumes move fence slots, the later eviction fence
> add can hit the dma_resv_add_fence() BUG.
> 
> Signed-off-by: Prike Liang <[email protected]>

Good catch, Reviewed-by: Christian König <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index ea743407dd06..22ec4eb6e17f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -249,7 +249,7 @@ static int amdgpu_gem_object_open(struct drm_gem_object 
> *obj,
>  
>       drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 0);
>       drm_exec_until_all_locked(&exec) {
> -             r = drm_exec_prepare_obj(&exec, &abo->tbo.base, 1);
> +             r = drm_exec_prepare_obj(&exec, &abo->tbo.base, 
> TTM_NUM_MOVE_FENCES + 1);
>               drm_exec_retry_on_contention(&exec);
>               if (unlikely(r))
>                       goto out_unlock;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index f650d8d0ef53..39b188848927 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -978,7 +978,7 @@ amdgpu_userq_vm_validate(struct amdgpu_userq_mgr *uq_mgr)
>               if (unlikely(ret))
>                       goto unlock_all;
>  
> -             ret = amdgpu_vm_lock_individual(vm, &exec, 1);
> +             ret = amdgpu_vm_lock_individual(vm, &exec, TTM_NUM_MOVE_FENCES 
> + 1);
>               drm_exec_retry_on_contention(&exec);
>               if (unlikely(ret))
>                       goto unlock_all;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 519352378b9f..51ddd267da63 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -473,7 +473,7 @@ int amdgpu_vm_lock_individual(struct amdgpu_vm *vm, 
> struct drm_exec *exec,
>                       amdgpu_bo_ref(bo);
>                       spin_unlock(&vm->individual_lock);
>  
> -                     ret = drm_exec_prepare_obj(exec, &bo->tbo.base, 1);
> +                     ret = drm_exec_prepare_obj(exec, &bo->tbo.base, 
> num_fences);
>                       amdgpu_bo_unref(&bo);
>                       if (unlikely(ret))
>                               return ret;

Reply via email to