From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: accel/amdxdna: Remove mmap and export support for ubuf
Date: Sat, 16 May 2026 08:56:26 +1000 [thread overview]
Message-ID: <review-patch1-20260515155332.743097-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260515155332.743097-1-lizhi.hou@amd.com>
Patch Review
**Dead code: `amdxdna_ubuf_vm_ops` and `amdxdna_ubuf_vm_fault` are now orphaned.**
The patch removes `amdxdna_ubuf_mmap` which was the sole user of `amdxdna_ubuf_vm_ops`, which in turn was the sole user of `amdxdna_ubuf_vm_fault`. After this patch, both `amdxdna_ubuf_vm_fault` (line 72) and `amdxdna_ubuf_vm_ops` (line 86) in `amdxdna_ubuf.c` are dead code. They should be removed in this patch to avoid a compiler warning (`-Wunused-function` for the static `amdxdna_ubuf_vm_fault`). This will actually cause a build failure with `-Werror`, which the kernel uses.
**Flag naming: `pri` is cryptic and misleading.**
The new field:
```c
/* True, if BO is not exportable */
bool pri;
```
The name `pri` doesn't convey "not exportable." It could be misread as "priority" or "primary" or "private." A name like `no_export` or `unexportable` would be immediately clear. Even `private` (spelled out) would be better. The comment helps, but a self-documenting name costs nothing.
**The export-blocking logic is correct but could be more robust.**
The check in `amdxdna_gem_prime_export`:
```c
if (abo->pri)
return ERR_PTR(-EOPNOTSUPP);
```
This correctly prevents re-export. The ubuf object is created through `amdxdna_gem_prime_import` and then marked with `abo->pri = true`, which will prevent it from being re-exported through the shmem funcs' `.export = amdxdna_gem_prime_export` path.
**No mmap blocking on the GEM object side.**
The patch removes `amdxdna_ubuf_mmap` from the dma-buf ops, which prevents mmap through the dma-buf fd. However, ubuf objects are imported via `drm_gem_shmem_prime_import_sg_table`, and the resulting GEM shmem object has `.mmap = amdxdna_gem_obj_mmap` set via `amdxdna_gem_shmem_funcs`. The commit message says "ubuf pages should not be mmaped" — should `amdxdna_gem_obj_mmap` also check `abo->pri` and reject the mmap? If the intent is only to block the dma-buf mmap path (since user already has the pages mapped), this should be clarified in the commit message. If GEM mmap should also be blocked, it's missing.
**Summary:**
- **Must fix:** Remove the now-dead `amdxdna_ubuf_vm_fault` and `amdxdna_ubuf_vm_ops` — this will cause a build warning/error.
- **Should fix:** Rename `pri` to something self-documenting (`no_export`, `unexportable`, etc.).
- **Should clarify:** Whether GEM-object-level mmap should also be blocked for ubuf objects, or only dma-buf mmap. If only dma-buf mmap, update the commit message to be precise.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-05-15 22:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 15:53 [PATCH V1] accel/amdxdna: Remove mmap and export support for ubuf Lizhi Hou
2026-05-15 22:56 ` Claude review: " Claude Code Review Bot
2026-05-15 22:56 ` Claude Code Review Bot [this message]
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-patch1-20260515155332.743097-1-lizhi.hou@amd.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