[PATCH] drm/amdgpu/gfx9: make room for the SPM VMID write in the compute rings
From: Eren Özen via B4 Relay
Date: Sun Nov 29 2026 - 14:50:52 EST
From: Eren Özen <erenozen@xxxxxxxxxxxxxx>
Commit f7053847051c ("drm/amdgpu: bring back the ring parameter for
update_spm_vmid()") added 5 dwords for the RLC_SPM_MC_CNTL write to the
emit_frame_size of the gfx9 compute rings, raising it from 145 to 150.
With up to 125 IBs of 7 dwords each, a worst-case submission is now
150 + 125 * 7 = 1025 dwords, or 1280 after aligning to the 256-dword
fetch size, but gfx_v9_0_compute_ring_init() still passes a max_dw of
1024. amdgpu_ring_init() therefore hits WARN_ON(max_ibs_dw > max_dw)
once per compute ring on every GC 9.0.1 to 9.4.2 part (the ones that
use gfx_v9_0_ring_funcs_compute): eight splats at every boot on a
Cezanne laptop, and a panic with panic_on_warn.
The rings still work, because the fallback after the WARN raises max_dw
to 1280, so amdgpu_ring_alloc() does not reject a worst-case submission.
Pass 2048 instead, as gfx_v6_0 already does for its gfx ring. The driver
forces sched_hw_submission to a power of two, so
roundup_pow_of_two(2048 * 4 * n) equals roundup_pow_of_two(1280 * 4 * n)
and the ring keeps the size the fallback already gives it (16 KiB with
the default of 2, up from 8 KiB before that commit). ring_size is again
exactly sched_hw_submission * max_dw dwords.
The other rings whose emit_frame_size that commit raised still fit in
1024 dwords: gfx9 gfx and sw gfx (972), gfx10 gfx/compute (969/1006)
and gfx12.0 gfx/compute (927/986). gfx11 already counted the write.
The Sashiko AI review pointed out this mismatch when that commit was
posted.
Tested on a Ryzen 7 5800H (Cezanne, GC 9.3.0): the eight WARNs are
gone, the compute rings keep their 16 KiB size and the debugfs
amdgpu_test_ib ring tests pass.
Fixes: f7053847051c ("drm/amdgpu: bring back the ring parameter for update_spm_vmid()")
Link: https://lore.kernel.org/all/sashiko-outbox-217433@xxxxxxxxxx/
Signed-off-by: Eren Özen <erenozen@xxxxxxxxxxxxxx>
---
f7053847051c is also in the amd-drm-next-7.5-2026-11-19 pull request
as e9ebb72a64b6, so the WARNs will reach 7.5 unless this fix goes in
with it. Fixes: uses the amd-staging-drm-next hash; please swap it if
you prefer the other one.
While checking the frame sizes I noticed that amdgpu_ib_schedule()
emits the wave limit twice on high-priority compute rings (set and
restore, 20 dwords each on gfx8, gfx9 and gfx9.4.3), but their
emit_frame_size counts it only once. This predates f7053847051c and is
not fixed here. From reading the code (not tested): at some IB counts
amdgpu_ring_commit() would print "writing more dwords to the ring than
expected!", and on gfx9.4.3 a high-priority submission with 123 or more
IBs needs 1040 dwords, padded to 1280, while max_dw is 1024 and the
ring holds 2048, so two of them in flight could overwrite each other.
I can send separate patches for that if you agree.
I used an AI coding assistant to help analyse and draft this patch.
---
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 2d8ab438c9f7..b6d9943a8c20 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -2191,7 +2191,7 @@ static int gfx_v9_0_compute_ring_init(struct amdgpu_device *adev, int ring_id,
hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring) ?
AMDGPU_RING_PRIO_2 : AMDGPU_RING_PRIO_DEFAULT;
/* type-2 packets are deprecated on MEC, use type-3 instead */
- return amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq, irq_type,
+ return amdgpu_ring_init(adev, ring, 2048, &adev->gfx.eop_irq, irq_type,
hw_prio, NULL);
}
---
base-commit: da37959f4a22c6bb25a337fcc7946101c8a10f7b
change-id: 20261129-gfx9-ring-max-dw-4e2e680b846e
Best regards,
--
Eren Özen <erenozen@xxxxxxxxxxxxxx>