The queue is being destroyed (entering the `amdgpu_userq_destroy` function).
The counter is decremented prematurely.
The concurrent reset detection in the `amdgpu_userq_detect_and_reset_queues()` 
function skips this queue type because the counter has already become 0 at this 
point.

Signed-off-by: Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 402307581293..83b85dc0b735 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -612,7 +612,6 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
        }
        amdgpu_bo_unref(&queue->wptr_obj.obj);
 
-       atomic_dec(&uq_mgr->userq_count[queue->queue_type]);
 #if defined(CONFIG_DEBUG_FS)
        debugfs_remove_recursive(queue->debugfs_queue);
 #endif
@@ -623,6 +622,7 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
                drm_warn(adev_to_drm(uq_mgr->adev), "trying to destroy a HW 
mapping userq\n");
                queue->state = AMDGPU_USERQ_STATE_HUNG;
        }
+       atomic_dec(&uq_mgr->userq_count[queue->queue_type]);
        amdgpu_userq_cleanup(queue, queue_id);
        mutex_unlock(&uq_mgr->userq_mutex);
 
-- 
2.49.0

Reply via email to