]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: reserve TTM move fences slot for rearming eviction fences
authorPrike Liang <Prike.Liang@amd.com>
Tue, 26 May 2026 08:42:14 +0000 (16:42 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Jun 2026 17:49:29 +0000 (13:49 -0400)
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 <Prike.Liang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 1120f8225ac020b627ee23790653e9c0b4e1bce7..212c14d99f6b58ee44604ddb3386d0ba5bbf8628 100644 (file)
@@ -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;
index 5438d5fde8786b7bda898113adf87babd1cdbd41..e07d936b8f8df2aa40c5211d6a622100d9b9f481 100644 (file)
@@ -975,7 +975,7 @@ retry_lock:
                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;
index 4558a5663c66e97439db380a8f68cf221c882f4d..96da18e5b1386e0827cc285d0ab14229380895fa 100644 (file)
@@ -484,7 +484,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;