[PATCH v2 1/2] drm/scheduler: add a pointer to scheduler in the rq

Christian König christian.koenig at amd.com
Fri Jul 13 13:45:45 UTC 2018


Am 13.07.2018 um 15:40 schrieb Nayan Deshmukh:
> I forgot to add these:

Not a problem at all. It is actually my job to do this while committing 
the patches.

BTW: I've pushed you patches to amd-staging-drm-next just a few minutes 
ago. Thanks for the help.

I'm preparing quite a cleanup for amdgpu which should make your live 
easier, but still no idea why the scheduler hangs when we try to load 
balance jobs.

Regards,
Christian.

> On Fri, Jul 13, 2018 at 3:21 PM Nayan Deshmukh
> <nayan26deshmukh at gmail.com> wrote:
>> This patch is in preparation for a better load balancing in
>> scheduler. It allows us to associate entities with the
>> run queues instead of binding them to a scheduler.
>>
>> Signed-off-by: Nayan Deshmukh <nayan26deshmukh at gmail.com>
> Reviewed-by: Christian König <christian.koenig at amd.com>
> Acked-by: Eric Anholt <eric at anholt.net>
>
>> ---
>>   drivers/gpu/drm/scheduler/gpu_scheduler.c | 6 ++++--
>>   include/drm/gpu_scheduler.h               | 2 ++
>>   2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
>> index 7d2560699b84..429b1328653a 100644
>> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
>> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
>> @@ -69,11 +69,13 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb);
>>    *
>>    * Initializes a scheduler runqueue.
>>    */
>> -static void drm_sched_rq_init(struct drm_sched_rq *rq)
>> +static void drm_sched_rq_init(struct drm_gpu_scheduler *sched,
>> +                             struct drm_sched_rq *rq)
>>   {
>>          spin_lock_init(&rq->lock);
>>          INIT_LIST_HEAD(&rq->entities);
>>          rq->current_entity = NULL;
>> +       rq->sched = sched;
>>   }
>>
>>   /**
>> @@ -926,7 +928,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
>>          sched->timeout = timeout;
>>          sched->hang_limit = hang_limit;
>>          for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_MAX; i++)
>> -               drm_sched_rq_init(&sched->sched_rq[i]);
>> +               drm_sched_rq_init(sched, &sched->sched_rq[i]);
>>
>>          init_waitqueue_head(&sched->wake_up_worker);
>>          init_waitqueue_head(&sched->job_scheduled);
>> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
>> index 4214ceb71c05..43e93d6077cf 100644
>> --- a/include/drm/gpu_scheduler.h
>> +++ b/include/drm/gpu_scheduler.h
>> @@ -93,6 +93,7 @@ struct drm_sched_entity {
>>    * struct drm_sched_rq - queue of entities to be scheduled.
>>    *
>>    * @lock: to modify the entities list.
>> + * @sched: the scheduler to which this rq belongs to.
>>    * @entities: list of the entities to be scheduled.
>>    * @current_entity: the entity which is to be scheduled.
>>    *
>> @@ -102,6 +103,7 @@ struct drm_sched_entity {
>>    */
>>   struct drm_sched_rq {
>>          spinlock_t                      lock;
>> +       struct drm_gpu_scheduler        *sched;
>>          struct list_head                entities;
>>          struct drm_sched_entity         *current_entity;
>>   };
>> --
>> 2.14.3
>>



More information about the dri-devel mailing list