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. Seperate 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 <shaoyun....@amd.com>

Change-Id: I4a7dba32c21cbd5fc77512c0476b8d2b4b6ea155
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index a3ee5bf..8e03f44 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -2309,9 +2309,6 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info)
                goto ttm_reserve_fail;
        }
 
-       if (!list_empty(&duplicate_save))
-               pr_err("BUG: list of BOs to reserve has duplicates!\n");
-
        amdgpu_sync_create(&sync_obj);
        ctx.sync = &sync_obj;
 
@@ -2360,12 +2357,11 @@ 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,
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to