From ccd8b3a0eda53f434ff634b2babff0264975741f Mon Sep 17 00:00:00 2001 From: Shaoyun Liu Date: Fri, 4 Aug 2017 18:44:20 -0400 Subject: [PATCH 1764/4131] drm/amdgpu: Fix recursive evict/restore worker on a multiple mapped bo When one buffer object is mapped muliple times, KFD will treat them as different memory object but share the same ttm_bo with a single eviction fence. Separate the ttm_bo_wait and attach eviction fence code to avoid ttm_bo_wait trigger the eviction worker on the bo that just be assigned with the eviction fence Signed-off-by: Shaoyun Liu Change-Id: I4a7dba32c21cbd5fc77512c0476b8d2b4b6ea155 --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 764585f..80b5197 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -2368,12 +2368,12 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info) /* Wait for validate to finish and attach new eviction fence */ list_for_each_entry(mem, &process_info->kfd_bo_list, - validate_list.head) { - struct amdgpu_bo *bo = mem->bo; - - ttm_bo_wait(&bo->tbo, false, false); - amdgpu_bo_fence(bo, &process_info->eviction_fence->base, true); - } + validate_list.head) + ttm_bo_wait(&mem->bo->tbo, false, false); + list_for_each_entry(mem, &process_info->kfd_bo_list, + validate_list.head) + amdgpu_bo_fence(mem->bo, + &process_info->eviction_fence->base, true); /* Attach eviction fence to PD / PT BOs */ list_for_each_entry(peer_vm, &process_info->vm_list_head, -- 2.7.4