[PATCH] crash: Fix crash memory reserve dead loop when low and high limits match

Mike Rapoport rppt at kernel.org
Sun Nov 22 08:30:15 PST 2026


Hi,

On Thu, Nov 19, 2026 at 04:07:41PM +0000, Bradley Morgan wrote:
> On 19 November 2026 09:37:27 GMT, Federico Parola <fparola at amazon.de>
> wrote:
> >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.

This is really hard to read :/

> >
> >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

How is this related?

> >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 at vger.kernel.org

Do you see this in field or it's what some sort of analysis shows?
 
> Oki.
> 
> >Signed-off-by: Federico Parola <fparola at 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) {
> 
> Reviewed-by: Bradley Morgan <bradley.morgan at linux.dev>
> 
> 
> > 			search_end = CRASH_ADDR_HIGH_MAX;
> > 			search_base = CRASH_ADDR_LOW_MAX;
> > 			crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
> >
> 
> --- Thanks!

-- 
Sincerely yours,
Mike.



More information about the linux-riscv mailing list