Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
@ 2026-11-19  9:37 Federico Parola
  2026-11-19 16:07 ` Bradley Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Federico Parola @ 2026-11-19  9:37 UTC (permalink / raw)
  To: Andrew Morton, Baoquan He, Mike Rapoport, Pasha Tatashin,
	Pratyush Yadav, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Zhen Lei, kexec, linux-riscv
  Cc: nh-open-source, stable

On arm64 with neither CONFIG_ZONE_DMA nor CONFIG_ZONE_DMA32,
arm64_dma_phys_limit is PHYS_MASK + 1, so CRASH_ADDR_LOW_MAX equals
CRASH_ADDR_HIGH_MAX. If the first crashkernel=size[KMG] attempt fails,
reserve_crashkernel_generic() falls back to [CRASH_ADDR_LOW_MAX,
CRASH_ADDR_HIGH_MAX), which is empty. That attempt fails too, and since
search_end still equals CRASH_ADDR_LOW_MAX the fallback is taken again,
forever. Boot stalls after the "Initmem setup" messages.

The first attempt can fail on a kexec handover (KHO) boot, where early
allocations are confined to the KHO scratch areas.

Commit edb907a61333 ("crash: fix riscv64 crash memory reserve dead
loop") fixed the same loop for crashkernel=size[KMG],high. Skip the
fallback to high memory when there is none, so the reservation fails
with "cannot allocate crashkernel" and boot continues.

Fixes: 0ab97169aa05 ("crash_core: add generic function to do reservation")
CC: stable@vger.kernel.org
Signed-off-by: Federico Parola <fparola@amazon.de>
---
 kernel/crash_reserve.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c
index eee37a11380ce..1417b429b45c6 100644
--- a/kernel/crash_reserve.c
+++ b/kernel/crash_reserve.c
@@ -421,9 +421,11 @@ void __init reserve_crashkernel_generic(unsigned long long crash_size,
 		/*
 		 * For crashkernel=size[KMG], if the first attempt was for
 		 * low memory, fall back to high memory, the minimum required
-		 * low memory will be reserved later.
+		 * low memory will be reserved later. There is no high memory to
+		 * fall back to if CRASH_ADDR_LOW_MAX equals CRASH_ADDR_HIGH_MAX.
 		 */
-		if (!high && search_end == CRASH_ADDR_LOW_MAX) {
+		if (!high && search_end == CRASH_ADDR_LOW_MAX &&
+		    CRASH_ADDR_LOW_MAX < CRASH_ADDR_HIGH_MAX) {
 			search_end = CRASH_ADDR_HIGH_MAX;
 			search_base = CRASH_ADDR_LOW_MAX;
 			crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  9:37 [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match Federico Parola
2026-11-19 16:07 ` Bradley Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox