• Mike Rapoport's avatar
    memblock: make for_each_mem_range() traverse MEMBLOCK_HOTPLUG regions · 79e482e9
    Mike Rapoport authored
    Commit b10d6bca ("arch, drivers: replace for_each_membock() with
    for_each_mem_range()") didn't take into account that when there is
    movable_node parameter in the kernel command line, for_each_mem_range()
    would skip ranges marked with MEMBLOCK_HOTPLUG.
    
    The page table setup code in POWER uses for_each_mem_range() to create
    the linear mapping of the physical memory and since the regions marked
    as MEMORY_HOTPLUG are skipped, they never make it to the linear map.
    
    A later access to the memory in those ranges will fail:
    
      BUG: Unable to handle kernel data access on write at 0xc000000400000000
      Faulting instruction address: 0xc00000000008a3c0
      Oops: Kernel access of bad area, sig: 11 [#1]
      LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
      Modules linked in:
      CPU: 0 PID: 53 Comm: kworker/u2:0 Not tainted 5.13.0 #7
      NIP:  c00000000008a3c0 LR: c0000000003c1ed8 CTR: 0000000000000040
      REGS: c000000008a57770 TRAP: 0300   Not tai...
    79e482e9
memblock.c 59.5 KB