• Yinghai Lu's avatar
    x86/mm: Fix boot crash with DEBUG_PAGE_ALLOC=y and more than 512G RAM · 527bf129
    Yinghai Lu authored
    Dave Hansen reported that systems between 500G and 600G RAM
    crash early if DEBUG_PAGEALLOC is selected.
    
     > [    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
     > [    0.000000]  [mem 0x00000000-0x000fffff] page 4k
     > [    0.000000] BRK [0x02086000, 0x02086fff] PGTABLE
     > [    0.000000] BRK [0x02087000, 0x02087fff] PGTABLE
     > [    0.000000] BRK [0x02088000, 0x02088fff] PGTABLE
     > [    0.000000] init_memory_mapping: [mem 0xe80ee00000-0xe80effffff]
     > [    0.000000]  [mem 0xe80ee00000-0xe80effffff] page 4k
     > [    0.000000] BRK [0x02089000, 0x02089fff] PGTABLE
     > [    0.000000] BRK [0x0208a000, 0x0208afff] PGTABLE
     > [    0.000000] Kernel panic - not syncing: alloc_low_page: ran out of memory
    
    It turns out that we missed increasing needed pages in BRK to
    mapping initial 2M and [0,1M) when we switched to use the #PF
    handler to set memory mappings:
    
     > commit 8170e6be
     > Author: H. Peter Anvin <hpa@zytor.com>
     > Date:   Thu Jan 24 12:19:52 2013 -0800
     >
     >     x86, 64bit: Use a #PF handler to materialize early mappings on demand
    
    Before that, we had the maping from [0,512M) in head_64.S, and we
    can spare two pages [0-1M).  After that change, we can not reuse
    pages anymore.
    
    When we have more than 512M ram, we need an extra page for pgd page
    with [512G, 1024g).
    
    Increase pages in BRK for page table to solve the boot crash.
    Reported-by: default avatarDave Hansen <dave.hansen@intel.com>
    Bisected-by: default avatarDave Hansen <dave.hansen@intel.com>
    Tested-by: default avatarDave Hansen <dave.hansen@intel.com>
    Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
    Cc: <stable@vger.kernel.org> # v3.9 and later
    Link: http://lkml.kernel.org/r/1376351004-4015-1-git-send-email-yinghai@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    527bf129
init.c 15.5 KB