Skip to content

Commit

Permalink
amdkfd: Fix accounting of device queues
Browse files Browse the repository at this point in the history
This patch fixes a device QCM bug, where the number of queues were not
counted correctly for the operation of update queue. The count was incorrect
as there was no regard to the previous state of the queue.

Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
  • Loading branch information
Oded Gabbay committed Dec 7, 2014
1 parent b7392d2 commit b6ffbab
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
{
int retval;
struct mqd_manager *mqd;
bool prev_active = false;

BUG_ON(!dqm || !q || !q->mqd);

Expand All @@ -330,10 +331,18 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
return -ENOMEM;
}

retval = mqd->update_mqd(mqd, q->mqd, &q->properties);
if (q->properties.is_active == true)
prev_active = true;

/*
*
* check active state vs. the previous state
* and modify counter accordingly
*/
retval = mqd->update_mqd(mqd, q->mqd, &q->properties);
if ((q->properties.is_active == true) && (prev_active == false))
dqm->queue_count++;
else
else if ((q->properties.is_active == false) && (prev_active == true))
dqm->queue_count--;

if (sched_policy != KFD_SCHED_POLICY_NO_HWS)
Expand Down

0 comments on commit b6ffbab

Please sign in to comment.