Skip to contentSkip to conversation

kdump: use generic functions to simplify crashkernel reservation in architectures

PATCH Superseded Baoquan He 3 participants 13 messages Aug 27, 2023 – Aug 28, 2023

Subsystems (13)
Arm (32-bit) x86 PowerPC MIPS +9 more subsystems

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Baoquan He

author
#0 lore raw

cover kdump: use generic functions to simplify crashkernel reservation in architectures

In the current arm64, crashkernel=,high support has been finished after several rounds of posting and careful reviewing. The code in arm64 which parses crashkernel kernel parameters firstly, then reserve memory can be a good example for other ARCH to refer to.

Whereas in x86_64, the code mixing crashkernel parameter parsing and memory reserving is twisted, and looks messy. Refactoring the code to make it more readable maintainable is necessary.

Here, firstly abstract the crashkernel parameter parsing code into parse_crashkernel() to make it be able to parse crashkernel=,high|low. Then abstract the crashkernel memory reserving code into a generic function reserve_crashkernel_generic(). Finally, in ARCH which crashkernel=,high support is needed, a simple arch_reserve_crashkernel() can be added to call above two functions. This can remove the duplicated implmentation code in each ARCH, like arm64, x86_64.

I only change the arm64 and x86_64 implementation to make use of the generic functions to simplify code. Risc-v can be done very easily refer to the steps in arm64 and x86_64.

History:
- RFC patchset:
https://lore.kernel.org/all/[email protected]/T/#u
[RFC PATCH 0/4] kdump: add generic functions to simplify crashkernel crashkernel in architecture Dave and Philipp commented the old parse_crashkernel_common() and parse_crashkernel_generic() are quite confusing. In this formal post,
I made change to address the concern by unifying all crashkernel
parsing into parse_crashkernel().

Baoquan He (8):
crash_core.c: remove unnecessary parameter of function
crash_core: change the prototype of function parse_crashkernel() include/linux/kexec.h: move down crash_core.h including
crash_core: change parse_crashkernel() to support
crashkernel=,high|low parsing
crash_core: add generic function to do reservation
arm64: kdump: use generic interface to simplify crashkernel
reservation
x86: kdump: use generic interface to simplify crashkernel reservation
code
crash_core.c: remove unneeded functions

 arch/arm/kernel/setup.c              |   3 +-
 arch/arm64/Kconfig                   |   3 +
 arch/arm64/include/asm/kexec.h       |   5 +
 arch/arm64/mm/init.c                 | 140 ++--------------------
 arch/ia64/kernel/setup.c             |   2 +-
 arch/loongarch/kernel/setup.c        |   4 +-
 arch/mips/kernel/setup.c             |   3 +-
 arch/powerpc/kernel/fadump.c         |   2 +-
 arch/powerpc/kexec/core.c            |   2 +-
 arch/powerpc/mm/nohash/kaslr_booke.c |   2 +-
 arch/riscv/mm/init.c                 |   2 +-
 arch/s390/kernel/setup.c             |   4 +-
 arch/sh/kernel/machine_kexec.c       |   2 +-
 arch/x86/Kconfig                     |   3 +
 arch/x86/include/asm/kexec.h         |  32 +++++
 arch/x86/kernel/setup.c              | 143 +++-------------------
 include/linux/crash_core.h           |  35 +++++-
 include/linux/kexec.h                |  14 +--
 kernel/crash_core.c                  | 170 +++++++++++++++++++++++----
 19 files changed, 266 insertions(+), 305 deletions(-)
Signature · 7 lines
2.41.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
author
#1 lore raw

PATCH 1/8 crash_core.c: remove unnecessary parameter of function

In all call sites of __parse_crashkernel(), the parameter 'name' is hardcoded as "crashkernel=". So remove the unnecessary parameter 'name', add local varibale 'name' inside __parse_crashkernel() instead.

---
 kernel/crash_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/crash_core.c +4 -4
index 90ce1dfd591c..f27b4e45d410 100644
@@ -241,11 +241,11 @@ static int __init __parse_crashkernel(char *cmdline,
 			     unsigned long long system_ram,
 			     unsigned long long *crash_size,
 			     unsigned long long *crash_base,
-			     const char *name,
 			     const char *suffix)
 {
 	char	*first_colon, *first_space;
 	char	*ck_cmdline;
+	char	*name = "crashkernel=";
 
 	BUG_ON(!crash_size || !crash_base);
 	*crash_size = 0;
@@ -283,7 +283,7 @@ int __init parse_crashkernel(char *cmdline,
 			     unsigned long long *crash_base)
 {
 	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-					"crashkernel=", NULL);
+				NULL);
 }
 
 int __init parse_crashkernel_high(char *cmdline,
@@ -292,7 +292,7 @@ int __init parse_crashkernel_high(char *cmdline,
 			     unsigned long long *crash_base)
 {
 	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				"crashkernel=", suffix_tbl[SUFFIX_HIGH]);
+				suffix_tbl[SUFFIX_HIGH]);
 }
 
 int __init parse_crashkernel_low(char *cmdline,
@@ -301,7 +301,7 @@ int __init parse_crashkernel_low(char *cmdline,
 			     unsigned long long *crash_base)
 {
 	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				"crashkernel=", suffix_tbl[SUFFIX_LOW]);
+				suffix_tbl[SUFFIX_LOW]);
 }
 
 /*
Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#2 lore raw

PATCH 2/8 crash_core: change the prototype of function parse_crashkernel()

In reply to Baoquan He

Add two parameters 'low_size' and 'high' to function parse_crashkernel(), later crashkernel=,high|low parsing will be added. Make adjustments in all call sites of parse_crashkernel() in arch.

---
 arch/arm/kernel/setup.c              |  3 ++-
 arch/arm64/mm/init.c                 |  2 +-
 arch/ia64/kernel/setup.c             |  2 +-
 arch/loongarch/kernel/setup.c        |  4 +++-
 arch/mips/kernel/setup.c             |  3 ++-
 arch/powerpc/kernel/fadump.c         |  2 +-
 arch/powerpc/kexec/core.c            |  2 +-
 arch/powerpc/mm/nohash/kaslr_booke.c |  2 +-
 arch/riscv/mm/init.c                 |  2 +-
 arch/s390/kernel/setup.c             |  4 ++--
 arch/sh/kernel/machine_kexec.c       |  2 +-
 arch/x86/kernel/setup.c              |  3 ++-
 include/linux/crash_core.h           |  3 ++-
 kernel/crash_core.c                  | 15 ++++++++++++---
 14 files changed, 32 insertions(+), 17 deletions(-)
arch/arm/kernel/setup.c +2 -1
index c66b560562b3..e2bb7afd0683 100644
@@ -1010,7 +1010,8 @@ static void __init reserve_crashkernel(void)
 
 	total_mem = get_total_mem();
 	ret = parse_crashkernel(boot_command_line, total_mem,
-				&crash_size, &crash_base);
+				&crash_size, &crash_base,
+				NULL, NULL);
 	/* invalid value specified or crashkernel=0 */
 	if (ret || !crash_size)
 		return;
arch/arm64/mm/init.c +1 -1
index d31c3a9290c5..36967b82c150 100644
@@ -115,7 +115,7 @@ static void __init reserve_crashkernel(void)
 
 	/* crashkernel=X[@offset] */
 	ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
-				&crash_size, &crash_base);
+				&crash_size, &crash_base, NULL, NULL);
 	if (ret == -ENOENT) {
 		ret = parse_crashkernel_high(cmdline, 0, &crash_size, &crash_base);
 		if (ret || !crash_size)
arch/ia64/kernel/setup.c +1 -1
index 5a55ac82c13a..4faea2d2cf07 100644
@@ -277,7 +277,7 @@ static void __init setup_crashkernel(unsigned long total, int *n)
 	int ret;
 
 	ret = parse_crashkernel(boot_command_line, total,
-			&size, &base);
+			&size, &base, NULL, NULL);
 	if (ret == 0 && size > 0) {
 		if (!base) {
 			sort_regions(rsvd_region, *n);
arch/loongarch/kernel/setup.c +3 -1
index 9d830ab4e302..776a068d8718 100644
@@ -267,7 +267,9 @@ static void __init arch_parse_crashkernel(void)
 	unsigned long long crash_base, crash_size;
 
 	total_mem = memblock_phys_mem_size();
-	ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base);
+	ret = parse_crashkernel(boot_command_line, total_mem,
+				&crash_size, &crash_base,
+				NULL, NULL);
 	if (ret < 0 || crash_size <= 0)
 		return;
 
arch/mips/kernel/setup.c +2 -1
index cb871eb784a7..08321c945ac4 100644
@@ -460,7 +460,8 @@ static void __init mips_parse_crashkernel(void)
 
 	total_mem = memblock_phys_mem_size();
 	ret = parse_crashkernel(boot_command_line, total_mem,
-				&crash_size, &crash_base);
+				&crash_size, &crash_base,
+				NULL, NULL);
 	if (ret != 0 || crash_size <= 0)
 		return;
 
arch/powerpc/kernel/fadump.c +1 -1
index ea0a073abd96..7dbdeba56e74 100644
@@ -313,7 +313,7 @@ static __init u64 fadump_calculate_reserve_size(void)
 	 * memory at a predefined offset.
 	 */
 	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
-				&size, &base);
+				&size, &base, NULL, NULL);
 	if (ret == 0 && size > 0) {
 		unsigned long max_size;
 
arch/powerpc/kexec/core.c +1 -1
index de64c7962991..9346c960b296 100644
@@ -109,7 +109,7 @@ void __init reserve_crashkernel(void)
 	total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
 	/* use common parsing */
 	ret = parse_crashkernel(boot_command_line, total_mem_sz,
-			&crash_size, &crash_base);
+			&crash_size, &crash_base, NULL, NULL);
 	if (ret == 0 && crash_size > 0) {
 		crashk_res.start = crash_base;
 		crashk_res.end = crash_base + crash_size - 1;
arch/powerpc/mm/nohash/kaslr_booke.c +1 -1
index 2fb3edafe9ab..b4f2786a7d2b 100644
@@ -178,7 +178,7 @@ static void __init get_crash_kernel(void *fdt, unsigned long size)
 	int ret;
 
 	ret = parse_crashkernel(boot_command_line, size, &crash_size,
-				&crash_base);
+				&crash_base, NULL, NULL);
 	if (ret != 0 || crash_size == 0)
 		return;
 	if (crash_base == 0)
arch/riscv/mm/init.c +1 -1
index e4c35ac2357f..a9ef0824f905 100644
@@ -1332,7 +1332,7 @@ static void __init reserve_crashkernel(void)
 	}
 
 	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
-				&crash_size, &crash_base);
+				&crash_size, &crash_base, NULL, NULL);
 	if (ret || !crash_size)
 		return;
 
arch/s390/kernel/setup.c +2 -2
index 00d76448319d..386a36181ceb 100644
@@ -625,8 +625,8 @@ static void __init reserve_crashkernel(void)
 	phys_addr_t low, high;
 	int rc;
 
-	rc = parse_crashkernel(boot_command_line, ident_map_size, &crash_size,
-			       &crash_base);
+	rc = parse_crashkernel(boot_command_line, ident_map_size,
+			       &crash_size, &crash_base, NULL, NULL);
 
 	crash_base = ALIGN(crash_base, KEXEC_CRASH_MEM_ALIGN);
 	crash_size = ALIGN(crash_size, KEXEC_CRASH_MEM_ALIGN);
arch/sh/kernel/machine_kexec.c +1 -1
index 223c14f44af7..fa3a7b36190a 100644
@@ -154,7 +154,7 @@ void __init reserve_crashkernel(void)
 	int ret;
 
 	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
-			&crash_size, &crash_base);
+			&crash_size, &crash_base, NULL, NULL);
 	if (ret == 0 && crash_size > 0) {
 		crashk_res.start = crash_base;
 		crashk_res.end = crash_base + crash_size - 1;
arch/x86/kernel/setup.c +2 -1
index fd975a4a5200..382c66d2cf71 100644
@@ -558,7 +558,8 @@ static void __init reserve_crashkernel(void)
 	total_mem = memblock_phys_mem_size();
 
 	/* crashkernel=XM */
-	ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base);
+	ret = parse_crashkernel(boot_command_line, total_mem,
+				&crash_size, &crash_base, NULL, NULL);
 	if (ret != 0 || crash_size <= 0) {
 		/* crashkernel=X,high */
 		ret = parse_crashkernel_high(boot_command_line, total_mem,
include/linux/crash_core.h +2 -1
index de62a722431e..2e76289699ff 100644
@@ -78,7 +78,8 @@ Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 void final_note(Elf_Word *buf);
 
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
+		unsigned long long *crash_size, unsigned long long *crash_base,
+		unsigned long long *low_size, bool *high);
 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base);
 int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
kernel/crash_core.c +12 -3
index f27b4e45d410..f6a5c219e2e1 100644
@@ -280,10 +280,19 @@ static int __init __parse_crashkernel(char *cmdline,
 int __init parse_crashkernel(char *cmdline,
 			     unsigned long long system_ram,
 			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
+			     unsigned long long *crash_base,
+			     unsigned long long *low_size,
+			     bool *high)
 {
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				NULL);
+	int ret;
+
+	/* crashkernel=X[@offset] */
+	ret = __parse_crashkernel(cmdline, system_ram, crash_size,
+				crash_base, NULL);
+	if (!high)
+		return ret;
+
+	return 0;
 }
 
 int __init parse_crashkernel_high(char *cmdline,
Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#3 lore raw

PATCH 3/8 include/linux/kexec.h: move down crash_core.h including

In reply to Baoquan He

Later generic macros related to crash_core will be added into <linux/crash_core.h>, and the corresponding arch specific macros will be added to override them if needed. And Kconfig option KEXEC_CORE selects CRASH_CORE. So move <linux/crash_core.h> including after <asm/kexec.h>.

And also move the crash_res|low_res and crash_notes delcarations after <linux/crash_core.h> including because they are all defined in kernel/kexec_core.c, and note_buf_t is definied in crash_core.h.

This is a preparation patch.

---
 include/linux/kexec.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
include/linux/kexec.h +7 -7
index 22b5cd24f581..8768fd9e2a66 100644
@@ -15,25 +15,25 @@
 
 #if !defined(__ASSEMBLY__)
 
-#include <linux/crash_core.h>
 #include <asm/io.h>
 #include <linux/range.h>
 
 #include <uapi/linux/kexec.h>
 #include <linux/verification.h>
 
-/* Location of a reserved region to hold the crash kernel.
- */
-extern struct resource crashk_res;
-extern struct resource crashk_low_res;
-extern note_buf_t __percpu *crash_notes;
-
 #ifdef CONFIG_KEXEC_CORE
 #include <linux/list.h>
 #include <linux/compat.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
 #include <asm/kexec.h>
+#include <linux/crash_core.h>
+
+/* Location of a reserved region to hold the crash kernel.
+ */
+extern struct resource crashk_res;
+extern struct resource crashk_low_res;
+extern note_buf_t __percpu *crash_notes;
 
 /* Verify architecture specific macros are defined */
 
Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#4 lore raw

PATCH 4/8 crash_core: change parse_crashkernel() to support crashkernel=,high|low parsing

In reply to Baoquan He

Now parse_crashkernel() is a real entry point for all kinds of crahskernel parsing on any architecture.

And wrap the crahskernel=,high|low handling inside CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION ifdeffery scope.

---
 include/linux/crash_core.h |  6 ++++++
 kernel/crash_core.c        | 28 +++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)
include/linux/crash_core.h +6 -0
index 2e76289699ff..85260bf4a734 100644
@@ -77,6 +77,12 @@ Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 			  void *data, size_t data_len);
 void final_note(Elf_Word *buf);
 
+#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
+#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
+#define DEFAULT_CRASH_KERNEL_LOW_SIZE  (128UL << 20)
+#endif
+#endif
+
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base,
 		unsigned long long *low_size, bool *high);
kernel/crash_core.c +27 -1
index f6a5c219e2e1..355b0ab5189c 100644
@@ -276,6 +276,9 @@ static int __init __parse_crashkernel(char *cmdline,
 /*
  * That function is the entry point for command line parsing and should be
  * called from the arch-specific code.
+ *
+ * If crashkernel=,high|low is supported on architecture, non-NULL values
+ * should be passed to parameters 'low_size' and 'high'.
  */
 int __init parse_crashkernel(char *cmdline,
 			     unsigned long long system_ram,
@@ -291,7 +294,30 @@ int __init parse_crashkernel(char *cmdline,
 				crash_base, NULL);
 	if (!high)
 		return ret;
-
+#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
+	else if (ret == -ENOENT) {
+		ret = __parse_crashkernel(cmdline, 0, crash_size,
+				crash_base, suffix_tbl[SUFFIX_HIGH]);
+		if (ret || !*crash_size)
+			return -1;
+
+		/*
+		 * crashkernel=Y,low can be specified or not, but invalid value
+		 * is not allowed.
+		 */
+		ret = __parse_crashkernel(cmdline, 0, low_size,
+				crash_base, suffix_tbl[SUFFIX_LOW]);
+		if (ret == -ENOENT)
+			*low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
+		else if (ret)
+			return -1;
+
+		*high = true;
+	} else if (ret || !*crash_size) {
+		/* The specified value is invalid */
+		return -1;
+	}
+#endif
 	return 0;
 }
 
Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#5 lore raw

PATCH 5/8 crash_core: add generic function to do reservation

In reply to Baoquan He

In architecture like x86_64, arm64 and riscv, they have vast virtual address space and usually have huge physical memory RAM. Their crashkernel reservation doesn't have to be limited under 4G RAM, but can be extended to the whole physical memory via crashkernel=,high support.

Now add function reserve_crashkernel_generic() to reserve crashkernel memory if users specify any case of kernel pamameters, like crashkernel=xM[@offset] or crashkernel=,high|low.

This is preparation to simplify code of crashkernel=,high support in architecutures.

---
 include/linux/crash_core.h |  34 ++++++++++--
 kernel/crash_core.c        | 109 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 136 insertions(+), 7 deletions(-)
include/linux/crash_core.h +28 -6
index 85260bf4a734..2f732493e922 100644
@@ -77,12 +77,6 @@ Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
 			  void *data, size_t data_len);
 void final_note(Elf_Word *buf);
 
-#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
-#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
-#define DEFAULT_CRASH_KERNEL_LOW_SIZE  (128UL << 20)
-#endif
-#endif
-
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base,
 		unsigned long long *low_size, bool *high);
@@ -91,4 +85,32 @@ int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
 int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base);
 
+#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
+#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
+#define DEFAULT_CRASH_KERNEL_LOW_SIZE	(128UL << 20)
+#endif
+#ifndef CRASH_ALIGN
+#define CRASH_ALIGN			SZ_2M
+#endif
+#ifndef CRASH_ADDR_LOW_MAX
+#define CRASH_ADDR_LOW_MAX		SZ_4G
+#endif
+#ifndef CRASH_ADDR_HIGH_MAX
+#define CRASH_ADDR_HIGH_MAX		memblock_end_of_DRAM()
+#endif
+
+void __init reserve_crashkernel_generic(char *cmdline,
+		unsigned long long crash_size,
+		unsigned long long crash_base,
+		unsigned long long crash_low_size,
+		bool high);
+#else
+static inline void __init reserve_crashkernel_generic(char *cmdline,
+		unsigned long long crash_size,
+		unsigned long long crash_base,
+		unsigned long long crash_low_size,
+		bool high)
+{}
+#endif
+
 #endif /* LINUX_CRASH_CORE_H */
kernel/crash_core.c +108 -1

125 lines not on this page · raw message

Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#8 lore raw

PATCH 6/8 arm64: kdump: use generic interface to simplify crashkernel reservation

In reply to Baoquan He

With the help of newly changed function parse_crashkernel() and generic reserve_crashkernel_generic(), crashkernel reservation can be simplified by steps:

1) Provide CRASH_ALIGN, CRASH_ADDR_LOW_MAX, CRASH_ADDR_HIGH_MAX and DEFAULT_CRASH_KERNEL_LOW_SIZE in <asm/kexec.h>;

2) Add arch_reserve_crashkernel() to call parse_crashkernel() and reserve_crashkernel_generic();

3) Add ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION Kconfig in arch/arm64/Kconfig.

The old reserve_crashkernel_low() and reserve_crashkernel() can be removed.

---
 arch/arm64/Kconfig             |   3 +
 arch/arm64/include/asm/kexec.h |   5 ++
 arch/arm64/mm/init.c           | 140 ++-------------------------------
 3 files changed, 16 insertions(+), 132 deletions(-)
arch/arm64/Kconfig +3 -0
index a2511b30d0f6..6739e7b456b9 100644
@@ -1481,6 +1481,9 @@ config KEXEC_FILE
 	  for kernel and initramfs as opposed to list of segments as
 	  accepted by previous system call.
 
+config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
+	def_bool CRASH_CORE
+
 config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on KEXEC_FILE
arch/arm64/include/asm/kexec.h +5 -0
index 9ac9572a3bbe..442fc13588a2 100644
@@ -132,4 +132,9 @@ extern int load_other_segments(struct kimage *image,
 
 #endif /* __ASSEMBLY__ */
 
+/* Current arm64 boot protocol requires 2MB alignment */
+#define CRASH_ALIGN                     SZ_2M
+
+#define CRASH_ADDR_LOW_MAX              arm64_dma_phys_limit
+#define CRASH_ADDR_HIGH_MAX             (PHYS_MASK + 1)
 #endif
arch/arm64/mm/init.c +8 -132

164 lines not on this page · raw message

Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#9 lore raw

PATCH 7/8 x86: kdump: use generic interface to simplify crashkernel reservation code

In reply to Baoquan He

With the help of newly changed function parse_crashkernel() and generic reserve_crashkernel_generic(), crashkernel reservation can be simplified by steps:

1) Provide CRASH_ALIGN, CRASH_ADDR_LOW_MAX, CRASH_ADDR_HIGH_MAX and DEFAULT_CRASH_KERNEL_LOW_SIZE in <asm/kexec.h>;

2) Add arch_reserve_crashkernel() to call parse_crashkernel() and reserve_crashkernel_generic(), and do the ARCH specific work if needed.

3) Add ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION Kconfig in arch/x86/Kconfig.

When adding DEFAULT_CRASH_KERNEL_LOW_SIZE, add crash_low_size_default() to calculate crashkernel low memory because x86_64 has special requirement.

The old reserve_crashkernel_low() and reserve_crashkernel() can be removed.

---
 arch/x86/Kconfig             |   3 +
 arch/x86/include/asm/kexec.h |  32 ++++++++
 arch/x86/kernel/setup.c      | 144 ++++-------------------------------
 3 files changed, 51 insertions(+), 128 deletions(-)
arch/x86/Kconfig +3 -0
index e36261b4ea14..31515b3ef55b 100644
@@ -2073,6 +2073,9 @@ config KEXEC_FILE
 config ARCH_HAS_KEXEC_PURGATORY
 	def_bool KEXEC_FILE
 
+config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
+	def_bool CRASH_CORE
+
 config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on KEXEC_FILE
arch/x86/include/asm/kexec.h +32 -0
index 5b77bbc28f96..84a7d1f6f153 100644
@@ -66,6 +66,37 @@ struct kimage;
 # define KEXEC_ARCH KEXEC_ARCH_X86_64
 #endif
 
+/*
+ * --------- Crashkernel reservation ------------------------------
+ */
+
+/* 16M alignment for crash kernel regions */
+#define CRASH_ALIGN             SZ_16M
+
+/*
+ * Keep the crash kernel below this limit.
+ *
+ * Earlier 32-bits kernels would limit the kernel to the low 512 MB range
+ * due to mapping restrictions.
+ *
+ * 64-bit kdump kernels need to be restricted to be under 64 TB, which is
+ * the upper limit of system RAM in 4-level paging mode. Since the kdump
+ * jump could be from 5-level paging to 4-level paging, the jump will fail if
+ * the kernel is put above 64 TB, and during the 1st kernel bootup there's
+ * no good way to detect the paging mode of the target kernel which will be
+ * loaded for dumping.
+ */
+
+#ifdef CONFIG_X86_32
+# define CRASH_ADDR_LOW_MAX     SZ_512M
+# define CRASH_ADDR_HIGH_MAX    SZ_512M
+#else
+# define CRASH_ADDR_LOW_MAX     SZ_4G
+# define CRASH_ADDR_HIGH_MAX    SZ_64T
+#endif
+
+# define DEFAULT_CRASH_KERNEL_LOW_SIZE crash_low_size_default()
+
 /*
  * This function is responsible for capturing register states if coming
  * via panic otherwise just fix up the ss and sp if coming via kernel
@@ -209,6 +240,7 @@ typedef void crash_vmclear_fn(void);
 extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss;
 extern void kdump_nmi_shootdown_cpus(void);
 
+extern unsigned long crash_low_size_default(void);
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_X86_KEXEC_H */
arch/x86/kernel/setup.c +16 -128

175 lines not on this page · raw message

Signature · 7 lines
2.41.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
author
#10 lore raw

PATCH 8/8 crash_core.c: remove unneeded functions

In reply to Baoquan He

So far, nobody calls functions parse_crashkernel_high() and parse_crashkernel_high(), remove both of them.

---
 include/linux/crash_core.h |  4 ----
 kernel/crash_core.c        | 18 ------------------
 2 files changed, 22 deletions(-)
include/linux/crash_core.h +0 -4
index 2f732493e922..0c512a80a768 100644
@@ -80,10 +80,6 @@ void final_note(Elf_Word *buf);
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base,
 		unsigned long long *low_size, bool *high);
-int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
-int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
 
 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
 #ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
kernel/crash_core.c +0 -18
index 6bc00cc390b5..61a8ea3b23a2 100644
@@ -323,24 +323,6 @@ int __init parse_crashkernel(char *cmdline,
 	return 0;
 }
 
-int __init parse_crashkernel_high(char *cmdline,
-			     unsigned long long system_ram,
-			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
-{
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				suffix_tbl[SUFFIX_HIGH]);
-}
-
-int __init parse_crashkernel_low(char *cmdline,
-			     unsigned long long system_ram,
-			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
-{
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				suffix_tbl[SUFFIX_LOW]);
-}
-
 /*
  * Add a dummy early_param handler to mark crashkernel= as a known command line
  * parameter and suppress incorrect warnings in init/main.c.
Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#6 lore raw

Re: [PATCH 5/8] crash_core: add generic function to do reservation

In reply to Baoquan He
kernel test robot noticed the following build errors:

Hi Baoquan,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/core]
[also build test ERROR on powerpc/next powerpc/fixes linus/master v6.5-rc7] [cannot apply to arm64/for-next/core next-20230825]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/crash_core-c-remove-unnecessary-parameter-of-function/20230827-181555
base:   tip/x86/core
patch link:    https://lore.kernel.org/r/20230827101128.70931-6-bhe%40redhat.com
patch subject: [PATCH 5/8] crash_core: add generic function to do reservation
config: csky-defconfig (https://download.01.org/0day-ci/archive/20230827/[email protected]/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230827/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

537 | void __weak arch_crash_save_vmcoreinfo(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/crash_core.c:540:20: warning: no previous prototype for 'paddr_vmcoreinfo_note' [-Wmissing-prototypes]
540 | phys_addr_t __weak paddr_vmcoreinfo_note(void)
| ^~~~~~~~~~~~~~~~~~~~~
kernel/crash_core.c: In function 'crash_save_vmcoreinfo_init':
kernel/crash_core.c:554:45: error: 'VMCOREINFO_NOTE_SIZE' undeclared (first use in this function)
554 | vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE,
| ^~~~~~~~~~~~~~~~~~~~
kernel/crash_core.c:563:9: error: implicit declaration of function 'VMCOREINFO_OSRELEASE' [-Werror=implicit-function-declaration]

     563 |         VMCOREINFO_OSRELEASE(init_uts_ns.name.release);
         |         ^~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:564:9: error: implicit declaration of function 'VMCOREINFO_BUILD_ID' [-Werror=implicit-function-declaration]
     564 |         VMCOREINFO_BUILD_ID();
         |         ^~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:565:9: error: implicit declaration of function 'VMCOREINFO_PAGESIZE' [-Werror=implicit-function-declaration]
     565 |         VMCOREINFO_PAGESIZE(PAGE_SIZE);
         |         ^~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:567:9: error: implicit declaration of function 'VMCOREINFO_SYMBOL' [-Werror=implicit-function-declaration]
     567 |         VMCOREINFO_SYMBOL(init_uts_ns);
         |         ^~~~~~~~~~~~~~~~~
   kernel/crash_core.c:568:9: error: implicit declaration of function 'VMCOREINFO_OFFSET' [-Werror=implicit-function-declaration]
     568 |         VMCOREINFO_OFFSET(uts_namespace, name);
         |         ^~~~~~~~~~~~~~~~~
   kernel/crash_core.c:568:27: error: 'uts_namespace' undeclared (first use in this function)
     568 |         VMCOREINFO_OFFSET(uts_namespace, name);
         |                           ^~~~~~~~~~~~~
   kernel/crash_core.c:568:42: error: 'name' undeclared (first use in this function)
     568 |         VMCOREINFO_OFFSET(uts_namespace, name);
         |                                          ^~~~
   kernel/crash_core.c:571:9: error: implicit declaration of function 'VMCOREINFO_SYMBOL_ARRAY' [-Werror=implicit-function-declaration]
     571 |         VMCOREINFO_SYMBOL_ARRAY(swapper_pg_dir);
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:588:9: error: implicit declaration of function 'VMCOREINFO_STRUCT_SIZE' [-Werror=implicit-function-declaration]
     588 |         VMCOREINFO_STRUCT_SIZE(page);
         |         ^~~~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:588:32: error: 'page' undeclared (first use in this function)
     588 |         VMCOREINFO_STRUCT_SIZE(page);
         |                                ^~~~
   kernel/crash_core.c:589:32: error: 'pglist_data' undeclared (first use in this function)
     589 |         VMCOREINFO_STRUCT_SIZE(pglist_data);
         |                                ^~~~~~~~~~~
   kernel/crash_core.c:590:32: error: 'zone' undeclared (first use in this function)
     590 |         VMCOREINFO_STRUCT_SIZE(zone);
         |                                ^~~~
   kernel/crash_core.c:591:32: error: 'free_area' undeclared (first use in this function)
     591 |         VMCOREINFO_STRUCT_SIZE(free_area);
         |                                ^~~~~~~~~
   kernel/crash_core.c:592:32: error: 'list_head' undeclared (first use in this function)
     592 |         VMCOREINFO_STRUCT_SIZE(list_head);
         |                                ^~~~~~~~~
   kernel/crash_core.c:593:9: error: implicit declaration of function 'VMCOREINFO_SIZE' [-Werror=implicit-function-declaration]
     593 |         VMCOREINFO_SIZE(nodemask_t);
         |         ^~~~~~~~~~~~~~~
   kernel/crash_core.c:593:25: error: expected expression before 'nodemask_t'
     593 |         VMCOREINFO_SIZE(nodemask_t);
         |                         ^~~~~~~~~~
   kernel/crash_core.c:594:33: error: 'flags' undeclared (first use in this function); did you mean 'fls'?
     594 |         VMCOREINFO_OFFSET(page, flags);
         |                                 ^~~~~
         |                                 fls
   kernel/crash_core.c:595:33: error: '_refcount' undeclared (first use in this function); did you mean 'seqcount'?
     595 |         VMCOREINFO_OFFSET(page, _refcount);
         |                                 ^~~~~~~~~
         |                                 seqcount
   kernel/crash_core.c:596:33: error: 'mapping' undeclared (first use in this function)
     596 |         VMCOREINFO_OFFSET(page, mapping);
         |                                 ^~~~~~~
   kernel/crash_core.c:597:33: error: 'lru' undeclared (first use in this function)
     597 |         VMCOREINFO_OFFSET(page, lru);
         |                                 ^~~
   kernel/crash_core.c:598:33: error: '_mapcount' undeclared (first use in this function); did you mean 'nmi_count'?
     598 |         VMCOREINFO_OFFSET(page, _mapcount);
         |                                 ^~~~~~~~~
         |                                 nmi_count
   kernel/crash_core.c:599:33: error: 'private' undeclared (first use in this function); did you mean 'PG_private'?
     599 |         VMCOREINFO_OFFSET(page, private);
         |                                 ^~~~~~~
         |                                 PG_private
   kernel/crash_core.c:600:27: error: 'folio' undeclared (first use in this function)
     600 |         VMCOREINFO_OFFSET(folio, _folio_dtor);
         |                           ^~~~~
   kernel/crash_core.c:600:34: error: '_folio_dtor' undeclared (first use in this function)
     600 |         VMCOREINFO_OFFSET(folio, _folio_dtor);
         |                                  ^~~~~~~~~~~
   kernel/crash_core.c:601:34: error: '_folio_order' undeclared (first use in this function); did you mean 'folio_order'?
     601 |         VMCOREINFO_OFFSET(folio, _folio_order);
         |                                  ^~~~~~~~~~~~
         |                                  folio_order
   kernel/crash_core.c:602:33: error: 'compound_head' undeclared (first use in this function); did you mean '_compound_head'?
     602 |         VMCOREINFO_OFFSET(page, compound_head);
         |                                 ^~~~~~~~~~~~~
         |                                 _compound_head
   kernel/crash_core.c:603:40: error: 'node_zones' undeclared (first use in this function); did you mean 'node_zonelist'?
     603 |         VMCOREINFO_OFFSET(pglist_data, node_zones);
         |                                        ^~~~~~~~~~
         |                                        node_zonelist
   kernel/crash_core.c:604:40: error: 'nr_zones' undeclared (first use in this function)
     604 |         VMCOREINFO_OFFSET(pglist_data, nr_zones);
         |                                        ^~~~~~~~
>> kernel/crash_core.c:606:40: error: 'node_mem_map' undeclared (first use in this function); did you mean 'node_remap'?
     606 |         VMCOREINFO_OFFSET(pglist_data, node_mem_map);
         |                                        ^~~~~~~~~~~~
         |                                        node_remap
   kernel/crash_core.c:608:40: error: 'node_start_pfn' undeclared (first use in this function)
     608 |         VMCOREINFO_OFFSET(pglist_data, node_start_pfn);
         |                                        ^~~~~~~~~~~~~~
   kernel/crash_core.c:609:40: error: 'node_spanned_pages' undeclared (first use in this function); did you mean 'zone_managed_pages'?
     609 |         VMCOREINFO_OFFSET(pglist_data, node_spanned_pages);
         |                                        ^~~~~~~~~~~~~~~~~~
         |                                        zone_managed_pages
   kernel/crash_core.c:610:40: error: 'node_id' undeclared (first use in this function)
     610 |         VMCOREINFO_OFFSET(pglist_data, node_id);
         |                                        ^~~~~~~
   kernel/crash_core.c:612:33: error: 'vm_stat' undeclared (first use in this function); did you mean 'vfs_stat'?
     612 |         VMCOREINFO_OFFSET(zone, vm_stat);
         |                                 ^~~~~~~
         |                                 vfs_stat
   kernel/crash_core.c:613:33: error: 'spanned_pages' undeclared (first use in this function); did you mean 'shake_page'?
     613 |         VMCOREINFO_OFFSET(zone, spanned_pages);
         |                                 ^~~~~~~~~~~~~
         |                                 shake_page
   kernel/crash_core.c:614:38: error: 'free_list' undeclared (first use in this function); did you mean 'kfree_link'?
     614 |         VMCOREINFO_OFFSET(free_area, free_list);
         |                                      ^~~~~~~~~
         |                                      kfree_link
   kernel/crash_core.c:615:38: error: 'next' undeclared (first use in this function); did you mean 'net'?
     615 |         VMCOREINFO_OFFSET(list_head, next);
         |                                      ^~~~
         |                                      net
   kernel/crash_core.c:616:38: error: 'prev' undeclared (first use in this function)
     616 |         VMCOREINFO_OFFSET(list_head, prev);
         |                                      ^~~~
   kernel/crash_core.c:617:27: error: 'vmap_area' undeclared (first use in this function)
     617 |         VMCOREINFO_OFFSET(vmap_area, va_start);
         |                           ^~~~~~~~~
   kernel/crash_core.c:617:38: error: 'va_start' undeclared (first use in this function); did you mean '_start'?
     617 |         VMCOREINFO_OFFSET(vmap_area, va_start);
         |                                      ^~~~~~~~
         |                                      _start
   kernel/crash_core.c:618:38: error: 'list' undeclared (first use in this function)
     618 |         VMCOREINFO_OFFSET(vmap_area, list);
         |                                      ^~~~
   kernel/crash_core.c:619:9: error: implicit declaration of function 'VMCOREINFO_LENGTH' [-Werror=implicit-function-declaration]
     619 |         VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER + 1);
         |         ^~~~~~~~~~~~~~~~~
   kernel/crash_core.c:622:9: error: implicit declaration of function 'VMCOREINFO_NUMBER' [-Werror=implicit-function-declaration]
     622 |         VMCOREINFO_NUMBER(NR_FREE_PAGES);
         |         ^~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +606 kernel/crash_core.c

692f66f26a4c19d Hari Bathini            2017-05-08  545  
692f66f26a4c19d Hari Bathini            2017-05-08  546  static int __init crash_save_vmcoreinfo_init(void)
692f66f26a4c19d Hari Bathini            2017-05-08  547  {
203e9e41219b4e7 Xunlei Pang             2017-07-12  548  	vmcoreinfo_data = (unsigned char *)get_zeroed_page(GFP_KERNEL);
203e9e41219b4e7 Xunlei Pang             2017-07-12  549  	if (!vmcoreinfo_data) {
203e9e41219b4e7 Xunlei Pang             2017-07-12  550  		pr_warn("Memory allocation for vmcoreinfo_data failed\n");
203e9e41219b4e7 Xunlei Pang             2017-07-12  551  		return -ENOMEM;
203e9e41219b4e7 Xunlei Pang             2017-07-12  552  	}
203e9e41219b4e7 Xunlei Pang             2017-07-12  553  
203e9e41219b4e7 Xunlei Pang             2017-07-12  554  	vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE,
203e9e41219b4e7 Xunlei Pang             2017-07-12  555  						GFP_KERNEL | __GFP_ZERO);
203e9e41219b4e7 Xunlei Pang             2017-07-12  556  	if (!vmcoreinfo_note) {
203e9e41219b4e7 Xunlei Pang             2017-07-12  557  		free_page((unsigned long)vmcoreinfo_data);
203e9e41219b4e7 Xunlei Pang             2017-07-12  558  		vmcoreinfo_data = NULL;
203e9e41219b4e7 Xunlei Pang             2017-07-12  559  		pr_warn("Memory allocation for vmcoreinfo_note failed\n");
203e9e41219b4e7 Xunlei Pang             2017-07-12  560  		return -ENOMEM;
203e9e41219b4e7 Xunlei Pang             2017-07-12  561  	}
203e9e41219b4e7 Xunlei Pang             2017-07-12  562  
692f66f26a4c19d Hari Bathini            2017-05-08  563  	VMCOREINFO_OSRELEASE(init_uts_ns.name.release);
44e8a5e9120bf4f Stephen Boyd            2021-07-07  564  	VMCOREINFO_BUILD_ID();
692f66f26a4c19d Hari Bathini            2017-05-08  565  	VMCOREINFO_PAGESIZE(PAGE_SIZE);
692f66f26a4c19d Hari Bathini            2017-05-08  566  
692f66f26a4c19d Hari Bathini            2017-05-08  567  	VMCOREINFO_SYMBOL(init_uts_ns);
ca4a9241cc5e718 Alexander Egorenkov     2020-12-15  568  	VMCOREINFO_OFFSET(uts_namespace, name);
692f66f26a4c19d Hari Bathini            2017-05-08  569  	VMCOREINFO_SYMBOL(node_online_map);
692f66f26a4c19d Hari Bathini            2017-05-08  570  #ifdef CONFIG_MMU
eff4345e7fba0aa Omar Sandoval           2018-08-21  571  	VMCOREINFO_SYMBOL_ARRAY(swapper_pg_dir);
692f66f26a4c19d Hari Bathini            2017-05-08  572  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  573  	VMCOREINFO_SYMBOL(_stext);
692f66f26a4c19d Hari Bathini            2017-05-08  574  	VMCOREINFO_SYMBOL(vmap_area_list);
692f66f26a4c19d Hari Bathini            2017-05-08  575  
a9ee6cf5c60ed10 Mike Rapoport           2021-06-28  576  #ifndef CONFIG_NUMA
692f66f26a4c19d Hari Bathini            2017-05-08  577  	VMCOREINFO_SYMBOL(mem_map);
692f66f26a4c19d Hari Bathini            2017-05-08  578  	VMCOREINFO_SYMBOL(contig_page_data);
692f66f26a4c19d Hari Bathini            2017-05-08  579  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  580  #ifdef CONFIG_SPARSEMEM
a0b1280368d1e91 Kirill A. Shutemov      2018-01-12  581  	VMCOREINFO_SYMBOL_ARRAY(mem_section);
692f66f26a4c19d Hari Bathini            2017-05-08  582  	VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS);
692f66f26a4c19d Hari Bathini            2017-05-08  583  	VMCOREINFO_STRUCT_SIZE(mem_section);
692f66f26a4c19d Hari Bathini            2017-05-08  584  	VMCOREINFO_OFFSET(mem_section, section_mem_map);
4f5aecdff25f59f Pingfan Liu             2021-06-15  585  	VMCOREINFO_NUMBER(SECTION_SIZE_BITS);
1d50e5d0c505244 Bhupesh Sharma          2020-05-14  586  	VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS);
692f66f26a4c19d Hari Bathini            2017-05-08  587  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  588  	VMCOREINFO_STRUCT_SIZE(page);
692f66f26a4c19d Hari Bathini            2017-05-08  589  	VMCOREINFO_STRUCT_SIZE(pglist_data);
692f66f26a4c19d Hari Bathini            2017-05-08  590  	VMCOREINFO_STRUCT_SIZE(zone);
692f66f26a4c19d Hari Bathini            2017-05-08  591  	VMCOREINFO_STRUCT_SIZE(free_area);
692f66f26a4c19d Hari Bathini            2017-05-08  592  	VMCOREINFO_STRUCT_SIZE(list_head);
692f66f26a4c19d Hari Bathini            2017-05-08  593  	VMCOREINFO_SIZE(nodemask_t);
692f66f26a4c19d Hari Bathini            2017-05-08  594  	VMCOREINFO_OFFSET(page, flags);
692f66f26a4c19d Hari Bathini            2017-05-08  595  	VMCOREINFO_OFFSET(page, _refcount);
692f66f26a4c19d Hari Bathini            2017-05-08  596  	VMCOREINFO_OFFSET(page, mapping);
692f66f26a4c19d Hari Bathini            2017-05-08  597  	VMCOREINFO_OFFSET(page, lru);
692f66f26a4c19d Hari Bathini            2017-05-08  598  	VMCOREINFO_OFFSET(page, _mapcount);
692f66f26a4c19d Hari Bathini            2017-05-08  599  	VMCOREINFO_OFFSET(page, private);
1c5509be58f636a Matthew Wilcox (Oracle  2023-01-11  600) 	VMCOREINFO_OFFSET(folio, _folio_dtor);
1c5509be58f636a Matthew Wilcox (Oracle  2023-01-11  601) 	VMCOREINFO_OFFSET(folio, _folio_order);
692f66f26a4c19d Hari Bathini            2017-05-08  602  	VMCOREINFO_OFFSET(page, compound_head);
692f66f26a4c19d Hari Bathini            2017-05-08  603  	VMCOREINFO_OFFSET(pglist_data, node_zones);
692f66f26a4c19d Hari Bathini            2017-05-08  604  	VMCOREINFO_OFFSET(pglist_data, nr_zones);
43b02ba93b25b1c Mike Rapoport           2021-06-28  605  #ifdef CONFIG_FLATMEM
692f66f26a4c19d Hari Bathini            2017-05-08 @606  	VMCOREINFO_OFFSET(pglist_data, node_mem_map);
692f66f26a4c19d Hari Bathini            2017-05-08  607  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  608  	VMCOREINFO_OFFSET(pglist_data, node_start_pfn);
692f66f26a4c19d Hari Bathini            2017-05-08  609  	VMCOREINFO_OFFSET(pglist_data, node_spanned_pages);
692f66f26a4c19d Hari Bathini            2017-05-08  610  	VMCOREINFO_OFFSET(pglist_data, node_id);
692f66f26a4c19d Hari Bathini            2017-05-08  611  	VMCOREINFO_OFFSET(zone, free_area);
692f66f26a4c19d Hari Bathini            2017-05-08  612  	VMCOREINFO_OFFSET(zone, vm_stat);
692f66f26a4c19d Hari Bathini            2017-05-08  613  	VMCOREINFO_OFFSET(zone, spanned_pages);
692f66f26a4c19d Hari Bathini            2017-05-08  614  	VMCOREINFO_OFFSET(free_area, free_list);
692f66f26a4c19d Hari Bathini            2017-05-08  615  	VMCOREINFO_OFFSET(list_head, next);
692f66f26a4c19d Hari Bathini            2017-05-08  616  	VMCOREINFO_OFFSET(list_head, prev);
692f66f26a4c19d Hari Bathini            2017-05-08  617  	VMCOREINFO_OFFSET(vmap_area, va_start);
692f66f26a4c19d Hari Bathini            2017-05-08  618  	VMCOREINFO_OFFSET(vmap_area, list);
23baf831a32c04f Kirill A. Shutemov      2023-03-15  619  	VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER + 1);
692f66f26a4c19d Hari Bathini            2017-05-08  620  	log_buf_vmcoreinfo_setup();
692f66f26a4c19d Hari Bathini            2017-05-08  621  	VMCOREINFO_LENGTH(free_area.free_list, MIGRATE_TYPES);
692f66f26a4c19d Hari Bathini            2017-05-08  622  	VMCOREINFO_NUMBER(NR_FREE_PAGES);
692f66f26a4c19d Hari Bathini            2017-05-08  623  	VMCOREINFO_NUMBER(PG_lru);
692f66f26a4c19d Hari Bathini            2017-05-08  624  	VMCOREINFO_NUMBER(PG_private);
692f66f26a4c19d Hari Bathini            2017-05-08  625  	VMCOREINFO_NUMBER(PG_swapcache);
1cbf29da3628b66 Petr Tesarik            2018-04-13  626  	VMCOREINFO_NUMBER(PG_swapbacked);
692f66f26a4c19d Hari Bathini            2017-05-08  627  	VMCOREINFO_NUMBER(PG_slab);
692f66f26a4c19d Hari Bathini            2017-05-08  628  #ifdef CONFIG_MEMORY_FAILURE
692f66f26a4c19d Hari Bathini            2017-05-08  629  	VMCOREINFO_NUMBER(PG_hwpoison);
692f66f26a4c19d Hari Bathini            2017-05-08  630  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  631  	VMCOREINFO_NUMBER(PG_head_mask);
6e292b9be7f4358 Matthew Wilcox          2018-06-07  632  #define PAGE_BUDDY_MAPCOUNT_VALUE	(~PG_buddy)
692f66f26a4c19d Hari Bathini            2017-05-08  633  	VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE);
692f66f26a4c19d Hari Bathini            2017-05-08  634  #ifdef CONFIG_HUGETLB_PAGE
692f66f26a4c19d Hari Bathini            2017-05-08  635  	VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR);
e04b742f74c2362 David Hildenbrand       2019-03-05  636  #define PAGE_OFFLINE_MAPCOUNT_VALUE	(~PG_offline)
e04b742f74c2362 David Hildenbrand       2019-03-05  637  	VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE);
692f66f26a4c19d Hari Bathini            2017-05-08  638  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  639  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#11 lore raw

Re: [PATCH 8/8] crash_core.c: remove unneeded functions

In reply to Baoquan He

Hi Baoquan,

Quoted 2 lines · Baoquan He

So far, nobody calls functions parse_crashkernel_high() and parse_crashkernel_high(), remove both of them.

minor typo: should be parse_crashkernel_low().

Regards,
Samuel

Quoted 40 lines
---
 include/linux/crash_core.h |  4 ----
 kernel/crash_core.c        | 18 ------------------
 2 files changed, 22 deletions(-)
include/linux/crash_core.h +0 -4
index 2f732493e922..0c512a80a768 100644
@@ -80,10 +80,6 @@ void final_note(Elf_Word *buf);
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base,
 		unsigned long long *low_size, bool *high);
-int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
-int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
 
 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
 #ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
kernel/crash_core.c +0 -11
index 6bc00cc390b5..61a8ea3b23a2 100644
@@ -323,24 +323,6 @@ int __init parse_crashkernel(char *cmdline,
 	return 0;
 }
 
-int __init parse_crashkernel_high(char *cmdline,
-			     unsigned long long system_ram,
-			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
-{
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				suffix_tbl[SUFFIX_HIGH]);
-}
-
-int __init parse_crashkernel_low(char *cmdline,
-			     unsigned long long system_ram,

kernel/crash_core.c int __init parse_crashkernel(char *cmdline, · line 328

Quoted 10 lines
kernel/crash_core.c +0 -7
-			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
-{
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				suffix_tbl[SUFFIX_LOW]);
-}
-
 /*
  * Add a dummy early_param handler to mark crashkernel= as a known command line
  * parameter and suppress incorrect warnings in init/main.c.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#12 lore raw

Re: [PATCH 8/8] crash_core.c: remove unneeded functions

Quoted 7 lines · Samuel Holland

Hi Baoquan,

Quoted 2 lines · Baoquan He

So far, nobody calls functions parse_crashkernel_high() and parse_crashkernel_high(), remove both of them.

minor typo: should be parse_crashkernel_low().

Good catch, will update. Thanks.

Quoted 43 lines
Quoted 43 lines
---
 include/linux/crash_core.h |  4 ----
 kernel/crash_core.c        | 18 ------------------
 2 files changed, 22 deletions(-)
include/linux/crash_core.h +0 -4
index 2f732493e922..0c512a80a768 100644
@@ -80,10 +80,6 @@ void final_note(Elf_Word *buf);
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base,
 		unsigned long long *low_size, bool *high);
-int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
-int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
-		unsigned long long *crash_size, unsigned long long *crash_base);
 
 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
 #ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
kernel/crash_core.c +0 -13
index 6bc00cc390b5..61a8ea3b23a2 100644
@@ -323,24 +323,6 @@ int __init parse_crashkernel(char *cmdline,
 	return 0;
 }
 
-int __init parse_crashkernel_high(char *cmdline,
-			     unsigned long long system_ram,
-			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
-{
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				suffix_tbl[SUFFIX_HIGH]);
-}
-
-int __init parse_crashkernel_low(char *cmdline,
-			     unsigned long long system_ram,
-			     unsigned long long *crash_size,
-			     unsigned long long *crash_base)
Quoted 9 lines

kernel/crash_core.c int __init parse_crashkernel(char *cmdline, · line 328

Quoted 8 lines
kernel/crash_core.c +0 -5
-{
-	return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
-				suffix_tbl[SUFFIX_LOW]);
-}
-
 /*
  * Add a dummy early_param handler to mark crashkernel= as a known command line
  * parameter and suppress incorrect warnings in init/main.c.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#7 lore raw

Re: [PATCH 5/8] crash_core: add generic function to do reservation

In reply to kernel test robot
Quoted 19 lines · kernel test robot

Hi Baoquan,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/core]
[also build test ERROR on powerpc/next powerpc/fixes linus/master v6.5-rc7] [cannot apply to arm64/for-next/core next-20230825]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/crash_core-c-remove-unnecessary-parameter-of-function/20230827-181555
base:   tip/x86/core
patch link:    https://lore.kernel.org/r/20230827101128.70931-6-bhe%40redhat.com
patch subject: [PATCH 5/8] crash_core: add generic function to do reservation
config: csky-defconfig (https://download.01.org/0day-ci/archive/20230827/[email protected]/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230827/[email protected]/reproduce)
Quoted 4 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Thanks for reporting this. The error is caused by patch 3:
[PATCH 3/8] include/linux/kexec.h: move down crash_core.h including

In this lkp's config, CONFIG_CRASH_CORE=y and CONFIG_KEXEC_CORE=n, the moving down of crash_core.h including will triger the error. I will think of another way to fix this.

Quoted 257 lines

All errors (new ones prefixed by >>):

537 | void __weak arch_crash_save_vmcoreinfo(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/crash_core.c:540:20: warning: no previous prototype for 'paddr_vmcoreinfo_note' [-Wmissing-prototypes]
540 | phys_addr_t __weak paddr_vmcoreinfo_note(void)
| ^~~~~~~~~~~~~~~~~~~~~
kernel/crash_core.c: In function 'crash_save_vmcoreinfo_init':

   kernel/crash_core.c:554:45: error: 'VMCOREINFO_NOTE_SIZE' undeclared (first use in this function)
     554 |         vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE,
         |                                             ^~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:563:9: error: implicit declaration of function 'VMCOREINFO_OSRELEASE' [-Werror=implicit-function-declaration]
     563 |         VMCOREINFO_OSRELEASE(init_uts_ns.name.release);
         |         ^~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:564:9: error: implicit declaration of function 'VMCOREINFO_BUILD_ID' [-Werror=implicit-function-declaration]
     564 |         VMCOREINFO_BUILD_ID();
         |         ^~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:565:9: error: implicit declaration of function 'VMCOREINFO_PAGESIZE' [-Werror=implicit-function-declaration]
     565 |         VMCOREINFO_PAGESIZE(PAGE_SIZE);
         |         ^~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:567:9: error: implicit declaration of function 'VMCOREINFO_SYMBOL' [-Werror=implicit-function-declaration]
     567 |         VMCOREINFO_SYMBOL(init_uts_ns);
         |         ^~~~~~~~~~~~~~~~~
   kernel/crash_core.c:568:9: error: implicit declaration of function 'VMCOREINFO_OFFSET' [-Werror=implicit-function-declaration]
     568 |         VMCOREINFO_OFFSET(uts_namespace, name);
         |         ^~~~~~~~~~~~~~~~~
   kernel/crash_core.c:568:27: error: 'uts_namespace' undeclared (first use in this function)
     568 |         VMCOREINFO_OFFSET(uts_namespace, name);
         |                           ^~~~~~~~~~~~~
   kernel/crash_core.c:568:42: error: 'name' undeclared (first use in this function)
     568 |         VMCOREINFO_OFFSET(uts_namespace, name);
         |                                          ^~~~
   kernel/crash_core.c:571:9: error: implicit declaration of function 'VMCOREINFO_SYMBOL_ARRAY' [-Werror=implicit-function-declaration]
     571 |         VMCOREINFO_SYMBOL_ARRAY(swapper_pg_dir);
         |         ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:588:9: error: implicit declaration of function 'VMCOREINFO_STRUCT_SIZE' [-Werror=implicit-function-declaration]
     588 |         VMCOREINFO_STRUCT_SIZE(page);
         |         ^~~~~~~~~~~~~~~~~~~~~~
   kernel/crash_core.c:588:32: error: 'page' undeclared (first use in this function)
     588 |         VMCOREINFO_STRUCT_SIZE(page);
         |                                ^~~~
   kernel/crash_core.c:589:32: error: 'pglist_data' undeclared (first use in this function)
     589 |         VMCOREINFO_STRUCT_SIZE(pglist_data);
         |                                ^~~~~~~~~~~
   kernel/crash_core.c:590:32: error: 'zone' undeclared (first use in this function)
     590 |         VMCOREINFO_STRUCT_SIZE(zone);
         |                                ^~~~
   kernel/crash_core.c:591:32: error: 'free_area' undeclared (first use in this function)
     591 |         VMCOREINFO_STRUCT_SIZE(free_area);
         |                                ^~~~~~~~~
   kernel/crash_core.c:592:32: error: 'list_head' undeclared (first use in this function)
     592 |         VMCOREINFO_STRUCT_SIZE(list_head);
         |                                ^~~~~~~~~
   kernel/crash_core.c:593:9: error: implicit declaration of function 'VMCOREINFO_SIZE' [-Werror=implicit-function-declaration]
     593 |         VMCOREINFO_SIZE(nodemask_t);
         |         ^~~~~~~~~~~~~~~
   kernel/crash_core.c:593:25: error: expected expression before 'nodemask_t'
     593 |         VMCOREINFO_SIZE(nodemask_t);
         |                         ^~~~~~~~~~
   kernel/crash_core.c:594:33: error: 'flags' undeclared (first use in this function); did you mean 'fls'?
     594 |         VMCOREINFO_OFFSET(page, flags);
         |                                 ^~~~~
         |                                 fls
   kernel/crash_core.c:595:33: error: '_refcount' undeclared (first use in this function); did you mean 'seqcount'?
     595 |         VMCOREINFO_OFFSET(page, _refcount);
         |                                 ^~~~~~~~~
         |                                 seqcount
   kernel/crash_core.c:596:33: error: 'mapping' undeclared (first use in this function)
     596 |         VMCOREINFO_OFFSET(page, mapping);
         |                                 ^~~~~~~
   kernel/crash_core.c:597:33: error: 'lru' undeclared (first use in this function)
     597 |         VMCOREINFO_OFFSET(page, lru);
         |                                 ^~~
   kernel/crash_core.c:598:33: error: '_mapcount' undeclared (first use in this function); did you mean 'nmi_count'?
     598 |         VMCOREINFO_OFFSET(page, _mapcount);
         |                                 ^~~~~~~~~
         |                                 nmi_count
   kernel/crash_core.c:599:33: error: 'private' undeclared (first use in this function); did you mean 'PG_private'?
     599 |         VMCOREINFO_OFFSET(page, private);
         |                                 ^~~~~~~
         |                                 PG_private
   kernel/crash_core.c:600:27: error: 'folio' undeclared (first use in this function)
     600 |         VMCOREINFO_OFFSET(folio, _folio_dtor);
         |                           ^~~~~
   kernel/crash_core.c:600:34: error: '_folio_dtor' undeclared (first use in this function)
     600 |         VMCOREINFO_OFFSET(folio, _folio_dtor);
         |                                  ^~~~~~~~~~~
   kernel/crash_core.c:601:34: error: '_folio_order' undeclared (first use in this function); did you mean 'folio_order'?
     601 |         VMCOREINFO_OFFSET(folio, _folio_order);
         |                                  ^~~~~~~~~~~~
         |                                  folio_order
   kernel/crash_core.c:602:33: error: 'compound_head' undeclared (first use in this function); did you mean '_compound_head'?
     602 |         VMCOREINFO_OFFSET(page, compound_head);
         |                                 ^~~~~~~~~~~~~
         |                                 _compound_head
   kernel/crash_core.c:603:40: error: 'node_zones' undeclared (first use in this function); did you mean 'node_zonelist'?
     603 |         VMCOREINFO_OFFSET(pglist_data, node_zones);
         |                                        ^~~~~~~~~~
         |                                        node_zonelist
   kernel/crash_core.c:604:40: error: 'nr_zones' undeclared (first use in this function)
     604 |         VMCOREINFO_OFFSET(pglist_data, nr_zones);
         |                                        ^~~~~~~~
Quoted 1 line
Quoted 1 line

kernel/crash_core.c:606:40: error: 'node_mem_map' undeclared (first use in this function); did you mean 'node_remap'?

     606 |         VMCOREINFO_OFFSET(pglist_data, node_mem_map);
         |                                        ^~~~~~~~~~~~
         |                                        node_remap
   kernel/crash_core.c:608:40: error: 'node_start_pfn' undeclared (first use in this function)
     608 |         VMCOREINFO_OFFSET(pglist_data, node_start_pfn);
         |                                        ^~~~~~~~~~~~~~
   kernel/crash_core.c:609:40: error: 'node_spanned_pages' undeclared (first use in this function); did you mean 'zone_managed_pages'?
     609 |         VMCOREINFO_OFFSET(pglist_data, node_spanned_pages);
         |                                        ^~~~~~~~~~~~~~~~~~
         |                                        zone_managed_pages
   kernel/crash_core.c:610:40: error: 'node_id' undeclared (first use in this function)
     610 |         VMCOREINFO_OFFSET(pglist_data, node_id);
         |                                        ^~~~~~~
   kernel/crash_core.c:612:33: error: 'vm_stat' undeclared (first use in this function); did you mean 'vfs_stat'?
     612 |         VMCOREINFO_OFFSET(zone, vm_stat);
         |                                 ^~~~~~~
         |                                 vfs_stat
   kernel/crash_core.c:613:33: error: 'spanned_pages' undeclared (first use in this function); did you mean 'shake_page'?
     613 |         VMCOREINFO_OFFSET(zone, spanned_pages);
         |                                 ^~~~~~~~~~~~~
         |                                 shake_page
   kernel/crash_core.c:614:38: error: 'free_list' undeclared (first use in this function); did you mean 'kfree_link'?
     614 |         VMCOREINFO_OFFSET(free_area, free_list);
         |                                      ^~~~~~~~~
         |                                      kfree_link
   kernel/crash_core.c:615:38: error: 'next' undeclared (first use in this function); did you mean 'net'?
     615 |         VMCOREINFO_OFFSET(list_head, next);
         |                                      ^~~~
         |                                      net
   kernel/crash_core.c:616:38: error: 'prev' undeclared (first use in this function)
     616 |         VMCOREINFO_OFFSET(list_head, prev);
         |                                      ^~~~
   kernel/crash_core.c:617:27: error: 'vmap_area' undeclared (first use in this function)
     617 |         VMCOREINFO_OFFSET(vmap_area, va_start);
         |                           ^~~~~~~~~
   kernel/crash_core.c:617:38: error: 'va_start' undeclared (first use in this function); did you mean '_start'?
     617 |         VMCOREINFO_OFFSET(vmap_area, va_start);
         |                                      ^~~~~~~~
         |                                      _start
   kernel/crash_core.c:618:38: error: 'list' undeclared (first use in this function)
     618 |         VMCOREINFO_OFFSET(vmap_area, list);
         |                                      ^~~~
   kernel/crash_core.c:619:9: error: implicit declaration of function 'VMCOREINFO_LENGTH' [-Werror=implicit-function-declaration]
     619 |         VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER + 1);
         |         ^~~~~~~~~~~~~~~~~
   kernel/crash_core.c:622:9: error: implicit declaration of function 'VMCOREINFO_NUMBER' [-Werror=implicit-function-declaration]
     622 |         VMCOREINFO_NUMBER(NR_FREE_PAGES);
         |         ^~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +606 kernel/crash_core.c

692f66f26a4c19d Hari Bathini            2017-05-08  545  
692f66f26a4c19d Hari Bathini            2017-05-08  546  static int __init crash_save_vmcoreinfo_init(void)
692f66f26a4c19d Hari Bathini            2017-05-08  547  {
203e9e41219b4e7 Xunlei Pang             2017-07-12  548  	vmcoreinfo_data = (unsigned char *)get_zeroed_page(GFP_KERNEL);
203e9e41219b4e7 Xunlei Pang             2017-07-12  549  	if (!vmcoreinfo_data) {
203e9e41219b4e7 Xunlei Pang             2017-07-12  550  		pr_warn("Memory allocation for vmcoreinfo_data failed\n");
203e9e41219b4e7 Xunlei Pang             2017-07-12  551  		return -ENOMEM;
203e9e41219b4e7 Xunlei Pang             2017-07-12  552  	}
203e9e41219b4e7 Xunlei Pang             2017-07-12  553  
203e9e41219b4e7 Xunlei Pang             2017-07-12  554  	vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE,
203e9e41219b4e7 Xunlei Pang             2017-07-12  555  						GFP_KERNEL | __GFP_ZERO);
203e9e41219b4e7 Xunlei Pang             2017-07-12  556  	if (!vmcoreinfo_note) {
203e9e41219b4e7 Xunlei Pang             2017-07-12  557  		free_page((unsigned long)vmcoreinfo_data);
203e9e41219b4e7 Xunlei Pang             2017-07-12  558  		vmcoreinfo_data = NULL;
203e9e41219b4e7 Xunlei Pang             2017-07-12  559  		pr_warn("Memory allocation for vmcoreinfo_note failed\n");
203e9e41219b4e7 Xunlei Pang             2017-07-12  560  		return -ENOMEM;
203e9e41219b4e7 Xunlei Pang             2017-07-12  561  	}
203e9e41219b4e7 Xunlei Pang             2017-07-12  562  
692f66f26a4c19d Hari Bathini            2017-05-08  563  	VMCOREINFO_OSRELEASE(init_uts_ns.name.release);
44e8a5e9120bf4f Stephen Boyd            2021-07-07  564  	VMCOREINFO_BUILD_ID();
692f66f26a4c19d Hari Bathini            2017-05-08  565  	VMCOREINFO_PAGESIZE(PAGE_SIZE);
692f66f26a4c19d Hari Bathini            2017-05-08  566  
692f66f26a4c19d Hari Bathini            2017-05-08  567  	VMCOREINFO_SYMBOL(init_uts_ns);
ca4a9241cc5e718 Alexander Egorenkov     2020-12-15  568  	VMCOREINFO_OFFSET(uts_namespace, name);
692f66f26a4c19d Hari Bathini            2017-05-08  569  	VMCOREINFO_SYMBOL(node_online_map);
692f66f26a4c19d Hari Bathini            2017-05-08  570  #ifdef CONFIG_MMU
eff4345e7fba0aa Omar Sandoval           2018-08-21  571  	VMCOREINFO_SYMBOL_ARRAY(swapper_pg_dir);
692f66f26a4c19d Hari Bathini            2017-05-08  572  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  573  	VMCOREINFO_SYMBOL(_stext);
692f66f26a4c19d Hari Bathini            2017-05-08  574  	VMCOREINFO_SYMBOL(vmap_area_list);
692f66f26a4c19d Hari Bathini            2017-05-08  575  
a9ee6cf5c60ed10 Mike Rapoport           2021-06-28  576  #ifndef CONFIG_NUMA
692f66f26a4c19d Hari Bathini            2017-05-08  577  	VMCOREINFO_SYMBOL(mem_map);
692f66f26a4c19d Hari Bathini            2017-05-08  578  	VMCOREINFO_SYMBOL(contig_page_data);
692f66f26a4c19d Hari Bathini            2017-05-08  579  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  580  #ifdef CONFIG_SPARSEMEM
a0b1280368d1e91 Kirill A. Shutemov      2018-01-12  581  	VMCOREINFO_SYMBOL_ARRAY(mem_section);
692f66f26a4c19d Hari Bathini            2017-05-08  582  	VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS);
692f66f26a4c19d Hari Bathini            2017-05-08  583  	VMCOREINFO_STRUCT_SIZE(mem_section);
692f66f26a4c19d Hari Bathini            2017-05-08  584  	VMCOREINFO_OFFSET(mem_section, section_mem_map);
4f5aecdff25f59f Pingfan Liu             2021-06-15  585  	VMCOREINFO_NUMBER(SECTION_SIZE_BITS);
1d50e5d0c505244 Bhupesh Sharma          2020-05-14  586  	VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS);
692f66f26a4c19d Hari Bathini            2017-05-08  587  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  588  	VMCOREINFO_STRUCT_SIZE(page);
692f66f26a4c19d Hari Bathini            2017-05-08  589  	VMCOREINFO_STRUCT_SIZE(pglist_data);
692f66f26a4c19d Hari Bathini            2017-05-08  590  	VMCOREINFO_STRUCT_SIZE(zone);
692f66f26a4c19d Hari Bathini            2017-05-08  591  	VMCOREINFO_STRUCT_SIZE(free_area);
692f66f26a4c19d Hari Bathini            2017-05-08  592  	VMCOREINFO_STRUCT_SIZE(list_head);
692f66f26a4c19d Hari Bathini            2017-05-08  593  	VMCOREINFO_SIZE(nodemask_t);
692f66f26a4c19d Hari Bathini            2017-05-08  594  	VMCOREINFO_OFFSET(page, flags);
692f66f26a4c19d Hari Bathini            2017-05-08  595  	VMCOREINFO_OFFSET(page, _refcount);
692f66f26a4c19d Hari Bathini            2017-05-08  596  	VMCOREINFO_OFFSET(page, mapping);
692f66f26a4c19d Hari Bathini            2017-05-08  597  	VMCOREINFO_OFFSET(page, lru);
692f66f26a4c19d Hari Bathini            2017-05-08  598  	VMCOREINFO_OFFSET(page, _mapcount);
692f66f26a4c19d Hari Bathini            2017-05-08  599  	VMCOREINFO_OFFSET(page, private);
1c5509be58f636a Matthew Wilcox (Oracle  2023-01-11  600) 	VMCOREINFO_OFFSET(folio, _folio_dtor);
1c5509be58f636a Matthew Wilcox (Oracle  2023-01-11  601) 	VMCOREINFO_OFFSET(folio, _folio_order);
692f66f26a4c19d Hari Bathini            2017-05-08  602  	VMCOREINFO_OFFSET(page, compound_head);
692f66f26a4c19d Hari Bathini            2017-05-08  603  	VMCOREINFO_OFFSET(pglist_data, node_zones);
692f66f26a4c19d Hari Bathini            2017-05-08  604  	VMCOREINFO_OFFSET(pglist_data, nr_zones);
43b02ba93b25b1c Mike Rapoport           2021-06-28  605  #ifdef CONFIG_FLATMEM
692f66f26a4c19d Hari Bathini            2017-05-08 @606  	VMCOREINFO_OFFSET(pglist_data, node_mem_map);
692f66f26a4c19d Hari Bathini            2017-05-08  607  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  608  	VMCOREINFO_OFFSET(pglist_data, node_start_pfn);
692f66f26a4c19d Hari Bathini            2017-05-08  609  	VMCOREINFO_OFFSET(pglist_data, node_spanned_pages);
692f66f26a4c19d Hari Bathini            2017-05-08  610  	VMCOREINFO_OFFSET(pglist_data, node_id);
692f66f26a4c19d Hari Bathini            2017-05-08  611  	VMCOREINFO_OFFSET(zone, free_area);
692f66f26a4c19d Hari Bathini            2017-05-08  612  	VMCOREINFO_OFFSET(zone, vm_stat);
692f66f26a4c19d Hari Bathini            2017-05-08  613  	VMCOREINFO_OFFSET(zone, spanned_pages);
692f66f26a4c19d Hari Bathini            2017-05-08  614  	VMCOREINFO_OFFSET(free_area, free_list);
692f66f26a4c19d Hari Bathini            2017-05-08  615  	VMCOREINFO_OFFSET(list_head, next);
692f66f26a4c19d Hari Bathini            2017-05-08  616  	VMCOREINFO_OFFSET(list_head, prev);
692f66f26a4c19d Hari Bathini            2017-05-08  617  	VMCOREINFO_OFFSET(vmap_area, va_start);
692f66f26a4c19d Hari Bathini            2017-05-08  618  	VMCOREINFO_OFFSET(vmap_area, list);
23baf831a32c04f Kirill A. Shutemov      2023-03-15  619  	VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER + 1);
692f66f26a4c19d Hari Bathini            2017-05-08  620  	log_buf_vmcoreinfo_setup();
692f66f26a4c19d Hari Bathini            2017-05-08  621  	VMCOREINFO_LENGTH(free_area.free_list, MIGRATE_TYPES);
692f66f26a4c19d Hari Bathini            2017-05-08  622  	VMCOREINFO_NUMBER(NR_FREE_PAGES);
692f66f26a4c19d Hari Bathini            2017-05-08  623  	VMCOREINFO_NUMBER(PG_lru);
692f66f26a4c19d Hari Bathini            2017-05-08  624  	VMCOREINFO_NUMBER(PG_private);
692f66f26a4c19d Hari Bathini            2017-05-08  625  	VMCOREINFO_NUMBER(PG_swapcache);
1cbf29da3628b66 Petr Tesarik            2018-04-13  626  	VMCOREINFO_NUMBER(PG_swapbacked);
692f66f26a4c19d Hari Bathini            2017-05-08  627  	VMCOREINFO_NUMBER(PG_slab);
692f66f26a4c19d Hari Bathini            2017-05-08  628  #ifdef CONFIG_MEMORY_FAILURE
692f66f26a4c19d Hari Bathini            2017-05-08  629  	VMCOREINFO_NUMBER(PG_hwpoison);
692f66f26a4c19d Hari Bathini            2017-05-08  630  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  631  	VMCOREINFO_NUMBER(PG_head_mask);
6e292b9be7f4358 Matthew Wilcox          2018-06-07  632  #define PAGE_BUDDY_MAPCOUNT_VALUE	(~PG_buddy)
692f66f26a4c19d Hari Bathini            2017-05-08  633  	VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE);
692f66f26a4c19d Hari Bathini            2017-05-08  634  #ifdef CONFIG_HUGETLB_PAGE
692f66f26a4c19d Hari Bathini            2017-05-08  635  	VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR);
e04b742f74c2362 David Hildenbrand       2019-03-05  636  #define PAGE_OFFLINE_MAPCOUNT_VALUE	(~PG_offline)
e04b742f74c2362 David Hildenbrand       2019-03-05  637  	VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE);
692f66f26a4c19d Hari Bathini            2017-05-08  638  #endif
692f66f26a4c19d Hari Bathini            2017-05-08  639  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki