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/gpuvm: Ensure correctness of unmap/remaps of repeated regions
Date: Sat, 14 Mar 2026 06:48:46 +1000	[thread overview]
Message-ID: <review-patch7-20260313150956.1618635-8-adrian.larumbe@collabora.com> (raw)
In-Reply-To: <20260313150956.1618635-8-adrian.larumbe@collabora.com>

Patch Review

**`validate_repeated_unmap_request` has an issue with `do_div` modifying `multiple`:** The variable `multiple` is set to `req_addr` or `req_end`, then `do_div(multiple, ...)` is called. `do_div` replaces `multiple` with the quotient, and the remainder is the return value. The intent is to check alignment (remainder != 0 → error). This is correct.

**Missing alignment check for `req_addr` on the last VA:** The function checks `req_addr` alignment only against the `first` VA and `req_end` alignment against both `first` (if it extends past) and `last`. But if `first` is fully contained within the unmap range and `last` is a repeat VA, the start of `last` is necessarily aligned (since it was created that way), so only `req_end` matters. This seems correct.

**`DRM_GPUVM_HAS_REPEAT_MAPS` flag:** This is set but never cleared. If all repeat mappings are removed, subsequent map/unmap operations will still walk VAs twice (once in `validate_repeated_unmap_request` and once in the main loop). This is a performance concern but not a correctness bug. Worth a `FIXME` comment.

**Variable shadowing in `__drm_gpuvm_sm_unmap`:**

```c
 	drm_gpuvm_for_each_va_range_safe(va, next, gpuvm, req_addr, req_end) {
 		struct drm_gpuva_op_map prev = {}, next = {};
```

The `next` variable in the for-each loop is shadowed by the local `struct drm_gpuva_op_map next`. This is pre-existing code, not introduced by this patch, but worth noting that adding `validate_repeated_unmap_request` before this loop (which also uses `drm_gpuvm_for_each_va_range`) means the VA tree is iterated twice.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-13 20:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 15:09 [PATCH v5 00/11] Support repeated mappings in GPUVM and Panthor Adrián Larumbe
2026-03-13 15:09 ` [PATCH v5 01/11] drm/panthor: Expose GPU page sizes to UM Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 02/11] drm/gpuvm: Remove dead code Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 03/11] drm/gpuvm: Fix comment to reflect remap operation operand status Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 04/11] drm/gpuvm: Add a helper to check if two VA can be merged Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 05/11] drm/gpuvm: Add a flags field to drm_gpuva_op_map Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 06/11] drm/gpuvm: Add DRM_GPUVA_REPEAT flag and logic Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 07/11] drm/gpuvm: Ensure correctness of unmap/remaps of repeated regions Adrián Larumbe
2026-03-13 20:48   ` Claude Code Review Bot [this message]
2026-03-13 15:09 ` [PATCH v5 08/11] drm/panthor: Add support for repeated mappings Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 09/11] drm/panthor: Handle remap case " Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 10/11] drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 15:09 ` [PATCH v5 11/11] drm/panthor: Bump the driver version to 1.8 Adrián Larumbe
2026-03-13 20:48   ` Claude review: " Claude Code Review Bot
2026-03-13 20:48 ` Claude review: Support repeated mappings in GPUVM and Panthor 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-patch7-20260313150956.1618635-8-adrian.larumbe@collabora.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