All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bradley Morgan <bradley.morgan@linux.dev>
To: fparola@amazon.de
Cc: akpm@linux-foundation.org, alex@ghiti.fr, aou@eecs.berkeley.edu,
	baoquan.he@linux.dev, kexec@lists.infradead.org,
	linux-riscv@lists.infradead.org, nh-open-source@amazon.com,
	palmer@dabbelt.com, pasha.tatashin@soleen.com, pjw@kernel.org,
	pratyush@kernel.org, rppt@kernel.org, stable@vger.kernel.org,
	thunder.leizhen@huawei.com
Subject: Re: [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
Date: Thu, 19 Nov 2026 16:07:41 +0000	[thread overview]
Message-ID: <CAEBC780-5EA0-425E-84DA-F16817BE884C@linux.dev> (raw)
In-Reply-To: <20261119093730.49471-1-fparola@amazon.de>

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

WARNING: multiple messages have this Message-ID (diff)
From: Bradley Morgan <bradley.morgan@linux.dev>
To: fparola@amazon.de
Cc: akpm@linux-foundation.org, alex@ghiti.fr, aou@eecs.berkeley.edu,
	baoquan.he@linux.dev, kexec@lists.infradead.org,
	linux-riscv@lists.infradead.org, nh-open-source@amazon.com,
	palmer@dabbelt.com, pasha.tatashin@soleen.com, pjw@kernel.org,
	pratyush@kernel.org, rppt@kernel.org, stable@vger.kernel.org,
	thunder.leizhen@huawei.com
Subject: Re: [PATCH] crash: Fix crash memory reserve dead loop when low and high limits match
Date: Thu, 19 Nov 2026 16:07:41 +0000	[thread overview]
Message-ID: <CAEBC780-5EA0-425E-84DA-F16817BE884C@linux.dev> (raw)
In-Reply-To: <20261119093730.49471-1-fparola@amazon.de>

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!


  parent reply	other threads:[~2026-11-19 16:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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:37 ` Federico Parola
2026-11-19  9:47 ` sashiko-bot
2026-11-19 16:07 ` Bradley Morgan [this message]
2026-11-19 16:07   ` Bradley Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEBC780-5EA0-425E-84DA-F16817BE884C@linux.dev \
    --to=bradley.morgan@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=baoquan.he@linux.dev \
    --cc=fparola@amazon.de \
    --cc=kexec@lists.infradead.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=nh-open-source@amazon.com \
    --cc=palmer@dabbelt.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pjw@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thunder.leizhen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.