mm/memory_hotplug: Enable kernel page-tables before free pages
When pages are getting free'ed, the kernel assumes that the page-table
entries were enabled, since the pages were in-use before. And along the
free path, with PAGE_POISONING enabled, it poisons the pages and then
disables the entries. However, this is not the case with memory hotplug.
Initially, when the hotplugable memory is added, the page-table entries
are created and enabled, and when onlined, the pages get free'ed and the
entries get disabled. These pages now remain disabled along the path of
doing a offline and online again and we hit data abort since CPU is trying
to poison the pages whose entries are disabled.
[243.736338] Unable to handle kernel paging request at virtual address
ffffffdde0000000
[243.744577] Mem abort info:
[243.747491] Exception class = DABT (current EL), IL = 32 bits
[243.753638] SET = 0, FnV = 0
[243.756818] EA = 0, S1PTW = 0
[243.760251] Data abort info:
[243.763473] ISV = 0, ISS = 0x00000047
[243.767446] CM = 0, WnR = 1
[243.770584] swapper pgtable: 4k pages, 39-bit VAs, pgd = ffffff97159d7000
[243.777586] [ffffffdde0000000] *pgd=00000001afc95003, *pud=00000001afc95003,
*pmd=00000001aeffe003, *pte=00f80001e0000712
[243.788985] Internal error: Oops: 96000047 [#1] PREEMPT SMP
[243.794717] Modules linked in:
[243.797873] CPU: 2 PID: 4538 Comm: sh Tainted: G S 4.14.62+ #862
...
[ 369.546983] Call trace:
[ 369.549508] __memset+0x108/0x200
[ 369.552929] __free_pages_ok+0x1ac/0x480
[ 369.556970] __free_pages+0x48/0x64
[ 369.560560] online_pages_range+0x124/0x16c
[ 369.564863] walk_system_ram_range+0x98/0xe4
[ 369.569257] online_pages+0xc4/0x1fc
[ 369.572948] memory_block_change_state+0x118/0x18c
[ 369.577879] memory_subsys_online+0x48/0x5c
[ 369.582189] device_online+0x74/0x98
[ 369.585869] store_mem_state+0xa4/0xf4
[ 369.589730] dev_attr_store+0x40/0x58
[ 369.593508] sysfs_kf_write+0x50/0x68
[ 369.597282] kernfs_fop_write+0x12c/0x1cc
[ 369.601408] __vfs_write+0x54/0x14c
Hence, enable the kernel page-tables before free'ing the pages.
Change-Id: I57838e296c8836def5a73d43329683ce9dbf1cd7
Signed-off-by:
Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Loading
Please register or sign in to comment