kdump: Allow shrinking of kdump region to be overridden
authorAnton Blanchard <anton@samba.org>
Wed, 25 Aug 2010 00:22:58 +0000 (10:22 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 1 Apr 2011 05:14:30 +0000 (16:14 +1100)
On ppc64 the crashkernel region almost always overlaps an area of firmware.
This works fine except when using the sysfs interface to reduce the kdump
region. If we free the firmware area we are guaranteed to crash.

Rename free_reserved_phys_range to crash_free_reserved_phys_range and make
it a weak function so we can override it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
include/linux/kexec.h
kernel/kexec.c

index 03e8e8dbc5772c481f77dd78464ecac2be089947..c2478a342cd7d9f9b4a754cb73f906745cf4f42c 100644 (file)
@@ -208,6 +208,7 @@ int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
                unsigned long long *crash_size, unsigned long long *crash_base);
 int crash_shrink_memory(unsigned long new_size);
 size_t crash_get_memory_size(void);
+void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
 
 #else /* !CONFIG_KEXEC */
 struct pt_regs;
index ec19b92c7ebdac942fa3e8dc269d737c7032593a..4e240a378df6d10a67b027aa924a1fb748d42e66 100644 (file)
@@ -1099,7 +1099,8 @@ size_t crash_get_memory_size(void)
        return size;
 }
 
-static void free_reserved_phys_range(unsigned long begin, unsigned long end)
+void __weak crash_free_reserved_phys_range(unsigned long begin,
+                                          unsigned long end)
 {
        unsigned long addr;
 
@@ -1135,7 +1136,7 @@ int crash_shrink_memory(unsigned long new_size)
        start = roundup(start, PAGE_SIZE);
        end = roundup(start + new_size, PAGE_SIZE);
 
-       free_reserved_phys_range(end, crashk_res.end);
+       crash_free_reserved_phys_range(end, crashk_res.end);
 
        if ((start == end) && (crashk_res.parent != NULL))
                release_resource(&crashk_res);