From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/v3d: Ensure atomic submissions in v3d_submit_jobs() Date: Thu, 04 Jun 2026 11:24:43 +1000 Message-ID: In-Reply-To: <20260603-v3d-sched-misc-fixes-v3-14-d7114bba55a0@igalia.com> References: <20260603-v3d-sched-misc-fixes-v3-0-d7114bba55a0@igalia.com> <20260603-v3d-sched-misc-fixes-v3-14-d7114bba55a0@igalia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This is the capstone fix. The submission is restructured into three phases: 1. **Arm** all jobs (get `done_fence`, take refcount) 2. **Wire** inter-job dependencies (can fail) 3. **Push** all jobs to scheduler (unconditional) If phase 2 fails, all armed jobs have their finished fence marked with an error: ```c for (int i = 0; i < submit->job_count; i++) dma_fence_set_error(&submit->jobs[i]->base.s_fence->finished, ret); ``` Then all jobs are pushed anyway, relying on the `run_job()` callbacks' existing `s_fence->finished.error` checks to skip execution. The patch also adds the error check to `v3d_cpu_job_run()` and `v3d_cache_clean_job_run()`, which previously lacked them. BIN, RENDER, TFU, and CSD already had these checks (added/consolidated in patch 2). The error path in `v3d_submit_jobs()` now handles reservation unlock and job put internally, so callers don't need `fail_unreserve` labels. The callers' error paths are updated accordingly with a new `fail_submit` label that skips job cleanup (since `v3d_submit_jobs` already did it on error). **One concern with the error path**: On failure, `v3d_submit_jobs()` calls `v3d_submit_unlock_reservations(submit)` and `v3d_submit_put_jobs(submit)`, but does NOT call `v3d_submit_attach_object_fences()` or `v3d_submit_process_post_deps()`. This is correct -- on error, we don't want to attach fences to BOs or signal syncobjs to userspace. The jobs are pushed with error-marked fences, the scheduler will run them (no-op via the error check), and they'll be freed by the scheduler completion callback. **Also correct**: The caller's `fail_submit` path still calls `v3d_submit_put_post_deps(sync_out, &se)` to release the sync_out reference and any multi-sync output references, which is the right thing since those were never consumed. No issues. Well-designed error handling. --- **Summary**: The series is well-decomposed and addresses real issues. The one actionable finding is: 1. **Patch 8**: `v3d_submit_add_job()` should check `submit->job_count < V3D_MAX_JOBS_PER_SUBMISSION` before writing to `submit->jobs[]` to prevent a potential out-of-bounds array write. --- Generated by Claude Code Patch Reviewer