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

Luben Tuikov luben.tuikov at amd.com
Wed Feb 19 21:40:27 UTC 2020


On 2020-02-19 9:44 a.m., Christian König wrote:
> Well it should apply on top of amd-staging-drm-next. But I haven't 
> fetched that today yet.
> 
> Give me a minute to rebase.

This patch seems to have fixed the regression we saw yesterday.
It applies to amd-staging-drm-next with a small jitter:

$patch -p1 < /tmp/\[PATCH\]\ drm_amdgpu\:\ add\ VM\ update\ fences\ back\ to\ the\ root\ PD.eml 
patching file amdgpu_vm.c
Hunk #2 succeeded at 1599 (offset -20 lines).

I've been running 'glxgears' on the root window and 'pinion'
and no problems--clean log.

Tested-by: Luben Tuikov <luben.tuikov at amd.com>

Regards,
Luben

> 
> Christian.
> 
> Am 19.02.20 um 15:27 schrieb Tom St Denis:
>> This doesn't apply on top of 7fd3b632e17e55c5ffd008f9f025754e7daa1b66 
>> which is the tip of drm-next
>>
>>
>> Tom
>>
>> On 2020-02-19 9:20 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.
>>>
>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>> ---
>>>   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 e7ab0c1e2793..dd63ccdbad2a 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> @@ -585,8 +585,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);
>>>   }
>>> @@ -1619,6 +1619,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, resv, sync_mode);
>>>       if (r)
>>>           goto error_unlock;
> 



More information about the amd-gfx mailing list