From: sashiko-bot@kernel.org
To: "Frank Min" <Frank.Min@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 8/9] drm/amdgpu: enable uni-mes for gfx13
Date: Fri, 04 Dec 2026 16:41:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-250210@kernel.org> (raw)
In-Reply-To: <20261204142408.988734-8-Frank.Min@amd.com>
Thank you for your contribution! Sashiko AI review found 9 potential
issues to consider:
- [High] drm/amdgpu: GFX13 MES enabled with no-op
suspend_gang/resume_gang stubs
- [High] drm/amdgpu: mes_v13_0_submit_pkt_and_poll_completion() returns
0 on errors
- [High] drm/amdgpu: mes_v13_0_remove_hw_queue() omits queue_type and
reset flag
- [Medium] drm/amdgpu: GFX13 uni-mes routes legacy KQs and resets to KIQ
pipe
- [Medium] drm/amdgpu: amdgpu_mes_queue_reset_by_mes_supported() omits
GC 13.x
- [Medium] drm/amdgpu: missing MODULE_FIRMWARE declarations for GC
13.0.4 MES firmware
- [Medium] drm/amdgpu: literal 0 write clears regCP_MQD_CONTROL in
mes_v13_0_queue_init_register()
- [Medium] drm/amdgpu: mes_v13_0_set_hw_resources_1() gated on 0x4b and
unchecked
- [Low] drm/amdgpu: commit message omits unconditional enable_mes and
enable_mes_kiq
--
commit bfe01128f1efb4aa22fc5a9f7950763067c635fd
Author: Frank Min <Frank.Min@amd.com>
> drm/amdgpu: enable uni-mes for gfx13
>
> Enable uni-mes for gfx13.
>
> Signed-off-by: Frank Min <Frank.Min@amd.com>
[Severity: Low]
The subject and body only mention enabling uni-mes, but this patch also
unconditionally enables adev->enable_mes and adev->enable_mes_kiq for both
GC 13.0.1 and GC 13.0.4 even when amdgpu.uni_mes=0 is set. Could the
commit message describe all three changes and explain why GFX13 is ready
for MES enablement?
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 5997946fb1171..292245f167e07 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -3407,10 +3407,10 @@ static int amdgpu_discovery_set_mes_ip_blocks(struct amdgpu_device *adev)
> case IP_VERSION(13, 0, 1):
> case IP_VERSION(13, 0, 4):
> amdgpu_device_ip_block_add(adev, &mes_v13_0_ip_block);
> - adev->enable_mes = false;
> - adev->enable_mes_kiq = false;
> + adev->enable_mes = true;
[Severity: High]
Can GFX13 enable MES before mes_v13_0_suspend_gang() and
mes_v13_0_resume_gang() are implemented?
Both callbacks in drivers/gpu/drm/amd/amdgpu/mes_v13_0.c are empty stubs
returning 0 without submitting a packet or signaling the suspend fence.
During user queue preemption (such as S0ix suspend or enforce_isolation
switches), mes_userq_preempt() zeroes *fence_ptr, calls suspend_gang(),
and busy-waits in a udelay(1) loop for 2.1 seconds per queue before
failing with -ETIMEDOUT, marking healthy queues hung while leaving them
active on hardware.
In addition, amdgpu_mes_suspend_resume_all_supported() returns true for
GC 13.x, so amdgpu_gfx_reset_mes_compute() treats the stub 0 return from
amdgpu_mes_suspend() as all gangs suspended and skips
amdgpu_mes_detect_and_reset_hung_queues().
[Severity: High]
Does mes_v13_0_submit_pkt_and_poll_completion() silently return 0 on MES
command failures?
Per MES_API_STATUS in drivers/gpu/drm/amd/include/mes_v13_api_def.h, MES
v13 reports API rejections by writing 0 to the lower 32 bits and a
non-zero error code to the upper 32 bits. Testing !*status_ptr across
all 64 bits instead of !lower_32_bits(*status_ptr) treats rejected
commands as success.
Similarly, when amdgpu_fence_wait_polling() times out waiting for ring
space, it returns 0, and jumping to error_undo returns 0 without
submitting the packet instead of -ETIMEDOUT. If
mes_v13_0_remove_hw_queue() falsely succeeds on either error,
amdgpu_userq_destroy() skips GPU reset and frees the queue BOs while the
queue may still be active on hardware, risking DMA use-after-free.
[Severity: High]
Does mes_v13_0_remove_hw_queue() leave mes_remove_queue_pkt.queue_type at
0 (MES_QUEUE_TYPE_GFX) for compute and SDMA queues?
With adev->enable_mes enabled, KFD and userq tear down compute and SDMA
queues through this function, but it only populates doorbell_offset and
gang_context_addr. As seen in commit 89db46e455ab ("drm/amdgpu,amdkfd:
correct setting MES queue type"), sending REMOVE_QUEUE with the wrong
queue type makes MES search the wrong queue class, causing unmap hangs
or leaving the queue active after its memory is freed.
It also ignores input->remove_queue_after_reset, breaking post-reset
cleanup in reset_queue_mes().
[Severity: Medium]
Should amdgpu_mes_queue_reset_by_mes_supported() in
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c also handle GC 13.x?
It currently only checks GC 11.x, 12.0, and 12.1, so it returns false on
GFX13 even though gfx_v13_0 advertises per-queue compute reset. When a
KFD compute queue hangs, reset_queues_mes() fails with -ENOTRECOVERABLE
and escalates to a full GPU reset.
> + adev->enable_mes_kiq = true;
[Severity: Medium]
Now that adev->enable_mes_kiq is enabled, does
mes_v13_0_queue_init_register() wipe regCP_MQD_CONTROL?
drivers/gpu/drm/amd/amdgpu/mes_v13_0.c:mes_v13_0_queue_init_register() {
...
data = RREG32_SOC15(GC, 0, regCP_MQD_CONTROL);
data = REG_SET_FIELD(data, CP_MQD_CONTROL, VMID, 0);
WREG32_SOC15(GC, 0, regCP_MQD_CONTROL, 0);
...
}
Writing literal 0 instead of data clears PRIV_STATE and the other control
fields during MES KIQ HQD setup on every init, resume, and reset.
> if (amdgpu_uni_mes)
> - adev->enable_uni_mes = false;
> + adev->enable_uni_mes = true;
[Severity: Medium]
Should mes_v13_0_map_legacy_queue(), mes_v13_0_unmap_legacy_queue(), and
mes_v13_0_reset_hw_queue() use AMDGPU_MES_SCHED_PIPE for non-MES legacy
kernel queues when enable_uni_mes is set?
All three functions in drivers/gpu/drm/amd/amdgpu/mes_v13_0.c currently
send legacy kernel queues and is_kq resets to AMDGPU_MES_KIQ_PIPE. As
fixed for GFX12 in commit 5ec4cc917083 ("drm/amdgpu/mes_v12_0: use mes
schedule pipe for legacy queues on unified MES"), pipe 0 MES only tracks
queues on the schedule pipe, leaving legacy kernel queues (when booted
with amdgpu.user_queue=0 or 1) inconsistent across suspend/resume and
resets.
[Severity: Medium]
Are MODULE_FIRMWARE declarations missing for GC 13.0.4 MES firmware?
drivers/gpu/drm/amd/amdgpu/mes_v13_0.c only declares MODULE_FIRMWARE for
gc_13_0_1, whereas enabling MES on IP_VERSION(13, 0, 4) makes
amdgpu_mes_init_microcode() require amdgpu/gc_13_0_4_uni_mes.bin (or
gc_13_0_4_mes.bin and gc_13_0_4_mes1.bin with amdgpu.uni_mes=0).
Initramfs builders using modinfo will omit them, causing probe to fail
with -ENODEV during early boot.
[Severity: Medium]
Should mes_v13_0_hw_init() call mes_v13_0_set_hw_resources_1()
unconditionally and check its return value in both mes_v13_0_hw_init()
and mes_v13_0_kiq_hw_init()?
On GFX13, mes_v13_0_set_hw_resources_1() is the only place sdma_hqd_mask
is sent to MES, yet mes_v13_0_hw_init() gates it on sched_version >= 0x4b
(a GFX12 check from commit 0180e0a5dd5c ("drm/amdgpu/mes: add
compatibility checks for set_hw_resource_1")) while
mes_v13_0_kiq_hw_init() calls it unconditionally. On GFX13 firmware with
a version below 0x4b, this leaves sdma_hqd_mask zeroed and breaks MES
SDMA user-queue scheduling.
Both callers also discard the int return value of
mes_v13_0_set_hw_resources_1(), allowing MES initialization to succeed
even if the packet submission or completion fails.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204142408.988734-1-Frank.Min@amd.com?part=8
next prev parent reply other threads:[~2026-12-04 16:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:24 [PATCH 1/9] drm/amdgpu: skip vm inv for kiq ring Frank Min
2026-12-04 14:24 ` [PATCH 2/9] drm/amdgpu: disable gfx 13 pipe 1 ring Frank Min
2026-12-04 14:55 ` sashiko-bot
2026-12-04 16:05 ` Alex Deucher
2026-12-04 14:24 ` [PATCH 3/9] drm/amdgpu: update table info retrieval from discovery binary Frank Min
2026-12-04 15:14 ` sashiko-bot
2026-12-04 16:19 ` Alex Deucher
2026-12-04 14:24 ` [PATCH 4/9] drm/amdgpu: add lsdma v8 fw query interface Frank Min
2026-12-04 15:25 ` sashiko-bot
2026-12-04 16:21 ` Alex Deucher
2026-12-04 14:24 ` [PATCH 5/9] drm/amdgpu: add lsdma v8 fw loading support Frank Min
2026-12-04 15:47 ` sashiko-bot
2026-12-04 14:24 ` [PATCH 6/9] drm/amdgpu: Fix system aperture size for gfx13 Frank Min
2026-12-04 16:01 ` sashiko-bot
2026-12-04 14:24 ` [PATCH 7/9] drm/amdgpu: remove the unused ring parameter in update_spm_vmid() " Frank Min
2026-12-04 16:03 ` Alex Deucher
2026-12-04 16:11 ` sashiko-bot
2026-12-04 14:24 ` [PATCH 8/9] drm/amdgpu: enable uni-mes " Frank Min
2026-12-04 16:41 ` sashiko-bot [this message]
2026-12-04 17:24 ` Alex Deucher
2026-12-04 14:24 ` [PATCH 9/9] drm/amdgpu: fix mutex unlock position for ucode loading Frank Min
2026-12-04 16:12 ` Alex Deucher
2026-12-04 16:52 ` sashiko-bot
2026-12-04 14:41 ` [PATCH 1/9] drm/amdgpu: skip vm inv for kiq ring sashiko-bot
2026-12-04 16:16 ` Alex Deucher
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-250210@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Min@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.