[PATCH] drm/amdgpu: Fix recursive evict/restore worker on a multiple mapped bo

Felix Kuehling felix.kuehling at amd.com
Sat Aug 5 03:46:19 UTC 2017


Hi Shaoyun,

The change looks good to me. But I'd make the removal of the duplicate
warning a separate commit and explain the scenario where this occurs in
the commit description (same graphics BO imported multiple times for
interop).

The code you're changing is not upstream yet. It's in amd-kfd-staging
and in the hybrid branch. Let's review this in Gerrit for amd-kfd-staging.

Thanks,
  Felix


On 2017-08-04 07:03 PM, Shaoyun Liu wrote:
> 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.Liu at 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,



More information about the amd-gfx mailing list