FAILED: Patch "LoongArch: Prefer top-down allocation after arch_mem_init()" failed to apply to 6.6-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 2172d6ebac9372eb01fe4505a53e18cb061e103b Mon Sep 17 00:00:00 2001
From: Huacai Chen <[email protected]>
Date: Tue, 10 Feb 2026 19:31:13 +0800
Subject: [PATCH] LoongArch: Prefer top-down allocation after arch_mem_init()
Currently we use bottom-up allocation after sparse_init(), the reason is sparse_init() need a lot of memory, and bottom-up allocation may exhaust precious low memory (below 4GB). On the other hand, SWIOTLB and CMA need low memories for DMA32, so swiotlb_init() and dma_contiguous_reserve() need bottom-up allocation.
Since swiotlb_init() and dma_contiguous_reserve() are both called in arch_mem_init(), we no longer need bottom-up allocation after that. So we set the allocation policy to top-down at the end of arch_mem_init(), in order to avoid later memory allocations (such as KASAN) exhaust low memory.
This solve at least two problems:
1. Some buggy BIOSes use 0xfd000000~0xfe000000 for secondary CPUs, but didn't reserve this range, which causes smpboot failures.
2. Some DMA32 devices, such as Loongson-DRM and OHCI, cannot work with KASAN enabled.
--- arch/loongarch/kernel/setup.c | 1 + 1 file changed, 1 insertion(+)
arch/loongarch/kernel/setup.c +1 -0
@@ -421,6 +421,7 @@ static void __init arch_mem_init(char **cmdline_p) PFN_UP(__pa_symbol(&__nosave_end)));memblock_dump_all (); +memblock_set_bottom_up (false);early_memtest (PFN_PHYS (ARCH_PFN_OFFSET ),PFN_PHYS (max_low_pfn)); }
Signature · 1 line
2.51.0
Huacai Chen
maintainerHi, Sasha,
Quoted 5 lines · Sasha Levin
The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
I'm very confused because it can be applied and already here:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/queue-6.6
Huacai
Quoted 53 lines
Thanks,
Sasha------------------ original commit in Linus's tree ------------------
From
2172d6ebac9372eb01fe4505a53e18cb061e103bMon Sep 17 00:00:00 2001
From: Huacai Chen <[email protected]>
Date: Tue, 10 Feb 2026 19:31:13 +0800
Subject: [PATCH] LoongArch: Prefer top-down allocation afterarch_mem_init()Currently we use bottom-up allocation after
sparse_init(), the reason issparse_init()need a lot of memory, and bottom-up allocation may exhaust precious low memory (below 4GB). On the other hand, SWIOTLB and CMA need low memories for DMA32, soswiotlb_init()anddma_contiguous_reserve()need bottom-up allocation.Since
swiotlb_init()anddma_contiguous_reserve()are both called inarch_mem_init(), we no longer need bottom-up allocation after that. So we set the allocation policy to top-down at the end ofarch_mem_init(), in order to avoid later memory allocations (such as KASAN) exhaust low memory.This solve at least two problems:
1. Some buggy BIOSes use 0xfd000000~0xfe000000 for secondary CPUs, but didn't reserve this range, which causes smpboot failures.
2. Some DMA32 devices, such as Loongson-DRM and OHCI, cannot work with KASAN enabled.Signed-off-by Huacai Chen <[email protected]>--- arch/loongarch/kernel/setup.c | 1 + 1 file changed, 1 insertion(+)arch/loongarch/kernel/setup.c +1
-1@@ -421,6 +421,7 @@ static void __init arch_mem_init(char **cmdline_p) PFN_UP(__pa_symbol(&__nosave_end)));memblock_dump_all (); +memblock_set_bottom_up (false);early_memtest (PFN_PHYS (ARCH_PFN_OFFSET ),PFN_PHYS (max_low_pfn)); } --2.51.0