From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/v3d: Skip CSD when it has zeroed workgroups
Date: Thu, 04 Jun 2026 12:23:40 +1000 [thread overview]
Message-ID: <review-patch2-20260602-v3d-fix-indirect-csd-v4-2-654309e32bc0@igalia.com> (raw)
In-Reply-To: <20260602-v3d-fix-indirect-csd-v4-2-654309e32bc0@igalia.com>
Patch Review
**Status: Good, with one minor style observation.**
This patch addresses two things:
**Part A — Always rewrite CFG[0..2] from the indirect buffer.** In the rewrite function, the cfg writes are now done unconditionally *before* the zero check:
```c
args->cfg[0] = wg_counts[0] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
args->cfg[1] = wg_counts[1] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
args->cfg[2] = wg_counts[2] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
+ if (wg_counts[0] == 0 || wg_counts[1] == 0 || wg_counts[2] == 0)
+ goto unmap_bo;
```
This is the v3→v4 improvement. It ensures CFG[0..2] always reflect the actual indirect buffer contents rather than preserving stale userspace values. The `goto unmap_bo` still correctly skips the `num_batches` calculation, which would produce `0 - 1 = 0xFFFFFFFF` (triggering the existing `WARN_ON(args->cfg[4] == ~0)`) if any count is zero.
**Part B — Skip hardware dispatch for zero workgroups.** In `v3d_csd_job_run()`:
```c
+ if (!V3D_GET_FIELD(job->args.cfg[0], V3D_CSD_QUEUED_CFG0_NUM_WGS_X) ||
+ !V3D_GET_FIELD(job->args.cfg[1], V3D_CSD_QUEUED_CFG1_NUM_WGS_Y) ||
+ !V3D_GET_FIELD(job->args.cfg[2], V3D_CSD_QUEUED_CFG2_NUM_WGS_Z))
+ return NULL;
```
Using `V3D_GET_FIELD` with the proper register field macros is the right approach — it extracts bits [31:16] from each CFG register, which is exactly where the workgroup counts live (confirmed: `V3D_CSD_QUEUED_CFG0_NUM_WGS_X_SHIFT = 16` in `v3d_regs.h` matches `V3D_CSD_CFG012_WG_COUNT_SHIFT = 16`). This works for both indirect and direct CSD submissions. The comment explaining the hardware's 0→65536 interpretation is useful.
**Minor observation:** The existing error path in this function does `v3d->queue[V3D_CSD].active_job = NULL` before returning NULL:
```c
if (unlikely(job->base.base.s_fence->finished.error)) {
v3d->queue[V3D_CSD].active_job = NULL;
return NULL;
}
```
The new zero-workgroup path returns NULL without this. Since `active_job` is set only on the *next* line (`v3d->queue[V3D_CSD].active_job = &job->base`), the value at this point should already be NULL from the previous job's IRQ handler, so this is not a correctness issue. However, for consistency with the existing error path and defensive coding, adding `v3d->queue[V3D_CSD].active_job = NULL;` before the return would be slightly cleaner. Not a blocker.
No other issues. The Fixes tag (`d223f98f0209`) correctly references the original CSD dispatch support, as the zero-workgroup check belongs there at the hardware-facing level.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 2:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 17:50 [PATCH v4 0/2] drm/v3d: Fix indirect CSD jobs with zeroed workgroups Maíra Canal
2026-06-02 17:50 ` [PATCH v4 1/2] drm/v3d: Fix vaddr leak when indirect CSD has " Maíra Canal
2026-06-04 2:23 ` Claude review: " Claude Code Review Bot
2026-06-02 17:50 ` [PATCH v4 2/2] drm/v3d: Skip CSD when it " Maíra Canal
2026-06-03 5:32 ` Iago Toral
2026-06-04 2:23 ` Claude Code Review Bot [this message]
2026-06-03 11:28 ` [PATCH v4 0/2] drm/v3d: Fix indirect CSD jobs with " Maíra Canal
2026-06-04 2:23 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-06-02 11:57 [PATCH v3 0/2] " Maíra Canal
2026-06-02 11:57 ` [PATCH v3 2/2] drm/v3d: Skip CSD when it has " Maíra Canal
2026-06-04 2:49 ` Claude review: " Claude Code Review Bot
2026-06-01 19:13 [PATCH v2 0/2] drm/v3d: Fix indirect CSD jobs with " Maíra Canal
2026-06-01 19:13 ` [PATCH v2 2/2] drm/v3d: Skip CSD when it has " Maíra Canal
2026-06-04 3:44 ` Claude review: " Claude Code Review Bot
2026-05-30 19:51 [PATCH 0/2] drm/v3d: Fix indirect CSD jobs with " Maíra Canal
2026-05-30 19:51 ` [PATCH 2/2] drm/v3d: Skip CSD when it has " Maíra Canal
2026-06-04 5:15 ` Claude review: " Claude Code Review 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=review-patch2-20260602-v3d-fix-indirect-csd-v4-2-654309e32bc0@igalia.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