drm/amdgpu: Reserve fences for VM update
authorFelix Kuehling <Felix.Kuehling@amd.com>
Mon, 17 Jul 2023 19:28:52 +0000 (15:28 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Oct 2023 22:56:57 +0000 (18:56 -0400)
In amdgpu_dma_buf_move_notify reserve fences for the page table updates
in amdgpu_vm_clear_freed and amdgpu_vm_handle_moved. This fixes a BUG_ON
in dma_resv_add_fence when using SDMA for page table updates.

Signed-off-by: Felix Kuehling <Felix.Kuehling@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_dma_buf.c

index 12210598e5b8e64c8f88d50eaec69ff3f3161bac..ba3a87cb88ccc9de8ea6ad71012d880ab1777336 100644 (file)
@@ -403,7 +403,10 @@ amdgpu_dma_buf_move_notify(struct dma_buf_attachment *attach)
                                continue;
                }
 
-               r = amdgpu_vm_clear_freed(adev, vm, NULL);
+               /* Reserve fences for two SDMA page table updates */
+               r = dma_resv_reserve_fences(resv, 2);
+               if (!r)
+                       r = amdgpu_vm_clear_freed(adev, vm, NULL);
                if (!r)
                        r = amdgpu_vm_handle_moved(adev, vm);