[PATCH] drm/amdgpu: add VM update fences back to the root PD v2

Tom St Denis tom.stdenis at amd.com
Wed Feb 19 15:14:26 UTC 2020


Doesn't build even with conflict resolved:

[root at raven linux]# make
   CALL    scripts/checksyscalls.sh
   CALL    scripts/atomic/check-atomics.sh
   DESCEND  objtool
   CHK     include/generated/compile.h
   CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.o
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c: In function 
‘amdgpu_vm_bo_update_mapping’:
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1612:41: error: ‘owner’ 
undeclared (first use in this function)
  1612 |  r = vm->update_funcs->prepare(&params, owner, exclusive);
       |                                         ^~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1612:41: note: each undeclared 
identifier is reported only once for each function it appears in
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1612:48: error: ‘exclusive’ 
undeclared (first use in this function)
  1612 |  r = vm->update_funcs->prepare(&params, owner, exclusive);
       |                                                ^~~~~~~~~
make[4]: *** [scripts/Makefile.build:266: 
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.o] Error 1
make[3]: *** [scripts/Makefile.build:509: drivers/gpu/drm/amd/amdgpu] 
Error 2
make[2]: *** [scripts/Makefile.build:509: drivers/gpu/drm] Error 2
make[1]: *** [scripts/Makefile.build:509: drivers/gpu] Error 2
make: *** [Makefile:1649: drivers] Error 2

Should I just move to drm-misc-next?

tom

On 2020-02-19 10:02 a.m., Christian König wrote:
> Add update fences to the root PD while mapping BOs.
>
> Otherwise PDs freed during the mapping won't wait for
> updates to finish and can cause corruptions.
>
> v2: rebased on drm-misc-next
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> Fixes: 90b69cdc5f159 drm/amdgpu: stop adding VM updates fences to the resv obj
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index d16231d6a790..ef73fa94f357 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -588,8 +588,8 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
>   {
>   	entry->priority = 0;
>   	entry->tv.bo = &vm->root.base.bo->tbo;
> -	/* One for TTM and one for the CS job */
> -	entry->tv.num_shared = 2;
> +	/* Two for VM updates, one for TTM and one for the CS job */
> +	entry->tv.num_shared = 4;
>   	entry->user_pages = NULL;
>   	list_add(&entry->tv.head, validated);
>   }
> @@ -1591,6 +1591,16 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
>   		goto error_unlock;
>   	}
>   
> +	if (flags & AMDGPU_PTE_VALID) {
> +		struct amdgpu_bo *root = vm->root.base.bo;
> +
> +		if (!dma_fence_is_signaled(vm->last_direct))
> +			amdgpu_bo_fence(root, vm->last_direct, true);
> +
> +		if (!dma_fence_is_signaled(vm->last_delayed))
> +			amdgpu_bo_fence(root, vm->last_delayed, true);
> +	}
> +
>   	r = vm->update_funcs->prepare(&params, owner, exclusive);
>   	if (r)
>   		goto error_unlock;


More information about the amd-gfx mailing list