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/gpuvm: Ensure correctness of unmap/remaps of repeated regions Date: Sat, 14 Mar 2026 06:48:46 +1000 Message-ID: In-Reply-To: <20260313150956.1618635-8-adrian.larumbe@collabora.com> References: <20260313150956.1618635-1-adrian.larumbe@collabora.com> <20260313150956.1618635-8-adrian.larumbe@collabora.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **`validate_repeated_unmap_request` has an issue with `do_div` modifying `m= ultiple`:** The variable `multiple` is set to `req_addr` or `req_end`, then= `do_div(multiple, ...)` is called. `do_div` replaces `multiple` with the q= uotient, and the remainder is the return value. The intent is to check alig= nment (remainder !=3D 0 =E2=86=92 error). This is correct. **Missing alignment check for `req_addr` on the last VA:** The function che= cks `req_addr` alignment only against the `first` VA and `req_end` alignmen= t against both `first` (if it extends past) and `last`. But if `first` is f= ully 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 wa= lk VAs twice (once in `validate_repeated_unmap_request` and once in the mai= n 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 =3D {}, next =3D {}; ``` The `next` variable in the for-each loop is shadowed by the local `struct d= rm_gpuva_op_map next`. This is pre-existing code, not introduced by this pa= tch, 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