[PATCH v3 3/4] drm/amdgpu: change hw sched list on ctx priority override

Christian König ckoenig.leichtzumerken at gmail.com
Mon Mar 2 12:28:03 UTC 2020


Am 02.03.20 um 13:27 schrieb Nirmoy:
>
> On 3/2/20 1:10 PM, Christian König wrote:
>> Am 02.03.20 um 10:52 schrieb Nirmoy Das:
>>> Switch to appropriate sched list for an entity on priority override.
>>>
>>> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 30 
>>> +++++++++++++++++++++----
>>>   1 file changed, 26 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>>> index 4266da1f3977..57445a61a4cd 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>>> @@ -522,6 +522,30 @@ struct dma_fence *amdgpu_ctx_get_fence(struct 
>>> amdgpu_ctx *ctx,
>>>       return fence;
>>>   }
>>>
>>> +static void amdgpu_ctx_set_entity_priority(struct amdgpu_ctx *ctx,
>>> +                   struct amdgpu_ctx_entity *aentity,
>>> +                   int hw_ip, enum drm_sched_priority priority)
>>> +{
>>> +    struct amdgpu_device *adev = ctx->adev;
>>> +    enum gfx_pipe_priority compute_priority;
>>
>> Maybe use some shorter name, e.g. hw_prio or something like that.
>>
>>> +    struct drm_gpu_scheduler **scheds = NULL;
>>> +    unsigned num_scheds = 0;
>>
>> Don't initialize those here.
>>
>>> +
>>> +    switch (hw_ip) {
>>> +    case AMDGPU_HW_IP_COMPUTE:
>>> +        compute_priority =
>>> + amdgpu_ctx_sched_prio_to_compute_prio(priority);
>>> +        scheds = adev->gfx.compute_prio_sched[compute_priority];
>>> +        num_scheds = adev->gfx.num_compute_sched[compute_priority];
>>> +        break;
>>> +    default:
>>> +        return;
>>> +    }
>>> +
>>> +    drm_sched_entity_modify_sched(&aentity->entity, scheds, 
>>> num_scheds);
>>
>> That needs to be under the "case AMDGPU_HW_IP_COMPUTE" or otherwise 
>> we set the schedulers to NULL for SDMA.
> SDMA will fall into  default case which will return from the function 
> immediately.

Oh, that's a bad idea. We still want the call to 
drm_sched_entity_set_priority() in this case.

Maybe move the call to drm_sched_entity_set_priority() above the switch?

Regards,
Christian.

>>
>> Regards,
>> Christian.
>>
>>> + drm_sched_entity_set_priority(&aentity->entity, priority);
>>> +}
>>> +
>>>   void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx,
>>>                     enum drm_sched_priority priority)
>>>   {
>>> @@ -534,13 +558,11 @@ void amdgpu_ctx_priority_override(struct 
>>> AMDGPU_GFX_PIPE_PRIO_MAX
>>> amdgpu_ctx *ctx,
>>>               ctx->init_priority : ctx->override_priority;
>>>       for (i = 0; i < AMDGPU_HW_IP_NUM; ++i) {
>>>           for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j) {
>>> -            struct drm_sched_entity *entity;
>>> -
>>>               if (!ctx->entities[i][j])
>>>                   continue;
>>>
>>> -            entity = &ctx->entities[i][j]->entity;
>>> -            drm_sched_entity_set_priority(entity, ctx_prio);
>>> +            amdgpu_ctx_set_entity_priority(ctx, ctx->entities[i][j],
>>> +                               i, ctx_prio);
>>>           }
>>>       }
>>>   }
>>> -- 
>>> 2.25.0
>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx at lists.freedesktop.org
>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cnirmoy.das%40amd.com%7Ccece40b13ba74a6daf7b08d7bea2abd1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637187478188066407&sdata=TdqnspdZL63DXKe%2BjsIvE2YLeoxktTTJ577lz0cLVY4%3D&reserved=0 
>>>
>>
> _______________________________________________
> 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