• Yinghai Lu's avatar
    x86, memblock: Fix crashkernel allocation · 9f4c1396
    Yinghai Lu authored
    Cai Qian found crashkernel is broken with the x86 memblock changes.
    
    1. crashkernel=128M@32M always reported that range is used, even if
       the first kernel is small and does not usethat range
    
    2. we always got following report when using "kexec -p"
    	Could not find a free area of memory of a000 bytes...
    	locate_hole failed
    
    The root cause is that generic memblock_find_in_range() will try to
    allocate from the top of the range, whereas the kexec code was written
    assuming that allocation was always near the bottom and that it could
    blindly extend memory upward.  Unfortunately the kexec code doesn't
    have a system for requesting the range that it really needs, so this
    is subject to probabilistic failures.
    
    This patch hacks around the problem by limiting the target range
    heuristically to below the traditional bzImage max range.  This number
    is arbitrary and not always correct, and a much better result would be
    obtained by having kexec communicate this number based on the kernel
    header information and any appropriate command line options.
    Reported-and-Bisected-by: default avatarCAI Qian <caiqian@redhat.com>
    Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
    LKML-Reference: <4CABAF2A.5090501@kernel.org>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
    9f4c1396
setup.c 26.7 KB