From patchwork Sat Dec 25 07:23:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12699200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 325E3C433F5 for ; Sat, 25 Dec 2021 07:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7byVCCJ95BSolvReIr4Ab8ams5302HIUHtgRh7k81A8=; b=U3PfAUBAL7i0OV PWPuujtuwyzE9qcrKII8U+gOjzXIWcmMQOk1rD6kpn3+ta3TDUOsT0/Y8pGRe3P7/v814gY81lk0j fFbQ8kc/KntoEPwl2LvE81ythRKEWiyJj/F94VvSojFvjpKFPon/qcMFiTWPKo+k9PJnz1ZucecoE Z1BXiO87APq36fXrFreT2nUXIGfLfwTsnp8a/sQtw3Ytylx0VZ1nV1jkD8IS8wq4n7j++HnMipafC X4xoeawI3rZp6p20IrKTaRTg8xHS7xmsYvY0cPSid6LvEIXGwcVZ0h7EcgMrhpwCXiny+3sfHJKnP oOPJ6MppGrGQsnsGneCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11Sv-00EkVb-41; Sat, 25 Dec 2021 07:27:41 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11S0-00Ek6m-4Z; Sat, 25 Dec 2021 07:26:49 +0000 Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JLb7T1dqfz91nM; Sat, 25 Dec 2021 15:25:41 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:34 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:32 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH 1/4] kdump: add helper parse_crashkernel_high_low() Date: Sat, 25 Dec 2021 15:23:24 +0800 Message-ID: <20211225072327.1807-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211225072327.1807-1-thunder.leizhen@huawei.com> References: <20211225072327.1807-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211224_232644_676374_2337E100 X-CRM114-Status: GOOD ( 11.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The bootup command line option crashkernel=Y,low is valid only when crashkernel=X,high is specified. Putting their parsing into a separate function makes the code logic clearer and easier to understand the strong dependencies between them. Signed-off-by: Zhen Lei --- include/linux/crash_core.h | 3 +++ kernel/crash_core.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index de62a722431e7db..2d3a64761d18998 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -83,5 +83,8 @@ int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); int parse_crashkernel_low(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); +int __init parse_crashkernel_high_low(char *cmdline, + unsigned long long *high_size, + unsigned long long *low_size); #endif /* LINUX_CRASH_CORE_H */ diff --git a/kernel/crash_core.c b/kernel/crash_core.c index eb53f5ec62c900f..8ab59a0e04f178f 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -295,6 +295,41 @@ int __init parse_crashkernel_low(char *cmdline, "crashkernel=", suffix_tbl[SUFFIX_LOW]); } +/** + * parse_crashkernel_high_low - Parsing "crashkernel=X,high" and possible + * "crashkernel=Y,low". + * @cmdline: The bootup command line. + * @high_size: Save the memory size specified by "crashkernel=X,high". + * @low_size: Save the memory size specified by "crashkernel=Y,low" or "-1" + if it's not specified. + * + * Returns 0 on success, else a negative status code. + */ +int __init parse_crashkernel_high_low(char *cmdline, + unsigned long long *high_size, + unsigned long long *low_size) +{ + int ret; + unsigned long long base; + + BUG_ON(!high_size || !low_size); + + /* crashkernel=X,high */ + ret = parse_crashkernel_high(cmdline, 0, high_size, &base); + if (ret) + return ret; + + if (*high_size <= 0) + return -EINVAL; + + /* crashkernel=Y,low */ + ret = parse_crashkernel_low(cmdline, 0, low_size, &base); + if (ret) + *low_size = -1; + + return 0; +} + Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, void *data, size_t data_len) { From patchwork Sat Dec 25 07:23:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12699201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB230C433F5 for ; Sat, 25 Dec 2021 07:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VHJm/h7a2VMs4hrqbJKYbhNqtsL3hRK55Q6T0sE752I=; b=khmyM7c9FSwgpj bii1cee12H2EEkbv+rupVk1jgK+fDDAFrBPishlFEuCHK6fQev/A82BVol7cThg9GgwUhBqwNdGjp hwGrFtx7XZ6mrnWslLnwqpqb0WedcEL13ybHNelBU8+Gu+l3/sRVgtdkNi+Bc0YdkTYdsVxX+cNVE CQdeI3X5T2/p5lVp5PEZQ2MDNtAgz0oibFvdwvXS6JaAdLccUHA5GPykXUizIckoyzPJG9/G5R4jt sFb9GCylBfm80FWNkpab+XFcJkAGzZNeTUzWJAHxhF878z3ewZ/s12PTHvNOdlsTPVHNdnYrBzXq3 KJrl7S84Tydfcr9Y52zQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11Sk-00EkQz-Es; Sat, 25 Dec 2021 07:27:30 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11S0-00Ek6u-4V; Sat, 25 Dec 2021 07:26:49 +0000 Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JLb7V2Ctvz91rc; Sat, 25 Dec 2021 15:25:42 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:35 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:33 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH 2/4] x86/setup: Use parse_crashkernel_high_low() to simplify code Date: Sat, 25 Dec 2021 15:23:25 +0800 Message-ID: <20211225072327.1807-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211225072327.1807-1-thunder.leizhen@huawei.com> References: <20211225072327.1807-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211224_232644_688032_5D68795E X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use parse_crashkernel_high_low() to bring the parsing of "crashkernel=X,high" and the parsing of "crashkernel=Y,low" together, they are strongly dependent, make code logic clear and more readable. Suggested-by: Borislav Petkov Signed-off-by: Zhen Lei --- arch/x86/kernel/setup.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 6a190c7f4d71b05..93d78aae1937db3 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -416,18 +416,16 @@ static void __init memblock_x86_reserve_range_setup_data(void) # define CRASH_ADDR_HIGH_MAX SZ_64T #endif -static int __init reserve_crashkernel_low(void) +static int __init reserve_crashkernel_low(unsigned long long low_size) { #ifdef CONFIG_X86_64 - unsigned long long base, low_base = 0, low_size = 0; + unsigned long long low_base = 0; unsigned long low_mem_limit; - int ret; low_mem_limit = min(memblock_phys_mem_size(), CRASH_ADDR_LOW_MAX); - /* crashkernel=Y,low */ - ret = parse_crashkernel_low(boot_command_line, low_mem_limit, &low_size, &base); - if (ret) { + /* crashkernel=Y,low is not specified */ + if ((long)low_size < 0) { /* * two parts from kernel/dma/swiotlb.c: * -swiotlb size: user-specified with swiotlb= or default. @@ -465,7 +463,7 @@ static int __init reserve_crashkernel_low(void) static void __init reserve_crashkernel(void) { - unsigned long long crash_size, crash_base, total_mem; + unsigned long long crash_size, crash_base, total_mem, low_size; bool high = false; int ret; @@ -474,10 +472,9 @@ static void __init reserve_crashkernel(void) /* crashkernel=XM */ ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base); if (ret != 0 || crash_size <= 0) { - /* crashkernel=X,high */ - ret = parse_crashkernel_high(boot_command_line, total_mem, - &crash_size, &crash_base); - if (ret != 0 || crash_size <= 0) + /* crashkernel=X,high and possible crashkernel=Y,low */ + ret = parse_crashkernel_high_low(boot_command_line, &crash_size, &low_size); + if (ret) return; high = true; } @@ -520,7 +517,7 @@ static void __init reserve_crashkernel(void) } } - if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) { + if (crash_base >= (1ULL << 32) && reserve_crashkernel_low(low_size)) { memblock_phys_free(crash_base, crash_size); return; } From patchwork Sat Dec 25 07:23:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12699199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45718C433F5 for ; Sat, 25 Dec 2021 07:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dRXxk1kJXXrSxfsQSwZpBM7kFj5u4/mZNIakYqmlV10=; b=llH+oNywt1LJ9q er2IdYK+qD/HSvO/NPQSFZije6t0er+koJ7bElvlnwrk/ICaDQWhRrXkCHCruqt5ZjMBN+f0wsUSs 3446Xs9tFz/ecwvRvsjIHKsZPd/8WLxDWoAhdH1Ds+jB61El8ZPlGlvFZgI1TG1gLhGzdLdUiTyC3 12gIXGrqd6BW5ljAzCn7v0urNBOwZON3yV7cualKMlcA1a0gLIZ59ImutP7+t4FolOdy5nlP76tuF yFVwCI6RsC2xx3LxWYrfMPsfVsybVdU4zlldKK7CpNNm9z23kvv71BwdRW2etQOG+xXzlTJuO/D6Q 7dOf1eT4k46H6MqooOlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11SI-00EkIx-T4; Sat, 25 Dec 2021 07:27:03 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11S0-00Ek7T-38; Sat, 25 Dec 2021 07:26:47 +0000 Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JLb826Bckzcc4V; Sat, 25 Dec 2021 15:26:10 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:36 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:35 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH 3/4] kdump: make parse_crashkernel_{high|low}() static Date: Sat, 25 Dec 2021 15:23:26 +0800 Message-ID: <20211225072327.1807-4-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211225072327.1807-1-thunder.leizhen@huawei.com> References: <20211225072327.1807-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211224_232644_536326_49D03F88 X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make parse_crashkernel_{high|low}() static, they are only referenced by parse_crashkernel_high_low() in the same file. The latter is recommended. Signed-off-by: Zhen Lei --- include/linux/crash_core.h | 4 ---- kernel/crash_core.c | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index 2d3a64761d18998..598fd55d83c169e 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -79,10 +79,6 @@ void final_note(Elf_Word *buf); int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); -int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, - unsigned long long *crash_size, unsigned long long *crash_base); -int parse_crashkernel_low(char *cmdline, unsigned long long system_ram, - unsigned long long *crash_size, unsigned long long *crash_base); int __init parse_crashkernel_high_low(char *cmdline, unsigned long long *high_size, unsigned long long *low_size); diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 8ab59a0e04f178f..97001820396295e 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -277,7 +277,7 @@ int __init parse_crashkernel(char *cmdline, "crashkernel=", NULL); } -int __init parse_crashkernel_high(char *cmdline, +static int __init parse_crashkernel_high(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base) @@ -286,7 +286,7 @@ int __init parse_crashkernel_high(char *cmdline, "crashkernel=", suffix_tbl[SUFFIX_HIGH]); } -int __init parse_crashkernel_low(char *cmdline, +static int __init parse_crashkernel_low(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base) From patchwork Sat Dec 25 07:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12699197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCA05C433F5 for ; Sat, 25 Dec 2021 07:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PtOBu2UGkBMCmXWuymM7UDca417Ju0YdPjG71sI2A9U=; b=DDd0Hp6UOoBMaW ylDWf1c5iPbW45EbceATbuZvAIV4Ej75vqZx24+Q5Mg2AhLaHgtae8V3wwlitmj3Uag7amBdhQRY8 XYUGWeJ4UsKrKB22RKbCbaPEXiniyerAWAxm4CJ178Xu0J+vxOLmbe1055q71E8iYBNvg7KpDdTod lzzx3sAVTnQpOP4Xs8S/xZE7ZRYyDXWt7ExIlNVw7cZ2gLQH3smK5cPLQFyx9n05uZ3lEF9I4f5Xl 41llSykUB27L/ExB5zXaM9RmgSeXe5OCNjT2iU0unQJ3ByEtA8oL9ke4YEUtFflc/DdcHCLuAOfrI Er3XUZoV1nB+AlskQKDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11SU-00EkMd-JX; Sat, 25 Dec 2021 07:27:14 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n11S0-00Ek7h-4Y; Sat, 25 Dec 2021 07:26:47 +0000 Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JLb7Y2GlNz91t2; Sat, 25 Dec 2021 15:25:45 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:37 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 25 Dec 2021 15:26:36 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH 4/4] kdump: reduce unnecessary parameters of parse_crashkernel_{high|low}() Date: Sat, 25 Dec 2021 15:23:27 +0800 Message-ID: <20211225072327.1807-5-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211225072327.1807-1-thunder.leizhen@huawei.com> References: <20211225072327.1807-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211224_232644_645883_D2D26FB5 X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Delete confusing parameters 'system_ram' and 'crash_base' of parse_crashkernel_{high|low}(), they are only needed by the case of "crashkernel=X@[offset]". Signed-off-by: Zhen Lei --- kernel/crash_core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 97001820396295e..0ebf5efce3119c5 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -278,20 +278,20 @@ int __init parse_crashkernel(char *cmdline, } static int __init parse_crashkernel_high(char *cmdline, - unsigned long long system_ram, - unsigned long long *crash_size, - unsigned long long *crash_base) + unsigned long long *crash_size) { - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, + unsigned long long base; + + return __parse_crashkernel(cmdline, 0, crash_size, &base, "crashkernel=", suffix_tbl[SUFFIX_HIGH]); } static int __init parse_crashkernel_low(char *cmdline, - unsigned long long system_ram, - unsigned long long *crash_size, - unsigned long long *crash_base) + unsigned long long *crash_size) { - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, + unsigned long long base; + + return __parse_crashkernel(cmdline, 0, crash_size, &base, "crashkernel=", suffix_tbl[SUFFIX_LOW]); } @@ -310,12 +310,11 @@ int __init parse_crashkernel_high_low(char *cmdline, unsigned long long *low_size) { int ret; - unsigned long long base; BUG_ON(!high_size || !low_size); /* crashkernel=X,high */ - ret = parse_crashkernel_high(cmdline, 0, high_size, &base); + ret = parse_crashkernel_high(cmdline, high_size); if (ret) return ret; @@ -323,7 +322,7 @@ int __init parse_crashkernel_high_low(char *cmdline, return -EINVAL; /* crashkernel=Y,low */ - ret = parse_crashkernel_low(cmdline, 0, low_size, &base); + ret = parse_crashkernel_low(cmdline, low_size); if (ret) *low_size = -1;