[PATCH 1/3] drm/amdgpu: minor PRT turnoff fix

Christian König deathsimple at vodafone.de
Thu Feb 16 10:01:53 UTC 2017


Am 15.02.2017 um 18:28 schrieb Nicolai Hähnle:
> Hi Christian,
>
> On 15.02.2017 16:59, Christian König wrote:
>> Nicolai could you give that set a try?
>>
>> It should fix your problems with PRT tear down on process crash.
>
> Yes, it fixes those issues for me, thanks! The first two patches have 
> my R-b, for the third one I don't really understand the bug that it 
> fixes, but I have to leave soon, so...

The problem was what to do when we tear down the VM, but still have PRT 
mappings.

Initially I've just tried to unmap the PRT mappings as if they would 
have been cleaned up by userspace, but this doesn't work because the 
PD/PT might be swapped out etc....

Now instead of trying to unmap the PRT mappings I just increase the PRT 
reference count for each command submission still using the VM.

Can I get an review on those patches?

Thanks,
Christian.

>
> Thanks
> Nicolai
>
>> Regards,
>> Christian.
>>
>> Am 15.02.2017 um 15:57 schrieb Christian König:
>>> From: Christian König <christian.koenig at amd.com>
>>>
>>> When two VMs stop using PRT support at the same time we might
>>> not disable it in the right order otherwise.
>>>
>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 +++++-------
>>>   1 file changed, 5 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> index bc32239..447cda5 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> @@ -1200,7 +1200,8 @@ static void amdgpu_vm_prt_cb(struct fence
>>> *fence, struct fence_cb *_cb)
>>>   {
>>>       struct amdgpu_prt_cb *cb = container_of(_cb, struct
>>> amdgpu_prt_cb, cb);
>>>   -    amdgpu_vm_update_prt_state(cb->adev);
>>> +    if (atomic_dec_return(&cb->adev->vm_manager.num_prt_mappings) 
>>> == 0)
>>> +        amdgpu_vm_update_prt_state(cb->adev);
>>>       kfree(cb);
>>>   }
>>>   @@ -1219,17 +1220,14 @@ static void amdgpu_vm_free_mapping(struct
>>> amdgpu_device *adev,
>>>                      struct amdgpu_bo_va_mapping *mapping,
>>>                      struct fence *fence)
>>>   {
>>> -    if ((mapping->flags & AMDGPU_PTE_PRT) &&
>>> - atomic_dec_return(&adev->vm_manager.num_prt_mappings) == 0) {
>>> +    if (mapping->flags & AMDGPU_PTE_PRT) {
>>>           struct amdgpu_prt_cb *cb = kmalloc(sizeof(struct
>>> amdgpu_prt_cb),
>>>                              GFP_KERNEL);
>>>             cb->adev = adev;
>>>           if (!fence || fence_add_callback(fence, &cb->cb,
>>> -                         amdgpu_vm_prt_cb)) {
>>> -            amdgpu_vm_update_prt_state(adev);
>>> -            kfree(cb);
>>> -        }
>>> +                         amdgpu_vm_prt_cb))
>>> +            amdgpu_vm_prt_cb(fence, &cb->cb);
>>>       }
>>>       kfree(mapping);
>>>   }
>>
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>



More information about the amd-gfx mailing list