Skip to content

Commit

Permalink
kdump: Allow shrinking of kdump region to be overridden
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anton Blanchard authored and Benjamin Herrenschmidt committed Apr 1, 2011
1 parent 76d479a commit c0bb9e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/linux/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions kernel/kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c0bb9e4

Please sign in to comment.