From: Youling Tang <tangyouling@loongson.cn>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Huacai Chen <chenhuacai@kernel.org>
Subject: Re: [PATCH] mips: kdump: Crash kernel should be able to see old memories
Date: Tue, 20 Apr 2021 13:22:05 +0800 [thread overview]
Message-ID: <a04a736e-4f64-0491-165c-2544bb178d73@loongson.cn> (raw)
In-Reply-To: <bd5b70cf-cfdf-0a4a-dfb5-08e030864138@flygoat.com>
Hi, Jiaxun
On 04/20/2021 09:11 AM, Jiaxun Yang wrote:
>
> 在 2021/4/19 18:56, Youling Tang 写道:
>> From: Huacai Chen <chenhc@lemote.com>
>>
>> kexec-tools use mem=X@Y to pass usable memories to crash kernel, but in
>> commit a94e4f24ec836c8984f83959 ("MIPS: init: Drop boot_mem_map") all
>> BIOS passed memories are removed by early_parse_mem(). I think this is
>> reasonable for a normal kernel but not for a crash kernel, because a
>> crash kernel should be able to see all old memories, even though it is
>> not supposed to use them.
>>
>> Fixes: a94e4f24ec836c8984f83959 ("MIPS: init: Drop boot_mem_map")
>> Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
>> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
>> ---
>> arch/mips/kernel/setup.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
>> index b86e241..ac90d3b 100644
>> --- a/arch/mips/kernel/setup.c
>> +++ b/arch/mips/kernel/setup.c
>> @@ -351,8 +351,10 @@ static int __init early_parse_mem(char *p)
>> */
>> if (usermem == 0) {
>> usermem = 1;
>> +#ifndef CONFIG_CRASH_DUMP
>
> Why depend on a config instead of a runtime variable?
>
If not depend on config, we can determine whether the command line contains
the "elfcorehdr=" parameter, because the "mem=" and "elfcorhdr=" parameters
are automatically added in kexec-tools. So if there is an "elfcorehdr="
parameter in the command line, it means that the currently running kernel
is a capture kernel, and the memblock_remove() operation is not called.
The revised patch is as follows:
if (usermem == 0) {
usermem = 1;
- memblock_remove(memblock_start_of_DRAM(),
- memblock_end_of_DRAM() - memblock_start_of_DRAM());
+ if (!strstr(boot_command_line, "elfcorehdr")) {
+ memblock_remove(memblock_start_of_DRAM(),
+ memblock_end_of_DRAM() -
memblock_start_of_DRAM());
+ }
Do you think it is feasible?
> Btw as you are fixing my commit please keep me CCed.
Sorry, I will add your CCed.
Thanks,
Youling
>
> Thanks.
>
>
> - Jiaxun
>
next prev parent reply other threads:[~2021-04-20 5:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 10:56 Youling Tang
2021-04-20 1:11 ` Jiaxun Yang
2021-04-20 5:22 ` Youling Tang [this message]
2021-06-08 0:16 ` Maciej W. Rozycki
2021-06-08 7:46 ` Youling Tang
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=a04a736e-4f64-0491-165c-2544bb178d73@loongson.cn \
--to=tangyouling@loongson.cn \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/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
all inboxes | Powered by JetHome®