提交 61603016 编写于 作者: R Russell King

ARM: kexec: fix crashkernel= handling

When the kernel crashkernel parameter is specified with just a size, we
are supposed to allocate a region from RAM to store the crashkernel.
However, ARM merely reserves physical address zero with no checking that
there is even RAM there.

Fix this by lifting similar code from x86, importing it to ARM with the
ARM specific parameters added.  In the absence of any platform specific
information, we allocate the crashkernel region from the first 512MB of
physical memory.

Update the kdump documentation to reflect this change.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: NPratyush Anand <panand@redhat.com>
上级 f55532a0
...@@ -263,12 +263,6 @@ The syntax is: ...@@ -263,12 +263,6 @@ The syntax is:
crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
range=start-[end] range=start-[end]
Please note, on arm, the offset is required.
crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset
range=start-[end]
'start' is inclusive and 'end' is exclusive.
For example: For example:
crashkernel=512M-2G:64M,2G-:128M crashkernel=512M-2G:64M,2G-:128M
...@@ -307,10 +301,9 @@ Boot into System Kernel ...@@ -307,10 +301,9 @@ Boot into System Kernel
on the memory consumption of the kdump system. In general this is not on the memory consumption of the kdump system. In general this is not
dependent on the memory size of the production system. dependent on the memory size of the production system.
On arm, use "crashkernel=Y@X". Note that the start address of the kernel On arm, the use of "crashkernel=Y@X" is no longer necessary; the
will be aligned to 128MiB (0x08000000), so if the start address is not then kernel will automatically locate the crash kernel image within the
any space below the alignment point may be overwritten by the dump-capture kernel, first 512MB of RAM if X is not given.
which means it is possible that the vmcore is not that precise as expected.
Load the Dump-capture Kernel Load the Dump-capture Kernel
......
...@@ -938,6 +938,13 @@ static int __init init_machine_late(void) ...@@ -938,6 +938,13 @@ static int __init init_machine_late(void)
late_initcall(init_machine_late); late_initcall(init_machine_late);
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
/*
* The crash region must be aligned to 128MB to avoid
* zImage relocating below the reserved region.
*/
#define CRASH_ALIGN (128 << 20)
#define CRASH_ADDR_MAX (PHYS_OFFSET + (512 << 20))
static inline unsigned long long get_total_mem(void) static inline unsigned long long get_total_mem(void)
{ {
unsigned long total; unsigned long total;
...@@ -965,6 +972,28 @@ static void __init reserve_crashkernel(void) ...@@ -965,6 +972,28 @@ static void __init reserve_crashkernel(void)
if (ret) if (ret)
return; return;
if (crash_base <= 0) {
unsigned long long crash_max = CRASH_ADDR_MAX;
if (crash_max > (u32)~0)
crash_max = (u32)~0;
crash_base = memblock_find_in_range(CRASH_ALIGN, crash_max,
crash_size, CRASH_ALIGN);
if (!crash_base) {
pr_err("crashkernel reservation failed - No suitable area found.\n");
return;
}
} else {
unsigned long long start;
start = memblock_find_in_range(crash_base,
crash_base + crash_size,
crash_size, SECTION_SIZE);
if (start != crash_base) {
pr_err("crashkernel reservation failed - memory is in use.\n");
return;
}
}
ret = memblock_reserve(crash_base, crash_size); ret = memblock_reserve(crash_base, crash_size);
if (ret < 0) { if (ret < 0) {
pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n", pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册