[RFC PATCH 15/18] arm64: add support of NUMA replication for ptdump

Nikita Panov panov.nikita at huawei.com
Thu Aug 27 09:11:55 PDT 2026


Acked-by: Artem Kuzin <artem.kuzin at huawei.com>
Acked-by: Alexander Grubnikov <alexander.grubnikov at huawei.com>
Acked-by: Ilya Hanov <ilya.hanov at huawei-partners.com>
Acked-by: Denis Darvish <darvish.denis at huawei.com>
Signed-off-by: Nikita Panov <panov.nikita at huawei.com>
---
 arch/arm64/mm/ptdump.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
index 5a76c59b5ada..17c4de4b9b3e 100644
--- a/arch/arm64/mm/ptdump.c
+++ b/arch/arm64/mm/ptdump.c
@@ -18,6 +18,7 @@
 #include <linux/ptdump.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/numa_kernel_replication.h>
 
 #include <asm/fixmap.h>
 #include <asm/kasan.h>
@@ -328,7 +329,7 @@ static struct ptdump_info kernel_ptdump_info __ro_after_init = {
 	.mm		= &init_mm,
 };
 
-bool ptdump_check_wx(void)
+static bool ptdump_check_wx_pgd(struct mm_struct *mm, pgd_t *pgd)
 {
 	struct ptdump_pg_state st = {
 		.seq = NULL,
@@ -353,7 +354,7 @@ bool ptdump_check_wx(void)
 		}
 	};
 
-	ptdump_walk_pgd(&st.ptdump, &init_mm, NULL);
+	ptdump_walk_pgd(&st.ptdump, mm, pgd);
 
 	if (st.wx_pages || st.uxn_pages) {
 		pr_warn("Checked W+X mappings: FAILED, %lu W+X pages found, %lu non-UXN pages found\n",
@@ -367,6 +368,25 @@ bool ptdump_check_wx(void)
 	}
 }
 
+
+#ifdef CONFIG_KERNEL_REPLICATION
+bool ptdump_check_wx(void)
+{
+	bool res = false;
+	int nid;
+
+	for_each_memory_node(nid)
+		res |= ptdump_check_wx_pgd(&init_mm, per_node_pgd(&init_mm, nid));
+
+	return res;
+}
+#else
+bool ptdump_check_wx(void)
+{
+	return ptdump_check_wx_pgd(&init_mm, init_mm->pgd);
+}
+#endif
+
 static int __init ptdump_init(void)
 {
 	u64 page_offset = _PAGE_OFFSET(vabits_actual);
-- 
2.34.1




More information about the linux-arm-kernel mailing list