diff options
author | Corey Minyard <cminyard@mvista.com> | 2013-02-12 14:41:48 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-02-19 03:36:23 -0500 |
commit | 4893fc8856a81d2037c1c976cb320be6f00e84a0 (patch) | |
tree | cb7b5d9c47f65193a5dbc62ccc80d22484d7ad77 /arch/mips | |
parent | d3ff9338023236f39332b07b3afed76c490a5041 (diff) |
mips: reserve elfcorehdr
/proc/vmcore wasn't showing up in kdump kernels. It turns that that
for Octeon, the memory used by elfcorehdr wasn't being set aside
properly and it was getting clobbered before /proc/vmcore could get
it. So reserve the memory if it shows up in a memory area managed
by the kernel.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/4936/
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/setup.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 53462500c3cd..795f4379c0b6 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -480,6 +480,37 @@ static int __init early_parse_mem(char *p) | |||
480 | } | 480 | } |
481 | early_param("mem", early_parse_mem); | 481 | early_param("mem", early_parse_mem); |
482 | 482 | ||
483 | #ifdef CONFIG_PROC_VMCORE | ||
484 | unsigned long setup_elfcorehdr, setup_elfcorehdr_size; | ||
485 | static int __init early_parse_elfcorehdr(char *p) | ||
486 | { | ||
487 | int i; | ||
488 | |||
489 | setup_elfcorehdr = memparse(p, &p); | ||
490 | |||
491 | for (i = 0; i < boot_mem_map.nr_map; i++) { | ||
492 | unsigned long start = boot_mem_map.map[i].addr; | ||
493 | unsigned long end = (boot_mem_map.map[i].addr + | ||
494 | boot_mem_map.map[i].size); | ||
495 | if (setup_elfcorehdr >= start && setup_elfcorehdr < end) { | ||
496 | /* | ||
497 | * Reserve from the elf core header to the end of | ||
498 | * the memory segment, that should all be kdump | ||
499 | * reserved memory. | ||
500 | */ | ||
501 | setup_elfcorehdr_size = end - setup_elfcorehdr; | ||
502 | break; | ||
503 | } | ||
504 | } | ||
505 | /* | ||
506 | * If we don't find it in the memory map, then we shouldn't | ||
507 | * have to worry about it, as the new kernel won't use it. | ||
508 | */ | ||
509 | return 0; | ||
510 | } | ||
511 | early_param("elfcorehdr", early_parse_elfcorehdr); | ||
512 | #endif | ||
513 | |||
483 | static void __init arch_mem_addpart(phys_t mem, phys_t end, int type) | 514 | static void __init arch_mem_addpart(phys_t mem, phys_t end, int type) |
484 | { | 515 | { |
485 | phys_t size; | 516 | phys_t size; |
@@ -547,6 +578,14 @@ static void __init arch_mem_init(char **cmdline_p) | |||
547 | } | 578 | } |
548 | 579 | ||
549 | bootmem_init(); | 580 | bootmem_init(); |
581 | #ifdef CONFIG_PROC_VMCORE | ||
582 | if (setup_elfcorehdr && setup_elfcorehdr_size) { | ||
583 | printk(KERN_INFO "kdump reserved memory at %lx-%lx\n", | ||
584 | setup_elfcorehdr, setup_elfcorehdr_size); | ||
585 | reserve_bootmem(setup_elfcorehdr, setup_elfcorehdr_size, | ||
586 | BOOTMEM_DEFAULT); | ||
587 | } | ||
588 | #endif | ||
550 | #ifdef CONFIG_KEXEC | 589 | #ifdef CONFIG_KEXEC |
551 | if (crashk_res.start != crashk_res.end) | 590 | if (crashk_res.start != crashk_res.end) |
552 | reserve_bootmem(crashk_res.start, | 591 | reserve_bootmem(crashk_res.start, |