[PATCH v5 3/9] drm/amdgpu: rework the userq doorbell object destroy
Liang, Prike
Prike.Liang at amd.com
Tue Jul 8 07:00:43 UTC 2025
[Public]
> -----Original Message-----
> From: Koenig, Christian <Christian.Koenig at amd.com>
> Sent: Monday, July 7, 2025 5:28 PM
> To: Liang, Prike <Prike.Liang at amd.com>; amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: Re: [PATCH v5 3/9] drm/amdgpu: rework the userq doorbell object destroy
>
>
>
> On 04.07.25 12:33, 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 | 1 -
> > drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 4 ++++
> > 2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> > index 3d2a7f8946cf..f1c41b1114d0 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> > @@ -317,7 +317,6 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
> > 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..dbacdfcb6f7b 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> > @@ -336,6 +336,10 @@ mes_userq_mqd_destroy(struct amdgpu_userq_mgr
> *uq_mgr,
> > struct amdgpu_usermode_queue *queue) {
> > amdgpu_userq_destroy_object(uq_mgr, &queue->fw_obj);
> > + /*Validate the doorbell obj whether has unpinned by
> amdgpu_userq_destroy()*/
> > + if (queue->db_obj.obj->tbo.pin_count)
>
> Clear NAK to touching the pin_count here. That is clearly broken!
Thank you. I will ensure the doorbell object is locked before unpinning the BOs and then consolidate and relocate the userq doorbell unpinning code to mes_userq_mqd_destroy().
> Regards,
> Christian.
>
> > + amdgpu_bo_unpin(queue->db_obj.obj);
> > + amdgpu_userq_destroy_object(uq_mgr, &queue->db_obj);
> > kfree(queue->userq_prop);
> > amdgpu_userq_destroy_object(uq_mgr, &queue->mqd); }
More information about the amd-gfx
mailing list