[PATCH] drm/amdgpu: Sync KFD fence only for move/evict

Christian König ckoenig.leichtzumerken at gmail.com
Fri Oct 20 07:13:24 UTC 2017


Am 19.10.2017 um 19:40 schrieb Harish Kasiviswanathan:
> A single KFD eviction fence is attached to all the BOs of a process
> including BOs imported. This fence ensures that all BOs belonging to
> that process stays resident when the process queues are active.
>
> Don't add this eviction fence to any sync object unless it is a move or
> evict job. These jobs are identified by the fence owner
> AMDGPU_FENCE_OWNER_UNDEFINED
>
> Change-Id: I8752d1cf6b2a1c4f2a57292b7c2cd308d5b6f9b7
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
> index a4f0ecf..9b5e41e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
> @@ -200,8 +200,10 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
>   
>   	f = reservation_object_get_excl(resv);
>   	fence_owner = amdgpu_sync_get_owner(f);
> -	if (fence_owner != AMDGPU_FENCE_OWNER_KFD ||
> -			owner != AMDGPU_FENCE_OWNER_VM)
> +	if (fence_owner == AMDGPU_FENCE_OWNER_KFD) {
> +		if (owner == AMDGPU_FENCE_OWNER_UNDEFINED)
> +			r = amdgpu_sync_fence(adev, sync, f);
> +	} else
>   		r = amdgpu_sync_fence(adev, sync, f);

NAK, we always need to sync to the exclusive fence no matter what.

>   
>   	if (explicit_sync)
> @@ -216,7 +218,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
>   					      reservation_object_held(resv));
>   		fence_owner = amdgpu_sync_get_owner(f);
>   		if (fence_owner == AMDGPU_FENCE_OWNER_KFD &&
> -				owner == AMDGPU_FENCE_OWNER_VM)
> +		    owner != AMDGPU_FENCE_OWNER_UNDEFINED)

That hunk looks good to me, but I think we don't have that upstream yet 
don't we?

Thanks,
Christian.

>   			continue;
>   
>   		if (amdgpu_sync_same_dev(adev, f)) {




More information about the amd-gfx mailing list