Re: [PATCH 5/9] mm: convert PTE table entries in ptep_get()
[email protected] Thu, 06 Aug 2026 08:57:03 +0000
| Newsgroups | org.kernel.vger.linux-perf-users,dev.linux.lists.damon,org.freedesktop.lists.dri-devel,org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] ptep_get_lockless() fails to compile when both CONFIG_ARCH_HAS_HW_PTE_T and CONFIG_GUP_GET_PXX_LOW_HIGH are enabled. -- --- Patch [5]: [PATCH 5/9] mm: convert PTE table entries in ptep_get() --- commit 697ecf53dc0bc83c57005a208e0294657ed963f8 Author: Muhammad Usama Anjum <[email protected]> mm: convert PTE table entries in ptep_get() ptep_get() now accepts a pointer to hw_pte_t storage but must continue to return a logical pte_t value. Add __pte_from_hw for both generic hw_pte_t definitions. Read the hw_pte_t table element atomically before converting it to pte_t. > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > index dad80d264aac2..1768421755a9c 100644 > --- a/include/linux/pgtable.h > +++ b/include/linux/pgtable.h > @@ -493,7 +493,7 @@ static inline int pudp_set_access_flags(struct vm_area_struct *vma, > #ifndef ptep_get > static inline pte_t ptep_get(hw_pte_t *ptep) > { > - return READ_ONCE(*ptep); > + return __pte_from_hw(READ_ONCE(*ptep)); > } > #endif [Severity: Low] Does this change cause a compilation failure in ptep_get_lockless() when CONFIG_GUP_GET_PXX_LOW_HIGH and CONFIG_ARCH_HAS_HW_PTE_T are both enabled? When CONFIG_ARCH_HAS_HW_PTE_T is enabled, hw_pte_t becomes a wrapper struct. However, ptep_get_lockless() still attempts to access pte_low and pte_high directly from the hw_pte_t pointer: include/linux/pgtable.h:ptep_get_lockless() { ... do { pte.pte_low = ptep->pte_low; smp_rmb(); pte.pte_high = ptep->pte_high; smp_rmb(); } while (unlikely(pte.pte_low != ptep->pte_low)); ... } Should ptep_get_lockless() be updated to handle the wrapper struct, perhaps by accessing the __pte member or extracting the logical pte_t first? [ ... ] -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5