From e40be271d5baed5e2e3fa6ffe3d2dff7fbeede56 Mon Sep 17 00:00:00 2001 From: Jia He Date: Thu, 17 Jul 2025 03:24:27 +0000 Subject: [PATCH 1/2] mm: vmalloc: add VMALLOC_EARLY_START boundary for early vmalloc community inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICMWZW ------------------------------------------------- After commit ("2caf0ac95736 !15233 v4 mm: arm64: Add kernel replication feature"), OpenEuler enabled the kernel replication feature for text, vmalloc, module etc. The kernel replication feature changed VMALLOC_START for adding the replication pgtable. But in vm_area_register_early() case, it assumes to use the gobal structure _vmlist_ before vmalloc_init(). See the calltrace as follows: start_kernel() setup_per_cpu_areas() pcpu_page_first_chunk() vm_area_register_early() Hence fix it by adding a new boundary VMALLOC_EARLY_START for such case. Fixes: 2caf0ac95736 ("!15233 v4 mm: arm64: Add kernel replication feature") Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 1 + mm/vmalloc.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index b30e43b84a64..71cad93e0e18 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -27,6 +27,7 @@ #define VMALLOC_START (MODULES_END) #endif /* CONFIG_KERNEL_REPLICATION */ #define VMALLOC_END (VMEMMAP_START - SZ_256M) +#define VMALLOC_EARLY_START (MODULES_END) /* for early vmalloc before vmalloc_init() */ #define vmemmap ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT)) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index b170cc1ef447..35b9cb78e783 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -50,6 +50,10 @@ #include "internal.h" #include "pgalloc-track.h" +#ifndef VMALLOC_EARLY_START +#define VMALLOC_EARLY_START (VMALLOC_START) +#endif + #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP static unsigned int __ro_after_init ioremap_max_page_shift = BITS_PER_LONG - 1; @@ -3077,7 +3081,7 @@ void __init vm_area_add_early(struct vm_struct *vm) */ void __init vm_area_register_early(struct vm_struct *vm, size_t align) { - unsigned long addr = ALIGN(VMALLOC_START, align); + unsigned long addr = ALIGN(VMALLOC_EARLY_START, align); struct vm_struct *cur, **p; BUG_ON(vmap_initialized); -- Gitee From 583a3f5d30bca361484976c184acdcde8a9a9465 Mon Sep 17 00:00:00 2001 From: Jia He Date: Thu, 17 Jul 2025 03:25:50 +0000 Subject: [PATCH 2/2] mm: vmalloc: remove unnecessary vmflags update community inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICMWZW ------------------------------------------------- As a input parameter, _vmflags_ will not be used or passed to child function after the fixing point. Hence just remove the unnecessary update. Fixes: 2caf0ac95736 ("!15233 v4 mm: arm64: Add kernel replication feature") Signed-off-by: Jia He --- mm/vmalloc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 35b9cb78e783..63c77da22483 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3957,8 +3957,6 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, } #ifdef CONFIG_KERNEL_REPLICATION - if (numa_addr_has_replica(area->addr)) - vm_flags |= VM_NUMA_SHARED; area->node = node; #endif /* -- Gitee