diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2005-06-25 17:58:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:50 -0400 |
commit | 5f5609df0c943b005847d3b2765d6dd47b624011 (patch) | |
tree | f994509dc8b507b9392bcf632c4df2a0261a9f5f /arch/x86_64/kernel/setup.c | |
parent | 5234f5eb04abbbfa306ccfbc2ccbb6e73f515b15 (diff) |
[PATCH] crashdump: x86_64: crashkernel option
This is the x86_64 implementation of the crashkernel option. It reserves
a window of memory very early in the bootup process, so we never use
it for anything but the kernel to switch to when the running
kernel panics.
In addition to reserving this memory a resource structure is registered
so looking at /proc/iomem it is clear what happened to that memory.
ISSUES:
Is it possible to implement this in a architecture generic way?
What should be done with architectures that always use an iommu and
thus don't report their RAM memory resources in /proc/iomem?
Signed-off-by: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/setup.c')
-rw-r--r-- | arch/x86_64/kernel/setup.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index ca9a915a6d4a..b02d921da4f7 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/kallsyms.h> | 41 | #include <linux/kallsyms.h> |
42 | #include <linux/edd.h> | 42 | #include <linux/edd.h> |
43 | #include <linux/mmzone.h> | 43 | #include <linux/mmzone.h> |
44 | #include <linux/kexec.h> | ||
44 | 45 | ||
45 | #include <asm/mtrr.h> | 46 | #include <asm/mtrr.h> |
46 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
@@ -367,6 +368,27 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
367 | if (!memcmp(from, "noexec=", 7)) | 368 | if (!memcmp(from, "noexec=", 7)) |
368 | nonx_setup(from + 7); | 369 | nonx_setup(from + 7); |
369 | 370 | ||
371 | #ifdef CONFIG_KEXEC | ||
372 | /* crashkernel=size@addr specifies the location to reserve for | ||
373 | * a crash kernel. By reserving this memory we guarantee | ||
374 | * that linux never set's it up as a DMA target. | ||
375 | * Useful for holding code to do something appropriate | ||
376 | * after a kernel panic. | ||
377 | */ | ||
378 | else if (!memcmp(from, "crashkernel=", 12)) { | ||
379 | unsigned long size, base; | ||
380 | size = memparse(from+12, &from); | ||
381 | if (*from == '@') { | ||
382 | base = memparse(from+1, &from); | ||
383 | /* FIXME: Do I want a sanity check | ||
384 | * to validate the memory range? | ||
385 | */ | ||
386 | crashk_res.start = base; | ||
387 | crashk_res.end = base + size - 1; | ||
388 | } | ||
389 | } | ||
390 | #endif | ||
391 | |||
370 | next_char: | 392 | next_char: |
371 | c = *(from++); | 393 | c = *(from++); |
372 | if (!c) | 394 | if (!c) |
@@ -625,6 +647,13 @@ void __init setup_arch(char **cmdline_p) | |||
625 | #endif | 647 | #endif |
626 | 648 | ||
627 | sparse_init(); | 649 | sparse_init(); |
650 | |||
651 | #ifdef CONFIG_KEXEC | ||
652 | if (crashk_res.start != crashk_res.end) { | ||
653 | reserve_bootmem(crashk_res.start, | ||
654 | crashk_res.end - crashk_res.start + 1); | ||
655 | } | ||
656 | #endif | ||
628 | paging_init(); | 657 | paging_init(); |
629 | 658 | ||
630 | check_ioapic(); | 659 | check_ioapic(); |