* [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
@ 2026-11-19 9:37 ` Federico Parola
0 siblings, 0 replies; 5+ 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [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
-1 siblings, 0 replies; 5+ 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] 5+ messages in thread* Re: [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
-1 siblings, 0 replies; 5+ 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] 5+ 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
0 siblings, 0 replies; 5+ 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!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 5+ messages in thread