Re: [PATCH v2 01/14] kexec: split crashkernel reservation code out from crash_core.c

Sourabh Jain
2024-02-21T17:30:23Z

Hello Baoquan,

Thank you for reorganizing the kexec and kdump code with a well-defined
configuration structure.

While reviewing the patch series, I noticed a few typos.

On 19/01/24 20:22, Baoquan He wrote:
> Both kdump and fa_dump of ppc rely on crashkernel reservation. Move the
> relevant codes into separate files:
> crash_reserve.c, include/linux/crash_reserve.h.
>
> And also add config item CRASH_RESERVE to control its enabling of the
> codes. And update config items which has relationship with crashkernel
> reservation.
>
> And also change ifdeffery from CONFIG_CRASH_CORE to CONFIG_CRASH_RESERVE
> when those scopes are only crashkernel reservation related.
>
> And also rename arch/XXX/include/asm/{crash_core.h => crash_reserve.h}
> on arm64, x86 and risc-v because those architectures' crash_core.h
> is only related to crashkernel reservation.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> arch/arm64/Kconfig | 2 +-
> .../asm/{crash_core.h => crash_reserve.h} | 4 +-
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/mm/nohash/kaslr_booke.c | 4 +-
> arch/riscv/Kconfig | 2 +-
> .../asm/{crash_core.h => crash_reserve.h} | 4 +-
> arch/x86/Kconfig | 2 +-
> .../asm/{crash_core.h => crash_reserve.h} | 6 +-
> include/linux/crash_core.h | 40 --
> include/linux/crash_reserve.h | 48 ++
> include/linux/kexec.h | 1 +
> kernel/Kconfig.kexec | 5 +-
> kernel/Makefile | 1 +
> kernel/crash_core.c | 438 -----------------
> kernel/crash_reserve.c | 464 ++++++++++++++++++
> 15 files changed, 531 insertions(+), 491 deletions(-)
> rename arch/arm64/include/asm/{crash_core.h => crash_reserve.h} (81%)
> rename arch/riscv/include/asm/{crash_core.h => crash_reserve.h} (78%)
> rename arch/x86/include/asm/{crash_core.h => crash_reserve.h} (92%)
> create mode 100644 include/linux/crash_reserve.h
> create mode 100644 kernel/crash_reserve.c
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index ea01a2c43efa..d96bc3c67ec6 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1501,7 +1501,7 @@ config ARCH_SUPPORTS_CRASH_DUMP
> def_bool y
>
> config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
> - def_bool CRASH_CORE
> + def_bool CRASH_RESERVE
>
> config TRANS_TABLE
> def_bool y
> diff --git a/arch/arm64/include/asm/crash_core.h b/arch/arm64/include/asm/crash_reserve.h
> similarity index 81%
> rename from arch/arm64/include/asm/crash_core.h
> rename to arch/arm64/include/asm/crash_reserve.h
> index 9f5c8d339f44..4afe027a4e7b 100644
> --- a/arch/arm64/include/asm/crash_core.h
> +++ b/arch/arm64/include/asm/crash_reserve.h
> @@ -1,6 +1,6 @@
> /* SPDX-License-Identifier: GPL-2.0-only */
> -#ifndef _ARM64_CRASH_CORE_H
> -#define _ARM64_CRASH_CORE_H
> +#ifndef _ARM64_CRASH_RESERVE_H
> +#define _ARM64_CRASH_RESERVE_H
>
> /* Current arm64 boot protocol requires 2MB alignment */
> #define CRASH_ALIGN SZ_2M
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 414b978b8010..6aeab95f0edd 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -691,6 +691,7 @@ config FA_DUMP
> bool "Firmware-assisted dump"
> depends on PPC64 && (PPC_RTAS || PPC_POWERNV)
> select CRASH_CORE
> + select CRASH_RESERVE
> select CRASH_DUMP
> help
> A robust mechanism to get reliable kernel crash dump with
> diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
> index b4f2786a7d2b..cdff129abb14 100644
> --- a/arch/powerpc/mm/nohash/kaslr_booke.c
> +++ b/arch/powerpc/mm/nohash/kaslr_booke.c
> @@ -13,7 +13,7 @@
> #include <linux/delay.h>
> #include <linux/memblock.h>
> #include <linux/libfdt.h>
> -#include <linux/crash_core.h>
> +#include <linux/crash_reserve.h>
> #include <linux/of.h>
> #include <linux/of_fdt.h>
> #include <asm/cacheflush.h>
> @@ -173,7 +173,7 @@ static __init bool overlaps_region(const void *fdt, u32 start,
>
> static void __init get_crash_kernel(void *fdt, unsigned long size)
> {
> -#ifdef CONFIG_CRASH_CORE
> +#ifdef CONFIG_CRASH_RESERVE
> unsigned long long crash_size, crash_base;
> int ret;
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index b549499eb363..37a438c23deb 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -712,7 +712,7 @@ config ARCH_SUPPORTS_CRASH_DUMP
> def_bool y
>
> config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
> - def_bool CRASH_CORE
> + def_bool CRASH_RESERVE
>
> config COMPAT
> bool "Kernel support for 32-bit U-mode"
> diff --git a/arch/riscv/include/asm/crash_core.h b/arch/riscv/include/asm/crash_reserve.h
> similarity index 78%
> rename from arch/riscv/include/asm/crash_core.h
> rename to arch/riscv/include/asm/crash_reserve.h
> index e1874b23feaf..013962e63587 100644
> --- a/arch/riscv/include/asm/crash_core.h
> +++ b/arch/riscv/include/asm/crash_reserve.h
> @@ -1,6 +1,6 @@
> /* SPDX-License-Identifier: GPL-2.0-only */
> -#ifndef _RISCV_CRASH_CORE_H
> -#define _RISCV_CRASH_CORE_H
> +#ifndef _RISCV_CRASH_RESERVE_H
> +#define _RISCV_CRASH_RESERVE_H
>
> #define CRASH_ALIGN PMD_SIZE
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 5edec175b9bf..71417c5b228c 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2106,7 +2106,7 @@ config ARCH_SUPPORTS_CRASH_HOTPLUG
> def_bool y
>
> config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
> - def_bool CRASH_CORE
> + def_bool CRASH_RESEERVE

%s/CRASH_RESEERVE/CRASH_RESERVE? - Sourabh