drm/amdgpu: fix call to amdgpu_eviction_fence_detach
authorChristian König <christian.koenig@amd.com>
Fri, 20 Dec 2024 12:44:23 +0000 (13:44 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 8 Apr 2025 20:48:20 +0000 (16:48 -0400)
That needs to be done after grabbing the lock, not before.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Arvind Yadav <arvind.yadav@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

index 6850a6954a716a2aac94b2476eb55ca5668dedbf..b9b80b0b60cad9a28203535408e12ccd071a9821 100644 (file)
@@ -351,9 +351,6 @@ static void amdgpu_gem_object_close(struct drm_gem_object *obj,
        struct drm_exec exec;
        long r;
 
-       if (!amdgpu_vm_is_bo_always_valid(vm, bo))
-               amdgpu_eviction_fence_detach(&fpriv->evf_mgr, bo);
-
        drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 0);
        drm_exec_until_all_locked(&exec) {
                r = drm_exec_prepare_obj(&exec, &bo->tbo.base, 1);
@@ -367,6 +364,9 @@ static void amdgpu_gem_object_close(struct drm_gem_object *obj,
                        goto out_unlock;
        }
 
+       if (!amdgpu_vm_is_bo_always_valid(vm, bo))
+               amdgpu_eviction_fence_detach(&fpriv->evf_mgr, bo);
+
        bo_va = amdgpu_vm_bo_find(vm, bo);
        if (!bo_va || --bo_va->ref_count)
                goto out_unlock;