From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Sunil Khatri <sunil.khatri@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH] drm/amdgpu: validate the WPTR BO before handing its address to the MES
Date: Fri, 27 Nov 2026 18:09:30 +0800 [thread overview]
Message-ID: <20261127100941.738014-1-Jesse.Zhang@amd.com> (raw)
The unpinned WPTR BO can be evicted to SYSTEM before queue creation.
amdgpu_evf_mgr_attach_fence() skips validation when the eviction fence
is already signaled, leaving the BO in SYSTEM. Since resource->start
is zero, amdgpu_ttm_alloc_gart() also returns success without allocating
or binding GART space. mes_userq_create_wptr_mapping() then passes an
invalid GPU address to MES.
On Navi31, creating SDMA user queues during GTT eviction triggers:
WARNING: amdgpu_object.c:1550 at amdgpu_bo_gpu_offset
mes_userq_create_wptr_mapping
mes_userq_mqd_create
amdgpu_userq_ioctl
followed by page faults at address 0 and GPU resets.
Validate the BO into its allowed domains before allocating GART space,
as the restore path does. This removes the warning and address-zero
faults in the same test.
Fixes: 7264bc10c7c6 ("drm/amdgpu: dont pin wptr bo instead use eviction fence")
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
index 7abb9d95ef59..105c9866b2a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
@@ -37,6 +37,7 @@ mes_userq_create_wptr_mapping(struct amdgpu_device *adev,
struct amdgpu_usermode_queue *queue,
uint64_t wptr)
{
+ struct ttm_operation_ctx ctx = { false, false };
struct amdgpu_bo_va_mapping *wptr_mapping;
struct amdgpu_userq_obj *wptr_obj = &queue->wptr_obj;
struct amdgpu_bo *obj;
@@ -84,6 +85,12 @@ mes_userq_create_wptr_mapping(struct amdgpu_device *adev,
goto fail_map;
}
+ /* The BO may have been evicted, it needs a GPU address for the MES */
+ amdgpu_bo_placement_from_domain(wptr_obj->obj, wptr_obj->obj->allowed_domains);
+ ret = ttm_bo_validate(&wptr_obj->obj->tbo, &wptr_obj->obj->placement, &ctx);
+ if (ret)
+ goto fail_map;
+
ret = amdgpu_ttm_alloc_gart(&wptr_obj->obj->tbo);
if (ret) {
DRM_ERROR("Failed to bind wptr bo to GART. ret %d\n", ret);
--
2.50.1
next reply other threads:[~2026-11-27 10:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 10:09 Jesse Zhang [this message]
2026-11-27 10:37 ` [PATCH] drm/amdgpu: validate the WPTR BO before handing its address to the MES sashiko-bot
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=20261127100941.738014-1-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=sunil.khatri@amd.com \
/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.