[PATCH 6/8] drm/amdgpu: always reserve two slots for the VM

Zhang, Jerry(Junwei) Jerry.Zhang at amd.com
Wed Oct 24 05:27:34 UTC 2018


On 10/4/18 9:12 PM, Christian König wrote:
> And drop the now superflous extra reservations.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |  4 ----
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++---------
>   2 files changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index b8de56d1a866..ba406bd1b08f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -964,10 +964,6 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
>   	if (r)
>   		return r;
>   
> -	r = reservation_object_reserve_shared(vm->root.base.bo->tbo.resv, 1);
> -	if (r)
> -		return r;
> -
>   	p->job->vm_pd_addr = amdgpu_gmc_pd_addr(vm->root.base.bo);
>   
>   	if (amdgpu_vm_debug) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 218527bb0156..1b39b0144698 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -616,7 +616,8 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
>   {
>   	entry->priority = 0;
>   	entry->tv.bo = &vm->root.base.bo->tbo;
> -	entry->tv.num_shared = 1;
> +	/* One for the VM updates and one for the CS job */
> +	entry->tv.num_shared = 2;
>   	entry->user_pages = NULL;
>   	list_add(&entry->tv.head, validated);
>   }
> @@ -772,10 +773,6 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
>   
>   	ring = container_of(vm->entity.rq->sched, struct amdgpu_ring, sched);
>   
> -	r = reservation_object_reserve_shared(bo->tbo.resv, 1);
> -	if (r)
> -		return r;
> -

A trivial thing, this change may belong to next patch.
this patch looks dropping the resv for root bo.

Regards,
Jerry

>   	r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
>   	if (r)
>   		goto error;
> @@ -1839,10 +1836,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
>   	if (r)
>   		goto error_free;
>   
> -	r = reservation_object_reserve_shared(vm->root.base.bo->tbo.resv, 1);
> -	if (r)
> -		goto error_free;
> -
>   	r = amdgpu_vm_update_ptes(&params, start, last + 1, addr, flags);
>   	if (r)
>   		goto error_free;
> @@ -3023,6 +3016,10 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   	if (r)
>   		goto error_free_root;
>   
> +	r = reservation_object_reserve_shared(root->tbo.resv, 1);
> +	if (r)
> +		goto error_unreserve;
> +
>   	r = amdgpu_vm_clear_bo(adev, vm, root,
>   			       adev->vm_manager.root_level,
>   			       vm->pte_support_ats);



More information about the amd-gfx mailing list