Skip to contentSkip to conversation

MIPS: Let early memblock_alloc*() allocate memories bottom-up

PATCH Applied Huacai Chen 2 participants 2 messages Nov 10, 2018 – Nov 13, 2018 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Let early memblock_alloc*() allocate memories bottom-up

After switched to NO_BOOTMEM, there are several boot failures. Some of them have been fixed and some of them haven't. I find that many of them are because of memory allocations are top-down, while the old behavior is bottom-up. This patch let early memblock_alloc*() allocate memories bottom-up to avoid some potential problems.

References: https://patchwork.linux-mips.org/patch/21031/

---
 arch/mips/kernel/setup.c | 1 +
 arch/mips/kernel/traps.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/setup.c +1 -0
index ea09ed6..8c6c48ed 100644
@@ -794,6 +794,7 @@ static void __init arch_mem_init(char **cmdline_p)
 
 	/* call board setup routine */
 	plat_mem_setup();
+	memblock_set_bottom_up(true);
 
 	/*
 	 * Make sure all kernel memory is in the maps.  The "UP" and
arch/mips/kernel/traps.c +1 -2
index b34f9a7..c91097f 100644
@@ -2290,10 +2290,8 @@ void __init trap_init(void)
 		unsigned long size = 0x200 + VECTORSPACING*64;
 		phys_addr_t ebase_pa;
 
-		memblock_set_bottom_up(true);
 		ebase = (unsigned long)
 			memblock_alloc_from(size, 1 << fls(size), 0);
-		memblock_set_bottom_up(false);
 
 		/*
 		 * Try to ensure ebase resides in KSeg0 if possible.
@@ -2337,6 +2335,7 @@ void __init trap_init(void)
 	if (board_ebase_setup)
 		board_ebase_setup();
 	per_cpu_trap_init(true);
+	memblock_set_bottom_up(false);
 
 	/*
 	 * Copy the generic exception handlers to their final destination.
Signature · 1 line
2.7.0
Applied
#1 lore raw

Hello,

Quoted 8 lines · Huacai Chen

After switched to NO_BOOTMEM, there are several boot failures. Some of them have been fixed and some of them haven't. I find that many of them are because of memory allocations are top-down, while the old behavior is bottom-up. This patch let early memblock_alloc*() allocate memories bottom-up to avoid some potential problems.

References: https://patchwork.linux-mips.org/patch/21031/

Applied to mips-fixes.

Thanks,
Paul

[ This message was auto-generated; if you believe anything is incorrect
then please email [email protected] to report it. ]