Commit e854b61a authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/scheduler: bind job earlier to scheduler

Update job earlier with the scheduler it is supposed to be scheduled on.

Otherwise we could incorrectly optimize dependencies when moving an
entity from one scheduler to another.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarNayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7febe4bf
...@@ -530,8 +530,6 @@ drm_sched_entity_pop_job(struct drm_sched_entity *entity) ...@@ -530,8 +530,6 @@ drm_sched_entity_pop_job(struct drm_sched_entity *entity)
if (!sched_job) if (!sched_job)
return NULL; return NULL;
sched_job->sched = sched;
sched_job->s_fence->sched = sched;
while ((entity->dependency = sched->ops->dependency(sched_job, entity))) { while ((entity->dependency = sched->ops->dependency(sched_job, entity))) {
if (drm_sched_entity_add_dependency_cb(entity)) { if (drm_sched_entity_add_dependency_cb(entity)) {
...@@ -582,6 +580,8 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job, ...@@ -582,6 +580,8 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job,
spin_unlock(&entity->rq_lock); spin_unlock(&entity->rq_lock);
} }
sched_job->sched = entity->rq->sched;
sched_job->s_fence->sched = entity->rq->sched;
trace_drm_sched_job(sched_job, entity); trace_drm_sched_job(sched_job, entity);
atomic_inc(&entity->rq->sched->num_jobs); atomic_inc(&entity->rq->sched->num_jobs);
WRITE_ONCE(entity->last_user, current->group_leader); WRITE_ONCE(entity->last_user, current->group_leader);
......
...@@ -161,7 +161,7 @@ struct drm_sched_fence *drm_sched_fence_create(struct drm_sched_entity *entity, ...@@ -161,7 +161,7 @@ struct drm_sched_fence *drm_sched_fence_create(struct drm_sched_entity *entity,
return NULL; return NULL;
fence->owner = owner; fence->owner = owner;
fence->sched = entity->rq->sched; fence->sched = NULL;
spin_lock_init(&fence->lock); spin_lock_init(&fence->lock);
seq = atomic_inc_return(&entity->fence_seq); seq = atomic_inc_return(&entity->fence_seq);
......
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