Message ID | 20250212-kunit-mips-v1-1-eb49c9d76615@linutronix.de |
---|---|
State | New |
Headers | show |
Series | [1/2] MIPS: mm: Avoid blocking DMA zone with memory map memblock allocation | expand |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 4583d1a2a73e7ff36a42f6017d9aef008e45df6e..712eb4762917261416f1fca2d9925a42107ef6c1 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -435,7 +435,9 @@ void __init paging_init(void) #endif high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); + memblock_set_bottom_up(false); free_area_init(max_zone_pfns); + memblock_set_bottom_up(true); } #ifdef CONFIG_64BIT
On MIPS the memblock allocator is configured to allocate bottom-up. The memory map is allocated by the mm core through memblock and uses MEMBLOCK_LOW_LIMIT as minimal address. This constant is defined as zero because it assumes that "we are using top down, so it is safe to use 0 here". So the memory map is allocated as close to 0 as possible, right where the DMA zone will end up. As the memory map is allocated permanently and also larger than the DMA zone, it makes the DMA zone unusable. Temporarily switch to top-down allocation for the call to free_area_init() so the memory map allocation does not fall into the DMA zone. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> --- Another solution would be to change alloc_node_mem_map() in the mm core to use __pa(MAX_DMA_ADDRESS) for the min_addr when calling memmap_alloc(), as is done by the other callers of memmap_alloc(). Looping in the memblock maintainers for discussion. This is reliably reproducible in QEMU. To reproduce, use the kunit configuration from patch 2 of this series and run it like so: ./tools/testing/kunit/kunit.py run --arch mips64el --cross_compile $CROSS_COMPILE cs_dsp_wmfwV3_err_halo.wmfw_v2_coeff_description_exceeds_block To: Mike Rapoport <rppt@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org --- arch/mips/mm/init.c | 2 ++ 1 file changed, 2 insertions(+)