• Yinghai Lu's avatar
    x86, mm: Don't clear page table if range is ram · eceb3632
    Yinghai Lu authored
    After we add code use buffer in BRK to pre-map buf for page table in
    following patch:
    	x86, mm: setup page table in top-down
    it should be safe to remove early_memmap for page table accessing.
    Instead we get panic with that.
    
    It turns out that we clear the initial page table wrongly for next range
    that is separated by holes.
    And it only happens when we are trying to map ram range one by one.
    
    We need to check if the range is ram before clearing page table.
    
    We change the loop structure to remove the extra little loop and use
    one loop only, and in that loop will caculate next at first, and check if
    [addr,next) is covered by E820_RAM.
    
    -v2: E820_RESERVED_KERN is treated as E820_RAM. EFI one change some E820_RAM
         to that, so next kernel by kexec will know that range is used already.
    Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
    Link: http://lkml.kernel.org/r/1353123563-3103-20-git-send-email-yinghai@kernel.orgSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    eceb3632
init_64.c 24 KB