[PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n
Randy Dunlap
rdunlap at infradead.org
Mon Dec 4 11:14:03 PST 2023
On 12/3/23 18:19, Baoquan He wrote:
> 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
> ......
> -----------------------
>
[]
>
> 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.
>
> Signed-off-by: Baoquan He <bhe at redhat.com>
> ---
> arch/riscv/kernel/crash_core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c
> index 55f1d7856b54..8706736fd4e2 100644
> --- a/arch/riscv/kernel/crash_core.c
> +++ b/arch/riscv/kernel/crash_core.c
> @@ -5,17 +5,19 @@
>
> 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",
Both riscv 32-bit and 64-bit complain:
../arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo':
../arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
11 | vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
| ~~^
| |
| long unsigned int
| %x
Otherwise this builds without failure.
Tested-by: Randy Dunlap <rdunlap at infradead.org> # build-tested
Thanks.
--
~Randy
More information about the kexec
mailing list