Re: [PATCH] arm64: mm: Fix initialisation of DMA zones on non-NUMA systems

From: Catalin Marinas
Date: Wed Dec 04 2019 - 06:26:06 EST


On Tue, Dec 03, 2019 at 12:10:13PM +0000, Will Deacon wrote:
> John reports that the recently merged commit 1a8e1cef7603 ("arm64: use
> both ZONE_DMA and ZONE_DMA32") breaks the boot on his DB845C board:
>
> | Booting Linux on physical CPU 0x0000000000 [0x517f803c]
> | Linux version 5.4.0-mainline-10675-g957a03b9e38f
> | Machine model: Thundercomm Dragonboard 845c
> | [...]
> | Built 1 zonelists, mobility grouping on. Total pages: -188245
> | Kernel command line: earlycon
> | firmware_class.path=/vendor/firmware/ androidboot.hardware=db845c
> | init=/init androidboot.boot_devices=soc/1d84000.ufshc
> | printk.devkmsg=on buildvariant=userdebug root=/dev/sda2
> | androidboot.bootdevice=1d84000.ufshc androidboot.serialno=c4e1189c
> | androidboot.baseband=sda
> | msm_drm.dsi_display0=dsi_lt9611_1080_video_display:
> | androidboot.slot_suffix=_a skip_initramfs rootwait ro init=/init
> |
> | <hangs indefinitely here>
>
> This is because, when CONFIG_NUMA=n, zone_sizes_init() fails to handle
> memblocks that fall entirely within the ZONE_DMA region and erroneously ends up
> trying to add a negatively-sized region into the following ZONE_DMA32, which is
> later interpreted as a large unsigned region by the core MM code.
>
> Rework the non-NUMA implementation of zone_sizes_init() so that the start
> address of the memblock being processed is adjusted according to the end of the
> previous zone, which is then range-checked before updating the hole information
> of subsequent zones.
>
> Cc: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> Link: https://lore.kernel.org/lkml/CALAqxLVVcsmFrDKLRGRq7GewcW405yTOxG=KR3csVzQ6bXutkA@xxxxxxxxxxxxxx
> Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
> Reported-by: John Stultz <john.stultz@xxxxxxxxxx>
> Signed-off-by: Will Deacon <will@xxxxxxxxxx>

Queued for 5.5-rc1. Thanks.

--
Catalin