提交 42e5fee6 编写于 作者: C Christian König 提交者: Alex Deucher

drm/amdgpu: add VM update fences back to the root PD v2

Add update fences to the root PD while mapping BOs.

Otherwise PDs freed during the mapping won't wait for
updates to finish and can cause corruptions.

v2: rebased on drm-misc-next
Signed-off-by: NChristian König <christian.koenig@amd.com>
Fixes: 90b69cdc drm/amdgpu: stop adding VM updates fences to the resv obj
Reviewed-by: Nxinhui pan <xinhui.pan@amd.com>
Tested-by: NLuben Tuikov <luben.tuikov@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 6f9f9604
...@@ -585,8 +585,8 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, ...@@ -585,8 +585,8 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
{ {
entry->priority = 0; entry->priority = 0;
entry->tv.bo = &vm->root.base.bo->tbo; entry->tv.bo = &vm->root.base.bo->tbo;
/* One for TTM and one for the CS job */ /* Two for VM updates, one for TTM and one for the CS job */
entry->tv.num_shared = 2; entry->tv.num_shared = 4;
entry->user_pages = NULL; entry->user_pages = NULL;
list_add(&entry->tv.head, validated); list_add(&entry->tv.head, validated);
} }
...@@ -1599,6 +1599,16 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, ...@@ -1599,6 +1599,16 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
goto error_unlock; goto error_unlock;
} }
if (flags & AMDGPU_PTE_VALID) {
struct amdgpu_bo *root = vm->root.base.bo;
if (!dma_fence_is_signaled(vm->last_direct))
amdgpu_bo_fence(root, vm->last_direct, true);
if (!dma_fence_is_signaled(vm->last_delayed))
amdgpu_bo_fence(root, vm->last_delayed, true);
}
r = vm->update_funcs->prepare(&params, resv, sync_mode); r = vm->update_funcs->prepare(&params, resv, sync_mode);
if (r) if (r)
goto error_unlock; goto error_unlock;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册