Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3046352pxb; Mon, 19 Apr 2021 22:23:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+0Po6tG4lVXUiXG/fhTJtSUcOo+3b4e3b94kfhi1SHveub5DjCkDDSYjikqgCFrOv8HYA X-Received: by 2002:a17:906:68da:: with SMTP id y26mr26110054ejr.442.1618896208884; Mon, 19 Apr 2021 22:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618896208; cv=none; d=google.com; s=arc-20160816; b=N7TUhdaiLdx2rwO9KGlROT4+kPEq2ayZ/pwc7PN0LdLSO23MM99Ys1URKg15YyfJKS lyTMVSQCpYfmgtvkHw8ndUHPv9yfggf6sQPBc6KxvQO7MEWeHqd1XTRRBMGH6yTTIAs2 fVXU0FDYuSNsIAXL4LkTaUoIsMjGS5D76802CaGIGQm3RLxoL0ELQLpT+doYOCqcAowf ZvBY6JjXm4OpYqK0h44ck3E85vAC+YQbXG5m9h80/3w0VX5Bf8TZFQlX1k/pxrnBq8w+ GHb0uOEssPUxsoX0OYTgXES0QF1buL6PyiSaZbwF7G2BuNCSyoynp19GDPvJn0nbyv5E VePA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=seZrS9ABgSjgWDWZclcU3DLMYLr4gHjbXAakx294HqU=; b=Ml+r1e7CrxywSOFhLtvxGCrz6y4o+lS00tvPmi20y2aIncHmHi8c8zX2qmPkeV9UZf dvRxnqKTal3OiDXBW08EoVgDtQONfKVySdWwabjw0kSwRAS5J66DZ+FD1/okCpEMlDQc Xq9mpAjNM+kOI3hNxbe8ZyDtj7/JK49/RdIo3yOkc0EZoqN5/hheH7KLk4acNevyWKbW QLCm9hD28PiCLeUZkcMtpWLoU3KqceWo8aaq+MuI8cpGnSFSCnmGUBT9c/ybnWWCIy99 jiPFsoNmDjzzdoO7kiJ7ToBQ7zjz9Ag+rImIJVrAde1u0Xc1Kdxkhh63ZkAkaCfjrnfi szfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s3si1006579edd.219.2021.04.19.22.23.05; Mon, 19 Apr 2021 22:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbhDTFWq (ORCPT + 99 others); Tue, 20 Apr 2021 01:22:46 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47414 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229523AbhDTFWp (ORCPT ); Tue, 20 Apr 2021 01:22:45 -0400 Received: from [10.130.0.193] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Ax7cj+ZH5ghuAKAA--.14700S3; Tue, 20 Apr 2021 13:22:07 +0800 (CST) Subject: Re: [PATCH] mips: kdump: Crash kernel should be able to see old memories To: Jiaxun Yang , Thomas Bogendoerfer References: <1618829807-12522-1-git-send-email-tangyouling@loongson.cn> Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Huacai Chen From: Youling Tang Message-ID: Date: Tue, 20 Apr 2021 13:22:05 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-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BIdaVFxhVjvjDU0xZFpf 9x07j2-erUUUUU= X-CM-SenderInfo: 5wdqw5prxox03j6o00pqjv00gofq/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Jiaxun On 04/20/2021 09:11 AM, Jiaxun Yang wrote: > > 在 2021/4/19 18:56, Youling Tang 写道: >> From: Huacai Chen >> >> 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 >> Signed-off-by: Youling Tang >> --- >> 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 >