Skip to content

Commit ba029e9

Browse files
erichuang22alexdeucher
authored andcommitted
drm/amdkfd: Add sync after creating vram bo
There will be data corruption on vram allocated by svm if the initialization is not complete and application is writting on the memory. Adding sync to wait for the initialization completion is to resolve this issue. Signed-off-by: Eric Huang <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 99f1a36 commit ba029e9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_svm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,15 @@ svm_range_vram_node_new(struct amdgpu_device *adev, struct svm_range *prange,
570570
goto reserve_bo_failed;
571571
}
572572

573+
if (clear) {
574+
r = amdgpu_bo_sync_wait(bo, AMDGPU_FENCE_OWNER_KFD, false);
575+
if (r) {
576+
pr_debug("failed %d to sync bo\n", r);
577+
amdgpu_bo_unreserve(bo);
578+
goto reserve_bo_failed;
579+
}
580+
}
581+
573582
r = dma_resv_reserve_fences(bo->tbo.base.resv, 1);
574583
if (r) {
575584
pr_debug("failed %d to reserve bo\n", r);

0 commit comments

Comments
 (0)