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/gem/shmem: Introduce __drm_gem_shmem_free_sgt_locked()
Date: Thu, 23 Apr 2026 08:05:54 +1000	[thread overview]
Message-ID: <review-patch2-20260421235346.672794-3-lyude@redhat.com> (raw)
In-Reply-To: <20260421235346.672794-3-lyude@redhat.com>

Patch Review

Extracts the sgt teardown logic into a new exported function. The refactoring is clean and the function is correctly guarded with `dma_resv_assert_held()`.

**Naming mismatch in kdoc**: The kdoc comment header says `__drm_gem_shmem_release_sgt_locked` but the actual function is named `__drm_gem_shmem_free_sgt_locked`. The changelog mentions fixing this in V10, but the mismatch is still present:

```c
/**
 * __drm_gem_shmem_release_sgt_locked - Unpin and DMA unmap pages, and release the
 * cached scatter/gather table for an shmem GEM object.
```

vs:

```c
void __drm_gem_shmem_free_sgt_locked(struct drm_gem_shmem_object *shmem)
```

This should be `__drm_gem_shmem_free_sgt_locked` in the kdoc to match.

**No NULL check on shmem->sgt**: The original code in `drm_gem_shmem_release` checks `if (shmem->sgt)` before calling the teardown. The new `__drm_gem_shmem_free_sgt_locked()` does not check for NULL and will crash if called with `shmem->sgt == NULL`. The call site in `drm_gem_shmem_release` preserves the NULL guard, but external callers (the Rust bindings in patch 4) need to be careful. The Rust side does call this only after a successful `drm_gem_shmem_get_pages_sgt_locked`, so it should be fine in practice, but a defensive NULL check (or at least a `WARN_ON(!shmem->sgt)`) in the exported function would be safer.

**Kdoc says "Unpin" but function doesn't unpin**: The kdoc says "Unpin and DMA unmap pages" but the function only does DMA unmap + free the sgt structure. It does not call `drm_gem_shmem_put_pages_locked()`. This is accurate to the code behavior (the caller in `drm_gem_shmem_release` calls `put_pages_locked` separately), but the kdoc is misleading.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-04-22 22:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 23:52 [PATCH v12 0/5] Rust bindings for gem shmem Lyude Paul
2026-04-21 23:52 ` [PATCH v12 1/5] rust: drm: gem: s/device::Device/Device/ for shmem.rs Lyude Paul
2026-04-22 22:05   ` Claude review: " Claude Code Review Bot
2026-04-21 23:52 ` [PATCH v12 2/5] drm/gem/shmem: Introduce __drm_gem_shmem_free_sgt_locked() Lyude Paul
2026-04-22 22:05   ` Claude Code Review Bot [this message]
2026-04-21 23:52 ` [PATCH v12 3/5] drm/gem/shmem: Export drm_gem_shmem_get_pages_sgt_locked() Lyude Paul
2026-04-22 22:05   ` Claude review: " Claude Code Review Bot
2026-04-21 23:52 ` [PATCH v12 4/5] rust: drm: gem: Introduce shmem::SGTable Lyude Paul
2026-04-22 22:05   ` Claude review: " Claude Code Review Bot
2026-04-21 23:52 ` [PATCH v12 5/5] rust: drm: gem: Add vmap functions to shmem bindings Lyude Paul
2026-04-22 22:05   ` Claude review: " Claude Code Review Bot
2026-04-22 22:05 ` Claude review: Rust bindings for gem shmem Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-21 23:40 [PATCH v11 0/5] " Lyude Paul
2026-04-21 23:40 ` [PATCH v11 2/5] drm/gem/shmem: Introduce __drm_gem_shmem_free_sgt_locked() Lyude Paul
2026-04-22 22:09   ` Claude review: " Claude Code Review Bot
2026-04-09  0:12 [PATCH v10 0/5] Rust bindings for gem shmem Lyude Paul
2026-04-09  0:12 ` [PATCH v10 2/5] drm/gem/shmem: Introduce __drm_gem_shmem_free_sgt_locked() Lyude Paul
2026-04-12  2:01   ` 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-patch2-20260421235346.672794-3-lyude@redhat.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