From: Baoquan He <bhe@redhat.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: vgoyal@redhat.com, dyoung@redhat.com, paul.walmsley@sifive.com,
palmer@dabbelt.com, aou@eecs.berkeley.edu,
chenjiahao16@huawei.com, akpm@linux-foundation.org,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH -next] crash: Fix riscv64 crash memory reserve dead loop
Date: Fri, 2 Aug 2024 18:11:01 +0800 [thread overview]
Message-ID: <ZqywtegyIS/YXOVv@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20240802090105.3871929-1-ruanjinjie@huawei.com>
On 08/02/24 at 05:01pm, Jinjie Ruan wrote:
> On RISCV64 Qemu machine with 512MB memory, cmdline "crashkernel=500M,high"
> will cause system stall as below:
>
> Zone ranges:
> DMA32 [mem 0x0000000080000000-0x000000009fffffff]
> Normal empty
> Movable zone start for each node
> Early memory node ranges
> node 0: [mem 0x0000000080000000-0x000000008005ffff]
> node 0: [mem 0x0000000080060000-0x000000009fffffff]
> Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
> (stall here)
>
> commit 5d99cadf1568 ("crash: fix x86_32 crash memory reserve dead loop
> bug") fix this on 32-bit architecture. However, the problem is not
> completely solved. If `CRASH_ADDR_LOW_MAX = CRASH_ADDR_HIGH_MAX` on 64-bit
> architecture, for example, when system memory is equal to
> CRASH_ADDR_LOW_MAX on RISCV64, the following infinite loop will also occur:
Interesting, I didn't expect risc-v defining them like these.
#define CRASH_ADDR_LOW_MAX dma32_phys_limit
#define CRASH_ADDR_HIGH_MAX memblock_end_of_DRAM()
>
> -> reserve_crashkernel_generic() and high is true
> -> alloc at [CRASH_ADDR_LOW_MAX, CRASH_ADDR_HIGH_MAX] fail
> -> alloc at [0, CRASH_ADDR_LOW_MAX] fail and repeatedly
> (because CRASH_ADDR_LOW_MAX = CRASH_ADDR_HIGH_MAX).
>
> Before refactor in commit 9c08a2a139fe ("x86: kdump: use generic interface
> to simplify crashkernel reservation code"), x86 do not try to reserve crash
> memory at low if it fails to alloc above high 4G. However before refator in
> commit fdc268232dbba ("arm64: kdump: use generic interface to simplify
> crashkernel reservation"), arm64 try to reserve crash memory at low if it
> fails above high 4G. For 64-bit systems, this attempt is less beneficial
> than the opposite, remove it to fix this bug and align with native x86
> implementation.
And I don't like the idea crashkernel=,high failure will fallback to
attempt in low area, so this looks good to me.
>
> After this patch, it print:
> cannot allocate crashkernel (size:0x1f400000)
>
> Fixes: 39365395046f ("riscv: kdump: use generic interface to simplify crashkernel reservation")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> kernel/crash_reserve.c | 9 ---------
> 1 file changed, 9 deletions(-)
Acked-by: Baoquan He <bhe@redhat.com>
>
> diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c
> index 5387269114f6..69e4b8b7b969 100644
> --- a/kernel/crash_reserve.c
> +++ b/kernel/crash_reserve.c
> @@ -420,15 +420,6 @@ void __init reserve_crashkernel_generic(char *cmdline,
> goto retry;
> }
>
> - /*
> - * For crashkernel=size[KMG],high, if the first attempt was
> - * for high memory, fall back to low memory.
> - */
> - if (high && search_end == CRASH_ADDR_HIGH_MAX) {
> - search_end = CRASH_ADDR_LOW_MAX;
> - search_base = 0;
> - goto retry;
> - }
> pr_warn("cannot allocate crashkernel (size:0x%llx)\n",
> crash_size);
> return;
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-08-02 10:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 9:01 [PATCH -next] crash: Fix riscv64 crash memory reserve dead loop Jinjie Ruan
2024-08-02 10:11 ` Baoquan He [this message]
2024-08-06 19:10 ` Catalin Marinas
2024-08-06 19:34 ` Catalin Marinas
2024-08-08 7:56 ` Jinjie Ruan
2024-08-09 1:56 ` Baoquan He
2024-08-09 9:51 ` Catalin Marinas
2024-08-09 10:15 ` Jinjie Ruan
2024-08-13 8:40 ` Petr Tesařík
2024-08-13 12:04 ` Catalin Marinas
2024-08-13 13:33 ` Petr Tesařík
2024-08-07 1:40 ` Jinjie Ruan
2024-08-02 12:24 ` Alexandre Ghiti
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=ZqywtegyIS/YXOVv@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=chenjiahao16@huawei.com \
--cc=dyoung@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=ruanjinjie@huawei.com \
--cc=vgoyal@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox