From: sashiko-bot@kernel.org
To: "Prike Liang" <Prike.Liang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH RESEND 3/4] drm/amdgpu/userq: report invalid VA through the broken status flag
Date: Tue, 17 Nov 2026 07:42:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-218374@kernel.org> (raw)
In-Reply-To: <20261117072353.537506-3-Prike.Liang@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdgpu/userq: missing resume_work flush in
amdgpu_userq_query_status()
--
commit dcee7ab7a079dac06e55c3b0a31589e130baf8e9
Author: Prike Liang <Prike.Liang@amd.com>
drm/amdgpu/userq: report invalid VA through the broken status flag
This commit sets AMDGPU_USERQ_QUERY_STATUS_FLAGS_BROKEN in
amdgpu_userq_query_status() when a usermode queue is in
AMDGPU_USERQ_STATE_INVALID_VA, and updates the UAPI comment in
amdgpu_drm.h.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 496137fca1f0c..b48cf2a2118c0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -837,6 +837,7 @@ amdgpu_userq_query_status(struct drm_file *filp, union drm_amdgpu_userq *args)
>
> args->out_qs.flags = 0;
> if (queue->state == AMDGPU_USERQ_STATE_HUNG ||
> + queue->state == AMDGPU_USERQ_STATE_INVALID_VA ||
> queue->generation != amdgpu_vm_generation(adev, &fpriv->vm))
> args->out_qs.flags |= AMDGPU_USERQ_QUERY_STATUS_FLAGS_BROKEN;
> amdgpu_userq_put(queue);
[Severity: Medium]
Can amdgpu_userq_query_status() miss AMDGPU_USERQ_STATE_INVALID_VA when
called before uq_mgr->resume_work finishes?
The only place that sets queue->state to AMDGPU_USERQ_STATE_INVALID_VA is
amdgpu_userq_restore_all(), which runs asynchronously from
uq_mgr->resume_work:
CPU0 kworker
amdgpu_gem_va_ioctl(UNMAP)
amdgpu_userq_gem_va_unmap_validate()
dma_resv_wait_timeout()
amdgpu_eviction_fence_suspend_worker()
amdgpu_userq_evict()
queue->state =
AMDGPU_USERQ_STATE_UNMAPPED
dma_fence_signal(ev_fence)
schedule_delayed_work(
&uq_mgr->resume_work, 0)
drm_exec_fini()
amdgpu_userq_query_status()
mutex_lock(&uq_mgr->userq_mutex)
queue->state ==
AMDGPU_USERQ_STATE_UNMAPPED <-- BROKEN not set
mutex_unlock(&uq_mgr->userq_mutex)
amdgpu_userq_restore_worker()
...
amdgpu_userq_restore_all()
queue->state =
AMDGPU_USERQ_STATE_INVALID_VA
Because amdgpu_gem_va_ioctl() holds the VM reservation lock until
drm_exec_fini() just before returning to userspace, uq_mgr->resume_work
cannot finish validating the VM and calling amdgpu_userq_restore_all()
before the unmap ioctl returns. Unlike amdgpu_userq_ensure_ev_fence(),
amdgpu_userq_query_status() does not call
flush_delayed_work(&uq_mgr->resume_work) before acquiring
uq_mgr->userq_mutex, so querying queue status after unmapping a queue VA
reports flags as 0 instead of AMDGPU_USERQ_QUERY_STATUS_FLAGS_BROKEN.
Also, if a queue VA mapping is removed via AMDGPU_VA_OP_CLEAR or
AMDGPU_VA_OP_REPLACE (amdgpu_vm_bo_clear_mappings()),
amdgpu_userq_gem_va_unmap_validate() is never called to trigger eviction and
transition the queue to AMDGPU_USERQ_STATE_INVALID_VA.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117072353.537506-1-Prike.Liang@amd.com?part=3
next prev parent reply other threads:[~2026-11-17 7:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 7:23 [PATCH RESEND 1/4] drm/amdgpu: add UAPI for user queue query status Prike Liang
2026-11-17 7:23 ` [PATCH RESEND 2/4] drm/amdgpu/userq: implement support for " Prike Liang
2026-11-17 7:41 ` sashiko-bot
2026-11-17 7:23 ` [PATCH RESEND 3/4] drm/amdgpu/userq: report invalid VA through the broken status flag Prike Liang
2026-11-17 7:42 ` sashiko-bot [this message]
2026-11-17 7:23 ` [PATCH RESEND 4/4] drm/amdgpu/userq: report GPU reset in progress 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=sashiko-outbox-218374@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Prike.Liang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.