From: sashiko-bot@kernel.org
To: "Benjamin Cheng" <benjamin.cheng@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/8] drm/amdgpu/userq: remove extra fence request when locking PD
Date: Wed, 18 Nov 2026 19:05:41 +0000 [thread overview]
Message-ID: <sashiko-outbox-221793@kernel.org> (raw)
In-Reply-To: <20261118185225.1857845-6-benjamin.cheng@amd.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/amdgpu: ignored WPTR mapping offsets in userqueue
synchronization [1]
--
commit c736ecb92e4ba4e91728f33ea27cd11d90100ae5
Author: Benjamin Cheng <benjamin.cheng@amd.com>
drm/amdgpu/userq: remove extra fence request when locking PD
This commit changes amdgpu_vm_lock_pd() calls in
amdgpu_userq_fence_read_wptr() and mes_userq_create_wptr_mapping() to
request zero fence slots instead of one.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> index 6d1f5811d39c3..07a0af9feaf08 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -380,7 +380,7 @@ static int amdgpu_userq_fence_read_wptr(struct amdgpu_device *adev,
>
> drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 2);
> drm_exec_until_all_locked(&exec) {
> - ret = amdgpu_vm_lock_pd(queue->vm, &exec, 1);
> + ret = amdgpu_vm_lock_pd(queue->vm, &exec, 0);
> drm_exec_retry_on_contention(&exec);
> if (unlikely(ret))
> goto lock_error;
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index 7abb9d95ef59a..8b07e21d26862 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -48,7 +48,7 @@ mes_userq_create_wptr_mapping(struct amdgpu_device *adev,
>
> drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 2);
> drm_exec_until_all_locked(&exec) {
> - ret = amdgpu_vm_lock_pd(vm, &exec, 1);
> + ret = amdgpu_vm_lock_pd(vm, &exec, 0);
> drm_exec_retry_on_contention(&exec);
> if (unlikely(ret))
> goto fail_lock;
[Severity: High]
This problem wasn't introduced by this patch, but does
mes_userq_create_wptr_mapping() ignore the internal mapping and sub-page
offset when setting queue->wptr_obj.gpu_addr [1]?
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c:mes_userq_create_wptr_mapping() {
...
queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset(wptr_obj->obj);
...
}
When a usermode queue places its WPTR at a non-zero offset within the
backing BO, mes_userq_create_wptr_mapping() sets queue->wptr_obj.gpu_addr
to the base GPU offset of wptr_obj->obj without adding the mapping and
sub-page offsets (and if amdgpu_userq_fence_read_wptr() reads *ptr at
offset 0 directly, it misses the offset on the CPU side as well). This
causes the firmware and CPU fence polling to read the wrong memory address,
leading to premature fence signaling or command submission deadlocks.
[1] https://sashiko.dev/#/bug/linux-485b27a5-4aad-464a-b5b7-ad02f7bafded
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118185225.1857845-1-benjamin.cheng@amd.com?part=5
next prev parent reply other threads:[~2026-11-18 19:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 18:52 [PATCH 0/8] Consolidate and fix root PD fence resverations Benjamin Cheng
2026-11-18 18:52 ` [PATCH 1/8] drm/amdgpu/vm: reserve more fences in amdgpu_vm_lock_pd Benjamin Cheng
2026-11-19 13:19 ` Christian König
2026-11-18 18:52 ` [PATCH 2/8] drm/amdgpu/dma_buf: reserve AMDGPU_VM_UPDATE_FENCES for move_notify Benjamin Cheng
2026-11-19 13:22 ` Christian König
2026-11-18 18:52 ` [PATCH 3/8] drm/amdgpu/vm: reserve AMDGPU_VM_UPDATE_FENCES for handle_fault Benjamin Cheng
2026-11-19 13:24 ` Christian König
2026-11-18 18:52 ` [PATCH 4/8] drm/amdgpu: reserve only what the caller asks for in lock_pd Benjamin Cheng
2026-11-19 13:27 ` Christian König
2026-11-18 18:52 ` [PATCH 5/8] drm/amdgpu/userq: remove extra fence request when locking PD Benjamin Cheng
2026-11-18 19:05 ` sashiko-bot [this message]
2026-11-19 13:35 ` Christian König
2026-11-18 18:52 ` [PATCH 6/8] drm/amdgpu/vm: stop using amdgpu_bo_fence Benjamin Cheng
2026-11-19 13:41 ` Christian König
2026-11-18 18:52 ` [PATCH 7/8] drm/amdgpu/uvd: " Benjamin Cheng
2026-11-19 13:43 ` Christian König
2026-11-18 18:52 ` [PATCH 8/8] drm/amdgpu/object: get rid of amdgpu_bo_fence Benjamin Cheng
2026-11-19 13:47 ` Christian König
2026-11-18 18:58 ` [PATCH 0/8] Consolidate and fix root PD fence resverations Benjamin Cheng
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-221793@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=benjamin.cheng@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox