Skip to contentSkip to conversation

arch, kexec: declare kexec and crash capabilities in Kconfig.kexec

PATCH Applied Mike Rapoport (Microsoft) 10 participants 14 messages Nov 19 – Nov 26

Subsystems (13)
Arm (32-bit) x86 PowerPC MIPS +9 more subsystems
lore
Share & tools
lore

Mike Rapoport (Microsoft)

author maintainer
#0 lore raw

cover arch, kexec: declare kexec and crash capabilities in Kconfig.kexec

The intention is to take it via kexec tree.

---
Mike Rapoport (Microsoft) (2):
MAINTAINERS: add kernel/Kconfig.kexec to KEXEC
arch, kexec: declare kexec and crash capabilities in Kconfig.kexec

 MAINTAINERS            |  1 +
 arch/arm/Kconfig       | 12 +++---------
 arch/arm64/Kconfig     | 36 +++++++++---------------------------
 arch/loongarch/Kconfig | 20 +++++---------------
 arch/m68k/Kconfig      |  4 +---
 arch/mips/Kconfig      | 12 +++---------
 arch/parisc/Kconfig    |  8 ++------
 arch/powerpc/Kconfig   | 30 +++++++-----------------------
 arch/riscv/Kconfig     | 28 +++++++---------------------
 arch/s390/Kconfig      | 28 ++++++----------------------
 arch/sh/Kconfig        | 16 ++++------------
 arch/x86/Kconfig       | 48 ++++++++++++------------------------------------
 kernel/Kconfig.kexec   | 42 ++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 102 insertions(+), 183 deletions(-)

---
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
change-id: 20261119-arch-kconfig-b7c4b10c8c56

--
Sincerely yours,
Mike.

author maintainer
#1 lore raw

PATCH 1/2 MAINTAINERS: add kernel/Kconfig.kexec to KEXEC

kernel/Kconfig.kexec is not matched by the KEXEC entry, so get_maintainer.pl does not report kexec maintainers for changes in that file.

Add it to the KEXEC entry.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index d738990161bd0..c61a1f0ad330e 100644
@@ -14782,6 +14782,7 @@ W:	http://kernel.org/pub/linux/utils/kernel/kexec/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
 F:	include/linux/kexec.h
 F:	include/uapi/linux/kexec.h
+F:	kernel/Kconfig.kexec
 F:	kernel/kexec*
 
 KEXEC HANDOVER (KHO)
Signature · 1 line
2.53.0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] MAINTAINERS: add kernel/Kconfig.kexec to KEXEC

Quoted 10 lines · Mike Rapoport (Microsoft)

kernel/Kconfig.kexec is not matched by the KEXEC entry, so get_maintainer.pl does not report kexec maintainers for changes in that file.

Add it to the KEXEC entry.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
Quoted 17 lines
MAINTAINERS +1 -0
index d738990161bd0..c61a1f0ad330e 100644
@@ -14782,6 +14782,7 @@ W:	http://kernel.org/pub/linux/utils/kernel/kexec/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
 F:	include/linux/kexec.h
 F:	include/uapi/linux/kexec.h
+F:	kernel/Kconfig.kexec
 F:	kernel/kexec*
 
 KEXEC HANDOVER (KHO)
Signature · 2 lines
-- 
2.53.0
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] MAINTAINERS: add kernel/Kconfig.kexec to KEXEC

In reply to Mike Rapoport (Microsoft)
Quoted 7 lines · Mike Rapoport (Microsoft)

kernel/Kconfig.kexec is not matched by the KEXEC entry, so get_maintainer.pl does not report kexec maintainers for changes in that file.

Add it to the KEXEC entry.

In the spirit of finding any other misses in listing out relevant files under the kexec and crash entries in MAINTAINERS, I found a few other files that need to be added (unrelated to the Kconfig.kexec which is the focus of your current patchset). I'm planning to send a follow-up series to address that.

Regards,
Srivatsa

author maintainer
#4 lore raw

PATCH 2/2 arch, kexec: declare kexec and crash capabilities in Kconfig.kexec

In reply to Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

---
 arch/arm/Kconfig       | 12 +++---------
 arch/arm64/Kconfig     | 36 +++++++++---------------------------
 arch/loongarch/Kconfig | 20 +++++---------------
 arch/m68k/Kconfig      |  4 +---
 arch/mips/Kconfig      | 12 +++---------
 arch/parisc/Kconfig    |  8 ++------
 arch/powerpc/Kconfig   | 30 +++++++-----------------------
 arch/riscv/Kconfig     | 28 +++++++---------------------
 arch/s390/Kconfig      | 28 ++++++----------------------
 arch/sh/Kconfig        | 16 ++++------------
 arch/x86/Kconfig       | 48 ++++++++++++------------------------------------
 kernel/Kconfig.kexec   | 42 ++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 101 insertions(+), 183 deletions(-)
arch/arm/Kconfig +3 -9
index 0cc289a7184ab..afb6cc0995e57 100644
@@ -4,6 +4,7 @@ config ARM
 	default y
 	select ARCH_32BIT_OFF_T
 	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND
+	select ARCH_DEFAULT_CRASH_DUMP
 	select ARCH_HAS_BINFMT_FLAT
 	select ARCH_HAS_CACHE_LINE_SIZE if OF
 	select ARCH_HAS_CC_CAN_LINK
@@ -41,7 +42,9 @@ config ARM
 	select ARCH_NEED_CMPXCHG_1_EMU if CPU_V6
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_CFI
+	select ARCH_SUPPORTS_CRASH_DUMP
 	select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
+	select ARCH_SUPPORTS_KEXEC if (!SMP || PM_SLEEP_SMP) && MMU
 	select ARCH_SUPPORTS_RT
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF
@@ -1584,9 +1587,6 @@ config XIP_DEFLATED_DATA
 	  copied, saving some precious ROM space. A possible drawback is a
 	  slightly longer boot delay.
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool (!SMP || PM_SLEEP_SMP) && MMU
-
 config ATAGS_PROC
 	bool "Export atags in procfs"
 	depends on ATAGS && KEXEC
@@ -1595,12 +1595,6 @@ config ATAGS_PROC
 	  Should the atags used to boot the kernel be exported in an "atags"
 	  file in procfs. Useful with kexec.
 
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool y
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool y
-
 config AUTO_ZRELADDR
 	bool "Auto calculation of the decompressed kernel image address" if !ARCH_MULTIPLATFORM
 	default !(ARCH_FOOTBRIDGE || ARCH_RPC || ARCH_SA1100)
arch/arm64/Kconfig +9 -27
index 9b08b2457a555..c47a2e8d781b3 100644
@@ -14,6 +14,8 @@ config ARM64
 	select ARCH_HAS_CHECK_WX
 	select ARCH_BINFMT_ELF_EXTRA_PHDRS
 	select ARCH_BINFMT_ELF_STATE
+	select ARCH_DEFAULT_CRASH_DUMP
+	select ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG
 	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
 	select ARCH_ENABLE_MEMORY_HOTPLUG
 	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
@@ -30,6 +32,7 @@ config ARM64
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION if CRASH_RESERVE
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON
@@ -77,11 +80,17 @@ config ARM64
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_CFI
 	select ARCH_SUPPORTS_ATOMIC_RMW
+	select ARCH_SUPPORTS_CRASH_DUMP
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
 	select ARCH_HAS_PTE_PROTNONE
 	select ARCH_SUPPORTS_NUMA_BALANCING
 	select ARCH_SUPPORTS_PAGE_TABLE_CHECK
 	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
+	select ARCH_SUPPORTS_KEXEC if PM_SLEEP_SMP
+	select ARCH_SUPPORTS_KEXEC_FILE
+	select ARCH_SUPPORTS_KEXEC_HANDOVER
+	select ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG
+	select ARCH_SUPPORTS_KEXEC_SIG
 	select ARCH_SUPPORTS_RMM
 	select ARCH_SUPPORTS_RT
 	select ARCH_SUPPORTS_SCHED_SMT
@@ -1769,38 +1778,11 @@ config PARAVIRT_TIME_ACCOUNTING
 
 	  If in doubt, say N here.
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool PM_SLEEP_SMP
-
-config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool y
-
 config ARCH_SELECTS_KEXEC_FILE
 	def_bool y
 	depends on KEXEC_FILE
 	select HAVE_IMA_KEXEC if IMA
 
-config ARCH_SUPPORTS_KEXEC_SIG
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG
-	def_bool y
-
-config ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_HANDOVER
-	def_bool y
-
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool y
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool y
-
-config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
-	def_bool CRASH_RESERVE
-
 config TRANS_TABLE
 	def_bool y
 	depends on HIBERNATION || KEXEC_CORE
arch/loongarch/Kconfig +5 -15
index b5ed4881d3c01..f7738e7b829de 100644
@@ -10,6 +10,7 @@ config LOONGARCH
 	select ACPI_PPTT if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
 	select ARCH_BINFMT_ELF_STATE
+	select ARCH_DEFAULT_CRASH_DUMP if 64BIT
 	select ARCH_NEEDS_DEFER_KASAN
 	select ARCH_DISABLE_KASAN_INLINE
 	select ARCH_ENABLE_MEMORY_HOTPLUG
@@ -20,6 +21,7 @@ config LOONGARCH
 	select ARCH_HAS_DEBUG_VM_PGTABLE
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_FORTIFY_SOURCE
+	select ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION if CRASH_RESERVE
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && CPU_HAS_FPU
 	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
@@ -63,8 +65,11 @@ config LOONGARCH
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ACPI
 	select ARCH_SUPPORTS_ATOMIC_RMW
+	select ARCH_SUPPORTS_CRASH_DUMP if 64BIT
 	select ARCH_SUPPORTS_HUGETLBFS if 64BIT
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
+	select ARCH_SUPPORTS_KEXEC
+	select ARCH_SUPPORTS_KEXEC_FILE if 64BIT
 	select ARCH_SUPPORTS_LTO_CLANG
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
@@ -677,12 +682,6 @@ config CPU_HAS_PREFETCH
 	bool
 	default y
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool 64BIT
-
 config ARCH_SELECTS_KEXEC_FILE
 	def_bool 64BIT
 	depends on KEXEC_FILE
@@ -690,20 +689,11 @@ config ARCH_SELECTS_KEXEC_FILE
 	select RELOCATABLE
 	select HAVE_IMA_KEXEC if IMA
 
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool 64BIT
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool 64BIT
-
 config ARCH_SELECTS_CRASH_DUMP
 	def_bool 64BIT
 	depends on CRASH_DUMP
 	select RELOCATABLE
 
-config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
-	def_bool CRASH_RESERVE
-
 config RELOCATABLE
 	bool "Relocatable kernel"
 	depends on 64BIT
arch/m68k/Kconfig +1 -3
index eb84c3af92c02..0142c37c23229 100644
@@ -12,6 +12,7 @@ config M68K
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_PREEMPT if !COLDFIRE
+	select ARCH_SUPPORTS_KEXEC if (M68KCLASSIC || SUN3) && MMU
 	select ARCH_USE_MEMTEST if MMU_MOTOROLA
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
@@ -100,9 +101,6 @@ config MMU_SUN3
 	def_bool MMU && SUN3
 	select HAVE_PAGE_SIZE_8KB
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool (M68KCLASSIC || SUN3) && MMU
-
 config BOOTINFO_PROC
 	bool "Export bootinfo in procfs"
 	depends on KEXEC && (M68KCLASSIC || SUN3)
arch/mips/Kconfig +3 -9
index dac3ec5120a34..e275d9d13f6a2 100644
@@ -4,6 +4,7 @@ config MIPS
 	default y
 	select ARCH_32BIT_OFF_T if !64BIT
 	select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
+	select ARCH_DEFAULT_CRASH_DUMP
 	select ARCH_HAS_CC_CAN_LINK
 	select ARCH_HAS_CPU_CACHE_ALIASING
 	select ARCH_HAS_CPU_FINALIZE_INIT
@@ -25,7 +26,9 @@ config MIPS
 	select ARCH_USE_MEMTEST
 	select ARCH_USE_QUEUED_RWLOCKS
 	select ARCH_USE_QUEUED_SPINLOCKS
+	select ARCH_SUPPORTS_CRASH_DUMP
 	select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES
+	select ARCH_SUPPORTS_KEXEC
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select ARCH_WANT_LD_ORPHAN_WARN
@@ -2871,15 +2874,6 @@ config HZ
 config SCHED_HRTICK
 	def_bool HIGH_RES_TIMERS
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool y
-
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool y
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool y
-
 config PHYSICAL_START
 	hex "Physical address where the kernel is loaded"
 	default "0xffffffff84000000"
arch/parisc/Kconfig +2 -6
index 77f67028ad89c..aec3078e365b4 100644
@@ -20,6 +20,8 @@ config PARISC
 	select ARCH_NO_SG_CHAIN
 	select ARCH_SPLIT_ARG64 if !64BIT
 	select ARCH_SUPPORTS_HUGETLBFS if PA20
+	select ARCH_SUPPORTS_KEXEC
+	select ARCH_SUPPORTS_KEXEC_FILE
 	select ARCH_SUPPORTS_MEMORY_FAILURE
 	select ARCH_STACKWALK
 	select ARCH_HAS_CACHE_LINE_SIZE
@@ -373,12 +375,6 @@ config NR_CPUS
 
 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
arch/powerpc/Kconfig +7 -23
index c3b6cd6556069..179b8674e8d87 100644
@@ -122,6 +122,7 @@ config PPC
 	# Please keep this list sorted alphabetically.
 	#
 	select ARCH_32BIT_OFF_T if PPC32
+	select ARCH_DEFAULT_CRASH_DUMP		if !PPC_BOOK3S_32
 	select ARCH_NEEDS_DEFER_KASAN		if PPC_RADIX_MMU
 	select ARCH_DISABLE_KASAN_INLINE	if PPC_RADIX_MMU
 	select ARCH_DMA_DEFAULT_COHERENT	if !NOT_COHERENT_CACHE
@@ -136,6 +137,7 @@ config PPC
 	select ARCH_HAS_DMA_OPS			if PPC64
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION	if CRASH_RESERVE
 	select ARCH_HAS_GIGANTIC_PAGE		if ARCH_SUPPORTS_HUGETLBFS
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_KERNEL_FPU_SUPPORT	if PPC64 && PPC_FPU
@@ -169,8 +171,13 @@ config PPC
 	select ARCH_SPLIT_ARG64			if PPC32
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
+	select ARCH_SUPPORTS_CRASH_DUMP		if PPC64 || PPC_BOOK3S_32 || PPC_85xx || (44x && !SMP)
+	select ARCH_SUPPORTS_CRASH_HOTPLUG	if PPC64
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC	if PPC_BOOK3S || PPC_8xx
 	select ARCH_SUPPORTS_HUGE_PFNMAP	if PPC_BOOK3S_64 && TRANSPARENT_HUGEPAGE
+	select ARCH_SUPPORTS_KEXEC		if PPC_BOOK3S || PPC_E500 || (44x && !SMP)
+	select ARCH_SUPPORTS_KEXEC_FILE		if PPC64
+	select ARCH_SUPPORTS_KEXEC_PURGATORY
 	select ARCH_SUPPORTS_PAGE_TABLE_CHECK	if !HUGETLB_PAGE
 	select ARCH_SUPPORTS_SCHED_MC		if SMP
 	select ARCH_SUPPORTS_SCHED_SMT		if PPC64 && SMP
@@ -627,15 +634,6 @@ config PPC64_SUPPORTS_MEMORY_FAILURE
 	default "y" if PPC_POWERNV
 	select ARCH_SUPPORTS_MEMORY_FAILURE
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool PPC_BOOK3S || PPC_E500 || (44x && !SMP)
-
-config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool PPC64
-
-config ARCH_SUPPORTS_KEXEC_PURGATORY
-	def_bool y
-
 config ARCH_SELECTS_KEXEC_FILE
 	def_bool y
 	depends on KEXEC_FILE
@@ -701,25 +699,11 @@ config RELOCATABLE_TEST
 	  loaded at, which tends to be non-zero and therefore test the
 	  relocation code.
 
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool PPC64 || PPC_BOOK3S_32 || PPC_85xx || (44x && !SMP)
-
-config ARCH_DEFAULT_CRASH_DUMP
-	bool
-	default y if !PPC_BOOK3S_32
-
 config ARCH_SELECTS_CRASH_DUMP
 	def_bool y
 	depends on CRASH_DUMP
 	select RELOCATABLE if PPC64 || 44x || PPC_85xx
 
-config ARCH_SUPPORTS_CRASH_HOTPLUG
-	def_bool y
-	depends on PPC64
-
-config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
-	def_bool CRASH_RESERVE
-
 config FA_DUMP
 	bool "Firmware-assisted dump"
 	depends on CRASH_DUMP && PPC64 && (PPC_RTAS || PPC_POWERNV)
arch/riscv/Kconfig +7 -21
index e7891a2a89da6..3fc73c99d06f1 100644
@@ -18,6 +18,7 @@ config RISCV
 	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
 	select ACPI_RIMT if ACPI
 	select ACPI_SPCR_TABLE if ACPI
+	select ARCH_DEFAULT_CRASH_DUMP
 	select ARCH_DMA_DEFAULT_COHERENT
 	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
 	select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM_VMEMMAP
@@ -35,6 +36,7 @@ config RISCV
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION	if CRASH_RESERVE
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_HW_PTE_YOUNG
 	select ARCH_HAS_KCOV
@@ -65,9 +67,14 @@ config RISCV
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_CFI
+	select ARCH_SUPPORTS_CRASH_DUMP
+	select ARCH_SUPPORTS_CRASH_HOTPLUG
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
 	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
 	select ARCH_SUPPORTS_HUGETLBFS if MMU
+	select ARCH_SUPPORTS_KEXEC
+	select ARCH_SUPPORTS_KEXEC_FILE		if 64BIT
+	select ARCH_SUPPORTS_KEXEC_PURGATORY	if 64BIT
 	select ARCH_SUPPORTS_LTO_CLANG if CMODEL_MEDANY
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
@@ -1105,38 +1112,17 @@ config RISCV_BOOT_SPINWAIT
 
 	  If unsure what to do here, say N.
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool y
-
 config ARCH_SELECTS_KEXEC
 	def_bool y
 	depends on KEXEC
 	select HOTPLUG_CPU if SMP
 
-config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool 64BIT
-
 config ARCH_SELECTS_KEXEC_FILE
 	def_bool y
 	depends on KEXEC_FILE
 	select HAVE_IMA_KEXEC if IMA
 	select KEXEC_ELF
 
-config ARCH_SUPPORTS_KEXEC_PURGATORY
-	def_bool ARCH_SUPPORTS_KEXEC_FILE
-
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool y
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool y
-
-config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
-	def_bool CRASH_RESERVE
-
-config ARCH_SUPPORTS_CRASH_HOTPLUG
-	def_bool y
-
 config COMPAT
 	bool "Kernel support for 32-bit U-mode"
 	default 64BIT
arch/s390/Kconfig +6 -22
index 7138d923d86f8..3a4ad71b8364d 100644
@@ -83,6 +83,7 @@ config S390
 	select ALTERNATE_USER_ADDRESS_SPACE
 	select ARCH_32BIT_USTAT_F_TINODE
 	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
+	select ARCH_DEFAULT_CRASH_DUMP
 	select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
 	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
 	select ARCH_HAS_PMD_SOFTLEAVES if TRANSPARENT_HUGEPAGE
@@ -150,9 +151,14 @@ config S390
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_CFI
+	select ARCH_SUPPORTS_CRASH_DUMP
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
 	select ARCH_SUPPORTS_HUGETLBFS
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && CC_IS_CLANG
+	select ARCH_SUPPORTS_KEXEC
+	select ARCH_SUPPORTS_KEXEC_FILE
+	select ARCH_SUPPORTS_KEXEC_PURGATORY
+	select ARCH_SUPPORTS_KEXEC_SIG
 	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
 	select ARCH_HAS_PTE_PROTNONE
 	select ARCH_SUPPORTS_NUMA_BALANCING
@@ -312,28 +318,6 @@ config ARCH_USERFLAGS
 	string
 	default "-m64"
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_SIG
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_PURGATORY
-	def_bool y
-
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool y
-	help
-	  Refer to <file:Documentation/arch/s390/zfcpdump.rst> for more details on this.
-	  This option also enables s390 zfcpdump.
-	  See also <file:Documentation/arch/s390/zfcpdump.rst>
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool y
-
 menu "Processor type and features"
 
 config HAVE_MARCH_Z10_FEATURES
arch/sh/Kconfig +4 -12
index 5512f446eed16..a12397bfa53be 100644
@@ -2,6 +2,7 @@
 config SUPERH
 	def_bool y
 	select ARCH_32BIT_OFF_T
+	select ARCH_DEFAULT_CRASH_DUMP
 	select ARCH_HAS_CPU_CACHE_ALIASING
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
 	select ARCH_HAS_BINFMT_FLAT if !MMU
@@ -15,6 +16,9 @@ config SUPERH
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select ARCH_NEED_CMPXCHG_1_EMU
+	select ARCH_SUPPORTS_CRASH_DUMP if BROKEN_ON_SMP
+	select ARCH_SUPPORTS_KEXEC if MMU
+	select ARCH_SUPPORTS_KEXEC_JUMP
 	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
 	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
@@ -534,18 +538,6 @@ menu "Kernel features"
 
 source "kernel/Kconfig.hz"
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool MMU
-
-config ARCH_SUPPORTS_CRASH_DUMP
-	def_bool BROKEN_ON_SMP
-
-config ARCH_DEFAULT_CRASH_DUMP
-	def_bool y
-
-config ARCH_SUPPORTS_KEXEC_JUMP
-	def_bool y
-
 config PHYSICAL_START
 	hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
 	default MEMORY_START
arch/x86/Kconfig +12 -36

77 lines not on this page · raw message

kernel/Kconfig.kexec +42 -0

102 lines not on this page · raw message

Signature · 1 line
2.53.0
#5 lore raw
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] riscv: missing ARCH_KEEP_MEMBLOCK and…

Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] riscv: missing ARCH_KEEP_MEMBLOCK and HOTPLUG_CPU selects for KEXEC_FILE [1]
--

commit 72fcff7ceb4b8dc27b8490a2ed5edc55973e96f8
Author: Mike Rapoport (Microsoft) <[email protected]>

arch, kexec: declare kexec and crash capabilities in Kconfig.kexec

This commit moves the architecture capability options for kexec and crash dumps into kernel/Kconfig.kexec and updates each architecture to select them.

Quoted 4 lines
arch/riscv/Kconfig +0 -0
index e7891a2a89da6..3fc73c99d06f1 100644

[ ... ]

Quoted 25 lines
arch/riscv/Kconfig +5 -3
@@ -65,9 +67,14 @@ config RISCV
 	select ARCH_STACKWALK
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_SUPPORTS_CFI
+	select ARCH_SUPPORTS_CRASH_DUMP
+	select ARCH_SUPPORTS_CRASH_HOTPLUG
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
 	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
 	select ARCH_SUPPORTS_HUGETLBFS if MMU
+	select ARCH_SUPPORTS_KEXEC
+	select ARCH_SUPPORTS_KEXEC_FILE		if 64BIT
+	select ARCH_SUPPORTS_KEXEC_PURGATORY	if 64BIT
 	select ARCH_SUPPORTS_LTO_CLANG if CMODEL_MEDANY
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
@@ -1105,38 +1112,17 @@ config RISCV_BOOT_SPINWAIT
 
 	  If unsure what to do here, say N.
 
-config ARCH_SUPPORTS_KEXEC
-	def_bool y
-
 config ARCH_SELECTS_KEXEC
 	def_bool y
 	depends on KEXEC

arch/riscv/Kconfig config RISCV_BOOT_SPINWAIT · line 1124

Quoted 10 lines
arch/riscv/Kconfig +0 -3
 	select HOTPLUG_CPU if SMP
 
-config ARCH_SUPPORTS_KEXEC_FILE
-	def_bool 64BIT
-
 config ARCH_SELECTS_KEXEC_FILE
 	def_bool y
 	depends on KEXEC_FILE
 	select HAVE_IMA_KEXEC if IMA
 	select KEXEC_ELF

[Severity: High]
This problem wasn't introduced by this patch, but should KEXEC_FILE (or KEXEC_CORE) also select ARCH_KEEP_MEMBLOCK and HOTPLUG_CPU if SMP [1]?

config RISCV only has "select ARCH_KEEP_MEMBLOCK if ACPI || KEXEC", and only ARCH_SELECTS_KEXEC selects HOTPLUG_CPU if SMP. When KEXEC_FILE=y and KEXEC=n:

- Without ACPI, memblock_discard() frees the reserved regions array before reserve_memblock_reserved_regions() registers them in iomem_resource, so kexec_file_load() can place kexec segments over reserved memory.

- On SMP without another option enabling HOTPLUG_CPU, smp_shutdown_nonboot_cpus() in machine_shutdown() and cpu_ops_sbi.cpu_stop are compiled out, leaving secondary harts running in the old kernel during kernel_kexec().

[1] https://sashiko.dev/#/bug/linux-78e86ad1-8753-462c-a044-1d3b3f2cab21

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer Acked-by Reviewed-by on v1 2/2
#6 lore raw
In reply to Mike Rapoport (Microsoft)
Quoted 5 lines · Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Quoted 8 lines

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer Acked-by on v1 2/2
#7 lore raw
In reply to Mike Rapoport (Microsoft)
Quoted 13 lines · Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

Quoted 14 lines
---
 arch/arm/Kconfig       | 12 +++---------
 arch/arm64/Kconfig     | 36 +++++++++---------------------------
 arch/loongarch/Kconfig | 20 +++++---------------
 arch/m68k/Kconfig      |  4 +---
 arch/mips/Kconfig      | 12 +++---------
 arch/parisc/Kconfig    |  8 ++------
 arch/powerpc/Kconfig   | 30 +++++++-----------------------
 arch/riscv/Kconfig     | 28 +++++++---------------------
 arch/s390/Kconfig      | 28 ++++++----------------------
 arch/sh/Kconfig        | 16 ++++------------
 arch/x86/Kconfig       | 48 ++++++++++++------------------------------------
 kernel/Kconfig.kexec   | 42 ++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 101 insertions(+), 183 deletions(-)
maintainer Acked-by
#8 lore raw
Quoted 29 lines · Heiko Carstens
Quoted 13 lines · Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

Quoted 14 lines
---
  arch/arm/Kconfig       | 12 +++---------
  arch/arm64/Kconfig     | 36 +++++++++---------------------------
  arch/loongarch/Kconfig | 20 +++++---------------
  arch/m68k/Kconfig      |  4 +---
  arch/mips/Kconfig      | 12 +++---------
  arch/parisc/Kconfig    |  8 ++------
  arch/powerpc/Kconfig   | 30 +++++++-----------------------
  arch/riscv/Kconfig     | 28 +++++++---------------------
  arch/s390/Kconfig      | 28 ++++++----------------------
  arch/sh/Kconfig        | 16 ++++------------
  arch/x86/Kconfig       | 48 ++++++++++++------------------------------------
  kernel/Kconfig.kexec   | 42 ++++++++++++++++++++++++++++++++++++++++++
  12 files changed, 101 insertions(+), 183 deletions(-)
Quoted 1 line
maintainer Acked-by on v1 2/2
#9 lore raw
In reply to Mike Rapoport (Microsoft)
Quoted 5 lines · Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Quoted 8 lines

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

[...]

Signature · 2 lines
Regards,
Pratyush Yadav
reviewer Reviewed-by on v1 2/2
#10 lore raw
In reply to Mike Rapoport (Microsoft)
Quoted 5 lines · Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Quoted 8 lines

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

No function change observed in this patch (as described in the commit msg).

LGTM, feel free to add:

Reviewed-by on v1 2/2
#11 lore raw
In reply to Mike Rapoport (Microsoft)
Quoted 5 lines · Mike Rapoport (Microsoft)

The options that let an architecture opt in to kexec and crash dump features, like ARCH_SUPPORTS_KEXEC or ARCH_SUPPORTS_CRASH_DUMP, are defined in each architecture's Kconfig as def_bool, and most of them are copied over several architectures.

Quoted 8 lines

Declare these options once in kernel/Kconfig.kexec next to the options that depend on them, similarly to how mm/Kconfig does it, and make the architectures select them instead.

Selection conditions are preserved, so there is no functional change.

Reviewed each code movement for correctness and also reasoned through why the ARCH_SELECTS_* entries were left untouched in this series (as they don't yield any consolidation benefits towards Kconfig.kexec).

Regards,
Srivatsa

author maintainer Applied
#13 lore raw
In reply to Mike Rapoport (Microsoft)

From: Mike Rapoport (Microsoft) <[email protected]>

Quoted 1 line · Mike Rapoport (Microsoft)

The intention is to take it via kexec tree.

Applied to kexec-7.5 branch of liveupdate/linux.git tree, thanks!

[1/2] MAINTAINERS: add kernel/Kconfig.kexec to KEXEC

      commit: 09ade745fcd10af7fa62c73a918cae6814c5b0d8
[2/2] arch, kexec: declare kexec and crash capabilities in Kconfig.kexec
      commit: e583fcbe5b58597fdd81bcf150115fb801d6507f

tree: https://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux
branch: kexec-7.5

--
Sincerely yours,
Mike.