[RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs

Christian König ckoenig.leichtzumerken at gmail.com
Wed Mar 11 17:57:58 UTC 2020


Am 11.03.20 um 18:58 schrieb Nirmoy:
>
> On 3/11/20 6:23 PM, Andrey Grodzovsky wrote:
>>
>> On 3/11/20 1:18 PM, Nirmoy Das wrote:
>>> Implement drm_sched_entity_num_jobs() so that drm drivers can
>>> query number of jobs in an entity.
>>>
>>> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
>>> ---
>>>   drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++
>>>   include/drm/gpu_scheduler.h              |  1 +
>>>   2 files changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c 
>>> b/drivers/gpu/drm/scheduler/sched_entity.c
>>> index 90fd9c30ae5a..dfe8216f2d52 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_entity.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
>>> @@ -119,6 +119,21 @@ static bool drm_sched_entity_is_idle(struct 
>>> drm_sched_entity *entity)
>>>       return false;
>>>   }
>>>   +/**
>>> + * drm_sched_entity_num_job - Get number of jobs in the entity
>
>
> typo s/drm_sched_entity_num_job/drm_sched_entity_num_jobs
>
>
>>> + *
>>> + * @entity: scheduler entity
>>> + *
>>> + * Returns number of jobs in the entity
>>> + */
>>> +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity)
>>> +{
>>> +    if (drm_sched_entity_is_idle(entity))
>>> +        return 0;
>>> +
>>> +    return spsc_queue_count(&entity->job_queue);
>>> +}
>>
>>
>> What about the jobs which already have been dequeued from job_queue 
>> and are in progress in the HW ring but yet to complete - don't they 
>> count ?
>
> Hi Andrey,
>
> I am thinking in terms of software side of the counting because for an 
> entity once a job dequeued, that job is completely lost.
>
> I might be wrong here that's why tagged RFC :)

My question is rather what do we need that for in the first place?

Thanks,
Christian.

>
>
> Regards,
>
> Nirmoy
>
>
>>
>> Andrey
>>
>>
>>
>>> +EXPORT_SYMBOL(drm_sched_entity_num_jobs);
>>>   /**
>>>    * drm_sched_entity_is_ready - Check if entity is ready
>>>    *
>>> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
>>> index d8972836d248..b5ceff75cbbe 100644
>>> --- a/include/drm/gpu_scheduler.h
>>> +++ b/include/drm/gpu_scheduler.h
>>> @@ -341,5 +341,6 @@ void drm_sched_fence_finished(struct 
>>> drm_sched_fence *fence);
>>>   unsigned long drm_sched_suspend_timeout(struct drm_gpu_scheduler 
>>> *sched);
>>>   void drm_sched_resume_timeout(struct drm_gpu_scheduler *sched,
>>>                           unsigned long remaining);
>>> +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity);
>>>     #endif
> _______________________________________________
> 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