aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/machine_kexec_file.c
diff options
context:
space:
mode:
authorGravatar Chen Zhou <chenzhou10@huawei.com> 2022-05-06 19:43:59 +0800
committerGravatar Catalin Marinas <catalin.marinas@arm.com> 2022-05-07 19:54:33 +0100
commit944a45abfabc171fd121315ff0d5e62b11cb5d6f (patch)
treebceddfe1948986284e9ff090b6e695cf2e07ef4d /arch/arm64/kernel/machine_kexec_file.c
parentarm64: Use insert_resource() to simplify code (diff)
downloadlinux-944a45abfabc171fd121315ff0d5e62b11cb5d6f.tar.gz
linux-944a45abfabc171fd121315ff0d5e62b11cb5d6f.tar.bz2
linux-944a45abfabc171fd121315ff0d5e62b11cb5d6f.zip
arm64: kdump: Reimplement crashkernel=X
There are following issues in arm64 kdump: 1. We use crashkernel=X to reserve crashkernel in DMA zone, which will fail when there is not enough low memory. 2. If reserving crashkernel above DMA zone, in this case, crash dump kernel will fail to boot because there is no low memory available for allocation. To solve these issues, introduce crashkernel=X,[high,low]. The "crashkernel=X,high" is used to select a region above DMA zone, and the "crashkernel=Y,low" is used to allocate specified size low memory. Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Co-developed-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Link: https://lore.kernel.org/r/20220506114402.365-4-thunder.leizhen@huawei.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/machine_kexec_file.c')
-rw-r--r--arch/arm64/kernel/machine_kexec_file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c
index 59c648d51848..889951291cc0 100644
--- a/arch/arm64/kernel/machine_kexec_file.c
+++ b/arch/arm64/kernel/machine_kexec_file.c
@@ -65,10 +65,18 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
/* Exclude crashkernel region */
ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end);
+ if (ret)
+ goto out;
+
+ if (crashk_low_res.end) {
+ ret = crash_exclude_mem_range(cmem, crashk_low_res.start, crashk_low_res.end);
+ if (ret)
+ goto out;
+ }
- if (!ret)
- ret = crash_prepare_elf64_headers(cmem, true, addr, sz);
+ ret = crash_prepare_elf64_headers(cmem, true, addr, sz);
+out:
kfree(cmem);
return ret;
}