From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A97C0C83F18 for ; Sun, 27 Aug 2023 10:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjH0KNG (ORCPT ); Sun, 27 Aug 2023 06:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjH0KMh (ORCPT ); Sun, 27 Aug 2023 06:12:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC3F124 for ; Sun, 27 Aug 2023 03:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tfjMHtwZmYPGJa055635da7tGwR4fHeiGc9iyDU58/U=; b=CTzi29rfPNZyOKPWEksM41CbgFFMICpWFW3b8Fu0tEvDnhhDcIa9myFdywPJjKBvQvqWWq rZZH5UARODlzpMZr2o/xJIgkj5S+zxbkXw6Dgmlxhmm07RHltPmJN9r5a2kvoafNngYp9a 2xgn3SsV6x9h7XeR+b+17V5BVMndhKU= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-157-_F2DW1_AP7-9rph8ZAP7Hw-1; Sun, 27 Aug 2023 06:11:41 -0400 X-MC-Unique: _F2DW1_AP7-9rph8ZAP7Hw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 89A72380673A; Sun, 27 Aug 2023 10:11:40 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 634522166B25; Sun, 27 Aug 2023 10:11:36 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 1/8] crash_core.c: remove unnecessary parameter of function Date: Sun, 27 Aug 2023 18:11:20 +0800 Message-ID: <20230827101128.70931-2-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In all call sites of __parse_crashkernel(), the parameter 'name' is hardcoded as "crashkernel=3D". So remove the unnecessary parameter 'name', add local varibale 'name' inside __parse_crashkernel() instead. Signed-off-by: Baoquan He --- kernel/crash_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 90ce1dfd591c..f27b4e45d410 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -241,11 +241,11 @@ static int __init __parse_crashkernel(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base, - const char *name, const char *suffix) { char *first_colon, *first_space; char *ck_cmdline; + char *name =3D "crashkernel=3D"; =20 BUG_ON(!crash_size || !crash_base); *crash_size =3D 0; @@ -283,7 +283,7 @@ int __init parse_crashkernel(char *cmdline, unsigned long long *crash_base) { return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel=3D", NULL); + NULL); } =20 int __init parse_crashkernel_high(char *cmdline, @@ -292,7 +292,7 @@ int __init parse_crashkernel_high(char *cmdline, unsigned long long *crash_base) { return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel=3D", suffix_tbl[SUFFIX_HIGH]); + suffix_tbl[SUFFIX_HIGH]); } =20 int __init parse_crashkernel_low(char *cmdline, @@ -301,7 +301,7 @@ int __init parse_crashkernel_low(char *cmdline, unsigned long long *crash_base) { return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel=3D", suffix_tbl[SUFFIX_LOW]); + suffix_tbl[SUFFIX_LOW]); } =20 /* --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91D15C83F19 for ; Sun, 27 Aug 2023 10:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230447AbjH0KND (ORCPT ); Sun, 27 Aug 2023 06:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjH0KM3 (ORCPT ); Sun, 27 Aug 2023 06:12:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89147127 for ; Sun, 27 Aug 2023 03:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YK7T85vx8iCEMaXbCChNlA1g9PhGLEkKTHdrd3z3JaA=; b=VDYsSHv3byXQ2B+vDXtln87B7oYnaaIEaIR+mhohwt2Lh/xd4UB+mcRWshrai8+/bUFAdO px91/Fp3HrXoindkNguwdMf8g8u7K/iStR1c1kmkaBUozbL+pDJPNADe5iG94POkrKxZl6 6Da871oL5Y7UjcoOaKOtMQqXMFzzNEw= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-lTvJkyeNO62CNkI-e2tH1g-1; Sun, 27 Aug 2023 06:11:46 -0400 X-MC-Unique: lTvJkyeNO62CNkI-e2tH1g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77EB63806630; Sun, 27 Aug 2023 10:11:45 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BA8A2166B25; Sun, 27 Aug 2023 10:11:40 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 2/8] crash_core: change the prototype of function parse_crashkernel() Date: Sun, 27 Aug 2023 18:11:21 +0800 Message-ID: <20230827101128.70931-3-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add two parameters 'low_size' and 'high' to function parse_crashkernel(), later crashkernel=3D,high|low parsing will be added. Make adjustments in all call sites of parse_crashkernel() in arch. Signed-off-by: Baoquan He --- arch/arm/kernel/setup.c | 3 ++- arch/arm64/mm/init.c | 2 +- arch/ia64/kernel/setup.c | 2 +- arch/loongarch/kernel/setup.c | 4 +++- arch/mips/kernel/setup.c | 3 ++- arch/powerpc/kernel/fadump.c | 2 +- arch/powerpc/kexec/core.c | 2 +- arch/powerpc/mm/nohash/kaslr_booke.c | 2 +- arch/riscv/mm/init.c | 2 +- arch/s390/kernel/setup.c | 4 ++-- arch/sh/kernel/machine_kexec.c | 2 +- arch/x86/kernel/setup.c | 3 ++- include/linux/crash_core.h | 3 ++- kernel/crash_core.c | 15 ++++++++++++--- 14 files changed, 32 insertions(+), 17 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index c66b560562b3..e2bb7afd0683 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1010,7 +1010,8 @@ static void __init reserve_crashkernel(void) =20 total_mem =3D get_total_mem(); ret =3D parse_crashkernel(boot_command_line, total_mem, - &crash_size, &crash_base); + &crash_size, &crash_base, + NULL, NULL); /* invalid value specified or crashkernel=3D0 */ if (ret || !crash_size) return; diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index d31c3a9290c5..36967b82c150 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -115,7 +115,7 @@ static void __init reserve_crashkernel(void) =20 /* crashkernel=3DX[@offset] */ ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), - &crash_size, &crash_base); + &crash_size, &crash_base, NULL, NULL); if (ret =3D=3D -ENOENT) { ret =3D parse_crashkernel_high(cmdline, 0, &crash_size, &crash_base); if (ret || !crash_size) diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 5a55ac82c13a..4faea2d2cf07 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -277,7 +277,7 @@ static void __init setup_crashkernel(unsigned long tota= l, int *n) int ret; =20 ret =3D parse_crashkernel(boot_command_line, total, - &size, &base); + &size, &base, NULL, NULL); if (ret =3D=3D 0 && size > 0) { if (!base) { sort_regions(rsvd_region, *n); diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index 9d830ab4e302..776a068d8718 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -267,7 +267,9 @@ static void __init arch_parse_crashkernel(void) unsigned long long crash_base, crash_size; =20 total_mem =3D memblock_phys_mem_size(); - ret =3D parse_crashkernel(boot_command_line, total_mem, &crash_size, &cra= sh_base); + ret =3D parse_crashkernel(boot_command_line, total_mem, + &crash_size, &crash_base, + NULL, NULL); if (ret < 0 || crash_size <=3D 0) return; =20 diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index cb871eb784a7..08321c945ac4 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -460,7 +460,8 @@ static void __init mips_parse_crashkernel(void) =20 total_mem =3D memblock_phys_mem_size(); ret =3D parse_crashkernel(boot_command_line, total_mem, - &crash_size, &crash_base); + &crash_size, &crash_base, + NULL, NULL); if (ret !=3D 0 || crash_size <=3D 0) return; =20 diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index ea0a073abd96..7dbdeba56e74 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -313,7 +313,7 @@ static __init u64 fadump_calculate_reserve_size(void) * memory at a predefined offset. */ ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), - &size, &base); + &size, &base, NULL, NULL); if (ret =3D=3D 0 && size > 0) { unsigned long max_size; =20 diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c index de64c7962991..9346c960b296 100644 --- a/arch/powerpc/kexec/core.c +++ b/arch/powerpc/kexec/core.c @@ -109,7 +109,7 @@ void __init reserve_crashkernel(void) total_mem_sz =3D memory_limit ? memory_limit : memblock_phys_mem_size(); /* use common parsing */ ret =3D parse_crashkernel(boot_command_line, total_mem_sz, - &crash_size, &crash_base); + &crash_size, &crash_base, NULL, NULL); if (ret =3D=3D 0 && crash_size > 0) { crashk_res.start =3D crash_base; crashk_res.end =3D crash_base + crash_size - 1; diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/= kaslr_booke.c index 2fb3edafe9ab..b4f2786a7d2b 100644 --- a/arch/powerpc/mm/nohash/kaslr_booke.c +++ b/arch/powerpc/mm/nohash/kaslr_booke.c @@ -178,7 +178,7 @@ static void __init get_crash_kernel(void *fdt, unsigned= long size) int ret; =20 ret =3D parse_crashkernel(boot_command_line, size, &crash_size, - &crash_base); + &crash_base, NULL, NULL); if (ret !=3D 0 || crash_size =3D=3D 0) return; if (crash_base =3D=3D 0) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index e4c35ac2357f..a9ef0824f905 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -1332,7 +1332,7 @@ static void __init reserve_crashkernel(void) } =20 ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), - &crash_size, &crash_base); + &crash_size, &crash_base, NULL, NULL); if (ret || !crash_size) return; =20 diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 00d76448319d..386a36181ceb 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -625,8 +625,8 @@ static void __init reserve_crashkernel(void) phys_addr_t low, high; int rc; =20 - rc =3D parse_crashkernel(boot_command_line, ident_map_size, &crash_size, - &crash_base); + rc =3D parse_crashkernel(boot_command_line, ident_map_size, + &crash_size, &crash_base, NULL, NULL); =20 crash_base =3D ALIGN(crash_base, KEXEC_CRASH_MEM_ALIGN); crash_size =3D ALIGN(crash_size, KEXEC_CRASH_MEM_ALIGN); diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c index 223c14f44af7..fa3a7b36190a 100644 --- a/arch/sh/kernel/machine_kexec.c +++ b/arch/sh/kernel/machine_kexec.c @@ -154,7 +154,7 @@ void __init reserve_crashkernel(void) int ret; =20 ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), - &crash_size, &crash_base); + &crash_size, &crash_base, NULL, NULL); if (ret =3D=3D 0 && crash_size > 0) { crashk_res.start =3D crash_base; crashk_res.end =3D crash_base + crash_size - 1; diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index fd975a4a5200..382c66d2cf71 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -558,7 +558,8 @@ static void __init reserve_crashkernel(void) total_mem =3D memblock_phys_mem_size(); =20 /* crashkernel=3DXM */ - ret =3D parse_crashkernel(boot_command_line, total_mem, &crash_size, &cra= sh_base); + ret =3D parse_crashkernel(boot_command_line, total_mem, + &crash_size, &crash_base, NULL, NULL); if (ret !=3D 0 || crash_size <=3D 0) { /* crashkernel=3DX,high */ ret =3D parse_crashkernel_high(boot_command_line, total_mem, diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index de62a722431e..2e76289699ff 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -78,7 +78,8 @@ Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsi= gned int type, void final_note(Elf_Word *buf); =20 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, - unsigned long long *crash_size, unsigned long long *crash_base); + unsigned long long *crash_size, unsigned long long *crash_base, + unsigned long long *low_size, bool *high); 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, diff --git a/kernel/crash_core.c b/kernel/crash_core.c index f27b4e45d410..f6a5c219e2e1 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -280,10 +280,19 @@ static int __init __parse_crashkernel(char *cmdline, int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, - unsigned long long *crash_base) + unsigned long long *crash_base, + unsigned long long *low_size, + bool *high) { - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - NULL); + int ret; + + /* crashkernel=3DX[@offset] */ + ret =3D __parse_crashkernel(cmdline, system_ram, crash_size, + crash_base, NULL); + if (!high) + return ret; + + return 0; } =20 int __init parse_crashkernel_high(char *cmdline, --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E534FC83F10 for ; Sun, 27 Aug 2023 10:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbjH0KNI (ORCPT ); Sun, 27 Aug 2023 06:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjH0KMl (ORCPT ); Sun, 27 Aug 2023 06:12:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CAB4128 for ; Sun, 27 Aug 2023 03:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iV2wLAfcAl+D7MYwEotIMI/hG+PsohPBamGW1ll7QSU=; b=N0fWT95n/idPE3VjgiK7O5ElErLRV1fmPU159EAM7JwO1/IGCDGFvsoJp5xvkIgweYcAxv +kW9a7h9DYNl9sJ1H7+JeuynzrFNuGty7sfm0YtUUdc4J1lyfpDsR7WObKc3M7lGBj7N7E 4ho3wyK/+UMuOv5HvHHx0QWfEZUuQ+g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-372-dcQi-t8wMe-jYcKP77Qj1Q-1; Sun, 27 Aug 2023 06:11:50 -0400 X-MC-Unique: dcQi-t8wMe-jYcKP77Qj1Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E1C185CBE0; Sun, 27 Aug 2023 10:11:50 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2624C2166B25; Sun, 27 Aug 2023 10:11:45 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 3/8] include/linux/kexec.h: move down crash_core.h including Date: Sun, 27 Aug 2023 18:11:22 +0800 Message-ID: <20230827101128.70931-4-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Later generic macros related to crash_core will be added into , and the corresponding arch specific macros will be added to override them if needed. And Kconfig option KEXEC_CORE selects CRASH_CORE. So move including after . And also move the crash_res|low_res and crash_notes delcarations after including because they are all defined in kernel/kexec_core.c, and note_buf_t is definied in crash_core.h. This is a preparation patch. Signed-off-by: Baoquan He --- include/linux/kexec.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 22b5cd24f581..8768fd9e2a66 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -15,25 +15,25 @@ =20 #if !defined(__ASSEMBLY__) =20 -#include #include #include =20 #include #include =20 -/* Location of a reserved region to hold the crash kernel. - */ -extern struct resource crashk_res; -extern struct resource crashk_low_res; -extern note_buf_t __percpu *crash_notes; - #ifdef CONFIG_KEXEC_CORE #include #include #include #include #include +#include + +/* Location of a reserved region to hold the crash kernel. + */ +extern struct resource crashk_res; +extern struct resource crashk_low_res; +extern note_buf_t __percpu *crash_notes; =20 /* Verify architecture specific macros are defined */ =20 --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1885DC83F1A for ; Sun, 27 Aug 2023 10:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230509AbjH0KNK (ORCPT ); Sun, 27 Aug 2023 06:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbjH0KMm (ORCPT ); Sun, 27 Aug 2023 06:12:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 593DA129 for ; Sun, 27 Aug 2023 03:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ti+FZphx3tTCt2+5tJQ+9yD5S9gf+CV5t2KKqvLpfrs=; b=cb2x2OjYqZlCiPYKOfYyEK8tLZvrfcSODKnaYKoRIya5x6ObebXIwLGoll3B09JfFJmQCE URKblTlM/8Df+T2OlWCsx8WQl9138CrzwDQ4qAeJ3DZexQXWEc2Nrh7dVzZOlSSU2+ID+T 8v6s/zOKoBtuoQID7GIo6fcGl4RQ8lA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-235-h0NDYsL3PUmeR2mCgbvofA-1; Sun, 27 Aug 2023 06:11:55 -0400 X-MC-Unique: h0NDYsL3PUmeR2mCgbvofA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D6C88D40A0; Sun, 27 Aug 2023 10:11:55 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id F41802166B25; Sun, 27 Aug 2023 10:11:50 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 4/8] crash_core: change parse_crashkernel() to support crashkernel=,high|low parsing Date: Sun, 27 Aug 2023 18:11:23 +0800 Message-ID: <20230827101128.70931-5-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now parse_crashkernel() is a real entry point for all kinds of crahskernel parsing on any architecture. And wrap the crahskernel=3D,high|low handling inside CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION ifdeffery scope. Signed-off-by: Baoquan He --- include/linux/crash_core.h | 6 ++++++ kernel/crash_core.c | 28 +++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index 2e76289699ff..85260bf4a734 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -77,6 +77,12 @@ Elf_Word *append_elf_note(Elf_Word *buf, char *name, uns= igned int type, void *data, size_t data_len); void final_note(Elf_Word *buf); =20 +#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION +#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE +#define DEFAULT_CRASH_KERNEL_LOW_SIZE (128UL << 20) +#endif +#endif + int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base, unsigned long long *low_size, bool *high); diff --git a/kernel/crash_core.c b/kernel/crash_core.c index f6a5c219e2e1..355b0ab5189c 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -276,6 +276,9 @@ static int __init __parse_crashkernel(char *cmdline, /* * That function is the entry point for command line parsing and should be * called from the arch-specific code. + * + * If crashkernel=3D,high|low is supported on architecture, non-NULL values + * should be passed to parameters 'low_size' and 'high'. */ int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, @@ -291,7 +294,30 @@ int __init parse_crashkernel(char *cmdline, crash_base, NULL); if (!high) return ret; - +#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION + else if (ret =3D=3D -ENOENT) { + ret =3D __parse_crashkernel(cmdline, 0, crash_size, + crash_base, suffix_tbl[SUFFIX_HIGH]); + if (ret || !*crash_size) + return -1; + + /* + * crashkernel=3DY,low can be specified or not, but invalid value + * is not allowed. + */ + ret =3D __parse_crashkernel(cmdline, 0, low_size, + crash_base, suffix_tbl[SUFFIX_LOW]); + if (ret =3D=3D -ENOENT) + *low_size =3D DEFAULT_CRASH_KERNEL_LOW_SIZE; + else if (ret) + return -1; + + *high =3D true; + } else if (ret || !*crash_size) { + /* The specified value is invalid */ + return -1; + } +#endif return 0; } =20 --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D333C83F11 for ; Sun, 27 Aug 2023 10:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231158AbjH0KNv (ORCPT ); Sun, 27 Aug 2023 06:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230512AbjH0KNP (ORCPT ); Sun, 27 Aug 2023 06:13:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B849B131 for ; Sun, 27 Aug 2023 03:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yxgj/4bGPsyeEGGTCmmz+k2NvLzn/k3ICbMHRhDNWaw=; b=E+ojq+WE9FrNZYUrO1mgXiQjT+o8wmoF9Yey6WHhuPbzoPPkraFOdB+PwEAjQfJE2ZDaqc ZZvnpfLLLSuw6vKw2dvoCpRYXgQ7wSAiyrzaXvBGR0fFhp0SIgn+hTbrLa3uw1/KWMobcr Son1bJHPuaj8+/6ypMftonbI0uZkLMY= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-a20ST_vlMPiGrhHDdUzlCg-1; Sun, 27 Aug 2023 06:12:00 -0400 X-MC-Unique: a20ST_vlMPiGrhHDdUzlCg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2D333C02B6A; Sun, 27 Aug 2023 10:11:59 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id C491F2166B25; Sun, 27 Aug 2023 10:11:55 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 5/8] crash_core: add generic function to do reservation Date: Sun, 27 Aug 2023 18:11:24 +0800 Message-ID: <20230827101128.70931-6-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In architecture like x86_64, arm64 and riscv, they have vast virtual address space and usually have huge physical memory RAM. Their crashkernel reservation doesn't have to be limited under 4G RAM, but can be extended to the whole physical memory via crashkernel=3D,high support. Now add function reserve_crashkernel_generic() to reserve crashkernel memory if users specify any case of kernel pamameters, like crashkernel=3DxM[@offset] or crashkernel=3D,high|low. This is preparation to simplify code of crashkernel=3D,high support in architecutures. Signed-off-by: Baoquan He --- include/linux/crash_core.h | 34 ++++++++++-- kernel/crash_core.c | 109 ++++++++++++++++++++++++++++++++++++- 2 files changed, 136 insertions(+), 7 deletions(-) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index 85260bf4a734..2f732493e922 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -77,12 +77,6 @@ Elf_Word *append_elf_note(Elf_Word *buf, char *name, uns= igned int type, void *data, size_t data_len); void final_note(Elf_Word *buf); =20 -#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION -#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE -#define DEFAULT_CRASH_KERNEL_LOW_SIZE (128UL << 20) -#endif -#endif - int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base, unsigned long long *low_size, bool *high); @@ -91,4 +85,32 @@ int parse_crashkernel_high(char *cmdline, unsigned long = long system_ram, int parse_crashkernel_low(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); =20 +#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION +#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE +#define DEFAULT_CRASH_KERNEL_LOW_SIZE (128UL << 20) +#endif +#ifndef CRASH_ALIGN +#define CRASH_ALIGN SZ_2M +#endif +#ifndef CRASH_ADDR_LOW_MAX +#define CRASH_ADDR_LOW_MAX SZ_4G +#endif +#ifndef CRASH_ADDR_HIGH_MAX +#define CRASH_ADDR_HIGH_MAX memblock_end_of_DRAM() +#endif + +void __init reserve_crashkernel_generic(char *cmdline, + unsigned long long crash_size, + unsigned long long crash_base, + unsigned long long crash_low_size, + bool high); +#else +static inline void __init reserve_crashkernel_generic(char *cmdline, + unsigned long long crash_size, + unsigned long long crash_base, + unsigned long long crash_low_size, + bool high) +{} +#endif + #endif /* LINUX_CRASH_CORE_H */ diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 355b0ab5189c..6bc00cc390b5 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -5,11 +5,13 @@ */ =20 #include -#include #include #include #include #include +#include +#include +#include =20 #include #include @@ -349,6 +351,111 @@ static int __init parse_crashkernel_dummy(char *arg) } early_param("crashkernel", parse_crashkernel_dummy); =20 +#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION +static int __init reserve_crashkernel_low(unsigned long long low_size) +{ +#ifdef CONFIG_64BIT + unsigned long long low_base; + + low_base =3D memblock_phys_alloc_range(low_size, CRASH_ALIGN, 0, CRASH_AD= DR_LOW_MAX); + if (!low_base) { + pr_err("cannot allocate crashkernel low memory (size:0x%llx).\n", low_si= ze); + return -ENOMEM; + } + + pr_info("crashkernel low memory reserved: 0x%08llx - 0x%08llx (%lld MB)\n= ", + low_base, low_base + low_size, low_size >> 20); + + crashk_low_res.start =3D low_base; + crashk_low_res.end =3D low_base + low_size - 1; + insert_resource(&iomem_resource, &crashk_low_res); +#endif + return 0; +} + +void __init reserve_crashkernel_generic(char *cmdline, + unsigned long long crash_size, + unsigned long long crash_base, + unsigned long long crash_low_size, + bool high) +{ + unsigned long long search_end =3D CRASH_ADDR_LOW_MAX, search_base =3D 0; + bool fixed_base =3D false; + + /* User specifies base address explicitly. */ + if (crash_base) { + fixed_base =3D true; + search_base =3D crash_base; + search_end =3D crash_base + crash_size; + } + + if (high) { + search_base =3D CRASH_ADDR_LOW_MAX; + search_end =3D CRASH_ADDR_HIGH_MAX; + } + +retry: + crash_base =3D memblock_phys_alloc_range(crash_size, CRASH_ALIGN, + search_base, search_end); + if (!crash_base) { + /* + * For crashkernel=3Dsize[KMG]@offset[KMG], print out failure + * message if can't reserve the specified region. + */ + if (fixed_base) { + pr_warn("crashkernel reservation failed - memory is in use.\n"); + return; + } + + /* + * For crashkernel=3Dsize[KMG], if the first attempt was for + * low memory, fall back to high memory, the minimum required + * low memory will be reserved later. + */ + if (!high && search_end =3D=3D CRASH_ADDR_LOW_MAX) { + search_end =3D CRASH_ADDR_HIGH_MAX; + search_base =3D CRASH_ADDR_LOW_MAX; + crash_low_size =3D DEFAULT_CRASH_KERNEL_LOW_SIZE; + goto retry; + } + + /* + * For crashkernel=3Dsize[KMG],high, if the first attempt was + * for high memory, fall back to low memory. + */ + if (high && search_end =3D=3D CRASH_ADDR_HIGH_MAX) { + search_end =3D CRASH_ADDR_LOW_MAX; + search_base =3D 0; + goto retry; + } + pr_warn("cannot allocate crashkernel (size:0x%llx)\n", + crash_size); + return; + } + + if ((crash_base > CRASH_ADDR_LOW_MAX) && + crash_low_size && reserve_crashkernel_low(crash_low_size)) { + memblock_phys_free(crash_base, crash_size); + return; + } + + pr_info("crashkernel reserved: 0x%016llx - 0x%016llx (%lld MB)\n", + crash_base, crash_base + crash_size, crash_size >> 20); + + /* + * The crashkernel memory will be removed from the kernel linear + * map. Inform kmemleak so that it won't try to access it. + */ + kmemleak_ignore_phys(crash_base); + if (crashk_low_res.end) + kmemleak_ignore_phys(crashk_low_res.start); + + crashk_res.start =3D crash_base; + crashk_res.end =3D crash_base + crash_size - 1; + insert_resource(&iomem_resource, &crashk_res); +} +#endif + Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, void *data, size_t data_len) { --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E72C0C83F10 for ; Sun, 27 Aug 2023 10:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230516AbjH0KNj (ORCPT ); Sun, 27 Aug 2023 06:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230504AbjH0KNK (ORCPT ); Sun, 27 Aug 2023 06:13:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64210132 for ; Sun, 27 Aug 2023 03:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7abeATfyQslvBYUQ06/AS2G+fIAqveQCmkXKLRWolm0=; b=KeTrYZY89QWYa3vVRjHCZkUZKEcpOA70TnzDjt/ACvLIlNm+JNJm39bDpa4AsQtSe/uI+E 7RiubL4GRg/eLhuAqd06tNW1UWup5CQ4bTvB4RbqiU/bw42Hs8DUaMCXCUEoDu57OVa85h 6m23o+ElUy8yVmT3gdBSIA6De6/Jhyk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-2nrDBWI6N7WxvX9oaANdOw-1; Sun, 27 Aug 2023 06:12:05 -0400 X-MC-Unique: 2nrDBWI6N7WxvX9oaANdOw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3EA58015AB; Sun, 27 Aug 2023 10:12:04 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94AE92166B25; Sun, 27 Aug 2023 10:12:00 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 6/8] arm64: kdump: use generic interface to simplify crashkernel reservation Date: Sun, 27 Aug 2023 18:11:25 +0800 Message-ID: <20230827101128.70931-7-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" With the help of newly changed function parse_crashkernel() and generic reserve_crashkernel_generic(), crashkernel reservation can be simplified by steps: 1) Provide CRASH_ALIGN, CRASH_ADDR_LOW_MAX, CRASH_ADDR_HIGH_MAX and DEFAULT_CRASH_KERNEL_LOW_SIZE in ; 2) Add arch_reserve_crashkernel() to call parse_crashkernel() and reserve_crashkernel_generic(); 3) Add ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION Kconfig in arch/arm64/Kconfig. The old reserve_crashkernel_low() and reserve_crashkernel() can be removed. Signed-off-by: Baoquan He --- arch/arm64/Kconfig | 3 + arch/arm64/include/asm/kexec.h | 5 ++ arch/arm64/mm/init.c | 140 ++------------------------------- 3 files changed, 16 insertions(+), 132 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a2511b30d0f6..6739e7b456b9 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1481,6 +1481,9 @@ config KEXEC_FILE for kernel and initramfs as opposed to list of segments as accepted by previous system call. =20 +config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION + def_bool CRASH_CORE + config KEXEC_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index 9ac9572a3bbe..442fc13588a2 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -132,4 +132,9 @@ extern int load_other_segments(struct kimage *image, =20 #endif /* __ASSEMBLY__ */ =20 +/* Current arm64 boot protocol requires 2MB alignment */ +#define CRASH_ALIGN SZ_2M + +#define CRASH_ADDR_LOW_MAX arm64_dma_phys_limit +#define CRASH_ADDR_HIGH_MAX (PHYS_MASK + 1) #endif diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 36967b82c150..2e63954a2574 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -64,149 +64,25 @@ EXPORT_SYMBOL(memstart_addr); */ phys_addr_t __ro_after_init arm64_dma_phys_limit; =20 -/* Current arm64 boot protocol requires 2MB alignment */ -#define CRASH_ALIGN SZ_2M - -#define CRASH_ADDR_LOW_MAX arm64_dma_phys_limit -#define CRASH_ADDR_HIGH_MAX (PHYS_MASK + 1) -#define CRASH_HIGH_SEARCH_BASE SZ_4G - -#define DEFAULT_CRASH_KERNEL_LOW_SIZE (128UL << 20) - -static int __init reserve_crashkernel_low(unsigned long long low_size) -{ - unsigned long long low_base; - - low_base =3D memblock_phys_alloc_range(low_size, CRASH_ALIGN, 0, CRASH_AD= DR_LOW_MAX); - if (!low_base) { - pr_err("cannot allocate crashkernel low memory (size:0x%llx).\n", low_si= ze); - return -ENOMEM; - } - - pr_info("crashkernel low memory reserved: 0x%08llx - 0x%08llx (%lld MB)\n= ", - low_base, low_base + low_size, low_size >> 20); - - crashk_low_res.start =3D low_base; - crashk_low_res.end =3D low_base + low_size - 1; - insert_resource(&iomem_resource, &crashk_low_res); - - return 0; -} - -/* - * reserve_crashkernel() - reserves memory for crash kernel - * - * This function reserves memory area given in "crashkernel=3D" kernel com= mand - * line parameter. The memory reserved is used by dump capture kernel when - * primary kernel is crashing. - */ -static void __init reserve_crashkernel(void) +static void __init arch_reserve_crashkernel(void) { - unsigned long long crash_low_size =3D 0, search_base =3D 0; - unsigned long long crash_max =3D CRASH_ADDR_LOW_MAX; + unsigned long long low_size =3D 0; unsigned long long crash_base, crash_size; char *cmdline =3D boot_command_line; - bool fixed_base =3D false; bool high =3D false; int ret; =20 if (!IS_ENABLED(CONFIG_KEXEC_CORE)) return; =20 - /* crashkernel=3DX[@offset] */ ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), - &crash_size, &crash_base, NULL, NULL); - if (ret =3D=3D -ENOENT) { - ret =3D parse_crashkernel_high(cmdline, 0, &crash_size, &crash_base); - if (ret || !crash_size) - return; - - /* - * crashkernel=3DY,low can be specified or not, but invalid value - * is not allowed. - */ - ret =3D parse_crashkernel_low(cmdline, 0, &crash_low_size, &crash_base); - if (ret =3D=3D -ENOENT) - crash_low_size =3D DEFAULT_CRASH_KERNEL_LOW_SIZE; - else if (ret) - return; - - search_base =3D CRASH_HIGH_SEARCH_BASE; - crash_max =3D CRASH_ADDR_HIGH_MAX; - high =3D true; - } else if (ret || !crash_size) { - /* The specified value is invalid */ + &crash_size, &crash_base, + &low_size, &high); + if (ret) return; - } - - crash_size =3D PAGE_ALIGN(crash_size); - - /* User specifies base address explicitly. */ - if (crash_base) { - fixed_base =3D true; - search_base =3D crash_base; - crash_max =3D crash_base + crash_size; - } - -retry: - crash_base =3D memblock_phys_alloc_range(crash_size, CRASH_ALIGN, - search_base, crash_max); - if (!crash_base) { - /* - * For crashkernel=3Dsize[KMG]@offset[KMG], print out failure - * message if can't reserve the specified region. - */ - if (fixed_base) { - pr_warn("crashkernel reservation failed - memory is in use.\n"); - return; - } - - /* - * For crashkernel=3Dsize[KMG], if the first attempt was for - * low memory, fall back to high memory, the minimum required - * low memory will be reserved later. - */ - if (!high && crash_max =3D=3D CRASH_ADDR_LOW_MAX) { - crash_max =3D CRASH_ADDR_HIGH_MAX; - search_base =3D CRASH_ADDR_LOW_MAX; - crash_low_size =3D DEFAULT_CRASH_KERNEL_LOW_SIZE; - goto retry; - } - - /* - * For crashkernel=3Dsize[KMG],high, if the first attempt was - * for high memory, fall back to low memory. - */ - if (high && crash_max =3D=3D CRASH_ADDR_HIGH_MAX) { - crash_max =3D CRASH_ADDR_LOW_MAX; - search_base =3D 0; - goto retry; - } - pr_warn("cannot allocate crashkernel (size:0x%llx)\n", - crash_size); - return; - } - - if ((crash_base >=3D CRASH_ADDR_LOW_MAX) && crash_low_size && - reserve_crashkernel_low(crash_low_size)) { - memblock_phys_free(crash_base, crash_size); - return; - } - - pr_info("crashkernel reserved: 0x%016llx - 0x%016llx (%lld MB)\n", - crash_base, crash_base + crash_size, crash_size >> 20); - - /* - * The crashkernel memory will be removed from the kernel linear - * map. Inform kmemleak so that it won't try to access it. - */ - kmemleak_ignore_phys(crash_base); - if (crashk_low_res.end) - kmemleak_ignore_phys(crashk_low_res.start); =20 - crashk_res.start =3D crash_base; - crashk_res.end =3D crash_base + crash_size - 1; - insert_resource(&iomem_resource, &crashk_res); + reserve_crashkernel_generic(cmdline, crash_size, crash_base, + low_size, high); } =20 /* @@ -454,7 +330,7 @@ void __init bootmem_init(void) * request_standard_resources() depends on crashkernel's memory being * reserved, so do it here. */ - reserve_crashkernel(); + arch_reserve_crashkernel(); =20 memblock_dump_all(); } --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CABFC83F15 for ; Sun, 27 Aug 2023 10:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231133AbjH0KNn (ORCPT ); Sun, 27 Aug 2023 06:13:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbjH0KNN (ORCPT ); Sun, 27 Aug 2023 06:13:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F2BA138 for ; Sun, 27 Aug 2023 03:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H9Vqa75l+7u4j3OpciKGw2S9Ht0IvasTWkoki4mvRlQ=; b=dEUKuZSa6hwCcuMcu0e0fkduijE7Z7aIgP3nMnczBfmR566KdTGbti+ZCCIuRJ2hiwTZAs ZGDGIolV2tRyQV5nFdD2eTnzHqP0JD2d0BYPz20o/9afbeRHCCTfk9Hvm5E+Inzv1GNqb6 f/KBPLl6ZPMOllQllIBjYVsDWwIdtUM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-63M_9Sk1O12-xtAXNXeGqA-1; Sun, 27 Aug 2023 06:12:10 -0400 X-MC-Unique: 63M_9Sk1O12-xtAXNXeGqA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9662185A78F; Sun, 27 Aug 2023 10:12:09 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A44A2166B25; Sun, 27 Aug 2023 10:12:05 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 7/8] x86: kdump: use generic interface to simplify crashkernel reservation code Date: Sun, 27 Aug 2023 18:11:26 +0800 Message-ID: <20230827101128.70931-8-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" With the help of newly changed function parse_crashkernel() and generic reserve_crashkernel_generic(), crashkernel reservation can be simplified by steps: 1) Provide CRASH_ALIGN, CRASH_ADDR_LOW_MAX, CRASH_ADDR_HIGH_MAX and DEFAULT_CRASH_KERNEL_LOW_SIZE in ; 2) Add arch_reserve_crashkernel() to call parse_crashkernel() and reserve_crashkernel_generic(), and do the ARCH specific work if needed. 3) Add ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION Kconfig in arch/x86/Kconfig. When adding DEFAULT_CRASH_KERNEL_LOW_SIZE, add crash_low_size_default() to calculate crashkernel low memory because x86_64 has special requirement. The old reserve_crashkernel_low() and reserve_crashkernel() can be removed. Signed-off-by: Baoquan He --- arch/x86/Kconfig | 3 + arch/x86/include/asm/kexec.h | 32 ++++++++ arch/x86/kernel/setup.c | 144 ++++------------------------------- 3 files changed, 51 insertions(+), 128 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index e36261b4ea14..31515b3ef55b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2073,6 +2073,9 @@ config KEXEC_FILE config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE =20 +config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION + def_bool CRASH_CORE + config KEXEC_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index 5b77bbc28f96..84a7d1f6f153 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -66,6 +66,37 @@ struct kimage; # define KEXEC_ARCH KEXEC_ARCH_X86_64 #endif =20 +/* + * --------- Crashkernel reservation ------------------------------ + */ + +/* 16M alignment for crash kernel regions */ +#define CRASH_ALIGN SZ_16M + +/* + * Keep the crash kernel below this limit. + * + * Earlier 32-bits kernels would limit the kernel to the low 512 MB range + * due to mapping restrictions. + * + * 64-bit kdump kernels need to be restricted to be under 64 TB, which is + * the upper limit of system RAM in 4-level paging mode. Since the kdump + * jump could be from 5-level paging to 4-level paging, the jump will fail= if + * the kernel is put above 64 TB, and during the 1st kernel bootup there's + * no good way to detect the paging mode of the target kernel which will be + * loaded for dumping. + */ + +#ifdef CONFIG_X86_32 +# define CRASH_ADDR_LOW_MAX SZ_512M +# define CRASH_ADDR_HIGH_MAX SZ_512M +#else +# define CRASH_ADDR_LOW_MAX SZ_4G +# define CRASH_ADDR_HIGH_MAX SZ_64T +#endif + +# define DEFAULT_CRASH_KERNEL_LOW_SIZE crash_low_size_default() + /* * This function is responsible for capturing register states if coming * via panic otherwise just fix up the ss and sp if coming via kernel @@ -209,6 +240,7 @@ typedef void crash_vmclear_fn(void); extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss; extern void kdump_nmi_shootdown_cpus(void); =20 +extern unsigned long crash_low_size_default(void); #endif /* __ASSEMBLY__ */ =20 #endif /* _ASM_X86_KEXEC_H */ diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 382c66d2cf71..559a5c4141db 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -474,152 +474,40 @@ static void __init memblock_x86_reserve_range_setup_= data(void) /* * --------- Crashkernel reservation ------------------------------ */ - -/* 16M alignment for crash kernel regions */ -#define CRASH_ALIGN SZ_16M - -/* - * Keep the crash kernel below this limit. - * - * Earlier 32-bits kernels would limit the kernel to the low 512 MB range - * due to mapping restrictions. - * - * 64-bit kdump kernels need to be restricted to be under 64 TB, which is - * the upper limit of system RAM in 4-level paging mode. Since the kdump - * jump could be from 5-level paging to 4-level paging, the jump will fail= if - * the kernel is put above 64 TB, and during the 1st kernel bootup there's - * no good way to detect the paging mode of the target kernel which will be - * loaded for dumping. - */ -#ifdef CONFIG_X86_32 -# define CRASH_ADDR_LOW_MAX SZ_512M -# define CRASH_ADDR_HIGH_MAX SZ_512M -#else -# define CRASH_ADDR_LOW_MAX SZ_4G -# define CRASH_ADDR_HIGH_MAX SZ_64T -#endif - -static int __init reserve_crashkernel_low(void) +unsigned long crash_low_size_default(void) { #ifdef CONFIG_X86_64 - unsigned long long base, low_base =3D 0, low_size =3D 0; - unsigned long low_mem_limit; - int ret; - - low_mem_limit =3D min(memblock_phys_mem_size(), CRASH_ADDR_LOW_MAX); - - /* crashkernel=3DY,low */ - ret =3D parse_crashkernel_low(boot_command_line, low_mem_limit, &low_size= , &base); - if (ret) { - /* - * two parts from kernel/dma/swiotlb.c: - * -swiotlb size: user-specified with swiotlb=3D or default. - * - * -swiotlb overflow buffer: now hardcoded to 32k. We round it - * to 8M for other buffers that may need to stay low too. Also - * make sure we allocate enough extra low memory so that we - * don't run out of DMA buffers for 32-bit devices. - */ - low_size =3D max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20); - } else { - /* passed with crashkernel=3D0,low ? */ - if (!low_size) - return 0; - } - - low_base =3D memblock_phys_alloc_range(low_size, CRASH_ALIGN, 0, CRASH_AD= DR_LOW_MAX); - if (!low_base) { - pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller = size.\n", - (unsigned long)(low_size >> 20)); - return -ENOMEM; - } - - pr_info("Reserving %ldMB of low memory at %ldMB for crashkernel (low RAM = limit: %ldMB)\n", - (unsigned long)(low_size >> 20), - (unsigned long)(low_base >> 20), - (unsigned long)(low_mem_limit >> 20)); - - crashk_low_res.start =3D low_base; - crashk_low_res.end =3D low_base + low_size - 1; - insert_resource(&iomem_resource, &crashk_low_res); -#endif + return max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20); +#else return 0; +#endif } =20 -static void __init reserve_crashkernel(void) +static void __init arch_reserve_crashkernel(void) { - unsigned long long crash_size, crash_base, total_mem; + unsigned long long crash_base, crash_size, low_size =3D 0; + char *cmdline =3D boot_command_line; bool high =3D false; int ret; =20 if (!IS_ENABLED(CONFIG_KEXEC_CORE)) return; =20 - total_mem =3D memblock_phys_mem_size(); - - /* crashkernel=3DXM */ - ret =3D parse_crashkernel(boot_command_line, total_mem, - &crash_size, &crash_base, NULL, NULL); - if (ret !=3D 0 || crash_size <=3D 0) { - /* crashkernel=3DX,high */ - ret =3D parse_crashkernel_high(boot_command_line, total_mem, - &crash_size, &crash_base); - if (ret !=3D 0 || crash_size <=3D 0) - return; - high =3D true; - } + ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), + &crash_size, &crash_base, + &low_size, &high); + if (ret) + return; =20 if (xen_pv_domain()) { pr_info("Ignoring crashkernel for a Xen PV domain\n"); return; } =20 - /* 0 means: find the address automatically */ - if (!crash_base) { - /* - * Set CRASH_ADDR_LOW_MAX upper bound for crash memory, - * crashkernel=3Dx,high reserves memory over 4G, also allocates - * 256M extra low memory for DMA buffers and swiotlb. - * But the extra memory is not required for all machines. - * So try low memory first and fall back to high memory - * unless "crashkernel=3Dsize[KMG],high" is specified. - */ - if (!high) - crash_base =3D memblock_phys_alloc_range(crash_size, - CRASH_ALIGN, CRASH_ALIGN, - CRASH_ADDR_LOW_MAX); - if (!crash_base) - crash_base =3D memblock_phys_alloc_range(crash_size, - CRASH_ALIGN, CRASH_ALIGN, - CRASH_ADDR_HIGH_MAX); - if (!crash_base) { - pr_info("crashkernel reservation failed - No suitable area found.\n"); - return; - } - } else { - unsigned long long start; - - start =3D memblock_phys_alloc_range(crash_size, SZ_1M, crash_base, - crash_base + crash_size); - if (start !=3D crash_base) { - pr_info("crashkernel reservation failed - memory is in use.\n"); - return; - } - } - - if (crash_base >=3D (1ULL << 32) && reserve_crashkernel_low()) { - memblock_phys_free(crash_base, crash_size); - return; - } - - pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: = %ldMB)\n", - (unsigned long)(crash_size >> 20), - (unsigned long)(crash_base >> 20), - (unsigned long)(total_mem >> 20)); + reserve_crashkernel_generic(cmdline, crash_size, crash_base, + low_size, high); =20 - crashk_res.start =3D crash_base; - crashk_res.end =3D crash_base + crash_size - 1; - insert_resource(&iomem_resource, &crashk_res); + return; } =20 static struct resource standard_io_resources[] =3D { @@ -1231,7 +1119,7 @@ void __init setup_arch(char **cmdline_p) * Reserve memory for crash kernel after SRAT is parsed so that it * won't consume hotpluggable memory. */ - reserve_crashkernel(); + arch_reserve_crashkernel(); =20 memblock_find_dma_reserve(); =20 --=20 2.41.0 From nobody Thu Dec 18 12:11:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A590C83F13 for ; Sun, 27 Aug 2023 10:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbjH0KNt (ORCPT ); Sun, 27 Aug 2023 06:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjH0KNN (ORCPT ); Sun, 27 Aug 2023 06:13:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2341913D for ; Sun, 27 Aug 2023 03:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693131138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zIWsXjq9P0Tg5W/bc8NeaPZWq15ad3a2KkR2r2xHm0Q=; b=Y0IGdLBWsGRmMoVVq+L08FCyyHHxGSY+pT/AMZoo0GgXjtkxTdAc9EBKgjh0Dke7uHyU1o n461pga5P0aYU802cRZcp4Yg9T2WZWjz7Zym7uisLYu51F4bi4t2AZFhru6H0X9CWcDOya uctLn/sHuI5t6tW8ovqo/L/k3folPnc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-83-SMQtJMjNORyfOcC9gDFngQ-1; Sun, 27 Aug 2023 06:12:15 -0400 X-MC-Unique: SMQtJMjNORyfOcC9gDFngQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86E0B185A78B; Sun, 27 Aug 2023 10:12:14 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6169D2166B25; Sun, 27 Aug 2023 10:12:10 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-riscv@lists.infradead.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, Baoquan He Subject: [PATCH 8/8] crash_core.c: remove unneeded functions Date: Sun, 27 Aug 2023 18:11:27 +0800 Message-ID: <20230827101128.70931-9-bhe@redhat.com> In-Reply-To: <20230827101128.70931-1-bhe@redhat.com> References: <20230827101128.70931-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" So far, nobody calls functions parse_crashkernel_high() and parse_crashkernel_high(), remove both of them. Signed-off-by: Baoquan He --- include/linux/crash_core.h | 4 ---- kernel/crash_core.c | 18 ------------------ 2 files changed, 22 deletions(-) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index 2f732493e922..0c512a80a768 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -80,10 +80,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, unsigned long long *low_size, bool *high); -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); =20 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION #ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 6bc00cc390b5..61a8ea3b23a2 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -323,24 +323,6 @@ int __init parse_crashkernel(char *cmdline, return 0; } =20 -int __init parse_crashkernel_high(char *cmdline, - unsigned long long system_ram, - unsigned long long *crash_size, - unsigned long long *crash_base) -{ - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - suffix_tbl[SUFFIX_HIGH]); -} - -int __init parse_crashkernel_low(char *cmdline, - unsigned long long system_ram, - unsigned long long *crash_size, - unsigned long long *crash_base) -{ - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - suffix_tbl[SUFFIX_LOW]); -} - /* * Add a dummy early_param handler to mark crashkernel=3D as a known comma= nd line * parameter and suppress incorrect warnings in init/main.c. --=20 2.41.0