aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>2018-08-17 10:32:50 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 12:11:10 -0400
commit62347a33001c27b22465361aa4adcaa432497bdf (patch)
tree29ec0030e6b7cb636eb76b116b20f3afad1425eb /drivers/gpu
parent9c70d10ae72a188adb9da83ec760e1d5779bc2ed (diff)
drm/scheduler: Add stopped flag to drm_sched_entity
The flag will prevent another thread from same process to reinsert the entity queue into scheduler's rq after it was already removewd from there by another thread during drm_sched_entity_flush. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/scheduler/sched_entity.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 1416edb2642a..812e3530ea25 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -177,8 +177,12 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)
177 /* For killed process disable any more IBs enqueue right now */ 177 /* For killed process disable any more IBs enqueue right now */
178 last_user = cmpxchg(&entity->last_user, current->group_leader, NULL); 178 last_user = cmpxchg(&entity->last_user, current->group_leader, NULL);
179 if ((!last_user || last_user == current->group_leader) && 179 if ((!last_user || last_user == current->group_leader) &&
180 (current->flags & PF_EXITING) && (current->exit_code == SIGKILL)) 180 (current->flags & PF_EXITING) && (current->exit_code == SIGKILL)) {
181 spin_lock(&entity->rq_lock);
182 entity->stopped = true;
181 drm_sched_rq_remove_entity(entity->rq, entity); 183 drm_sched_rq_remove_entity(entity->rq, entity);
184 spin_unlock(&entity->rq_lock);
185 }
182 186
183 return ret; 187 return ret;
184} 188}
@@ -504,6 +508,12 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job,
504 if (first) { 508 if (first) {
505 /* Add the entity to the run queue */ 509 /* Add the entity to the run queue */
506 spin_lock(&entity->rq_lock); 510 spin_lock(&entity->rq_lock);
511 if (entity->stopped) {
512 spin_unlock(&entity->rq_lock);
513
514 DRM_ERROR("Trying to push to a killed entity\n");
515 return;
516 }
507 drm_sched_rq_add_entity(entity->rq, entity); 517 drm_sched_rq_add_entity(entity->rq, entity);
508 spin_unlock(&entity->rq_lock); 518 spin_unlock(&entity->rq_lock);
509 drm_sched_wakeup(entity->rq->sched); 519 drm_sched_wakeup(entity->rq->sched);