]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu/userq: move wptr_obj cleanup in mqd_destroy
authorSunil Khatri <sunil.khatri@amd.com>
Mon, 25 May 2026 04:26:23 +0000 (09:56 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Jun 2026 17:58:51 +0000 (13:58 -0400)
In case when queue_create fails and mqd has already been
allocated and hence wptr_obj is not cleaned up.

So moving that cleanup part to mqd_destroy so it takes
care of all the cases of clean up and during tear down of
the queue.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c

index 533ba9640d32ef4a9caeb7275544fe21f99b9753..91554e7c092c04d5493655340b35b3e84716f40d 100644 (file)
@@ -532,10 +532,6 @@ amdgpu_userq_destroy(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_usermode_que
        amdgpu_bo_unreserve(queue->db_obj.obj);
        amdgpu_bo_unref(&queue->db_obj.obj);
 
-       amdgpu_bo_reserve(queue->wptr_obj.obj, true);
-       amdgpu_bo_unpin(queue->wptr_obj.obj);
-       amdgpu_bo_unreserve(queue->wptr_obj.obj);
-       amdgpu_bo_unref(&queue->wptr_obj.obj);
        kfree(queue);
 
        pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
index 09a6f50cc5f4ba0cdeb2f8963fc94c62e247bd9a..16625c31bfd32f5c332188c14ca9b93b184ef17f 100644 (file)
@@ -467,6 +467,11 @@ static void mes_userq_mqd_destroy(struct amdgpu_usermode_queue *queue)
        kfree(queue->userq_prop);
        amdgpu_bo_free_kernel(&queue->mqd.obj, &queue->mqd.gpu_addr,
                              &queue->mqd.cpu_ptr);
+
+       amdgpu_bo_reserve(queue->wptr_obj.obj, true);
+       amdgpu_bo_unpin(queue->wptr_obj.obj);
+       amdgpu_bo_unreserve(queue->wptr_obj.obj);
+       amdgpu_bo_unref(&queue->wptr_obj.obj);
 }
 
 static int mes_userq_preempt(struct amdgpu_usermode_queue *queue)