[PATCH 1/8] drm/amdgpu: make VMID assignment more fair

Chunming Zhou zhoucm1 at amd.com
Thu Feb 1 08:55:00 UTC 2018



On 2018年02月01日 16:36, Christian König wrote:
>> reserved vmid is independent on id_mgr
> And that is exactly the reason why I want to have that here.
>
> If we don't fix this reserving a VMID would otherwise give the process 
> an unfair advantage while scheduling jobs.
ok, I see your mean, that's same why you always make idle vmid for 
re-using vmid. Adding this explain to patch commit is better.

Acked-by: Chunming Zhou <david1.zhou at amd.com> for this patch and patch 
#7 then.

Regards,
David Zhou
>
> Regards,
> Christian.
>
> Am 01.02.2018 um 05:42 schrieb Chunming Zhou:
>> NAK, reserved vmid is independent on id_mgr, which is removed from id 
>> mgr when process allocates reserved vmid.
>>
>>
>> Regards,
>>
>> David Zhou
>>
>>
>> On 2018年01月31日 23:47, Christian König wrote:
>>> To guarantee fairness between processes grab reserved VMID only when
>>> there is an idle one.
>>>
>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 12 +++++++-----
>>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
>>> index c13cf7e79b2e..7a3d0de7425d 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
>>> @@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, 
>>> struct amdgpu_ring *ring,
>>>       int r = 0;
>>>         mutex_lock(&id_mgr->lock);
>>> -    if (vm->reserved_vmid[vmhub]) {
>>> -        r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, fence, 
>>> job);
>>> -        mutex_unlock(&id_mgr->lock);
>>> -        return r;
>>> -    }
>>>       fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, 
>>> GFP_KERNEL);
>>>       if (!fences) {
>>>           mutex_unlock(&id_mgr->lock);
>>> @@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, 
>>> struct amdgpu_ring *ring,
>>>       }
>>>       kfree(fences);
>>>   +    if (vm->reserved_vmid[vmhub]) {
>>> +        r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync,
>>> +                             fence, job);
>>> +        mutex_unlock(&id_mgr->lock);
>>> +        return r;
>>> +    }
>>> +
>>>       job->vm_needs_flush = vm->use_cpu_for_update;
>>>       /* Check if we can use a VMID already assigned to this VM */
>>>       list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) {
>>
>



More information about the amd-gfx mailing list