Commit b6ffbab813cfc535db5c3815b4eb16dd7d97197c
1 parent
b7392d2247
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
amdkfd: Fix accounting of device queues
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>
Showing 1 changed file with 11 additions and 2 deletions Side-by-side Diff
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
... | ... | @@ -320,6 +320,7 @@ |
320 | 320 | { |
321 | 321 | int retval; |
322 | 322 | struct mqd_manager *mqd; |
323 | + bool prev_active = false; | |
323 | 324 | |
324 | 325 | BUG_ON(!dqm || !q || !q->mqd); |
325 | 326 | |
326 | 327 | |
327 | 328 | |
... | ... | @@ -330,10 +331,18 @@ |
330 | 331 | return -ENOMEM; |
331 | 332 | } |
332 | 333 | |
333 | - retval = mqd->update_mqd(mqd, q->mqd, &q->properties); | |
334 | 334 | if (q->properties.is_active == true) |
335 | + prev_active = true; | |
336 | + | |
337 | + /* | |
338 | + * | |
339 | + * check active state vs. the previous state | |
340 | + * and modify counter accordingly | |
341 | + */ | |
342 | + retval = mqd->update_mqd(mqd, q->mqd, &q->properties); | |
343 | + if ((q->properties.is_active == true) && (prev_active == false)) | |
335 | 344 | dqm->queue_count++; |
336 | - else | |
345 | + else if ((q->properties.is_active == false) && (prev_active == true)) | |
337 | 346 | dqm->queue_count--; |
338 | 347 | |
339 | 348 | if (sched_policy != KFD_SCHED_POLICY_NO_HWS) |