Thread (19 messages) flat view 19 messages, 2 authors, 4d ago

Re: [PATCH v3 4/9] mm: convert PTE table entries in ptep_get()

From: sashiko-bot@kernel.org
Date: 2026-09-22 17:25:56
Also in: bpf, damon, dri-devel, intel-gfx, linux-perf-users

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mm: build failure in ptep_get_lockless() with ARCH_HAS_HW_PTE_T
--

commit 5a58c0b37be320a1ff8bd51ae9ca94d50bf27375
Author: Muhammad Usama Anjum [off-list ref]

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 software PTE 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.

[ ... ]
quoted hunk ↗ jump to hunk
diff --git a/include/linux/pgtable_types.h b/include/linux/pgtable_types.h
index 07da05d375c2c..d6c5a7548550b 100644
--- a/include/linux/pgtable_types.h
+++ b/include/linux/pgtable_types.h
@@ -8,8 +8,10 @@
 
 #ifdef CONFIG_ARCH_HAS_HW_PTE_T
 typedef struct __hw_pte_t { pte_t __pte; } hw_pte_t;
+#define __pte_from_hw(pte)	((pte).__pte)
[Severity: Low]
Does this wrapper struct cause a build failure in ptep_get_lockless()
when architectures using CONFIG_GUP_GET_PXX_LOW_HIGH (like x86-32 PAE) 
opt into ARCH_HAS_HW_PTE_T?

When hw_pte_t is a wrapper struct instead of a typedef, the direct member 
access fails to compile:

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));
    ...
}

Since ptep is a pointer to the wrapper struct, it lacks the pte_low and
pte_high members.
 #else
 #define hw_pte_t pte_t
+#define __pte_from_hw(pte)	(pte)
 #endif
 
 #endif /* !__ASSEMBLY__ */
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-pte0-v3-0-5670b8cb9059@arm.com?part=4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help