[RFC PATCH] drm/amdgpu: allocate entities on demand
Christian König
christian.koenig at amd.com
Fri Nov 29 18:42:22 UTC 2019
Am 29.11.19 um 15:29 schrieb Nirmoy:
> Hi Christian,
>
> On 11/26/19 10:45 AM, Christian König wrote:
>> It looks like a start, but there numerous things which needs to be
>> fixed.
>>
>> Question number one is: What's that good for? Entities are not the
>> problem here. The real issue is the fence ring and the rq_list.
>>
>> The rq_list could actually be made constant since it should never be
>> changed by the entity. It is only changed for backward compatibility
>> in drm_sched_entity_set_priority().
>>
>> So I would start there and cleanup the
>> drm_sched_entity_set_priority() to actually just set a new constant
>> rq list instead.
>
> I am missing some context here. Can you please explain bit more? I
> looked over and over again but I still don't understand what do you
> mean by new constant rq list :/
Ok that needs a bit wider explanation.
The GPU scheduler consists mainly of drm_gpu_scheduler instances. Each
of those instances contain multiple runqueues with different priorities
(5 IIRC).
Now for each entity we give a list of runqueues where this entity can be
served on, e.g. where the jobs which are pushed to the entities are
executed.
The entity itself keeps a copy of that runqueue list because we have the
drm_sched_entity_set_priority() which modifies this runqueue list.
But essentially that is complete overkill, the runqueue lists are
constant for each amdgpu device, e.g. all contexts should use SDMA0 and
SDMA1 in the same way.
In other words building the list on runqueues should happen only once
and not for each contexts.
Multiple approach to fix this would be possible. One rather elegant
solution would be to change the rq list into a scheduler instances list
+ priority.
This way we would also fix the age old bug that changing the priority of
a context could actually mess up already scheduled jobs.
The alternative I noted before would be to drop
drm_sched_entity_set_priority() or change it into
drm_sched_entity_set_runqueues().
Regards,
Christian.
>
>>
>> Then we could embed the fences in amdgpu_ctx_entity as dynamic array
>> at the end of the structure.
>>
>> And last we can start to dynamic allocate and initialize the
>> amdgpu_ctx_entity() structures.
>>
>> Regards,
>> Christian.
>>
>>
More information about the amd-gfx
mailing list