[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a04a736e-4f64-0491-165c-2544bb178d73@loongson.cn>
Date: Tue, 20 Apr 2021 13:22:05 +0800
From: Youling Tang <tangyouling@...ngson.cn>
To: Jiaxun Yang <jiaxun.yang@...goat.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
Huacai Chen <chenhuacai@...nel.org>
Subject: Re: [PATCH] mips: kdump: Crash kernel should be able to see old
memories
Hi, Jiaxun
On 04/20/2021 09:11 AM, Jiaxun Yang wrote:
>
> 在 2021/4/19 18:56, Youling Tang 写道:
>> From: Huacai Chen <chenhc@...ote.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@...nel.org>
>> Signed-off-by: Youling Tang <tangyouling@...ngson.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
>
Powered by blists - more mailing lists