From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ihcQ8-0006ds-Tv for kexec@lists.infradead.org; Wed, 18 Dec 2019 16:43:34 +0000 Received: by mail-qv1-xf41.google.com with SMTP id t6so1004595qvs.5 for ; Wed, 18 Dec 2019 08:43:32 -0800 (PST) From: Masayoshi Mizuma Subject: [PATCH v3 3/3] arm64: kdump: deal with a lot of resource entries in /proc/iomem Date: Wed, 18 Dec 2019 11:42:32 -0500 Message-Id: <20191218164232.6086-4-msys.mizuma@gmail.com> In-Reply-To: <20191218164232.6086-1-msys.mizuma@gmail.com> References: <20191218164232.6086-1-msys.mizuma@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: kexec mailing list , Simon Horman Cc: AKASHI Takahiro , Bhupesh Sharma , Masayoshi Mizuma , James Morse From: AKASHI Takahiro 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 --- kexec/arch/arm64/crashdump-arm64.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c index 4fd7aa8..38d1a0f 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; @@ -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) @@ -135,9 +130,9 @@ static int crash_get_memory_ranges(void) dbgprint_mem_range("Reserved memory range", &crash_reserved_mem, 1); - if (mem_regions_exclude(&system_memory_rgns, &crash_reserved_mem)) { - 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)) { + fprintf(stderr, "Cannot allocate memory for ranges\n"); return -ENOMEM; } -- 2.18.1 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec