From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Baoquan He <bhe@redhat.com>
Cc: <linux@armlinux.org.uk>, <catalin.marinas@arm.com>,
<will@kernel.org>, <paul.walmsley@sifive.com>,
<palmer@dabbelt.com>, <aou@eecs.berkeley.edu>,
<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<dave.hansen@linux.intel.com>, <hpa@zytor.com>,
<vgoyal@redhat.com>, <dyoung@redhat.com>, <arnd@arndb.de>,
<afd@ti.com>, <linus.walleij@linaro.org>,
<akpm@linux-foundation.org>, <eric.devolder@oracle.com>,
<gregkh@linuxfoundation.org>, <javierm@redhat.com>,
<deller@gmx.de>, <robh@kernel.org>, <hbathini@linux.ibm.com>,
<thunder.leizhen@huawei.com>, <chenjiahao16@huawei.com>,
<linux-kernel@vger.kernel.org>, <kexec@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-riscv@lists.infradead.org>
Subject: Re: [PATCH v3 1/3] crash: Fix x86_32 crash memory reserve dead loop bug
Date: Thu, 18 Jul 2024 20:11:39 +0800 [thread overview]
Message-ID: <42e69f31-44da-0525-0a79-8d4b5f3e4c57@huawei.com> (raw)
In-Reply-To: <Zpj4OUsTPshBK4JZ@MiWiFi-R3L-srv>
On 2024/7/18 19:10, Baoquan He wrote:
> On 07/18/24 at 11:54am, Jinjie Ruan wrote:
>> On x86_32 Qemu machine with 1GB memory, the cmdline "crashkernel=1G,high"
>> will cause system stall as below:
>>
>> ACPI: Reserving FACP table memory at [mem 0x3ffe18b8-0x3ffe192b]
>> ACPI: Reserving DSDT table memory at [mem 0x3ffe0040-0x3ffe18b7]
>> ACPI: Reserving FACS table memory at [mem 0x3ffe0000-0x3ffe003f]
>> ACPI: Reserving APIC table memory at [mem 0x3ffe192c-0x3ffe19bb]
>> ACPI: Reserving HPET table memory at [mem 0x3ffe19bc-0x3ffe19f3]
>> ACPI: Reserving WAET table memory at [mem 0x3ffe19f4-0x3ffe1a1b]
>> 143MB HIGHMEM available.
>> 879MB LOWMEM available.
>> mapped low ram: 0 - 36ffe000
>> low ram: 0 - 36ffe000
>> (stall here)
>>
>> The reason is that the CRASH_ADDR_LOW_MAX is equal to CRASH_ADDR_HIGH_MAX
>> on x86_32, the first high crash kernel memory reservation will fail, then
>> go into the "retry" loop and never came out as below.
>>
>> -> 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).
>>
>> Fix it by prevent crashkernel=,high from being parsed successfully on 32bit
>> system with a architecture-defined macro.
>>
>> After this patch, the 'crashkernel=,high' for 32bit system can't succeed,
>> and it has no chance to call reserve_crashkernel_generic(), therefore this
>> issue on x86_32 is solved.
>>
>> Fixes: 9c08a2a139fe ("x86: kdump: use generic interface to simplify crashkernel reservation code")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> Signed-off-by: Baoquan He <bhe@redhat.com>
>
> Just adding my Suggested-by is fine. If multiple people cooperate on one
> patch, the Co-developed-by tag is needed. As a maintainer, I prefer to
> have the Suggested-by tag in this case.
OK, thank you very much!
>
>> Tested-by: Jinjie Ruan <ruanjinjie@huawei.com>
>
> You can't add Tested-by tag for your own patch. When you post patch,
> testing it is your obligation.
>
> Other than these tag adding concerns, this patch looks good to me. You
> can post v4 to update and add my:
Thank you, I'll fix it next version.
>
> Acked-by: Baoquan He <bhe@redhat.com>>
>> ---
>> v3:
>> - Fix it as Baoquan suggested.
>> - Update the commit message.
>> v2:
>> - Peel off the other two patches.
>> - Update the commit message and fix tag.
>> ---
>> arch/arm64/include/asm/crash_reserve.h | 2 ++
>> arch/riscv/include/asm/crash_reserve.h | 2 ++
>> arch/x86/include/asm/crash_reserve.h | 1 +
>> kernel/crash_reserve.c | 2 +-
>> 4 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/include/asm/crash_reserve.h b/arch/arm64/include/asm/crash_reserve.h
>> index 4afe027a4e7b..bf362c1a612f 100644
>> --- a/arch/arm64/include/asm/crash_reserve.h
>> +++ b/arch/arm64/include/asm/crash_reserve.h
>> @@ -7,4 +7,6 @@
>>
>> #define CRASH_ADDR_LOW_MAX arm64_dma_phys_limit
>> #define CRASH_ADDR_HIGH_MAX (PHYS_MASK + 1)
>> +
>> +#define HAVE_ARCH_CRASHKERNEL_RESERVATION_HIGH
>> #endif
>> diff --git a/arch/riscv/include/asm/crash_reserve.h b/arch/riscv/include/asm/crash_reserve.h
>> index 013962e63587..8d7a8fc1d459 100644
>> --- a/arch/riscv/include/asm/crash_reserve.h
>> +++ b/arch/riscv/include/asm/crash_reserve.h
>> @@ -7,5 +7,7 @@
>> #define CRASH_ADDR_LOW_MAX dma32_phys_limit
>> #define CRASH_ADDR_HIGH_MAX memblock_end_of_DRAM()
>>
>> +#define HAVE_ARCH_CRASHKERNEL_RESERVATION_HIGH
>> +
>> extern phys_addr_t memblock_end_of_DRAM(void);
>> #endif
>> diff --git a/arch/x86/include/asm/crash_reserve.h b/arch/x86/include/asm/crash_reserve.h
>> index 7835b2cdff04..24c2327f9a16 100644
>> --- a/arch/x86/include/asm/crash_reserve.h
>> +++ b/arch/x86/include/asm/crash_reserve.h
>> @@ -26,6 +26,7 @@ extern unsigned long swiotlb_size_or_default(void);
>> #else
>> # define CRASH_ADDR_LOW_MAX SZ_4G
>> # define CRASH_ADDR_HIGH_MAX SZ_64T
>> +#define HAVE_ARCH_CRASHKERNEL_RESERVATION_HIGH
>> #endif
>>
>> # define DEFAULT_CRASH_KERNEL_LOW_SIZE crash_low_size_default()
>> diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c
>> index 5b2722a93a48..c5213f123e19 100644
>> --- a/kernel/crash_reserve.c
>> +++ b/kernel/crash_reserve.c
>> @@ -306,7 +306,7 @@ int __init parse_crashkernel(char *cmdline,
>> /* crashkernel=X[@offset] */
>> ret = __parse_crashkernel(cmdline, system_ram, crash_size,
>> crash_base, NULL);
>> -#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
>> +#ifdef HAVE_ARCH_CRASHKERNEL_RESERVATION_HIGH
>> /*
>> * If non-NULL 'high' passed in and no normal crashkernel
>> * setting detected, try parsing crashkernel=,high|low.
>> --
>> 2.34.1
>>
>
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-07-18 12:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 3:54 [PATCH v3 0/3] crash: Fix x86_32 memory reserve dead loop bug Jinjie Ruan
2024-07-18 3:54 ` [PATCH v3 1/3] crash: Fix x86_32 crash " Jinjie Ruan
2024-07-18 11:10 ` Baoquan He
2024-07-18 12:11 ` Jinjie Ruan [this message]
2024-07-18 13:18 ` Jinjie Ruan
2024-07-18 3:54 ` [PATCH v3 2/3] crash: Fix x86_32 crash memory reserve dead loop bug at high Jinjie Ruan
2024-07-18 11:14 ` Baoquan He
2024-07-18 12:10 ` Jinjie Ruan
2024-07-18 14:42 ` Baoquan He
2024-07-18 3:54 ` [PATCH v3 3/3] ARM: Use generic interface to simplify crashkernel reservation Jinjie Ruan
2024-08-05 7:51 ` Linus Walleij
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=42e69f31-44da-0525-0a79-8d4b5f3e4c57@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=afd@ti.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chenjiahao16@huawei.com \
--cc=dave.hansen@linux.intel.com \
--cc=deller@gmx.de \
--cc=dyoung@redhat.com \
--cc=eric.devolder@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=hbathini@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=javierm@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
--cc=thunder.leizhen@huawei.com \
--cc=vgoyal@redhat.com \
--cc=will@kernel.org \
/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