From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260312151726.1779566-3-francois.dugast@intel.com> References: <20260312151726.1779566-1-francois.dugast@intel.com> <20260312151726.1779566-3-francois.dugast@intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review The helper `drm_pagemap_page_zone_device_data()` wraps the page=E2=86=92fol= io conversion and calls `folio_zone_device_data()`. This is good for consis= tency, 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 th= at could be **device-coherent**, not just device-private: - `drm_pagemap_migrate_unmap_pages` (guards with `is_zone_device_page()`, w= hich includes coherent pages) - `drm_pagemap_migrate_populate_ram_pfn` (compares `zone_device_data` of sr= c/fault pages without checking device_private) - `__drm_pagemap_migrate_to_ram`, `drm_pagemap_migrate_to_ram`, `drm_pagema= p_page_to_dpagemap` =E2=80=94 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` splat= s 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 `fo= lio->page.zone_device_data` directly (bypassing the debug check). Alternati= vely, if drm_pagemap is guaranteed to never see device-coherent pages at th= ese 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