[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:07:50 UTC 2020


Ignore that my brain wasn't engaged in the process.  It's clear where 
you wanted the prepare call.


Tom

On 2020-02-19 10:06 a.m., Tom St Denis wrote:
> I get this conflict on top of drm-next
>
> ++<<<<<<< HEAD
>  +      r = vm->update_funcs->prepare(&params, resv, sync_mode);
> ++=======
> +       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);
> ++>>>>>>> drm/amdgpu: add VM update fences back to the root PD v2
>
> Should I keep the prepare call before or after your block?
>
> 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