* [PATCH v5 01/13] kexec: consolidate kexec and crash options into kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec Eric DeVolder
` (11 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
The config options for kexec and crash features are consolidated
into new file kernel/Kconfig.kexec. Under the "General Setup" submenu
is a new submenu "Kexec and crash handling". All the kexec and
crash options that were once in the arch-dependent submenu "Processor
type and features" are now consolidated in the new submenu.
The following options are impacted:
- KEXEC
- KEXEC_FILE
- KEXEC_SIG
- KEXEC_SIG_FORCE
- KEXEC_BZIMAGE_VERIFY_SIG
- KEXEC_JUMP
- CRASH_DUMP
The three main options are KEXEC, KEXEC_FILE and CRASH_DUMP.
Architectures specify support of certain KEXEC and CRASH features with
similarly named new ARCH_SUPPORTS_<option> config options.
Architectures can utilize the new ARCH_SELECTS_<option> config
options to specify additional components when <option> is enabled.
To summarize, the ARCH_SUPPORTS_<option> permits the <option> to be
enabled, and the ARCH_SELECTS_<option> handles side effects (ie.
select statements).
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
---
arch/Kconfig | 13 -----
init/Kconfig | 2 +
kernel/Kconfig.kexec | 116 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 118 insertions(+), 13 deletions(-)
create mode 100644 kernel/Kconfig.kexec
diff --git a/arch/Kconfig b/arch/Kconfig
index aff2746c8af2..b2872e9d3760 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -11,19 +11,6 @@ source "arch/$(SRCARCH)/Kconfig"
menu "General architecture-dependent options"
-config CRASH_CORE
- bool
-
-config KEXEC_CORE
- select CRASH_CORE
- bool
-
-config KEXEC_ELF
- bool
-
-config HAVE_IMA_KEXEC
- bool
-
config ARCH_HAS_SUBPAGE_FAULTS
bool
help
diff --git a/init/Kconfig b/init/Kconfig
index f7f65af4ee12..639e8a3363c3 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1927,6 +1927,8 @@ config BINDGEN_VERSION_TEXT
config TRACEPOINTS
bool
+source "kernel/Kconfig.kexec"
+
endmenu # General setup
source "arch/Kconfig"
diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec
new file mode 100644
index 000000000000..ff72e45cfaef
--- /dev/null
+++ b/kernel/Kconfig.kexec
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+menu "Kexec and crash features"
+
+config CRASH_CORE
+ bool
+
+config KEXEC_CORE
+ select CRASH_CORE
+ bool
+
+config KEXEC_ELF
+ bool
+
+config HAVE_IMA_KEXEC
+ bool
+
+config KEXEC
+ bool "Enable kexec system call"
+ default ARCH_DEFAULT_KEXEC
+ depends on ARCH_SUPPORTS_KEXEC
+ select KEXEC_CORE
+ help
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
+ but it is independent of the system firmware. And like a reboot
+ you can start any kernel with it, not just Linux.
+
+ The name comes from the similarity to the exec system call.
+
+ It is an ongoing process to be certain the hardware in a machine
+ is properly shutdown, so do not be surprised if this code does not
+ initially work for you. As of this writing the exact hardware
+ interface is strongly in flux, so no good recommendation can be
+ made.
+
+config KEXEC_FILE
+ bool "Enable kexec file based system call"
+ depends on ARCH_SUPPORTS_KEXEC_FILE
+ select KEXEC_CORE
+ help
+ This is new version of kexec system call. This system call is
+ file based and takes file descriptors as system call argument
+ for kernel and initramfs as opposed to list of segments as
+ accepted by kexec system call.
+
+config KEXEC_SIG
+ bool "Verify kernel signature during kexec_file_load() syscall"
+ depends on ARCH_SUPPORTS_KEXEC_SIG
+ depends on KEXEC_FILE
+ help
+ This option makes the kexec_file_load() syscall check for a valid
+ signature of the kernel image. The image can still be loaded without
+ a valid signature unless you also enable KEXEC_SIG_FORCE, though if
+ there's a signature that we can check, then it must be valid.
+
+ In addition to this option, you need to enable signature
+ verification for the corresponding kernel image type being
+ loaded in order for this to work.
+
+config KEXEC_SIG_FORCE
+ bool "Require a valid signature in kexec_file_load() syscall"
+ depends on ARCH_SUPPORTS_KEXEC_SIG_FORCE
+ depends on KEXEC_SIG
+ help
+ This option makes kernel signature verification mandatory for
+ the kexec_file_load() syscall.
+
+config KEXEC_IMAGE_VERIFY_SIG
+ bool "Enable Image signature verification support (ARM)"
+ default ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG
+ depends on ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG
+ depends on KEXEC_SIG
+ depends on EFI && SIGNED_PE_FILE_VERIFICATION
+ help
+ Enable Image signature verification support.
+
+config KEXEC_BZIMAGE_VERIFY_SIG
+ bool "Enable bzImage signature verification support"
+ depends on ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG
+ depends on KEXEC_SIG
+ depends on SIGNED_PE_FILE_VERIFICATION
+ select SYSTEM_TRUSTED_KEYRING
+ help
+ Enable bzImage signature verification support.
+
+config KEXEC_JUMP
+ bool "kexec jump"
+ depends on ARCH_SUPPORTS_KEXEC_JUMP
+ depends on KEXEC && HIBERNATION
+ help
+ Jump between original kernel and kexeced kernel and invoke
+ code in physical address mode via KEXEC
+
+config CRASH_DUMP
+ bool "kernel crash dumps"
+ depends on ARCH_SUPPORTS_CRASH_DUMP
+ depends on ARCH_SUPPORTS_KEXEC
+ select CRASH_CORE
+ select KEXEC_CORE
+ select KEXEC
+ 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 or BIOS using
+ PHYSICAL_START, or it must be built as a relocatable image
+ (CONFIG_RELOCATABLE=y).
+ For more details see Documentation/admin-guide/kdump/kdump.rst
+
+ For s390, this option also enables zfcpdump.
+ See also <file:Documentation/s390/zfcpdump.rst>
+
+endmenu
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 01/13] kexec: consolidate kexec and crash options into kernel/Kconfig.kexec Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-07 5:58 ` Christophe Leroy
2023-07-06 22:20 ` [PATCH v5 03/13] arm/kexec: " Eric DeVolder
` (10 subsequent siblings)
12 siblings, 1 reply; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/x86/Kconfig | 92 ++++++++++--------------------------------------
1 file changed, 19 insertions(+), 73 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 7422db409770..9767a343f7c2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2040,88 +2040,34 @@ config EFI_RUNTIME_MAP
source "kernel/Kconfig.hz"
-config KEXEC
- bool "kexec system call"
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- The name comes from the similarity to the exec system call.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you. As of this writing the exact hardware
- interface is strongly in flux, so no good recommendation can be
- made.
-
-config KEXEC_FILE
- bool "kexec file based system call"
- select KEXEC_CORE
- select HAVE_IMA_KEXEC if IMA
- depends on X86_64
- depends on CRYPTO=y
- depends on CRYPTO_SHA256=y
- help
- This is new version of kexec system call. This system call is
- file based and takes file descriptors as system call argument
- for kernel and initramfs as opposed to list of segments as
- accepted by previous system call.
+config ARCH_SUPPORTS_KEXEC
+ def_bool y
-config ARCH_HAS_KEXEC_PURGATORY
- def_bool KEXEC_FILE
+config ARCH_SUPPORTS_KEXEC_FILE
+ def_bool X86_64 && CRYPTO && CRYPTO_SHA256
-config KEXEC_SIG
- bool "Verify kernel signature during kexec_file_load() syscall"
+config ARCH_SELECTS_KEXEC_FILE
+ def_bool y
depends on KEXEC_FILE
- help
+ select HAVE_IMA_KEXEC if IMA
- This option makes the kexec_file_load() syscall check for a valid
- signature of the kernel image. The image can still be loaded without
- a valid signature unless you also enable KEXEC_SIG_FORCE, though if
- there's a signature that we can check, then it must be valid.
+config ARCH_HAS_KEXEC_PURGATORY
+ def_bool KEXEC_FILE
- In addition to this option, you need to enable signature
- verification for the corresponding kernel image type being
- loaded in order for this to work.
+config ARCH_SUPPORTS_KEXEC_SIG
+ def_bool y
-config KEXEC_SIG_FORCE
- bool "Require a valid signature in kexec_file_load() syscall"
- depends on KEXEC_SIG
- help
- This option makes kernel signature verification mandatory for
- the kexec_file_load() syscall.
+config ARCH_SUPPORTS_KEXEC_SIG_FORCE
+ def_bool y
-config KEXEC_BZIMAGE_VERIFY_SIG
- bool "Enable bzImage signature verification support"
- depends on KEXEC_SIG
- depends on SIGNED_PE_FILE_VERIFICATION
- select SYSTEM_TRUSTED_KEYRING
- help
- Enable bzImage signature verification support.
+config ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG
+ def_bool y
-config CRASH_DUMP
- bool "kernel crash dumps"
- depends on X86_64 || (X86_32 && HIGHMEM)
- 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 or BIOS using
- PHYSICAL_START, or it must be built as a relocatable image
- (CONFIG_RELOCATABLE=y).
- For more details see Documentation/admin-guide/kdump/kdump.rst
+config ARCH_SUPPORTS_KEXEC_JUMP
+ def_bool y
-config KEXEC_JUMP
- bool "kexec jump"
- depends on KEXEC && HIBERNATION
- help
- Jump between original kernel and kexeced kernel and invoke
- code in physical address mode via KEXEC
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool X86_64 || (X86_32 && HIGHMEM)
config PHYSICAL_START
hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 ` [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec Eric DeVolder
@ 2023-07-07 5:58 ` Christophe Leroy
2023-07-07 12:16 ` Eric DeVolder
0 siblings, 1 reply; 18+ messages in thread
From: Christophe Leroy @ 2023-07-07 5:58 UTC (permalink / raw)
To: Eric DeVolder, linux@armlinux.org.uk, catalin.marinas@arm.com,
will@kernel.org, chenhuacai@kernel.org, geert@linux-m68k.org,
tsbogend@alpha.franken.de, James.Bottomley@HansenPartnership.com,
deller@gmx.de, ysato@users.sourceforge.jp, dalias@libc.org,
glaubitz@physik.fu-berlin.de, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,
linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org
Cc: peterz@infradead.org, linus.walleij@linaro.org,
thunder.leizhen@huawei.com, hpa@zytor.com, kernel@xen0n.name,
ardb@kernel.org, tsi@tuyoix.net, agordeev@linux.ibm.com,
paulmck@kernel.org, bhe@redhat.com, masahiroy@kernel.org,
konrad.wilk@oracle.com, sebastian.reichel@collabora.com,
samitolvanen@google.com, ojeda@kernel.org,
juerg.haefliger@canonical.com, borntraeger@linux.ibm.com,
frederic@kernel.org, arnd@arndb.de, mhiramat@kernel.org,
aou@eecs.berkeley.edu, kees cook@chromium.org, gor@linux.ibm.com,
anshuman.khandual@arm.com, hca@linux.ibm.com, xin3.li@intel.com,
npiggin@gmail.com, rmk+kernel@armlinux.org.uk,
paul.walmsley@sifive.com, boris.ostrovsky@oracle.com,
ziy@nvidia.com, hbathini@linux.ibm.com,
gregkh@linuxfoundation.org, kirill.shutemov@linux.intel.com,
ndesaulniers@google.com, sourabhjain@linux.ibm.com,
palmer@dabbelt.com, svens@linux.ibm.com, tj@kernel.org,
akpm@linux-foundation.org, rppt@kernel.org
Le 07/07/2023 à 00:20, Eric DeVolder a écrit :
> 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.
Why do you need to duplicate the ARCH_SELECTS_ entries in each
architecture ?
Why not define them in arch/Kconfig then select if from each architecture ?
For instance here for x86 for ARCH_SELECTS_KEXEC_FILE all you'll have to
do is:
select ARCH_SELECTS_KEXEC_FILE if KEXEC_FILE
select HAVE_IMA_KEXEC if IMA && KEXEC_FILE
Christophe
>
> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
> ---
> arch/x86/Kconfig | 92 ++++++++++--------------------------------------
> 1 file changed, 19 insertions(+), 73 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 7422db409770..9767a343f7c2 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2040,88 +2040,34 @@ config EFI_RUNTIME_MAP
>
> source "kernel/Kconfig.hz"
>
> -config KEXEC
> - bool "kexec system call"
> - select KEXEC_CORE
> - help
> - kexec is a system call that implements the ability to shutdown your
> - current kernel, and to start another kernel. It is like a reboot
> - but it is independent of the system firmware. And like a reboot
> - you can start any kernel with it, not just Linux.
> -
> - The name comes from the similarity to the exec system call.
> -
> - It is an ongoing process to be certain the hardware in a machine
> - is properly shutdown, so do not be surprised if this code does not
> - initially work for you. As of this writing the exact hardware
> - interface is strongly in flux, so no good recommendation can be
> - made.
> -
> -config KEXEC_FILE
> - bool "kexec file based system call"
> - select KEXEC_CORE
> - select HAVE_IMA_KEXEC if IMA
> - depends on X86_64
> - depends on CRYPTO=y
> - depends on CRYPTO_SHA256=y
> - help
> - This is new version of kexec system call. This system call is
> - file based and takes file descriptors as system call argument
> - for kernel and initramfs as opposed to list of segments as
> - accepted by previous system call.
> +config ARCH_SUPPORTS_KEXEC
> + def_bool y
>
> -config ARCH_HAS_KEXEC_PURGATORY
> - def_bool KEXEC_FILE
> +config ARCH_SUPPORTS_KEXEC_FILE
> + def_bool X86_64 && CRYPTO && CRYPTO_SHA256
>
> -config KEXEC_SIG
> - bool "Verify kernel signature during kexec_file_load() syscall"
> +config ARCH_SELECTS_KEXEC_FILE
> + def_bool y
> depends on KEXEC_FILE
> - help
> + select HAVE_IMA_KEXEC if IMA
>
> - This option makes the kexec_file_load() syscall check for a valid
> - signature of the kernel image. The image can still be loaded without
> - a valid signature unless you also enable KEXEC_SIG_FORCE, though if
> - there's a signature that we can check, then it must be valid.
> +config ARCH_HAS_KEXEC_PURGATORY
> + def_bool KEXEC_FILE
>
> - In addition to this option, you need to enable signature
> - verification for the corresponding kernel image type being
> - loaded in order for this to work.
> +config ARCH_SUPPORTS_KEXEC_SIG
> + def_bool y
>
> -config KEXEC_SIG_FORCE
> - bool "Require a valid signature in kexec_file_load() syscall"
> - depends on KEXEC_SIG
> - help
> - This option makes kernel signature verification mandatory for
> - the kexec_file_load() syscall.
> +config ARCH_SUPPORTS_KEXEC_SIG_FORCE
> + def_bool y
>
> -config KEXEC_BZIMAGE_VERIFY_SIG
> - bool "Enable bzImage signature verification support"
> - depends on KEXEC_SIG
> - depends on SIGNED_PE_FILE_VERIFICATION
> - select SYSTEM_TRUSTED_KEYRING
> - help
> - Enable bzImage signature verification support.
> +config ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG
> + def_bool y
>
> -config CRASH_DUMP
> - bool "kernel crash dumps"
> - depends on X86_64 || (X86_32 && HIGHMEM)
> - 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 or BIOS using
> - PHYSICAL_START, or it must be built as a relocatable image
> - (CONFIG_RELOCATABLE=y).
> - For more details see Documentation/admin-guide/kdump/kdump.rst
> +config ARCH_SUPPORTS_KEXEC_JUMP
> + def_bool y
>
> -config KEXEC_JUMP
> - bool "kexec jump"
> - depends on KEXEC && HIBERNATION
> - help
> - Jump between original kernel and kexeced kernel and invoke
> - code in physical address mode via KEXEC
> +config ARCH_SUPPORTS_CRASH_DUMP
> + def_bool X86_64 || (X86_32 && HIGHMEM)
>
> config PHYSICAL_START
> hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec
2023-07-07 5:58 ` Christophe Leroy
@ 2023-07-07 12:16 ` Eric DeVolder
0 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-07 12:16 UTC (permalink / raw)
To: Christophe Leroy, linux@armlinux.org.uk, catalin.marinas@arm.com,
will@kernel.org, chenhuacai@kernel.org, geert@linux-m68k.org,
tsbogend@alpha.franken.de, James.Bottomley@HansenPartnership.com,
deller@gmx.de, ysato@users.sourceforge.jp, dalias@libc.org,
glaubitz@physik.fu-berlin.de, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,
linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org
Cc: peterz@infradead.org, linus.walleij@linaro.org,
thunder.leizhen@huawei.com, hpa@zytor.com, kernel@xen0n.name,
ardb@kernel.org, tsi@tuyoix.net, agordeev@linux.ibm.com,
paulmck@kernel.org, bhe@redhat.com, masahiroy@kernel.org,
konrad.wilk@oracle.com, sebastian.reichel@collabora.com,
samitolvanen@google.com, ojeda@kernel.org,
juerg.haefliger@canonical.com, borntraeger@linux.ibm.com,
frederic@kernel.org, arnd@arndb.de, mhiramat@kernel.org,
aou@eecs.berkeley.edu, kees cook@chromium.org, gor@linux.ibm.com,
anshuman.khandual@arm.com, hca@linux.ibm.com, xin3.li@intel.com,
npiggin@gmail.com, rmk+kernel@armlinux.org.uk,
paul.walmsley@sifive.com, boris.ostrovsky@oracle.com,
ziy@nvidia.com, hbathini@linux.ibm.com,
gregkh@linuxfoundation.org, kirill.shutemov@linux.intel.com,
ndesaulniers@google.com, sourabhjain@linux.ibm.com,
palmer@dabbelt.com, svens@linux.ibm.com, tj@kernel.org,
akpm@linux-foundation.org, rppt@kernel.org
On 7/7/23 00:58, Christophe Leroy wrote:
>
>
> Le 07/07/2023 à 00:20, Eric DeVolder a écrit :
>> 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.
>
>
> Why do you need to duplicate the ARCH_SELECTS_ entries in each
> architecture ?
>
> Why not define them in arch/Kconfig then select if from each architecture ?
>
> For instance here for x86 for ARCH_SELECTS_KEXEC_FILE all you'll have to
> do is:
> select ARCH_SELECTS_KEXEC_FILE if KEXEC_FILE
> select HAVE_IMA_KEXEC if IMA && KEXEC_FILE
>
>
> Christophe
Hi Christophe, thanks for looking at this!
The ARCH_SELECTS_ is where the "customization" is performed for that option. The customization is
putting in place the differences that the arch had from the common option.
For example, with ARCH_SELECTS_KEXEC_FILE, here are all the uses:
x86:
select HAVE_IMA_KEXEC if IMA
arm64:
select HAVE_IMA_KEXEC if IMA
powerpc:
select KEXEC_ELF
select HAVE_IMA_KEXEC if IMA
riscv:
select HAVE_IMA_KEXEC if IMA
select KEXEC_ELF
And there are archs (parisc, riscv, s390) that support KEXEC_FILE that do not need
ARCH_SELECTS_KEXEC_FILE.
So there isn't a clear path for optimizing the IMA statement, in this example, that I'm aware of.
But perhaps I don't quite understand the technique you are suggesting, either...
eric
>
>>
>> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
>> ---
>> arch/x86/Kconfig | 92 ++++++++++--------------------------------------
>> 1 file changed, 19 insertions(+), 73 deletions(-)
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 7422db409770..9767a343f7c2 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -2040,88 +2040,34 @@ config EFI_RUNTIME_MAP
>>
>> source "kernel/Kconfig.hz"
>>
>> -config KEXEC
>> - bool "kexec system call"
>> - select KEXEC_CORE
>> - help
>> - kexec is a system call that implements the ability to shutdown your
>> - current kernel, and to start another kernel. It is like a reboot
>> - but it is independent of the system firmware. And like a reboot
>> - you can start any kernel with it, not just Linux.
>> -
>> - The name comes from the similarity to the exec system call.
>> -
>> - It is an ongoing process to be certain the hardware in a machine
>> - is properly shutdown, so do not be surprised if this code does not
>> - initially work for you. As of this writing the exact hardware
>> - interface is strongly in flux, so no good recommendation can be
>> - made.
>> -
>> -config KEXEC_FILE
>> - bool "kexec file based system call"
>> - select KEXEC_CORE
>> - select HAVE_IMA_KEXEC if IMA
>> - depends on X86_64
>> - depends on CRYPTO=y
>> - depends on CRYPTO_SHA256=y
>> - help
>> - This is new version of kexec system call. This system call is
>> - file based and takes file descriptors as system call argument
>> - for kernel and initramfs as opposed to list of segments as
>> - accepted by previous system call.
>> +config ARCH_SUPPORTS_KEXEC
>> + def_bool y
>>
>> -config ARCH_HAS_KEXEC_PURGATORY
>> - def_bool KEXEC_FILE
>> +config ARCH_SUPPORTS_KEXEC_FILE
>> + def_bool X86_64 && CRYPTO && CRYPTO_SHA256
>>
>> -config KEXEC_SIG
>> - bool "Verify kernel signature during kexec_file_load() syscall"
>> +config ARCH_SELECTS_KEXEC_FILE
>> + def_bool y
>> depends on KEXEC_FILE
>> - help
>> + select HAVE_IMA_KEXEC if IMA
>>
>> - This option makes the kexec_file_load() syscall check for a valid
>> - signature of the kernel image. The image can still be loaded without
>> - a valid signature unless you also enable KEXEC_SIG_FORCE, though if
>> - there's a signature that we can check, then it must be valid.
>> +config ARCH_HAS_KEXEC_PURGATORY
>> + def_bool KEXEC_FILE
>>
>> - In addition to this option, you need to enable signature
>> - verification for the corresponding kernel image type being
>> - loaded in order for this to work.
>> +config ARCH_SUPPORTS_KEXEC_SIG
>> + def_bool y
>>
>> -config KEXEC_SIG_FORCE
>> - bool "Require a valid signature in kexec_file_load() syscall"
>> - depends on KEXEC_SIG
>> - help
>> - This option makes kernel signature verification mandatory for
>> - the kexec_file_load() syscall.
>> +config ARCH_SUPPORTS_KEXEC_SIG_FORCE
>> + def_bool y
>>
>> -config KEXEC_BZIMAGE_VERIFY_SIG
>> - bool "Enable bzImage signature verification support"
>> - depends on KEXEC_SIG
>> - depends on SIGNED_PE_FILE_VERIFICATION
>> - select SYSTEM_TRUSTED_KEYRING
>> - help
>> - Enable bzImage signature verification support.
>> +config ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG
>> + def_bool y
>>
>> -config CRASH_DUMP
>> - bool "kernel crash dumps"
>> - depends on X86_64 || (X86_32 && HIGHMEM)
>> - 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 or BIOS using
>> - PHYSICAL_START, or it must be built as a relocatable image
>> - (CONFIG_RELOCATABLE=y).
>> - For more details see Documentation/admin-guide/kdump/kdump.rst
>> +config ARCH_SUPPORTS_KEXEC_JUMP
>> + def_bool y
>>
>> -config KEXEC_JUMP
>> - bool "kexec jump"
>> - depends on KEXEC && HIBERNATION
>> - help
>> - Jump between original kernel and kexeced kernel and invoke
>> - code in physical address mode via KEXEC
>> +config ARCH_SUPPORTS_CRASH_DUMP
>> + def_bool X86_64 || (X86_32 && HIGHMEM)
>>
>> config PHYSICAL_START
>> hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v5 03/13] arm/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 01/13] kexec: consolidate kexec and crash options into kernel/Kconfig.kexec Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 04/13] ia64/kexec: " Eric DeVolder
` (9 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/arm/Kconfig | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7a27550ff3c1..1a6a6eb48a15 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1645,20 +1645,8 @@ config XIP_DEFLATED_DATA
copied, saving some precious ROM space. A possible drawback is a
slightly longer boot delay.
-config KEXEC
- bool "Kexec system call (EXPERIMENTAL)"
- depends on (!SMP || PM_SLEEP_SMP)
- depends on MMU
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you.
+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
config AUTO_ZRELADDR
bool "Auto calculation of the decompressed kernel image address" if !ARCH_MULTIPLATFORM
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 04/13] ia64/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (2 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 03/13] arm/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 05/13] arm64/kexec: " Eric DeVolder
` (8 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/ia64/Kconfig | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 2cd93e6bf0fe..88382f105301 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -361,31 +361,13 @@ config IA64_HP_AML_NFW
the "force" module parameter, e.g., with the "aml_nfw.force"
kernel command line option.
-config KEXEC
- bool "kexec system call"
- depends on !SMP || HOTPLUG_CPU
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- The name comes from the similarity to the exec system call.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you. As of this writing the exact hardware
- interface is strongly in flux, so no good recommendation can be
- made.
+endmenu
-config CRASH_DUMP
- bool "kernel crash dumps"
- depends on IA64_MCA_RECOVERY && (!SMP || HOTPLUG_CPU)
- help
- Generate crash dump after being started by kexec.
+config ARCH_SUPPORTS_KEXEC
+ def_bool !SMP || HOTPLUG_CPU
-endmenu
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool IA64_MCA_RECOVERY && (!SMP || HOTPLUG_CPU)
menu "Power management and ACPI options"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 05/13] arm64/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (3 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 04/13] ia64/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 06/13] loongarch/kexec: " Eric DeVolder
` (7 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/arm64/Kconfig | 64 ++++++++++++----------------------------------
1 file changed, 16 insertions(+), 48 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7856c3a3e35a..3a9b06a693a9 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1459,60 +1459,28 @@ config PARAVIRT_TIME_ACCOUNTING
If in doubt, say N here.
-config KEXEC
- depends on PM_SLEEP_SMP
- select KEXEC_CORE
- bool "kexec system call"
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
-config KEXEC_FILE
- bool "kexec file based system call"
- select KEXEC_CORE
- select HAVE_IMA_KEXEC if IMA
- help
- This is new version of kexec system call. This system call is
- file based and takes file descriptors as system call argument
- for kernel and initramfs as opposed to list of segments as
- accepted by previous system call.
+config ARCH_SUPPORTS_KEXEC
+ def_bool PM_SLEEP_SMP
-config KEXEC_SIG
- bool "Verify kernel signature during kexec_file_load() syscall"
- depends on KEXEC_FILE
- help
- Select this option to verify a signature with loaded kernel
- image. If configured, any attempt of loading a image without
- valid signature will fail.
+config ARCH_SUPPORTS_KEXEC_FILE
+ def_bool y
- In addition to that option, you need to enable signature
- verification for the corresponding kernel image type being
- loaded in order for this to work.
+config ARCH_SELECTS_KEXEC_FILE
+ def_bool y
+ depends on KEXEC_FILE
+ select HAVE_IMA_KEXEC if IMA
-config KEXEC_IMAGE_VERIFY_SIG
- bool "Enable Image signature verification support"
- default y
- depends on KEXEC_SIG
- depends on EFI && SIGNED_PE_FILE_VERIFICATION
- help
- Enable Image signature verification support.
+config ARCH_SUPPORTS_KEXEC_SIG
+ def_bool y
-comment "Support for PE file signature verification disabled"
- depends on KEXEC_SIG
- depends on !EFI || !SIGNED_PE_FILE_VERIFICATION
+config ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG
+ def_bool y
-config CRASH_DUMP
- bool "Build kdump crash kernel"
- 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.
+config ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG
+ def_bool y
- For more details see Documentation/admin-guide/kdump/kdump.rst
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool y
config TRANS_TABLE
def_bool y
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 06/13] loongarch/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (4 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 05/13] arm64/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 07/13] m68k/kexec: " Eric DeVolder
` (6 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/loongarch/Kconfig | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index e55511af4c77..397203e18800 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -537,28 +537,16 @@ config CPU_HAS_PREFETCH
bool
default y
-config KEXEC
- bool "Kexec system call"
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
+config ARCH_SUPPORTS_KEXEC
+ def_bool y
- The name comes from the similarity to the exec system call.
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool y
-config CRASH_DUMP
- bool "Build kdump crash kernel"
+config ARCH_SELECTS_CRASH_DUMP
+ def_bool y
+ depends on CRASH_DUMP
select RELOCATABLE
- 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.
-
- For more details see Documentation/admin-guide/kdump/kdump.rst
config RELOCATABLE
bool "Relocatable kernel"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 07/13] m68k/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (5 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 06/13] loongarch/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 08/13] mips/kexec: " Eric DeVolder
` (5 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
arch/m68k/Kconfig | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index dc792b321f1e..3e318bf9504c 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -89,23 +89,8 @@ config MMU_SUN3
bool
depends on MMU && !MMU_MOTOROLA && !MMU_COLDFIRE
-config KEXEC
- bool "kexec system call"
- depends on M68KCLASSIC && MMU
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- The name comes from the similarity to the exec system call.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you. As of this writing the exact hardware
- interface is strongly in flux, so no good recommendation can be
- made.
+config ARCH_SUPPORTS_KEXEC
+ def_bool M68KCLASSIC && MMU
config BOOTINFO_PROC
bool "Export bootinfo in procfs"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 08/13] mips/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (6 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 07/13] m68k/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 09/13] parisc/kexec: " Eric DeVolder
` (4 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/Kconfig | 32 +++++---------------------------
1 file changed, 5 insertions(+), 27 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fc6fba925aea..bc8421859006 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2878,33 +2878,11 @@ config HZ
config SCHED_HRTICK
def_bool HIGH_RES_TIMERS
-config KEXEC
- bool "Kexec system call"
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- The name comes from the similarity to the exec system call.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you. As of this writing the exact hardware
- interface is strongly in flux, so no good recommendation can be
- made.
-
-config CRASH_DUMP
- bool "Kernel crash dumps"
- 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 or firmware using
- PHYSICAL_START.
+config ARCH_SUPPORTS_KEXEC
+ def_bool y
+
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool y
config PHYSICAL_START
hex "Physical address where the kernel is loaded"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 09/13] parisc/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (7 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 08/13] mips/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 10/13] powerpc/kexec: " Eric DeVolder
` (3 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/parisc/Kconfig | 34 +++++++++++-----------------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4cb46d5c64a2..2ef6843aae60 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -339,29 +339,17 @@ config NR_CPUS
default "8" if 64BIT
default "16"
-config KEXEC
- bool "Kexec system call"
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- It is an ongoing process to be certain the hardware in a machine
- shutdown, so do not be surprised if this code does not
- initially work for you.
-
-config KEXEC_FILE
- bool "kexec file based system call"
- select KEXEC_CORE
- select KEXEC_ELF
- help
- This enables the kexec_file_load() System call. This is
- file based and takes file descriptors as system call argument
- for kernel and initramfs as opposed to list of segments as
- accepted by previous system call.
-
endmenu
+config ARCH_SUPPORTS_KEXEC
+ def_bool y
+
+config ARCH_SUPPORTS_KEXEC_FILE
+ def_bool y
+
+config ARCH_SELECTS_KEXEC_FILE
+ def_bool y
+ depends on KEXEC_FILE
+ select KEXEC_ELF
+
source "drivers/parisc/Kconfig"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 10/13] powerpc/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (8 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 09/13] parisc/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 11/13] riscv/kexec: " Eric DeVolder
` (2 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
arch/powerpc/Kconfig | 55 ++++++++++++++------------------------------
1 file changed, 17 insertions(+), 38 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 0b1172cbeccb..1695a71777f0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -589,41 +589,21 @@ config PPC64_SUPPORTS_MEMORY_FAILURE
default "y" if PPC_POWERNV
select ARCH_SUPPORTS_MEMORY_FAILURE
-config KEXEC
- bool "kexec system call"
- depends on PPC_BOOK3S || PPC_E500 || (44x && !SMP)
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- The name comes from the similarity to the exec system call.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you. As of this writing the exact hardware
- interface is strongly in flux, so no good recommendation can be
- made.
-
-config KEXEC_FILE
- bool "kexec file based system call"
- select KEXEC_CORE
- select HAVE_IMA_KEXEC if IMA
- select KEXEC_ELF
- depends on PPC64
- depends on CRYPTO=y
- depends on CRYPTO_SHA256=y
- help
- This is a new version of the kexec system call. This call is
- file based and takes in file descriptors as system call arguments
- for kernel and initramfs as opposed to a list of segments as is the
- case for the older kexec call.
+config ARCH_SUPPORTS_KEXEC
+ def_bool PPC_BOOK3S || PPC_E500 || (44x && !SMP)
+
+config ARCH_SUPPORTS_KEXEC_FILE
+ def_bool PPC64 && CRYPTO=y && CRYPTO_SHA256=y
config ARCH_HAS_KEXEC_PURGATORY
def_bool KEXEC_FILE
+config ARCH_SELECTS_KEXEC_FILE
+ def_bool y
+ depends on KEXEC_FILE
+ select KEXEC_ELF
+ select HAVE_IMA_KEXEC if IMA
+
config PPC64_BIG_ENDIAN_ELF_ABI_V2
# Option is available to BFD, but LLD does not support ELFv1 so this is
# always true there.
@@ -683,14 +663,13 @@ config RELOCATABLE_TEST
loaded at, which tends to be non-zero and therefore test the
relocation code.
-config CRASH_DUMP
- bool "Build a dump capture kernel"
- depends on PPC64 || PPC_BOOK3S_32 || PPC_85xx || (44x && !SMP)
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool PPC64 || PPC_BOOK3S_32 || PPC_85xx || (44x && !SMP)
+
+config ARCH_SELECTS_CRASH_DUMP
+ def_bool y
+ depends on CRASH_DUMP
select RELOCATABLE if PPC64 || 44x || PPC_85xx
- help
- Build a kernel suitable for use as a dump capture kernel.
- The same kernel binary can be used as production kernel and dump
- capture kernel.
config FA_DUMP
bool "Firmware-assisted dump"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 11/13] riscv/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (9 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 10/13] powerpc/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:32 ` Palmer Dabbelt
2023-07-06 22:20 ` [PATCH v5 12/13] s390/kexec: " Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 13/13] sh/kexec: " Eric DeVolder
12 siblings, 1 reply; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
---
arch/riscv/Kconfig | 44 +++++++++++++-------------------------------
1 file changed, 13 insertions(+), 31 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index b49793cf34eb..8a3af850597a 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -647,48 +647,30 @@ config RISCV_BOOT_SPINWAIT
If unsure what to do here, say N.
-config KEXEC
- bool "Kexec system call"
- depends on MMU
+config ARCH_SUPPORTS_KEXEC
+ def_bool MMU
+
+config ARCH_SELECTS_KEXEC
+ def_bool y
+ depends on KEXEC
select HOTPLUG_CPU if SMP
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
- The name comes from the similarity to the exec system call.
+config ARCH_SUPPORTS_KEXEC_FILE
+ def_bool 64BIT && MMU
-config KEXEC_FILE
- bool "kexec file based systmem call"
- depends on 64BIT && MMU
+config ARCH_SELECTS_KEXEC_FILE
+ def_bool y
+ depends on KEXEC_FILE
select HAVE_IMA_KEXEC if IMA
- select KEXEC_CORE
select KEXEC_ELF
- help
- This is new version of kexec system call. This system call is
- file based and takes file descriptors as system call argument
- for kernel and initramfs as opposed to list of segments as
- accepted by previous system call.
-
- If you don't know what to do here, say Y.
config ARCH_HAS_KEXEC_PURGATORY
def_bool KEXEC_FILE
depends on CRYPTO=y
depends on CRYPTO_SHA256=y
-config CRASH_DUMP
- bool "Build kdump crash kernel"
- 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.
-
- For more details see Documentation/admin-guide/kdump/kdump.rst
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool y
config COMPAT
bool "Kernel support for 32-bit U-mode"
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v5 11/13] riscv/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 ` [PATCH v5 11/13] riscv/kexec: " Eric DeVolder
@ 2023-07-06 22:32 ` Palmer Dabbelt
2023-07-07 13:03 ` Eric DeVolder
0 siblings, 1 reply; 18+ messages in thread
From: Palmer Dabbelt @ 2023-07-06 22:32 UTC (permalink / raw)
To: eric.devolder
Cc: chenhuacai, linux-ia64, linux-sh, peterz, Catalin Marinas,
linus.walleij, dave.hansen, linux-mips, James.Bottomley, dalias,
hpa, linux-riscv, eric.devolder, Will Deacon, kernel, tsi,
linux-s390, agordeev, rmk+kernel, paulmck, ysato, deller, x86,
linux, Paul Walmsley, mingo, geert, hbathini, samitolvanen, ojeda,
borntraeger, frederic, Arnd Bergmann, mhiramat, Ard Biesheuvel,
thunder.leizhen, aou, keescook, gor, anshuman.khandu
On Thu, 06 Jul 2023 15:20:25 PDT (-0700), eric.devolder@oracle.com 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>
> ---
> arch/riscv/Kconfig | 44 +++++++++++++-------------------------------
> 1 file changed, 13 insertions(+), 31 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index b49793cf34eb..8a3af850597a 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -647,48 +647,30 @@ config RISCV_BOOT_SPINWAIT
>
> If unsure what to do here, say N.
>
> -config KEXEC
> - bool "Kexec system call"
> - depends on MMU
> +config ARCH_SUPPORTS_KEXEC
> + def_bool MMU
> +
> +config ARCH_SELECTS_KEXEC
> + def_bool y
> + depends on KEXEC
> select HOTPLUG_CPU if SMP
> - select KEXEC_CORE
> - help
> - kexec is a system call that implements the ability to shutdown your
> - current kernel, and to start another kernel. It is like a reboot
> - but it is independent of the system firmware. And like a reboot
> - you can start any kernel with it, not just Linux.
>
> - The name comes from the similarity to the exec system call.
> +config ARCH_SUPPORTS_KEXEC_FILE
> + def_bool 64BIT && MMU
>
> -config KEXEC_FILE
> - bool "kexec file based systmem call"
> - depends on 64BIT && MMU
> +config ARCH_SELECTS_KEXEC_FILE
> + def_bool y
> + depends on KEXEC_FILE
> select HAVE_IMA_KEXEC if IMA
> - select KEXEC_CORE
> select KEXEC_ELF
> - help
> - This is new version of kexec system call. This system call is
> - file based and takes file descriptors as system call argument
> - for kernel and initramfs as opposed to list of segments as
> - accepted by previous system call.
> -
> - If you don't know what to do here, say Y.
>
> config ARCH_HAS_KEXEC_PURGATORY
> def_bool KEXEC_FILE
> depends on CRYPTO=y
> depends on CRYPTO_SHA256=y
>
> -config CRASH_DUMP
> - bool "Build kdump crash kernel"
> - 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.
> -
> - For more details see Documentation/admin-guide/kdump/kdump.rst
> +config ARCH_SUPPORTS_CRASH_DUMP
> + def_bool y
>
> config COMPAT
> bool "Kernel support for 32-bit U-mode"
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v5 11/13] riscv/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:32 ` Palmer Dabbelt
@ 2023-07-07 13:03 ` Eric DeVolder
0 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-07 13:03 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: chenhuacai, linux-ia64, linux-sh, peterz, Catalin Marinas,
linus.walleij, dave.hansen, linux-mips, James.Bottomley, dalias,
hpa, linux-riscv, Will Deacon, kernel, tsi, linux-s390, agordeev,
rmk+kernel, paulmck, ysato, deller, x86, linux, Paul Walmsley,
mingo, geert, hbathini, samitolvanen, ojeda, borntraeger,
frederic, Arnd Bergmann, mhiramat, Ard Biesheuvel,
thunder.leizhen, aou, keescook, gor, anshuman.khandual, hca,
xin3.li, npiggin, konrad.wilk, linux-m68k, bp, loongarch,
glaubitz, tglx, ziy, linux-arm-kernel, boris.ostrovsky, tsbogend,
sebastian.reichel, bhe, linux-parisc, Greg KH, kirill.shutemov,
ndesaulniers, linux-kernel, sourabhjain, juerg.haefliger, svens,
tj, akpm, linuxppc-dev, masahiroy, rppt
On 7/6/23 17:32, Palmer Dabbelt wrote:
> On Thu, 06 Jul 2023 15:20:25 PDT (-0700), eric.devolder@oracle.com 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>
>> ---
>> arch/riscv/Kconfig | 44 +++++++++++++-------------------------------
>> 1 file changed, 13 insertions(+), 31 deletions(-)
>>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index b49793cf34eb..8a3af850597a 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -647,48 +647,30 @@ config RISCV_BOOT_SPINWAIT
>>
>> If unsure what to do here, say N.
>>
>> -config KEXEC
>> - bool "Kexec system call"
>> - depends on MMU
>> +config ARCH_SUPPORTS_KEXEC
>> + def_bool MMU
>> +
>> +config ARCH_SELECTS_KEXEC
>> + def_bool y
>> + depends on KEXEC
>> select HOTPLUG_CPU if SMP
>> - select KEXEC_CORE
>> - help
>> - kexec is a system call that implements the ability to shutdown your
>> - current kernel, and to start another kernel. It is like a reboot
>> - but it is independent of the system firmware. And like a reboot
>> - you can start any kernel with it, not just Linux.
>>
>> - The name comes from the similarity to the exec system call.
>> +config ARCH_SUPPORTS_KEXEC_FILE
>> + def_bool 64BIT && MMU
>>
>> -config KEXEC_FILE
>> - bool "kexec file based systmem call"
>> - depends on 64BIT && MMU
>> +config ARCH_SELECTS_KEXEC_FILE
>> + def_bool y
>> + depends on KEXEC_FILE
>> select HAVE_IMA_KEXEC if IMA
>> - select KEXEC_CORE
>> select KEXEC_ELF
>> - help
>> - This is new version of kexec system call. This system call is
>> - file based and takes file descriptors as system call argument
>> - for kernel and initramfs as opposed to list of segments as
>> - accepted by previous system call.
>> -
>> - If you don't know what to do here, say Y.
>>
>> config ARCH_HAS_KEXEC_PURGATORY
>> def_bool KEXEC_FILE
>> depends on CRYPTO=y
>> depends on CRYPTO_SHA256=y
>>
>> -config CRASH_DUMP
>> - bool "Build kdump crash kernel"
>> - 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.
>> -
>> - For more details see Documentation/admin-guide/kdump/kdump.rst
>> +config ARCH_SUPPORTS_CRASH_DUMP
>> + def_bool y
>>
>> config COMPAT
>> bool "Kernel support for 32-bit U-mode"
>
> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Thank you Palmer!
eric
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v5 12/13] s390/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (10 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 11/13] riscv/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
2023-07-06 22:20 ` [PATCH v5 13/13] sh/kexec: " Eric DeVolder
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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.
NOTE: The original Kconfig has a KEXEC_SIG which depends on
MODULE_SIG_FORMAT. However, attempts to keep the MODULE_SIG_FORMAT
dependency (using the strategy outlined in this series, and other
techniques) results in 'error: recursive dependency detected'
on CRYPTO.
Per Alexander Gordeev <agordeev@linux.ibm.com>: "the MODULE_SIG_FORMAT
dependency was introduced with [git commit below] and in fact was not
necessary, since s390 did/does not use mod_check_sig() anyway.
commit c8424e776b09 ("MODSIGN: Export module signature definitions")
MODULE_SIG_FORMAT is needed to select SYSTEM_DATA_VERIFICATION. But
SYSTEM_DATA_VERIFICATION is also selected by FS_VERITY*, so dropping
MODULE_SIG_FORMAT does not hurt."
Therefore, the solution is to drop the MODULE_SIG_FORMAT dependency
from KEXEC_SIG. Still results in equivalent .config files for s390.
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
arch/s390/Kconfig | 69 ++++++++++++++++-------------------------------
1 file changed, 23 insertions(+), 46 deletions(-)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 5b39918b7042..44154246e4b7 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -213,6 +213,7 @@ config S390
select HAVE_VIRT_CPU_ACCOUNTING_IDLE
select IOMMU_HELPER if PCI
select IOMMU_SUPPORT if PCI
+ select KEXEC
select MMU_GATHER_MERGE_VMAS
select MMU_GATHER_NO_GATHER
select MMU_GATHER_RCU_TABLE_FREE
@@ -244,6 +245,28 @@ config PGTABLE_LEVELS
source "kernel/livepatch/Kconfig"
+config ARCH_DEFAULT_KEXEC
+ def_bool y
+
+config ARCH_SUPPORTS_KEXEC
+ def_bool y
+
+config ARCH_SUPPORTS_KEXEC_FILE
+ def_bool CRYPTO && CRYPTO_SHA256 && CRYPTO_SHA256_S390
+
+config ARCH_SUPPORTS_KEXEC_SIG
+ def_bool y
+
+config ARCH_HAS_KEXEC_PURGATORY
+ def_bool KEXEC_FILE
+
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool y
+ help
+ Refer to <file:Documentation/s390/zfcpdump.rst> for more details on this.
+ This option also enables s390 zfcpdump.
+ See also <file:Documentation/s390/zfcpdump.rst>
+
menu "Processor type and features"
config HAVE_MARCH_Z10_FEATURES
@@ -482,36 +505,6 @@ config SCHED_TOPOLOGY
source "kernel/Kconfig.hz"
-config KEXEC
- def_bool y
- select KEXEC_CORE
-
-config KEXEC_FILE
- bool "kexec file based system call"
- select KEXEC_CORE
- depends on CRYPTO
- depends on CRYPTO_SHA256
- depends on CRYPTO_SHA256_S390
- help
- Enable the kexec file based system call. In contrast to the normal
- kexec system call this system call takes file descriptors for the
- kernel and initramfs as arguments.
-
-config ARCH_HAS_KEXEC_PURGATORY
- def_bool y
- depends on KEXEC_FILE
-
-config KEXEC_SIG
- bool "Verify kernel signature during kexec_file_load() syscall"
- depends on KEXEC_FILE && MODULE_SIG_FORMAT
- help
- This option makes kernel signature verification mandatory for
- the kexec_file_load() syscall.
-
- In addition to that option, you need to enable signature
- verification for the corresponding kernel image type being
- loaded in order for this to work.
-
config KERNEL_NOBP
def_bool n
prompt "Enable modified branch prediction for the kernel by default"
@@ -733,22 +726,6 @@ config VFIO_AP
endmenu
-menu "Dump support"
-
-config CRASH_DUMP
- bool "kernel crash dumps"
- select KEXEC
- help
- Generate crash dump after being started by kexec.
- Crash dump kernels are loaded in the main kernel with kexec-tools
- into a specially reserved region and then later executed after
- a crash by kdump/kexec.
- Refer to <file:Documentation/s390/zfcpdump.rst> for more details on this.
- This option also enables s390 zfcpdump.
- See also <file:Documentation/s390/zfcpdump.rst>
-
-endmenu
-
config CCW
def_bool y
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v5 13/13] sh/kexec: refactor for kernel/Kconfig.kexec
2023-07-06 22:20 [PATCH v5 00/13] refactor Kconfig to consolidate KEXEC and CRASH options Eric DeVolder
` (11 preceding siblings ...)
2023-07-06 22:20 ` [PATCH v5 12/13] s390/kexec: " Eric DeVolder
@ 2023-07-06 22:20 ` Eric DeVolder
12 siblings, 0 replies; 18+ messages in thread
From: Eric DeVolder @ 2023-07-06 22:20 UTC (permalink / raw)
To: linux, catalin.marinas, will, chenhuacai, geert, tsbogend,
James.Bottomley, deller, ysato, dalias, glaubitz, tglx, mingo, bp,
dave.hansen, x86, linux-kernel, linux-arm-kernel, linux-ia64,
loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
linux-riscv, linux-s390, linux-sh
Cc: peterz, linus.walleij, thunder.leizhen, hpa, kernel,
eric.devolder, ardb, tsi, agordeev, paulmck, bhe, masahiroy,
konrad.wilk, sebastian.reichel, samitolvanen, ojeda,
juerg.haefliger, borntraeger, frederic, arnd, mhiramat, aou,
keescook, gor, anshuman.khandual, hca, xin3.li, npiggin,
rmk+kernel, paul.walmsley, boris.ostrovsky, ziy, hbathini, gregkh,
kirill.shutemov, ndesaulniers, sourabhjain, palmer, svens, tj,
akpm, rppt
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>
Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
arch/sh/Kconfig | 46 ++++++++--------------------------------------
1 file changed, 8 insertions(+), 38 deletions(-)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 2b3ce4fd3956..1cf6603781c7 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -548,44 +548,14 @@ menu "Kernel features"
source "kernel/Kconfig.hz"
-config KEXEC
- bool "kexec system call (EXPERIMENTAL)"
- depends on MMU
- select KEXEC_CORE
- help
- kexec is a system call that implements the ability to shutdown your
- current kernel, and to start another kernel. It is like a reboot
- but it is independent of the system firmware. And like a reboot
- you can start any kernel with it, not just Linux.
-
- The name comes from the similarity to the exec system call.
-
- It is an ongoing process to be certain the hardware in a machine
- is properly shutdown, so do not be surprised if this code does not
- initially work for you. As of this writing the exact hardware
- interface is strongly in flux, so no good recommendation can be
- made.
-
-config CRASH_DUMP
- bool "kernel crash dumps (EXPERIMENTAL)"
- depends on BROKEN_ON_SMP
- 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 using
- PHYSICAL_START.
-
- For more details see Documentation/admin-guide/kdump/kdump.rst
-
-config KEXEC_JUMP
- bool "kexec jump (EXPERIMENTAL)"
- depends on KEXEC && HIBERNATION
- help
- Jump between original kernel and kexeced kernel and invoke
- code via KEXEC
+config ARCH_SUPPORTS_KEXEC
+ def_bool MMU
+
+config ARCH_SUPPORTS_CRASH_DUMP
+ def_bool BROKEN_ON_SMP
+
+config ARCH_SUPPORTS_KEXEC_JUMP
+ def_bool y
config PHYSICAL_START
hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
--
2.31.1
^ permalink raw reply related [flat|nested] 18+ messages in thread