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/panthor: Lazily allocate pages on mmap()
Date: Tue, 10 Mar 2026 12:15:41 +1000	[thread overview]
Message-ID: <review-patch6-20260309151119.290217-7-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20260309151119.290217-7-boris.brezillon@collabora.com>

Patch Review

This patch defers page allocation from `mmap()` time to fault time. The fault handler is significantly reworked with a nonblocking fast path and a blocking slow path.

1. **`nonblocking_page_setup`**: Uses `dma_resv_trylock()` — returns `VM_FAULT_RETRY` if pages aren't allocated or lock is contended. This is correct for the fast path.

2. **`blocking_page_setup`**: Uses `dma_resv_lock_interruptible()`. If it fails:
   - With mmap lock held: returns `VM_FAULT_NOPAGE` (will retry)
   - Without mmap lock: returns `VM_FAULT_RETRY`

   Minor concern: when `dma_resv_lock_interruptible()` returns `-EINTR`, returning `VM_FAULT_NOPAGE` with `mmap_lock_held=true` seems correct (the MM will retry), but if `err == -EDEADLK` (shouldn't happen with NULL ctx), the behavior would be the same.

3. **mmap lock release pattern**: The pattern of calling `mmap_read_unlock()`, doing work, then returning `VM_FAULT_RETRY` is standard for VM fault handlers that need to sleep.

4. **`drm_gem_object_get/put` around blocking path**: Correctly prevents the BO from being freed while the mmap lock is released.

5. **`vm_open` simplification**: The old `panthor_gem_vm_open` asserted pages were present and took the resv lock. With lazy allocation, it's simplified to just `drm_gem_vm_open`. This makes sense — pages may not be allocated yet.

No issues.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-10  2:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 15:11 [PATCH v5 0/9] drm/panthor: Add a GEM shrinker Boris Brezillon
2026-03-09 15:11 ` [PATCH v5 1/9] drm/gem: Consider GEM object reclaimable if shrinking fails Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 2/9] drm/panthor: Move panthor_gems_debugfs_init() to panthor_gem.c Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 3/9] drm/panthor: Group panthor_kernel_bo_xxx() helpers Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 4/9] drm/panthor: Don't call drm_gpuvm_bo_extobj_add() if the object is private Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 5/9] drm/panthor: Part ways with drm_gem_shmem_object Boris Brezillon
2026-03-09 15:34   ` Steven Price
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 6/9] drm/panthor: Lazily allocate pages on mmap() Boris Brezillon
2026-03-10  2:15   ` Claude Code Review Bot [this message]
2026-03-09 15:11 ` [PATCH v5 7/9] drm/panthor: Split panthor_vm_prepare_map_op_ctx() to prepare for reclaim Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 8/9] drm/panthor: Track the number of mmap on a BO Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-09 15:11 ` [PATCH v5 9/9] drm/panthor: Add a GEM shrinker Boris Brezillon
2026-03-10  2:15   ` Claude review: " Claude Code Review Bot
2026-03-10  2:15 ` 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-patch6-20260309151119.290217-7-boris.brezillon@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