Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash_core: move crashk_*res definition into crash_core.c

Both crashk_res and crashk_low_res are used to mark the reserved
crashkernel regions in iomem_resource tree. And later the generic
crashkernel resrvation will be added into crash_core.c. So move
crashk_res and crashk_low_res definition into crash_core.c to avoid
compiling error if CONFIG_CRASH_CORE=on while CONFIG_KEXEC_CORE is unset.

Meanwhile include <asm/crash_core.h> in <linux/crash_core.h> if generic
reservation is needed. In that case, <asm/crash_core.h> need be added by
ARCH. In asm/crash_core.h, ARCH can provide its own macro definitions to
override macros in <linux/crash_core.h> if needed. Wrap the including
into CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION ifdeffery scope to
avoid compiling error in other ARCH-es which don't take the generic
reservation way yet.

Link: https://lkml.kernel.org/r/20230914033142.676708-6-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chen Jiahao <chenjiahao16@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baoquan He and committed by
Andrew Morton
b631b95d 0ab97169

+24 -21
+8
include/linux/crash_core.h
··· 5 5 #include <linux/linkage.h> 6 6 #include <linux/elfcore.h> 7 7 #include <linux/elf.h> 8 + #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION 9 + #include <asm/crash_core.h> 10 + #endif 11 + 12 + /* Location of a reserved region to hold the crash kernel. 13 + */ 14 + extern struct resource crashk_res; 15 + extern struct resource crashk_low_res; 8 16 9 17 #define CRASH_CORE_NOTE_NAME "CORE" 10 18 #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
-4
include/linux/kexec.h
··· 22 22 #include <uapi/linux/kexec.h> 23 23 #include <linux/verification.h> 24 24 25 - /* Location of a reserved region to hold the crash kernel. 26 - */ 27 - extern struct resource crashk_res; 28 - extern struct resource crashk_low_res; 29 25 extern note_buf_t __percpu *crash_notes; 30 26 31 27 #ifdef CONFIG_KEXEC_CORE
+16
kernel/crash_core.c
··· 35 35 /* trusted vmcoreinfo, e.g. we can make a copy in the crash memory */ 36 36 static unsigned char *vmcoreinfo_data_safecopy; 37 37 38 + /* Location of the reserved area for the crash kernel */ 39 + struct resource crashk_res = { 40 + .name = "Crash kernel", 41 + .start = 0, 42 + .end = 0, 43 + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, 44 + .desc = IORES_DESC_CRASH_KERNEL 45 + }; 46 + struct resource crashk_low_res = { 47 + .name = "Crash kernel", 48 + .start = 0, 49 + .end = 0, 50 + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, 51 + .desc = IORES_DESC_CRASH_KERNEL 52 + }; 53 + 38 54 /* 39 55 * parsing the "crashkernel" commandline 40 56 *
-17
kernel/kexec_core.c
··· 52 52 /* Flag to indicate we are going to kexec a new kernel */ 53 53 bool kexec_in_progress = false; 54 54 55 - 56 - /* Location of the reserved area for the crash kernel */ 57 - struct resource crashk_res = { 58 - .name = "Crash kernel", 59 - .start = 0, 60 - .end = 0, 61 - .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, 62 - .desc = IORES_DESC_CRASH_KERNEL 63 - }; 64 - struct resource crashk_low_res = { 65 - .name = "Crash kernel", 66 - .start = 0, 67 - .end = 0, 68 - .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, 69 - .desc = IORES_DESC_CRASH_KERNEL 70 - }; 71 - 72 55 int kexec_should_crash(struct task_struct *p) 73 56 { 74 57 /*