[PATCH] x86, kexec: Limit the crashkernel address to 512 MiB

From: H . Peter Anvin
Date: Thu Dec 16 2010 - 22:20:41 EST


We used to only map a maximum of 512 MiB of low memory for the kernel
initialization; this was enforced by the bzImage decompressor. To
make sure we do not run afoul of this limitation, keep the crash
kernel below the 512 MiB mark.

This also adds a comfortable margin in case the user is running with a
nonstandard vmalloc= setting.

Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
Cc: Vivek Goyal <vgoyal@xxxxxxxxxx>
Cc: Stanislaw Gruszka <sgruszka@xxxxxxxxxx>
Cc: Yinghai Lu <yinghai@xxxxxxxxxx>
LKML-Reference: <4D09958D.2040907@xxxxxxxxxx>
---
arch/x86/kernel/setup.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 21c6746..7fb9abb 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -501,7 +501,12 @@ static inline unsigned long long get_total_mem(void)
return total << PAGE_SHIFT;
}

-#define DEFAULT_BZIMAGE_ADDR_MAX 0x37FFFFFF
+/*
+ * Keep the crash kernel below this limit. Not all bzImage kernels
+ * can be loaded above this address.
+ */
+#define CRASH_KERNEL_ADDR_MAX (512 << 20)
+
static void __init reserve_crashkernel(void)
{
unsigned long long total_mem;
@@ -520,10 +525,10 @@ static void __init reserve_crashkernel(void)
const unsigned long long alignment = 16<<20; /* 16M */

/*
- * kexec want bzImage is below DEFAULT_BZIMAGE_ADDR_MAX
+ * kexec want bzImage is below CRASH_KERNEL_ADDR_MAX
*/
crash_base = memblock_find_in_range(alignment,
- DEFAULT_BZIMAGE_ADDR_MAX, crash_size, alignment);
+ CRASH_KERNEL_ADDR_MAX, crash_size, alignment);

if (crash_base == MEMBLOCK_ERROR) {
pr_info("crashkernel reservation failed - No suitable area found.\n");
--
1.7.2.3


--------------030401060105050003030900--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/