Kexec Archive on lore.kernel.org
 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  9:47 ` sashiko-bot
  2026-11-19 16:07 ` Bradley Morgan
  0 siblings, 2 replies; 4+ 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] 4+ messages in thread

* Re: [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
  2026-11-19  9:37 [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match Federico Parola
@ 2026-11-19  9:47 ` sashiko-bot
  2026-11-19 16:07 ` Bradley Morgan
  1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-19  9:47 UTC (permalink / raw)
  To: Federico Parola, Andrew Morton, Baoquan He, Mike Rapoport,
	Pasha Tatashin, Pratyush Yadav, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Zhen Lei, kexec
  Cc: nh-open-source

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

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119093730.49471-1-fparola@amazon.de?part=1



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

* Re: [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
  2026-11-19  9:37 [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match Federico Parola
  2026-11-19  9:47 ` sashiko-bot
@ 2026-11-19 16:07 ` Bradley Morgan
  2026-11-22 16:30   ` Mike Rapoport
  1 sibling, 1 reply; 4+ messages in thread
From: Bradley Morgan @ 2026-11-19 16:07 UTC (permalink / raw)
  To: fparola
  Cc: akpm, alex, aou, baoquan.he, kexec, linux-riscv, nh-open-source,
	palmer, pasha.tatashin, pjw, pratyush, rppt, stable,
	thunder.leizhen

On 19 November 2026 09:37:27 GMT, Federico Parola <fparola@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.
>
>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

Oki.

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

Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>


> 			search_end = CRASH_ADDR_HIGH_MAX;
> 			search_base = CRASH_ADDR_LOW_MAX;
> 			crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
>

--- Thanks!


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

* Re: [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
  2026-11-19 16:07 ` Bradley Morgan
@ 2026-11-22 16:30   ` Mike Rapoport
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2026-11-22 16:30 UTC (permalink / raw)
  To: Bradley Morgan
  Cc: fparola, akpm, alex, aou, baoquan.he, kexec, linux-riscv,
	nh-open-source, palmer, pasha.tatashin, pjw, pratyush, stable,
	thunder.leizhen

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


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

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

Thread overview: 4+ 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  9:47 ` sashiko-bot
2026-11-19 16:07 ` Bradley Morgan
2026-11-22 16:30   ` Mike Rapoport

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