diff --git a/arm64-kdump-deal-with-a-lot-of-resource-entries-in-p.patch b/arm64-kdump-deal-with-a-lot-of-resource-entries-in-p.patch new file mode 100644 index 0000000000000000000000000000000000000000..21b7d3aad7dfbc76ec97077d15b6638857f4bf53 --- /dev/null +++ b/arm64-kdump-deal-with-a-lot-of-resource-entries-in-p.patch @@ -0,0 +1,81 @@ +From d940fc2f069f97226c7ec205a454e4cbf8aff631 Mon Sep 17 00:00:00 2001 +From: AKASHI Takahiro +Date: Wed, 18 Dec 2019 11:42:32 -0500 +Subject: [PATCH] arm64: kdump: deal with a lot of resource entries in + /proc/iomem + +As described in the commit ("arm64: kexec: allocate memory space avoiding +reserved regions"), /proc/iomem now has a lot of "reserved" entries, and +it's not just enough to have a fixed size of memory range array. + +With this patch, kdump is allowed to handle arbitrary number of memory +ranges, using mem_regions_alloc_and_xxx() functions. + +Signed-off-by: AKASHI Takahiro +Tested-by: Bhupesh Sharma +Tested-by: Masayoshi Mizuma +Signed-off-by: Simon Horman +--- + kexec/arch/arm64/crashdump-arm64.c | 24 +++++++++--------------- + 1 file changed, 9 insertions(+), 15 deletions(-) + +diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c +index 158e778..bc7fada 100644 +--- a/kexec/arch/arm64/crashdump-arm64.c ++++ b/kexec/arch/arm64/crashdump-arm64.c +@@ -23,13 +23,8 @@ + #include "kexec-elf.h" + #include "mem_regions.h" + +-/* memory ranges on crashed kernel */ +-static struct memory_range system_memory_ranges[CRASH_MAX_MEMORY_RANGES]; +-static struct memory_ranges system_memory_rgns = { +- .size = 0, +- .max_size = CRASH_MAX_MEMORY_RANGES, +- .ranges = system_memory_ranges, +-}; ++/* memory ranges of crashed kernel */ ++static struct memory_ranges system_memory_rgns; + + /* memory range reserved for crashkernel */ + struct memory_range crash_reserved_mem[CRASH_MAX_RESERVED_RANGES]; +@@ -82,7 +77,7 @@ static uint64_t get_kernel_page_offset(void) + * + * This function is called once for each memory region found in /proc/iomem. + * It locates system RAM and crashkernel reserved memory and places these to +- * variables, respectively, system_memory_ranges and crash_reserved_mem. ++ * variables, respectively, system_memory_rgns and usablemem_rgns. + */ + + static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr), +@@ -90,11 +85,11 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr), + unsigned long long length) + { + if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0) +- return mem_regions_add(&usablemem_rgns, +- base, length, RANGE_RAM); ++ return mem_regions_alloc_and_add(&usablemem_rgns, ++ base, length, RANGE_RAM); + else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0) +- return mem_regions_add(&system_memory_rgns, +- base, length, RANGE_RAM); ++ return mem_regions_alloc_and_add(&system_memory_rgns, ++ base, length, RANGE_RAM); + else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0) + elf_info.kern_paddr_start = base; + else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0) +@@ -139,9 +134,8 @@ static int crash_get_memory_ranges(void) + usablemem_rgns.ranges, usablemem_rgns.size); + + for (i = 0; i < usablemem_rgns.size; i++) { +- if (mem_regions_exclude(&system_memory_rgns, &crash_reserved_mem[i])) { +- fprintf(stderr, +- "Error: Number of crash memory ranges excedeed the max limit\n"); ++ if (mem_regions_alloc_and_exclude(&system_memory_rgns, &crash_reserved_mem[i])) { ++ fprintf(stderr, "Cannot allocate memory for ranges\n"); + return -ENOMEM; + } + } +-- +1.8.3.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index eaf938561c0b513ba9de836fb52df7b0e294c2dc..285f7048cf6dbd43ad8f1d9e884188067ba38d33 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -4,7 +4,7 @@ Name: kexec-tools Version: 2.0.20 -Release: 16 +Release: 17 License: GPLv2+ Summary: The kexec/kdump userspace component URL: https://www.kernel.org/ @@ -89,6 +89,7 @@ Patch10: fix-header-offset-overflow-when-large-pfn.patch Patch11: kexec-Add-quick-kexec-support.patch %ifarch aarch64 Patch12: kexec-Quick-kexec-implementation-for-arm64.patch +Patch13: arm64-kdump-deal-with-a-lot-of-resource-entries-in-p.patch %endif %description @@ -130,6 +131,7 @@ tar -z -x -v -f %{SOURCE19} %patch11 -p1 %ifarch aarch64 %patch12 -p1 +%patch13 -p1 %endif %build @@ -316,6 +318,9 @@ done %endif %changelog +* Mon Apr 25 2022 wangbin - 2.0.20-17 +- arm64: kdump: deal with a lot of resource entries in /proc/iomem + * Wed Apr 28 2021 snoweay - 2.0.20-16 - Fix bug of license to GPLv2+