On Mon, Sep 8, 2025 at 4:59 AM Prike Liang <prike.li...@amd.com> wrote:
>
> The user queue object destroy requires ensuring its
> VA keeps mapping prior to the queue being destroyed.
> Otherwise, it seems a bug in the user space or VA
> freed wrongly, and the kernel driver should report an
> invalidated state to the user IOCTL request.

You can drop this patch.  If the queue is destroyed, you won't be querying it.

Alex

>
> Signed-off-by: Prike Liang <prike.li...@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 85df04e9ec3d..98b6b3761a0a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -520,6 +520,13 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
>                 amdgpu_bo_unreserve(queue->db_obj.obj);
>         }
>         amdgpu_bo_unref(&queue->db_obj.obj);
> +       /*
> +        * At this point the userq obj va should be mapped,
> +        * otherwise will return error to user.
> +        */
> +       if (!amdgpu_userq_buffer_vas_mapped(&fpriv->vm, queue))
> +               queue->state = AMDGPU_USERQ_STATE_INVALID_VA;
> +
>         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)) {
> --
> 2.34.1
>

Reply via email to