Skip to content

Commit

Permalink
drm/amdkfd: Update queue_count before mapping queues
Browse files Browse the repository at this point in the history
map_queues_cpsch uses the queue_count to decide whether to upload
a new runlist. So update the counter before calling it.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
  • Loading branch information
Felix Kuehling authored and Oded Gabbay committed Nov 1, 2017
1 parent bfd5e37 commit 096d1a3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,17 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)

retval = mqd->update_mqd(mqd, q->mqd, &q->properties);

/*
* check active state vs. the previous state and modify
* counter accordingly. map_queues_cpsch uses the
* dqm->queue_count to determine whether a new runlist must be
* uploaded.
*/
if (q->properties.is_active && !prev_active)
dqm->queue_count++;
else if (!q->properties.is_active && prev_active)
dqm->queue_count--;

if (sched_policy != KFD_SCHED_POLICY_NO_HWS)
retval = map_queues_cpsch(dqm);
else if (sched_policy == KFD_SCHED_POLICY_NO_HWS &&
Expand All @@ -417,15 +428,6 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
retval = mqd->load_mqd(mqd, q->mqd, q->pipe, q->queue,
&q->properties, q->process->mm);

/*
* check active state vs. the previous state
* and modify counter accordingly
*/
if (q->properties.is_active && !prev_active)
dqm->queue_count++;
else if (!q->properties.is_active && prev_active)
dqm->queue_count--;

out_unlock:
mutex_unlock(&dqm->lock);
return retval;
Expand Down

0 comments on commit 096d1a3

Please sign in to comment.