[PATCH] drm/amdgpu: only wait GTT bo's fence in amdgpu_bo_move

Felix Kuehling felix.kuehling at amd.com
Wed Apr 12 21:32:33 UTC 2023


Am 2023-04-12 um 14:49 schrieb Eric Huang:
> It is to avoid redundant eviction for KFD's DMAbuf import
> bo when dmaunmapping DMAbuf. The DMAbuf import bo has
> been set as AMDGPU_PL_PREEMPT in KFD when mapping.
>
> Signed-off-by: Eric Huang <jinhuieric.huang at amd.com>

The headline is a bit inaccurate. The shortest description I can come up 
with is "Ignore KFD eviction fences invalidating preemptible DMABuf 
imports".


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 2430f3e9f3a7..a0828f6d9fbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -526,7 +526,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
>   	if ((old_mem->mem_type == TTM_PL_TT ||
>   	     old_mem->mem_type == AMDGPU_PL_PREEMPT) &&
>   	    new_mem->mem_type == TTM_PL_SYSTEM) {
> -		r = ttm_bo_wait_ctx(bo, ctx);
> +		if (old_mem->mem_type == AMDGPU_PL_PREEMPT)
> +			r = amdgpu_bo_sync_wait(abo, AMDGPU_FENCE_OWNER_KFD, false);

The interruptible flag (3rd parameter) should come from ctx->interruptible.

Regards,
   Felix


> +		else
> +			r = ttm_bo_wait_ctx(bo, ctx);
>   		if (r)
>   			return r;
>   


More information about the amd-gfx mailing list