public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
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 13:44:21 +1000	[thread overview]
Message-ID: <review-patch2-20260601-v3d-fix-indirect-csd-v2-2-aaebf035b936@igalia.com> (raw)
In-Reply-To: <20260601-v3d-fix-indirect-csd-v2-2-aaebf035b936@igalia.com>

Patch Review

**Status: Good, one minor observation**

This patch prevents the hardware from seeing a dispatch with zero workgroup counts. As the comment explains, the hardware interprets 0 in the NUM_WGS fields as 65536 (since the field is 16-bit and 0 wraps), which would cause an illegitimate submission.

The check uses `V3D_GET_FIELD` to extract only the workgroup count fields from `cfg[0..2]`:

```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;
```

This is correct. The `V3D_GET_FIELD` macro extracts bits [31:16] from each register (the workgroup count), ignoring the offset in bits [15:0]. This was improved in v2 per reviewer feedback — checking the full register word would have falsely triggered if an offset field happened to be non-zero while the count was zero, or failed to trigger if the whole word was non-zero but the count field was zero.

The placement of the check is correct — it's after the `s_fence->finished.error` check but before `active_job` assignment, `v3d_job_start_stats`, `v3d_switch_perfmon`, and register writes. This means none of those side effects occur when the job is skipped, so there's no resource or state imbalance.

Returning `NULL` from `v3d_csd_job_run` follows the existing pattern (the error path just above does the same) and tells the scheduler the job completed immediately with no hardware fence to wait on.

**Minor observation**: The existing error path defensively clears `v3d->queue[V3D_CSD].active_job = NULL` before returning NULL. The new zero-count path does not. This is technically fine because `active_job` hasn't been assigned to this job yet at this point, but for consistency with the existing error path's defensive style, adding the same `active_job = NULL` assignment could be considered. This is not a bug — just a minor consistency point.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-06-04  3:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 19:13 [PATCH v2 0/2] drm/v3d: Fix indirect CSD jobs with zeroed workgroups Maíra Canal
2026-06-01 19:13 ` [PATCH v2 1/2] drm/v3d: Fix vaddr leak when indirect CSD has " Maíra Canal
2026-06-04  3:44   ` Claude review: " Claude Code Review Bot
2026-06-01 19:13 ` [PATCH v2 2/2] drm/v3d: Skip CSD when it " Maíra Canal
2026-06-02  7:10   ` Iago Toral
2026-06-04  3:44   ` Claude Code Review Bot [this message]
2026-06-04  3:44 ` Claude review: drm/v3d: Fix indirect CSD jobs with " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-06-02 17:50 [PATCH v4 0/2] " Maíra Canal
2026-06-02 17:50 ` [PATCH v4 2/2] drm/v3d: Skip CSD when it has " Maíra Canal
2026-06-04  2:23   ` Claude review: " Claude Code Review Bot
2026-06-02 11:57 [PATCH v3 0/2] drm/v3d: Fix indirect CSD jobs with " 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-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-20260601-v3d-fix-indirect-csd-v2-2-aaebf035b936@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