From: "Christian König" <christian.koenig@amd.com>
To: Prike Liang <Prike.Liang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com
Subject: Re: [PATCH v6 06/11] drm/amdgpu: track the userq bo va for its obj management
Date: Fri, 11 Jul 2025 14:11:03 +0200 [thread overview]
Message-ID: <f391283e-8e3c-4d07-9da4-8bfac73342b5@amd.com> (raw)
In-Reply-To: <20250711093930.1411470-6-Prike.Liang@amd.com>
On 11.07.25 11:39, Prike Liang 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 error to the user IOCLT request.
>
> Signed-off-by: Prike Liang <Prike.Liang@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 2856c2506bee..81fbb00b6d91 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -510,12 +510,24 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id)
> return -EINVAL;
> }
> amdgpu_userq_wait_for_last_fence(uq_mgr, queue);
> +
> + /*
> + * 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)) {
> + drm_warn(adev_to_drm(uq_mgr->adev), "the userq obj va shouldn't be umapped here\n");
> + r = -EINVAL;
> + }
> +
That is still not something we can do.
Destroying an userque can't fail in any way.
Regards,
Christian.
> 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)) {
> drm_warn(adev_to_drm(uq_mgr->adev), "trying to destroy a HW mapping userq\n");
> r = -ETIMEDOUT;
> }
> +
> + amdgpu_userq_buffer_vas_put(&fpriv->vm, queue);
> amdgpu_userq_cleanup(uq_mgr, queue, queue_id);
> mutex_unlock(&uq_mgr->userq_mutex);
>
> @@ -636,6 +648,9 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
> goto unlock;
> }
>
> + /* refer to the userq objects vm bo*/
> + amdgpu_userq_buffer_vas_get(queue->vm, queue);
> +
> qid = idr_alloc(&uq_mgr->userq_idr, queue, 1, AMDGPU_MAX_USERQ_COUNT, GFP_KERNEL);
> if (qid < 0) {
> drm_file_err(uq_mgr->file, "Failed to allocate a queue id\n");
next prev parent reply other threads:[~2025-07-11 12:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-11 9:39 [PATCH v6 01/11] drm/amdgpu: validate userq input args Prike Liang
2025-07-11 9:39 ` [PATCH v6 02/11] drm/amdgpu: validate userq hw unmap status for destroying userq Prike Liang
2025-07-11 9:39 ` [PATCH v6 03/11] drm/amdgpu: rework the userq doorbell object destroy Prike Liang
2025-07-11 12:00 ` Christian König
2025-07-15 8:07 ` Liang, Prike
2025-07-15 8:49 ` Christian König
2025-07-16 7:03 ` Liang, Prike
2025-07-11 9:39 ` [PATCH v6 04/11] drm/amdgpu: validate userq buffer virtual address and size Prike Liang
2025-07-11 12:08 ` Christian König
2025-07-15 8:19 ` Liang, Prike
2025-07-15 8:41 ` Christian König
2025-07-11 9:39 ` [PATCH v6 05/11] drm/amdgpu: add userq object va track helpers Prike Liang
2025-07-11 9:39 ` [PATCH v6 06/11] drm/amdgpu: track the userq bo va for its obj management Prike Liang
2025-07-11 12:11 ` Christian König [this message]
2025-07-15 12:05 ` Liang, Prike
2025-07-15 12:17 ` Christian König
2025-07-16 6:54 ` Liang, Prike
2025-07-11 9:39 ` [PATCH v6 07/11] drm/amdgpu: validate userq's last fence prior to destroying Prike Liang
2025-07-11 12:12 ` Christian König
2025-07-15 11:50 ` Liang, Prike
2025-07-15 12:15 ` Christian König
2025-07-11 9:39 ` [PATCH v6 08/11] drm/amdgpu: clean up the amdgpu_userq_active() Prike Liang
2025-07-11 9:39 ` [PATCH v6 09/11] drm/amdgpu: validate the shared bo for tracking usage size Prike Liang
2025-07-11 12:14 ` Christian König
2025-07-11 13:43 ` Liang, Prike
2025-07-11 9:39 ` [PATCH v6 10/11] drm/amdgpu: validate the queue va for resuming the queue Prike Liang
2025-07-11 12:18 ` Christian König
2025-07-11 9:39 ` [PATCH v6 11/11] drm/amdgpu: validate userq va for GEM unmap Prike Liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f391283e-8e3c-4d07-9da4-8bfac73342b5@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Prike.Liang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.