[PATCH 3/3] drm/amdgpu: only bind VM shadows after validation

Felix Kuehling felix.kuehling at amd.com
Thu Jul 13 15:56:55 UTC 2017


On 17-07-13 09:25 AM, Christian König wrote:
> From: Christian König <christian.koenig at amd.com>
>
> No need to do this on every CS.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index ea419ec..e1641f1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -171,6 +171,18 @@ static int amdgpu_vm_validate_level(struct amdgpu_vm_pt *parent,
>  			return r;
>  	}
>  
> +	if (parent->bo->shadow) {
> +		struct amdgpu_bo *shadow = parent->bo->shadow;
> +
> +		r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem);
> +		if (r)
> +			return r;
> +
> +		spin_lock(&glob->lru_lock);
> +		ttm_bo_move_to_lru_tail(&shadow->tbo);
> +		spin_unlock(&glob->lru_lock);
> +	}
> +
>  	spin_lock(&glob->lru_lock);
>  	ttm_bo_move_to_lru_tail(&parent->bo->tbo);
>  	spin_unlock(&glob->lru_lock);
> @@ -1031,11 +1043,6 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
>  
>  		params.func = amdgpu_vm_cpu_set_ptes;
>  	} else {
> -		if (shadow) {
> -			r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem);
> -			if (r)
> -				return r;
> -		}

There is another bind of shadow BOs further down in the loop that does
the update.

Regards,
  Felix

>  		ring = container_of(vm->entity.sched, struct amdgpu_ring,
>  				    sched);
>  



More information about the amd-gfx mailing list