Re: Patch "arm64: mm: always enable CONFIG_HOLES_IN_ZONE" has been added to the 4.9-stable tree

From: Nathan Chancellor
Date: Fri Sep 07 2018 - 14:36:09 EST


On Fri, Sep 07, 2018 at 02:57:51PM +0200, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
>
> This is a note to let you know that I've just added the patch titled
>
> arm64: mm: always enable CONFIG_HOLES_IN_ZONE
>
> to the 4.9-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
> arm64-mm-always-enable-config_holes_in_zone.patch
> and it can be found in the queue-4.9 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@xxxxxxxxxxxxxxx> know about it.
>
>
> From f52bb98f5aded4c43e52f5ce19fb83f7261e9e73 Mon Sep 17 00:00:00 2001
> From: James Morse <james.morse@xxxxxxx>
> Date: Thu, 30 Aug 2018 16:05:32 +0100
> Subject: arm64: mm: always enable CONFIG_HOLES_IN_ZONE
>
> From: James Morse <james.morse@xxxxxxx>
>
> commit f52bb98f5aded4c43e52f5ce19fb83f7261e9e73 upstream.
>
> Commit 6d526ee26ccd ("arm64: mm: enable CONFIG_HOLES_IN_ZONE for NUMA")
> only enabled HOLES_IN_ZONE for NUMA systems because the NUMA code was
> choking on the missing zone for nomap pages. This problem doesn't just
> apply to NUMA systems.
>
> If the architecture doesn't set HAVE_ARCH_PFN_VALID, pfn_valid() will
> return true if the pfn is part of a valid sparsemem section.
>
> When working with multiple pages, the mm code uses pfn_valid_within()
> to test each page it uses within the sparsemem section is valid. On
> most systems memory comes in MAX_ORDER_NR_PAGES chunks which all
> have valid/initialised struct pages. In this case pfn_valid_within()
> is optimised out.
>
> Systems where this isn't true (e.g. due to nomap) should set
> HOLES_IN_ZONE and provide HAVE_ARCH_PFN_VALID so that mm tests each
> page as it works with it.
>
> Currently non-NUMA arm64 systems can't enable HOLES_IN_ZONE, leading to
> a VM_BUG_ON():
>
> | page:fffffdff802e1780 is uninitialized and poisoned
> | raw: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff
> | raw: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff
> | page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p))
> | ------------[ cut here ]------------
> | kernel BUG at include/linux/mm.h:978!
> | Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
> [...]
> | CPU: 1 PID: 25236 Comm: dd Not tainted 4.18.0 #7
> | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
> | pstate: 40000085 (nZcv daIf -PAN -UAO)
> | pc : move_freepages_block+0x144/0x248
> | lr : move_freepages_block+0x144/0x248
> | sp : fffffe0071177680
> [...]
> | Process dd (pid: 25236, stack limit = 0x0000000094cc07fb)
> | Call trace:
> | move_freepages_block+0x144/0x248
> | steal_suitable_fallback+0x100/0x16c
> | get_page_from_freelist+0x440/0xb20
> | __alloc_pages_nodemask+0xe8/0x838
> | new_slab+0xd4/0x418
> | ___slab_alloc.constprop.27+0x380/0x4a8
> | __slab_alloc.isra.21.constprop.26+0x24/0x34
> | kmem_cache_alloc+0xa8/0x180
> | alloc_buffer_head+0x1c/0x90
> | alloc_page_buffers+0x68/0xb0
> | create_empty_buffers+0x20/0x1ec
> | create_page_buffers+0xb0/0xf0
> | __block_write_begin_int+0xc4/0x564
> | __block_write_begin+0x10/0x18
> | block_write_begin+0x48/0xd0
> | blkdev_write_begin+0x28/0x30
> | generic_perform_write+0x98/0x16c
> | __generic_file_write_iter+0x138/0x168
> | blkdev_write_iter+0x80/0xf0
> | __vfs_write+0xe4/0x10c
> | vfs_write+0xb4/0x168
> | ksys_write+0x44/0x88
> | sys_write+0xc/0x14
> | el0_svc_naked+0x30/0x34
> | Code: aa1303e0 90001a01 91296421 94008902 (d4210000)
> | ---[ end trace 1601ba47f6e883fe ]---
>
> Remove the NUMA dependency.
>
> Link: https://www.spinics.net/lists/arm-kernel/msg671851.html
> Cc: <stable@xxxxxxxxxxxxxxx>
> Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
> Reported-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> Reviewed-by: Pavel Tatashin <pavel.tatashin@xxxxxxxxxxxxx>
> Tested-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> Signed-off-by: James Morse <james.morse@xxxxxxx>
> Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> ---
> arch/arm64/Kconfig | 1 -
> 1 file changed, 1 deletion(-)
>
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -631,7 +631,6 @@ config HAVE_SETUP_PER_CPU_AREA
>
> config NEED_PER_CPU_EMBED_FIRST_CHUNK

Looks like git got confused here, this isn't HOLES_IN_ZONE.

Additionally, commit 6d526ee26ccd ("arm64: mm: enable
CONFIG_HOLES_IN_ZONE for NUMA") that introduced it to this file didn't
appear until 4.11 so this patch can be dropped from 4.9.

> def_bool y
> - depends on NUMA
>
> source kernel/Kconfig.preempt
> source kernel/Kconfig.hz
>
>
> Patches currently in stable-queue which might be from james.morse@xxxxxxx are
>
> queue-4.9/arm64-mm-always-enable-config_holes_in_zone.patch