The patch titled Subject: riscv, crash: don't export some symbols when CONFIG_MMU=n has been added to the -mm mm-hotfixes-unstable branch. Its filename is kexec-drop-dependency-on-arch_supports_kexec-from-crash_dump-fix-1.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kexec-drop-dependency-on-arch_supports_kexec-from-crash_dump-fix-1.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Baoquan He <bhe@xxxxxxxxxx> Subject: riscv, crash: don't export some symbols when CONFIG_MMU=n Date: Mon, 4 Dec 2023 10:19:36 +0800 When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP, compiling error is reported when below config items are set: ----------------------- CONFIG_CRASH_CORE=y CONFIG_KEXEC_CORE=y CONFIG_CRASH_DUMP=y ...... ----------------------- ------------------------------------------------------------------------------------------------- arch/riscv/kernel/crash_core.c:8:27: error: 'VA_BITS' undeclared (first use in this function) 8 | VMCOREINFO_NUMBER(VA_BITS); | ^~~~~~~ include/linux/crash_core.h:78:64: note: in definition of macro 'VMCOREINFO_NUMBER' 78 | vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name) | ^~~~ arch/riscv/kernel/crash_core.c:14:64: error: 'VMEMMAP_START' undeclared (first use in this function) 14 | vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); | ^~~~~~~~~~~~~ arch/riscv/kernel/crash_core.c:15:62: error: 'VMEMMAP_END' undeclared (first use in this function); did you mean 'MEMREMAP_ENC'? 15 | vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); | ^~~~~~~~~~~ | MEMREMAP_ENC arch/riscv/kernel/crash_core.c:17:64: error: 'MODULES_VADDR' undeclared (first use in this function) 17 | vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); | ^~~~~~~~~~~~~ arch/riscv/kernel/crash_core.c:18:62: error: 'MODULES_END' undeclared (first use in this function) 18 | vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); ------------------------------------------------------------------------------------------------- Currently, riscv's ARCH_SUPPORTS_KEXEC has dependency on MMU. Before dropping ARCH_SUPPORTS_KEXEC, disabling CONFIG_MMU will unset CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE. Hence crash_core related codes won't be compiled. --------------------- arch/riscv/Kconfig: config ARCH_SUPPORTS_KEXEC def_bool MMU --------------------- After dropping ARCH_SUPPORTS_KEXEC, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE can be set independently of CONFIG_MMU. However, there are several macro definitions, such as VA_BITS, VMEMMAP_START, VMEMMAP_END, MODULES_VADDR, MODULES_END are only available when CONFIG_MMU=y. Then compiling errors are triggered. Here, add CONFIG_MMU ifdeffery in arch_crash_save_vmcoreinfo() to export those symbols when CONFIG_MMU is enabled. Link: https://lkml.kernel.org/r/ZW03ODUKGGhP1ZGU@MiWiFi-R3L-srv Signed-off-by: Baoquan He <bhe@xxxxxxxxxx> Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> Cc: Ignat Korchagin <ignat@xxxxxxxxxxxxxx> Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/riscv/kernel/crash_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/riscv/kernel/crash_core.c~kexec-drop-dependency-on-arch_supports_kexec-from-crash_dump-fix-1 +++ a/arch/riscv/kernel/crash_core.c @@ -5,18 +5,20 @@ void arch_crash_save_vmcoreinfo(void) { - VMCOREINFO_NUMBER(VA_BITS); VMCOREINFO_NUMBER(phys_ram_base); vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET); vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START); vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END); +#ifdef CONFIG_MMU + VMCOREINFO_NUMBER(VA_BITS); vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); #ifdef CONFIG_64BIT vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); #endif +#endif vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR); vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n", kernel_map.va_kernel_pa_offset); _ Patches currently in -mm which might be from bhe@xxxxxxxxxx are drivers-base-cpu-crash-data-showing-should-depends-on-kexec_core.patch kernel-kconfigkexec-drop-select-of-kexec-for-crash_dump.patch kexec_core-change-dependency-of-object-files.patch kexec-drop-dependency-on-arch_supports_kexec-from-crash_dump-fix-1.patch kexec-drop-dependency-on-arch_supports_kexec-from-crash_dump-fix-2.patch resource-add-walk_system_ram_res_rev.patch kexec_file-load-kernel-at-top-of-system-ram-if-required.patch kexec_file-add-kexec_file-flag-to-control-debug-printing.patch kexec_file-print-out-debugging-message-if-required.patch kexec_file-x86-print-out-debugging-message-if-required.patch kexec_file-arm64-print-out-debugging-message-if-required.patch kexec_file-ricv-print-out-debugging-message-if-required.patch kexec_file-power-print-out-debugging-message-if-required.patch kexec_file-parisc-print-out-debugging-message-if-required.patch riscv-kexec-fix-the-ifdeffery-for-aflags_kexec_relocateo.patch