[PATCH v2 03/11] drm/amdgpu: unify the userq doorbell object destroy

Liang, Prike Prike.Liang at amd.com
Thu Jun 19 08:29:45 UTC 2025


[Public]

> From: Alex Deucher <alexdeucher at gmail.com>
> Sent: Tuesday, June 17, 2025 11:14 PM
> To: Liang, Prike <Prike.Liang at amd.com>
> Cc: amd-gfx at lists.freedesktop.org; Deucher, Alexander
> <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>
> Subject: Re: [PATCH v2 03/11] drm/amdgpu: unify the userq doorbell object destroy
>
> On Tue, Jun 17, 2025 at 4:27 AM Prike Liang <Prike.Liang at amd.com> wrote:
> >
> > Unify and refine the userq doorbell object destroy.
> >
> > Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c  | 1 -
> > drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 3 +++
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> > index e3cebe532c7b..dca0f76c9fce 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 unmap error*/
> >         if (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 39decc0b00f7..c6f7b613e684 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> > @@ -343,6 +343,9 @@ 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 (queue->db_obj.obj->tbo.pin_count)
>
> I don't think you need to check the pin count.  Other than that, looks good.
[Prike] This pin count check is used for the case of amdgpu_userq_cleanup() invoked by amdgpu_userq_destroy().
If we want to remove the pin count check here then might need to clean up the doorbell object unpin at amdgpu_userq_destroy() before,
otherwise, the driver will complain the double unpin during destroying userq.

>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
>
> > +               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);  }
> > --
> > 2.34.1
> >


More information about the amd-gfx mailing list