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

From: Nikita Panov

Date: Thu Aug 27 2026 - 12:29:18 EST


Acked-by: Artem Kuzin <artem.kuzin@xxxxxxxxxx>
Acked-by: Alexander Grubnikov <alexander.grubnikov@xxxxxxxxxx>
Acked-by: Ilya Hanov <ilya.hanov@xxxxxxxxxxxxxxxxxxx>
Acked-by: Denis Darvish <darvish.denis@xxxxxxxxxx>
Signed-off-by: Nikita Panov <panov.nikita@xxxxxxxxxx>
---
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