From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/pagemap: Add helper to access zone_device_data
Date: Fri, 13 Mar 2026 14:02:32 +1000 [thread overview]
Message-ID: <review-patch2-20260312151726.1779566-3-francois.dugast@intel.com> (raw)
In-Reply-To: <20260312151726.1779566-3-francois.dugast@intel.com>
Patch Review
The helper `drm_pagemap_page_zone_device_data()` wraps the page→folio conversion and calls `folio_zone_device_data()`. This is good for consistency, but there is a concern:
`folio_zone_device_data()` in the kernel (memremap.h) has:
```c
static inline void *folio_zone_device_data(const struct folio *folio)
{
VM_WARN_ON_FOLIO(!folio_is_device_private(folio), folio);
return folio->page.zone_device_data;
}
```
Several call sites in `drm_pagemap.c` access `zone_device_data` on pages that could be **device-coherent**, not just device-private:
- `drm_pagemap_migrate_unmap_pages` (guards with `is_zone_device_page()`, which includes coherent pages)
- `drm_pagemap_migrate_populate_ram_pfn` (compares `zone_device_data` of src/fault pages without checking device_private)
- `__drm_pagemap_migrate_to_ram`, `drm_pagemap_migrate_to_ram`, `drm_pagemap_page_to_dpagemap` — the fault/source page could be from coherent memory since `MIGRATE_VMA_SELECT_DEVICE_COHERENT` is used
Under `CONFIG_DEBUG_VM`, these paths would produce `VM_WARN_ON_FOLIO` splats for device-coherent pages. This isn't a functional bug (the data is still read correctly), but it would be noisy in debug/development builds.
**Suggestion**: Either adjust `folio_zone_device_data()` upstream to accept both private and coherent pages, or have the drm_pagemap helper access `folio->page.zone_device_data` directly (bypassing the debug check). Alternatively, if drm_pagemap is guaranteed to never see device-coherent pages at these call sites, a comment explaining that would be helpful.
**Verdict: Potential issue with device-coherent pages under CONFIG_DEBUG_VM.**
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-13 4:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 15:16 [PATCH v8 0/4] Enable THP support in drm_pagemap Francois Dugast
2026-03-12 15:16 ` [PATCH v8 1/4] drm/pagemap: Unlock and put folios when possible Francois Dugast
2026-03-13 4:02 ` Claude review: " Claude Code Review Bot
2026-03-12 15:16 ` [PATCH v8 2/4] drm/pagemap: Add helper to access zone_device_data Francois Dugast
2026-03-13 4:02 ` Claude Code Review Bot [this message]
2026-03-12 15:16 ` [PATCH v8 3/4] drm/pagemap: Correct cpages calculation for migrate_vma_setup Francois Dugast
2026-03-13 4:02 ` Claude review: " Claude Code Review Bot
2026-03-12 15:16 ` [PATCH v8 4/4] drm/pagemap: Enable THP support for GPU memory migration Francois Dugast
2026-03-13 4:02 ` Claude review: " Claude Code Review Bot
2026-03-13 4:02 ` Claude review: Enable THP support in drm_pagemap Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-03-12 19:20 [PATCH v9 0/4] " Francois Dugast
2026-03-12 19:20 ` [PATCH v9 2/4] drm/pagemap: Add helper to access zone_device_data Francois Dugast
2026-03-13 3:55 ` 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-20260312151726.1779566-3-francois.dugast@intel.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