Skip to content

Commit 55a20ee

Browse files
Yinghai LuH. Peter Anvin
authored andcommitted
x86, kdump: Retore crashkernel= to allocate under 896M
Vivek found old kexec-tools does not work new kernel anymore. So change back crashkernel= back to old behavoir, and add crashkernel_high= to let user decide if buffer could be above 4G, and also new kexec-tools will be needed. -v2: let crashkernel=X override crashkernel_high= update description about _high will be ignored by crashkernel=X -v3: update description about kernel-parameters.txt according to Vivek. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/1366089828-19692-4-git-send-email-yinghai@kernel.org Acked-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent c729de8 commit 55a20ee

4 files changed

Lines changed: 41 additions & 7 deletions

File tree

‎Documentation/kernel-parameters.txt‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,16 +603,25 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
603603
a memory unit (amount[KMG]). See also
604604
Documentation/kdump/kdump.txt for an example.
605605

606+
crashkernel_high=size[KMG]
607+
[KNL, x86_64] range could be above 4G. Allow kernel
608+
to allocate physical memory region from top, so could
609+
be above 4G if system have more than 4G ram installed.
610+
Otherwise memory region will be allocated below 4G, if
611+
available.
612+
It will be ignored if crashkernel=X is specified.
606613
crashkernel_low=size[KMG]
607-
[KNL, x86_64] range under 4G. When crashkernel= is
608-
passed, kernel allocate physical memory region
614+
[KNL, x86_64] range under 4G. When crashkernel_high= is
615+
passed, kernel could allocate physical memory region
609616
above 4G, that cause second kernel crash on system
610617
that require some amount of low memory, e.g. swiotlb
611618
requires at least 64M+32K low memory. Kernel would
612619
try to allocate 72M below 4G automatically.
613620
This one let user to specify own low range under 4G
614621
for second kernel instead.
615622
0: to disable low allocation.
623+
It will be ignored when crashkernel_high=X is not used
624+
or memory reserved is below 4G.
616625

617626
cs89x0_dma= [HW,NET]
618627
Format: <dma>

‎arch/x86/kernel/setup.c‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,14 @@ static void __init memblock_x86_reserve_range_setup_data(void)
507507
/*
508508
* Keep the crash kernel below this limit. On 32 bits earlier kernels
509509
* would limit the kernel to the low 512 MiB due to mapping restrictions.
510+
* On 64bit, old kexec-tools need to under 896MiB.
510511
*/
511512
#ifdef CONFIG_X86_32
512-
# define CRASH_KERNEL_ADDR_MAX (512 << 20)
513+
# define CRASH_KERNEL_ADDR_LOW_MAX (512 << 20)
514+
# define CRASH_KERNEL_ADDR_HIGH_MAX (512 << 20)
513515
#else
514-
# define CRASH_KERNEL_ADDR_MAX MAXMEM
516+
# define CRASH_KERNEL_ADDR_LOW_MAX (896UL<<20)
517+
# define CRASH_KERNEL_ADDR_HIGH_MAX MAXMEM
515518
#endif
516519

517520
static void __init reserve_crashkernel_low(void)
@@ -525,6 +528,7 @@ static void __init reserve_crashkernel_low(void)
525528
int ret;
526529

527530
total_low_mem = memblock_mem_size(1UL<<(32-PAGE_SHIFT));
531+
/* crashkernel_low=YM */
528532
ret = parse_crashkernel_low(boot_command_line, total_low_mem,
529533
&low_size, &base);
530534
if (ret != 0) {
@@ -569,22 +573,32 @@ static void __init reserve_crashkernel(void)
569573
const unsigned long long alignment = 16<<20; /* 16M */
570574
unsigned long long total_mem;
571575
unsigned long long crash_size, crash_base;
576+
bool high = false;
572577
int ret;
573578

574579
total_mem = memblock_phys_mem_size();
575580

581+
/* crashkernel=XM */
576582
ret = parse_crashkernel(boot_command_line, total_mem,
577583
&crash_size, &crash_base);
578-
if (ret != 0 || crash_size <= 0)
579-
return;
584+
if (ret != 0 || crash_size <= 0) {
585+
/* crashkernel_high=XM */
586+
ret = parse_crashkernel_high(boot_command_line, total_mem,
587+
&crash_size, &crash_base);
588+
if (ret != 0 || crash_size <= 0)
589+
return;
590+
high = true;
591+
}
580592

581593
/* 0 means: find the address automatically */
582594
if (crash_base <= 0) {
583595
/*
584596
* kexec want bzImage is below CRASH_KERNEL_ADDR_MAX
585597
*/
586598
crash_base = memblock_find_in_range(alignment,
587-
CRASH_KERNEL_ADDR_MAX, crash_size, alignment);
599+
high ? CRASH_KERNEL_ADDR_HIGH_MAX :
600+
CRASH_KERNEL_ADDR_LOW_MAX,
601+
crash_size, alignment);
588602

589603
if (!crash_base) {
590604
pr_info("crashkernel reservation failed - No suitable area found.\n");

‎include/linux/kexec.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ extern size_t vmcoreinfo_max_size;
200200

201201
int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
202202
unsigned long long *crash_size, unsigned long long *crash_base);
203+
int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
204+
unsigned long long *crash_size, unsigned long long *crash_base);
203205
int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
204206
unsigned long long *crash_size, unsigned long long *crash_base);
205207
int crash_shrink_memory(unsigned long new_size);

‎kernel/kexec.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,15 @@ int __init parse_crashkernel(char *cmdline,
14221422
"crashkernel=");
14231423
}
14241424

1425+
int __init parse_crashkernel_high(char *cmdline,
1426+
unsigned long long system_ram,
1427+
unsigned long long *crash_size,
1428+
unsigned long long *crash_base)
1429+
{
1430+
return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base,
1431+
"crashkernel_high=");
1432+
}
1433+
14251434
int __init parse_crashkernel_low(char *cmdline,
14261435
unsigned long long system_ram,
14271436
unsigned long long *crash_size,

0 commit comments

Comments
 (0)