Re: [tip:x86/mm] mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y

From: Sudeep Holla
Date: Thu Nov 02 2017 - 08:32:00 EST


(+Will, Catalin)

On Fri, Oct 20, 2017 at 1:27 PM, tip-bot for Kirill A. Shutemov
<tipbot@xxxxxxxxx> wrote:
> Commit-ID: 83e3c48729d9ebb7af5a31a504f3fd6aff0348c4
> Gitweb: https://git.kernel.org/tip/83e3c48729d9ebb7af5a31a504f3fd6aff0348c4
> Author: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> AuthorDate: Fri, 29 Sep 2017 17:08:16 +0300
> Committer: Ingo Molnar <mingo@xxxxxxxxxx>
> CommitDate: Fri, 20 Oct 2017 13:07:09 +0200
>
> mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y
>
> Size of the mem_section[] array depends on the size of the physical address space.
>
> In preparation for boot-time switching between paging modes on x86-64
> we need to make the allocation of mem_section[] dynamic, because otherwise
> we waste a lot of RAM: with CONFIG_NODE_SHIFT=10, mem_section[] size is 32kB
> for 4-level paging and 2MB for 5-level paging mode.
>
> The patch allocates the array on the first call to sparse_memory_present_with_active_regions().
>

I am seeing a boot failure with this patch in linux-next today(20171102)

Unable to handle kernel NULL pointer dereference at virtual address 00000000
Mem abort info:
ESR = 0x96000004
Exception class = DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
[0000000000000000] user address but active_mm is swapper
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.14.0-rc7-next-20171102 #133
Hardware name: ARM Juno development board (r2) (DT)
task: ffff000008f82a80 task.stack: ffff000008f70000
pstate: 200000c5 (nzCv daIF -PAN -UAO)
pc : memory_present+0x5c/0xe8
lr : memory_present+0x34/0xe8
sp : ffff000008f73e90
x29: ffff000008f73e90 x28: 0000000080e60018
x27: 00000000fd9b8d18 x26: 0000000000000105
x25: 0000000000000000 x24: ffff0000090c4000
x23: 0000000000000000 x22: ffff0000090c4000
x21: 0000000000080000 x20: 0000000000000004
x19: 0000000000000000 x18: 0000000000000010
x17: 0000000000000001 x16: 0000000000000000
x15: ffffffffffffffff x14: ffff00008909a3af
x13: ffff00000909a3bd x12: ffff000008f79df0
x11: ffff000008590de8 x10: ffff000008f9c7f0
x9 : 0000000000000000 x8 : ffff80097ffccc80
x7 : 0000000000000000 x6 : 000000000000003f
x5 : ffff000008f79fc0 x4 : 0000000000000001
x3 : 0000001000000000 x2 : 00000000000e0000
x1 : 0000000000080000 x0 : 0000000000000000
Process swapper (pid: 0, stack limit = 0xffff000008f70000)
Call trace:
memory_present+0x5c/0xe8
bootmem_init+0x90/0x114
setup_arch+0x190/0x4a0
start_kernel+0x64/0x3a8
Code: 54000449 d35afeb3 f94032c0 d37df273 (f8736800)
random: get_random_bytes called from print_oops_end_marker+0x4c/0x68
with crng_init=0
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task!