From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: accel/amdxdna: Preserve user address when PASID is disabled
Date: Thu, 04 Jun 2026 13:24:31 +1000 [thread overview]
Message-ID: <review-patch1-20260602040624.2206774-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260602040624.2206774-1-lizhi.hou@amd.com>
Patch Review
**Correctness: The fix is correct.** Setting `abo->mem.uva = addr` before the early return ensures that `amdxdna_gem_uva()` returns a valid address for heap validation in `amdxdna_init_dev_bo()`, regardless of PASID state.
**Minor observations (non-blocking):**
1. **Cleanup asymmetry on munmap.** In the PASID-on path, `uva` is reset to `AMDXDNA_INVALID_ADDR` when the last umap entry is removed (`amdxdna_umap_release()` at `amdxdna_gem.c:322`). In the no-PASID path, no `mapp` is created and no entry is added to `umap_list`, so `uva` is never reset after munmap — it persists until the BO is freed. This means `amdxdna_gem_uva()` could return a stale address for an unmapped BO in the no-PASID case. In practice this is likely harmless because `amdxdna_obj_dma_addr()` uses `abo->mem.dma_addr` (not `uva`) when PASID is off, and heap validation would only occur during subsequent `amdxdna_init_dev_bo()` calls. But it's worth calling out.
2. **Repeated mmap behavior.** In the PASID-on path, `uva` is only set on the first mmap (guarded by `list_empty(&abo->mem.umap_list)` at line 389). With this patch, the no-PASID path sets `uva` on every mmap call unconditionally. For heap BOs this is fine since they're typically mmapped once, but it's a subtle behavioral difference.
3. **Locking.** The PASID-on path writes `uva` under `notifier_lock` (line 388–392). This patch writes `uva` without the lock. Since the no-PASID path doesn't manipulate `umap_list` and mmap is serialized by the mm's `mmap_lock`, this is safe in practice. The header comment (amdxdna_gem.h:33–36) already states `uva` can be accessed without `notifier_lock`.
**Verdict:** The patch is a clear bug fix with a correct Fixes tag. The asymmetries noted above are pre-existing design characteristics of the PASID-on vs PASID-off paths rather than issues introduced by this patch.
Reviewed-by tag warranted.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 3:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 4:06 [PATCH V1] accel/amdxdna: Preserve user address when PASID is disabled Lizhi Hou
2026-06-02 14:15 ` Mario Limonciello
2026-06-02 15:40 ` Lizhi Hou
2026-06-04 3:24 ` Claude Code Review Bot [this message]
2026-06-04 3:24 ` 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-patch1-20260602040624.2206774-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