[PATCH v6 03/11] drm/amdgpu: rework the userq doorbell object destroy
Christian König
christian.koenig at amd.com
Fri Jul 11 12:00:41 UTC 2025
On 11.07.25 11:39, Prike Liang wrote:
> This patch aims to unify and destroy the userq doorbell objects at
> mes_userq_mqd_destroy(), and this change will also help with unpinning
> and destroying the userq doorbell objects for amdgpu_userq_mgr_fini()
> during releasing the drm files.
>
> Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 6 ------
> drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 3d2a7f8946cf..15e833b1b3e3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -312,12 +312,6 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
> return -EINVAL;
> }
> amdgpu_userq_wait_for_last_fence(uq_mgr, queue);
> - r = amdgpu_bo_reserve(queue->db_obj.obj, true);
> - if (!r) {
> - amdgpu_bo_unpin(queue->db_obj.obj);
> - amdgpu_bo_unreserve(queue->db_obj.obj);
> - }
> - amdgpu_bo_unref(&queue->db_obj.obj);
> r = amdgpu_userq_unmap_helper(uq_mgr, queue);
> /*TODO: It requires a reset for userq hw unmap error*/
> if (unlikely(r != AMDGPU_USERQ_STATE_UNMAPPED)) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index 1457fb49a794..15aa1ca67a11 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -336,6 +336,13 @@ mes_userq_mqd_destroy(struct amdgpu_userq_mgr *uq_mgr,
> struct amdgpu_usermode_queue *queue)
> {
> amdgpu_userq_destroy_object(uq_mgr, &queue->fw_obj);
> +
> + if (!amdgpu_bo_reserve(queue->db_obj.obj, true)) {
> + amdgpu_bo_unpin(queue->db_obj.obj);
> + amdgpu_bo_unreserve(queue->db_obj.obj);
> + amdgpu_userq_destroy_object(uq_mgr, &queue->db_obj);
> + }
> +
That makes no sense to do here. The pinning isn't done in mes_userq_mqd_create() either.
In general we should avoid pinning the MQD in the first place, that buffer needs to be fences instead.
Regards,
Christian.
> kfree(queue->userq_prop);
> amdgpu_userq_destroy_object(uq_mgr, &queue->mqd);
> }
More information about the amd-gfx
mailing list