Commit ac0a6cf1 authored by Nayan Deshmukh's avatar Nayan Deshmukh Committed by Alex Deucher

drm/scheduler: add a list of run queues to the entity

These are the potential run queues on which the jobs from this
entity can be scheduled. We will use this to do load balancing.
Signed-off-by: default avatarNayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c36628d8
...@@ -179,6 +179,8 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, ...@@ -179,6 +179,8 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
unsigned int num_rq_list, unsigned int num_rq_list,
atomic_t *guilty) atomic_t *guilty)
{ {
int i;
if (!(entity && rq_list && num_rq_list > 0 && rq_list[0])) if (!(entity && rq_list && num_rq_list > 0 && rq_list[0]))
return -EINVAL; return -EINVAL;
...@@ -186,6 +188,11 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, ...@@ -186,6 +188,11 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
INIT_LIST_HEAD(&entity->list); INIT_LIST_HEAD(&entity->list);
entity->rq = rq_list[0]; entity->rq = rq_list[0];
entity->guilty = guilty; entity->guilty = guilty;
entity->num_rq_list = num_rq_list;
entity->rq_list = kcalloc(num_rq_list, sizeof(struct drm_sched_rq *),
GFP_KERNEL);
for (i = 0; i < num_rq_list; ++i)
entity->rq_list[i] = rq_list[i];
entity->last_scheduled = NULL; entity->last_scheduled = NULL;
spin_lock_init(&entity->rq_lock); spin_lock_init(&entity->rq_lock);
...@@ -348,6 +355,7 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity) ...@@ -348,6 +355,7 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity)
dma_fence_put(entity->last_scheduled); dma_fence_put(entity->last_scheduled);
entity->last_scheduled = NULL; entity->last_scheduled = NULL;
kfree(entity->rq_list);
} }
EXPORT_SYMBOL(drm_sched_entity_fini); EXPORT_SYMBOL(drm_sched_entity_fini);
......
...@@ -50,7 +50,10 @@ enum drm_sched_priority { ...@@ -50,7 +50,10 @@ enum drm_sched_priority {
* *
* @list: used to append this struct to the list of entities in the * @list: used to append this struct to the list of entities in the
* runqueue. * runqueue.
* @rq: runqueue to which this entity belongs. * @rq: runqueue on which this entity is currently scheduled.
* @rq_list: a list of run queues on which jobs from this entity can
* be scheduled
* @num_rq_list: number of run queues in the rq_list
* @rq_lock: lock to modify the runqueue to which this entity belongs. * @rq_lock: lock to modify the runqueue to which this entity belongs.
* @job_queue: the list of jobs of this entity. * @job_queue: the list of jobs of this entity.
* @fence_seq: a linearly increasing seqno incremented with each * @fence_seq: a linearly increasing seqno incremented with each
...@@ -75,6 +78,8 @@ enum drm_sched_priority { ...@@ -75,6 +78,8 @@ enum drm_sched_priority {
struct drm_sched_entity { struct drm_sched_entity {
struct list_head list; struct list_head list;
struct drm_sched_rq *rq; struct drm_sched_rq *rq;
struct drm_sched_rq **rq_list;
unsigned int num_rq_list;
spinlock_t rq_lock; spinlock_t rq_lock;
struct spsc_queue job_queue; struct spsc_queue job_queue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment