From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: Re: [PATCH] drm/amdgpu: deduplicate ring preempt ib function
Date: Thu, 23 Apr 2026 07:52:56 +1000 [thread overview]
Message-ID: <review-patch1-59b686c6-42f5-4cde-8199-dae64722bfd1@amd.com> (raw)
In-Reply-To: <59b686c6-42f5-4cde-8199-dae64722bfd1@amd.com>
Patch Review
**Correctness: Good.** The extracted function in `amdgpu_gfx.c` is an exact copy of the removed functions from both `gfx_v11_0.c` and `gfx_v12_0.c`. The function signature matches the `preempt_ib` callback in `struct amdgpu_ring_funcs` (`int (*preempt_ib)(struct amdgpu_ring *ring)`), so assigning it directly to `.preempt_ib` in the ring_funcs structs is correct.
**Nit — trailing blank line:** The new function in `amdgpu_gfx.c` is followed by two blank lines before the end of the diff:
```c
+ return r;
+}
+
+
```
Kernel coding style uses a single blank line between functions (or at end-of-file). Remove the extra blank line.
**Nit — alignment inconsistency:** In the new shared function, the `kiq_unmap_queues` call arguments use tab+tabs alignment:
```c
+ kiq->pmf->kiq_unmap_queues(kiq_ring, ring, PREEMPT_QUEUES_NO_UNMAP,
+ ring->trail_fence_gpu_addr,
+ ++ring->trail_seq);
```
The original code in both `gfx_v11_0.c` and `gfx_v12_0.c` aligned continuation lines to the opening parenthesis using tabs+spaces:
```c
kiq->pmf->kiq_unmap_queues(kiq_ring, ring, PREEMPT_QUEUES_NO_UNMAP,
ring->trail_fence_gpu_addr,
++ring->trail_seq);
```
The original alignment is the more common kernel style for this codebase. Since the goal is to move the code without modification, please preserve the original alignment.
**Missed opportunity — gfx_v10_0:** The `gfx_v10_0_ring_preempt_ib()` function at `gfx_v10_0.c:8855` is functionally identical to the new shared version, with only one difference: it lacks the `adev->enable_mes` early-return check. Since MES is not supported on GFX10 hardware, the `enable_mes` guard would be harmlessly false on v10 and the shared function could be used there as well. This would eliminate a third copy of the same logic. Worth considering for this patch or a follow-up.
**Not in scope but worth noting — gfx_v9_0:** The `gfx_v9_0` version uses a different fence emission mechanism (direct `gfx_v9_0_ring_emit_fence()` calls instead of `kiq_unmap_queues`), so it cannot be consolidated with this shared function. No action needed.
**Overall:** The patch does what it says on the tin and the logic is correct. Fix the trailing blank line and the alignment nit, and consider also converting `gfx_v10_0` to use the shared function since it's the same code.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-04-22 21:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 20:03 [PATCH] drm/amdgpu: deduplicate ring preempt ib function Leonardo Cesar
2026-04-22 6:58 ` Christian König
2026-04-22 12:55 ` Alex Deucher
2026-04-22 21:52 ` Claude review: " Claude Code Review Bot
2026-04-22 21:52 ` Claude Code Review Bot [this message]
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=review-patch1-59b686c6-42f5-4cde-8199-dae64722bfd1@amd.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox