mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] LoongArch: add p?d_leaf() definitions
@ 2023-09-06  9:20 Hongchen Zhang
  2023-09-06  9:25 ` David Hildenbrand
  2023-09-07  1:36 ` Huacai Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Hongchen Zhang @ 2023-09-06  9:20 UTC (permalink / raw)
  To: Huacai Chen, WANG Xuerui, Andrew Morton, David Hildenbrand,
	Mike Rapoport IBM),
	Feiyang Chen, Hongchen Zhang, Qi Zheng, Matthew Wilcox Oracle),
	Kefeng Wang, Jiaxun Yang
  Cc: loongarch, linux-kernel, stable, loongson-kernel

When I do LTP test, LTP test case ksm06 caused panic at
	break_ksm_pmd_entry
	  -> pmd_leaf (Huge page table but False)
	  -> pte_present (panic)

The reason is pmd_leaf is not defined, So like
commit 501b81046701 ("mips: mm: add p?d_leaf() definitions")
add p?d_leaf() definition for LoongArch.

Fixes: 09cfefb7fa70 ("LoongArch: Add memory management")
Cc: stable@vger.kernel.org
Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
---
v2->v3: add Cc: stable@vger.kernel.org
v1->v2: add Fixes in commit message
---
 arch/loongarch/include/asm/pgtable.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
index 370c6568ceb8..ea54653b7aab 100644
--- a/arch/loongarch/include/asm/pgtable.h
+++ b/arch/loongarch/include/asm/pgtable.h
@@ -243,6 +243,9 @@ static inline void pmd_clear(pmd_t *pmdp)
 
 #define pmd_phys(pmd)		PHYSADDR(pmd_val(pmd))
 
+#define pmd_leaf(pmd)		((pmd_val(pmd) & _PAGE_HUGE) != 0)
+#define pud_leaf(pud)		((pud_val(pud) & _PAGE_HUGE) != 0)
+
 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
 #define pmd_page(pmd)		(pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE  */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-07  1:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-06  9:20 [PATCH v3] LoongArch: add p?d_leaf() definitions Hongchen Zhang
2023-09-06  9:25 ` David Hildenbrand
2023-09-07  1:36 ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®