[PATCH v4 0/3] LoongArch: Add kexec/kdump support

Youling Tang tangyouling at loongson.cn
Fri Sep 23 02:16:14 PDT 2022



On 09/23/2022 03:44 PM, Youling Tang wrote:
> This patch series to support kexec/kdump (only 64bit).
>
> Kexec is a system call that enables you to load and boot into another kernel
> from the currently running kernel. This is useful for kernel developers or
> other people who need to reboot very quickly without waiting for the whole
> BIOS boot process to finish.
>
> Kdump uses kexec to quickly boot to a dump-capture kernel whenever a
> dump of the system kernel's memory needs to be taken (for example, when
> the system panics). The system kernel's memory image is preserved across
> the reboot and is accessible to the dump-capture kernel.
>
> For details, see Documentation/admin-guide/kdump/kdump.rst.
>
> User tools kexec-tools see link [1].
>
> TODO:
> Currently kdump does not support the same binary image, the production kernel
> and the capture kernel will be generated with different configurations. I will
> support kernel relocation support in the near future. Then will go to implement
> the same binary support based on kernel relocation support.
>
> [1] Link: https://github.com/tangyouling/kexec-tools
>
> Changes in v4:
>  After applying the following series of patches [1], the following
>  modifications need to be made:
>  - Adjust the number of parameters and the content of the parameters passed.
>  - Removed build and processing of fdt.
>  - Add handling of command line segments.
>  - Use the command line argument "elfcorehdr=" instead of the "linux,elfcorehdr"
>    member in fdt.
>  - Use the command line argument "mem=" instead of the "linux, usable-memory-range"
>    member in fdt.
>  - Use the command line argument "initrd=" instead of the "linux,initrd-start" and
>    "linux,initrd-end" members of fdt.

For the command line "initrd=start,size" method:
We need to move the reserve_initrd_mem call after parse_early_param to
make sure we can get the correct start and size.

Youling.

>  - Removed handling of "linux,elfcorehdr" and "linux, usable-memory-range".
>  - Add handling of "elfcorehdr=".
>  - Modify the handling of "mem=".
>  - Add implementation of reserve_oldmem_region.
>  - Reimplemented kexec-tools (note that kexec-tools needs to be updated).
>
>    Link [1]: https://lore.kernel.org/loongarch/20220920183554.3870247-1-ardb@kernel.org/T/#md02ad4a1510586b2df177cbce4422434eff2d457
>    [PATCH v2 0/8] efi: disentangle the generic EFI stub from FDT
>
> Changes in v3:
>  - Adjust the PE header (note that kexec-tools needs to be updated).
>  - Add ibar in kexec_reboot().
>  - boot_flag is replaced by efi_boot.
>  - Adjust do_kexec parameter passing order.
>  - Adjust the order of static variables to be consistent with do_kexec.
>  - Remove a-series register save.
>  - Some comments and register usage modification.
>  - Add the opening and closing of the cpu core state.
>  - Add a call to cpu_device_up to turn it on when the cpu core state is offline.
>
> Changes in v2:
>  - Add ibar.
>  - Access via IOCSR.
>  - Remove the settings of the tp, sp registers.
>  - Remove the crash.c file and merge the relevant code into machine_kexec.c.
>  - Adjust the use of CONFIG_SMP macro to avoid build errors under !SMP
>    configuration.
>  - Change the default value of PHYSICAL_START of the capture kernel to
>    0x90000000a0000000.
>
> Youling Tang (3):
>   LoongArch: Add kexec support
>   LoongArch: Add kdump support
>   LoongArch: Enable CONFIG_KEXEC
>
>  arch/loongarch/Kconfig                     |  33 +++
>  arch/loongarch/Makefile                    |   4 +
>  arch/loongarch/configs/loongson3_defconfig |   1 +
>  arch/loongarch/include/asm/kexec.h         |  60 ++++
>  arch/loongarch/kernel/Makefile             |   3 +
>  arch/loongarch/kernel/crash_dump.c         |  19 ++
>  arch/loongarch/kernel/head.S               |   6 +-
>  arch/loongarch/kernel/machine_kexec.c      | 309 +++++++++++++++++++++
>  arch/loongarch/kernel/mem.c                |   1 +
>  arch/loongarch/kernel/relocate_kernel.S    | 112 ++++++++
>  arch/loongarch/kernel/setup.c              | 123 +++++++-
>  arch/loongarch/kernel/traps.c              |   4 +
>  12 files changed, 664 insertions(+), 11 deletions(-)
>  create mode 100644 arch/loongarch/include/asm/kexec.h
>  create mode 100644 arch/loongarch/kernel/crash_dump.c
>  create mode 100644 arch/loongarch/kernel/machine_kexec.c
>  create mode 100644 arch/loongarch/kernel/relocate_kernel.S
>




More information about the kexec mailing list