Re: [PATCH v4 03/13] arm/kexec: refactor for kernel/Kconfig.kexec

Eric DeVolder
2023-07-05T15:23:44Z

On 7/5/23 10:05, Arnd Bergmann wrote:
> On Wed, Jul 5, 2023, at 16:19, Eric DeVolder wrote:
>> The kexec and crash kernel options are provided in the common
>> kernel/Kconfig.kexec. Utilize the common options and provide
>> the ARCH_SUPPORTS_ and ARCH_SELECTS_ entries to recreate the
>> equivalent set of KEXEC and CRASH options.
>>
>> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
>
>> +config ARCH_SUPPORTS_KEXEC
>> + def_bool (!SMP || PM_SLEEP_SMP) && MMU
>>
>> config ATAGS_PROC
>> bool "Export atags in procfs"
>> @@ -1668,17 +1656,8 @@ config ATAGS_PROC
>> Should the atags used to boot the kernel be exported in an "atags"
>> file in procfs. Useful with kexec.
>>
>> -config CRASH_DUMP
>> - bool "Build kdump crash kernel (EXPERIMENTAL)"
>> - help
>> - Generate crash dump after being started by kexec. This should
>> - be normally only set in special crash dump kernels which are
>> - loaded in the main kernel with kexec-tools into a specially
>> - reserved region and then later executed after a crash by
>> - kdump/kexec. The crash dump kernel must be compiled to a
>> - memory address not used by the main kernel
>> -
>> - For more details see Documentation/admin-guide/kdump/kdump.rst
>> +config ARCH_SUPPORTS_CRASH_DUMP
>> + def_bool y
>>
>
> I see this is now in linux-next, and it caused a few randconfig
> build issues, these never happened in the past:

Arnd,
Thanks for looking at this!

I received randconfig errors from Andrew Morton's machinery. When investigating I
found that randconfig was able to specify CRASH_DUMP without KEXEC, and that lead
to problems. I believe this situation existed prior to this series as well.
Specifically CRASH_DUMP does not have a dependency on KEXEC, or select (only s390
has this hole closed).

For CRASH_DUMP, this series now selects KEXEC to close this gap, which is what a
sane config would have (ie both CRASH_DUMP and KEXEC).

Do you think the changes outlined below are still needed?
eric

>
> * The #ifdef CONFIG_KEXEC check in arch/arm/include/asm/kexec.h
> needs to be changed to CONFIG_KEXEC_CORE:
>
> include/linux/kexec.h:41:2: error: #error KEXEC_SOURCE_MEMORY_LIMIT not defined
>
> same thing on m68k
>
> * ARCH_SUPPORTS_CRASH_DUMP needs the same dependency as ARCH_SUPPORTS_KEXEC,
> otherwise we seem to run into an obscure assembler error building the kdump
> core on architectures that do not support kdump:
>
> /tmp/ccpYl6w9.s:1546: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr'
>
> * Most architectures build machine_kexec.o only when KEXEC is enabled,
> this also needs to be changed to KEXEC_CORE:
>
> --- a/arch/arm/kernel/Makefile
> +++ b/arch/arm/kernel/Makefile
> @@ -59,7 +59,7 @@ obj-$(CONFIG_FUNCTION_TRACER) += entry-ftrace.o
> obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o patch.o
> obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o patch.o
> obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o
> -obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
> +obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o
> # Main staffs in KPROBES are in arch/arm/probes/ .
> obj-$(CONFIG_KPROBES) += patch.o insn.o
> obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
>
>
> Arnd