crash-split-crash-dumping-code-out-from-kexec_corec.patch removed from -mm tree
The quilt patch titled
Subject: crash: split crash dumping code out from kexec_core.c
has been removed from the -mm tree. Its filename was
crash-split-crash-dumping-code-out-from-kexec_corec.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Baoquan He <[email protected]>
Subject: crash: split crash dumping code out from kexec_core.c
Date: Wed, 24 Jan 2024 13:12:44 +0800
Currently, KEXEC_CORE select CRASH_CORE automatically because crash codes need be built in to avoid compiling error when building kexec code even though the crash dumping functionality is not enabled. E.g
--------------------CONFIG_CRASH_CORE=yCONFIG_KEXEC_CORE=yCONFIG_KEXEC=yCONFIG_KEXEC_FILE=y
---------------------
After splitting out crashkernel reservation code and vmcoreinfo exporting code, there's only crash related code left in kernel/crash_core.c. Now move crash related codes from kexec_core.c to crash_core.c and only build it in when CONFIG_CRASH_DUMP=y.
And also wrap up crash codes inside CONFIG_CRASH_DUMP ifdeffery scope, or replace inappropriate CONFIG_KEXEC_CORE ifdef with CONFIG_CRASH_DUMP ifdef in generic kernel files.
With these changes, crash_core codes are abstracted from kexec codes and can be disabled at all if only kexec reboot feature is wanted.
---
drivers/base/cpu.c | 6 include/linux/crash_core.h | 61 ++++++++ include/linux/kexec.h | 45 ------ init/initramfs.c | 2 kernel/Makefile | 3 kernel/crash_core.c | 256 +++++++++++++++++++++++++++++++++++ kernel/kexec.c | 11 + kernel/kexec_core.c | 250 +--------------------------------- kernel/kexec_file.c | 13 + kernel/ksysfs.c | 4 10 files changed, 359 insertions(+), 292 deletions(-)
drivers/base/cpu.c renamed from drivers/base/cpu.c~crash-split-crash-dumping-code-out-from-kexec_corec +3 -3
@@ -144,7 +144,7 @@ static DEVICE_ATTR(release, S_IWUSR, NUL#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ #endif /* CONFIG_HOTPLUG_CPU */ -#ifdef CONFIG_KEXEC_CORE +#ifdef CONFIG_CRASH_DUMP #include <linux/kexec.h> static ssize_t crash_notes_show(struct device *dev,
@@ -189,14 +189,14 @@ static const struct attribute_group cras#endif static const struct attribute_group *common_cpu_attr_groups[] = { -#ifdef CONFIG_KEXEC_CORE +#ifdef CONFIG_CRASH_DUMP &crash_note_cpu_attr_group, #endifNULL };static const struct attribute_group *hotplugable_cpu_attr_groups[] = { -#ifdef CONFIG_KEXEC_CORE +#ifdef CONFIG_CRASH_DUMP &crash_note_cpu_attr_group, #endifNULL
include/linux/crash_core.h renamed from include/linux/crash_core.h~crash-split-crash-dumping-code-out-from-kexec_corec +61 -0
71 lines not on this page · raw message
include/linux/kexec.h renamed from include/linux/kexec.h~crash-split-crash-dumping-code-out-from-kexec_corec +1 -44
75 lines not on this page · raw message
init/initramfs.c renamed from init/initramfs.c~crash-split-crash-dumping-code-out-from-kexec_corec +1 -1
@@ -642,7 +642,7 @@ void __weak __init free_initrd_mem(unsig "initrd"); } -#ifdef CONFIG_KEXEC_CORE +#ifdef CONFIG_CRASH_RESERVE static bool __init kexec_free_initrd (void ) {unsigned long crashk_start = (unsigned long )__va (crashk_res.start);
kernel/crash_core.c renamed from kernel/crash_core.c~crash-split-crash-dumping-code-out-from-kexec_corec +256 -0
283 lines not on this page · raw message
kernel/kexec.c renamed from kernel/kexec.c~crash-split-crash-dumping-code-out-from-kexec_corec +9 -2
@@ -28,12 +28,14 @@ static int kimage_alloc_init(struct kimastruct kimage *image;bool kexec_on_panic = flags &KEXEC_ON_CRASH ; +#ifdef CONFIG_CRASH_DUMP if (kexec_on_panic) {/* Verify we have a valid entry point */ if ((entry <phys_to_boot_phys (crashk_res.start)) || (entry >phys_to_boot_phys (crashk_res.end)))return -EADDRNOTAVAIL ; } +#endif /* Allocate and initialize a controlling structure */ image =do_kimage_alloc_init ();
@@ -44,11 +46,13 @@ static int kimage_alloc_init(struct kima image->nr_segments = nr_segments;memcpy (image->segment, segments, nr_segments *sizeof (*segments)); +#ifdef CONFIG_CRASH_DUMP if (kexec_on_panic) {/* Enable special crash kernel control page alloc policy. */ image->control_page = crashk_res.start; image->type =KEXEC_TYPE_CRASH ; } +#endif ret =sanity_check_segment_list (image);if (ret)
@@ -99,13 +103,14 @@ static int do_kexec_load(unsigned long eif (!kexec_trylock ())return -EBUSY ; +#ifdef CONFIG_CRASH_DUMP if (flags &KEXEC_ON_CRASH ) { dest_image = &kexec_crash_image;if (kexec_crash_image)arch_kexec_unprotect_crashkres (); - }else { + } else +#endif dest_image = &kexec_image; - }if (nr_segments ==0 ) {/* Uninstall image */
@@ -162,8 +167,10 @@ static int do_kexec_load(unsigned long e image =xchg (dest_image, image); out: +#ifdef CONFIG_CRASH_DUMP if ((flags &KEXEC_ON_CRASH ) && kexec_crash_image)arch_kexec_protect_crashkres (); +#endif kimage_free (image); out_unlock:
kernel/kexec_core.c renamed from kernel/kexec_core.c~crash-split-crash-dumping-code-out-from-kexec_corec +12 -238
331 lines not on this page · raw message
kernel/kexec_file.c renamed from kernel/kexec_file.c~crash-split-crash-dumping-code-out-from-kexec_corec +10 -3
@@ -285,11 +285,13 @@ kimage_file_alloc_init(struct kimage **r kexec_file_dbg_print = !!(flags &KEXEC_FILE_DEBUG ); image->file_mode =1 ; +#ifdef CONFIG_CRASH_DUMP if (kexec_on_panic) {/* Enable special crash kernel control page alloc policy. */ image->control_page = crashk_res.start; image->type =KEXEC_TYPE_CRASH ; } +#endif ret =kimage_file_prepare_segments (image, kernel_fd, initrd_fd, cmdline_ptr, cmdline_len, flags);
@@ -349,13 +351,14 @@ SYSCALL_DEFINE5(kexec_file_load, int, keif (!kexec_trylock ())return -EBUSY ; +#ifdef CONFIG_CRASH_DUMP if (image_type ==KEXEC_TYPE_CRASH ) { dest_image = &kexec_crash_image;if (kexec_crash_image)arch_kexec_unprotect_crashkres (); - }else { + } else +#endif dest_image = &kexec_image; - }if (flags &KEXEC_FILE_UNLOAD ) goto exchange;
@@ -419,8 +422,10 @@ SYSCALL_DEFINE5(kexec_file_load, int, ke exchange: image =xchg (dest_image, image); out: +#ifdef CONFIG_CRASH_DUMP if ((flags &KEXEC_FILE_ON_CRASH ) && kexec_crash_image)arch_kexec_protect_crashkres (); +#endif kexec_unlock ();kimage_free (image);
@@ -595,12 +600,14 @@ static int kexec_walk_memblock(struct kestatic int kexec_walk_resources (struct kexec_buf *kbuf,int (*func)(struct resource *,void *)) { +#ifdef CONFIG_CRASH_DUMP if (kbuf->image->type ==KEXEC_TYPE_CRASH )return walk_iomem_res_desc (crashk_res.desc,IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , crashk_res.start, crashk_res.end, kbuf, func); -else if (kbuf->top_down) +#endif +if (kbuf->top_down)return walk_system_ram_res_rev (0 ,ULONG_MAX , kbuf, func);else return walk_system_ram_res (0 ,ULONG_MAX , kbuf, func);
kernel/ksysfs.c renamed from kernel/ksysfs.c~crash-split-crash-dumping-code-out-from-kexec_corec +4 -0
@@ -120,6 +120,7 @@ static ssize_t kexec_loaded_show(struct }KERNEL_ATTR_RO (kexec_loaded); +#ifdef CONFIG_CRASH_DUMP static ssize_t kexec_crash_loaded_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf) {
@@ -152,6 +153,7 @@ static ssize_t kexec_crash_size_store(st }KERNEL_ATTR_RW (kexec_crash_size); +#endif /* CONFIG_CRASH_DUMP*/ #endif /* CONFIG_KEXEC_CORE */ #ifdef CONFIG_VMCORE_INFO
@@ -262,9 +264,11 @@ static struct attribute * kernel_attrs[]#endif #ifdef CONFIG_KEXEC_CORE &kexec_loaded_attr.attr, +#ifdef CONFIG_CRASH_DUMP &kexec_crash_loaded_attr.attr, &kexec_crash_size_attr.attr, #endif +#endif #ifdef CONFIG_VMCORE_INFO &vmcoreinfo_attr.attr, #ifdef CONFIG_CRASH_HOTPLUG
kernel/Makefile renamed from kernel/Makefile~crash-split-crash-dumping-code-out-from-kexec_corec +2 -1
@@ -70,7 +70,8 @@ obj-$(CONFIG_KALLSYMS_SELFTEST) += kalls obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o elfcorehdr.o obj-$(CONFIG_CRASH_RESERVE) += crash_reserve.o -obj-$(CONFIG_KEXEC_CORE) += kexec_core.o crash_core.o +obj-$(CONFIG_KEXEC_CORE) += kexec_core.o +obj-$(CONFIG_CRASH_DUMP) += crash_core.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC_FILE) += kexec_file.o obj-$(CONFIG_KEXEC_ELF) += kexec_elf.o
_
Patches currently in -mm which might be from [email protected] are