From nobody Thu Dec 18 05:38:59 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2562B1E1A25 for ; Tue, 17 Dec 2024 06:47:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418040; cv=none; b=qxlpelL4FO6iam8YFpJikjf3n1OHzhLEH81OSUIZ4s+SPGNsgk4G1KpMIfeIxNz5mePh6d/p8nVb+4HOhDeSUHAXIZ4WS/7HF4/46axVbHFHWxXAreFFutFyY/qiSQmlLDGfZ0J6dPsGYi7YjIs7eqk3LoLMR7z9+XK6P0cxf8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418040; c=relaxed/simple; bh=9H+8j0Ar5zAnphlteNh40pqUar291wd3JONfJ8ZcK8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H8yOq6JMhjLPmRREdA3s0pU0ZVYFvUbVFgKBmUAjut87KqFZQLvaF3Q/xkd2tA98l+3WY+Hj9b+yNe5g0m43xVYJ5BLvxWO6+shdoDFeDEE8XNSMCQCWX74ayq1DfoBL3xZp2Dguk4wIwTcwTU5TkcgbPa2cb2LvswqECm59iUI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Zn/Y6GAl; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Zn/Y6GAl" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGHXxDE027390; Tue, 17 Dec 2024 06:46:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=a51YAcOPHw8REYfzD T6Mazib9DPYr/BR2XxrvtalFWU=; b=Zn/Y6GAlyvcCRMIHN6NxZdur2lRmODZ9v H/JS6B+TZvdpaqX4LbLdjLOQkZ4VuYcdL9fullxJiSn4mXzkQ9/tj9/6EZxKKkcH 2ftP1cYYDqBHg/th51YoLQIWq7wcxQOQPTBaUzZwtIq03aJKwRCQP2WEErqCQ5F9 gqq+Ol6p/cVqwASJwofWoNNt8pVhgueIga1BCXM0KBsiLHvTCk+KP7GX1j1IhHGD JWiLkXHbnpfP+N4h4HWM1Vl4wlmvSX0mczhM54BGxIMCAjGWufuaQRisXp4kNavH yHLiXIDui79DlVjOmdqrFdC+2jRru9XH4ZcyMEc/nkLP0K3pZzmow== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43jgd2dcsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:46:47 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH62QgI029312; Tue, 17 Dec 2024 06:46:46 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 43hmbshtnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:46:46 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BH6khac39518486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2024 06:46:43 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54ED520040; Tue, 17 Dec 2024 06:46:43 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB5922004B; Tue, 17 Dec 2024 06:46:38 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.29.128]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2024 06:46:38 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@lists.ozlabs.org Cc: Sourabh Jain , Andrew Morton , Baoquan he , Hari Bathini , Madhavan Srinivasan , Michael Ellerman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] crash: remove an unused argument from reserve_crashkernel_generic() Date: Tue, 17 Dec 2024 12:16:09 +0530 Message-ID: <20241217064613.1042866-2-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> References: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: nJtrhwYMtX-uL4Zhj5Q5bt90Z2ltsieJ X-Proofpoint-GUID: nJtrhwYMtX-uL4Zhj5Q5bt90Z2ltsieJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 mlxlogscore=876 priorityscore=1501 malwarescore=0 impostorscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170052 Content-Type: text/plain; charset="utf-8" cmdline argument is not used in reserve_crashkernel_generic() so remove it. Correspondingly, all the callers have been updated as well. No functional change intended. Cc: Andrew Morton Cc: Baoquan he Cc: Hari Bathini CC: Madhavan Srinivasan Cc: Michael Ellerman Cc: kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sourabh Jain --- arch/arm64/mm/init.c | 6 ++---- arch/loongarch/kernel/setup.c | 5 ++--- arch/riscv/mm/init.c | 6 ++---- arch/x86/kernel/setup.c | 6 ++---- include/linux/crash_reserve.h | 11 +++++------ kernel/crash_reserve.c | 9 ++++----- 6 files changed, 17 insertions(+), 26 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index ccdef53872a0..2e496209af80 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -98,21 +98,19 @@ static void __init arch_reserve_crashkernel(void) { unsigned long long low_size =3D 0; unsigned long long crash_base, crash_size; - char *cmdline =3D boot_command_line; bool high =3D false; int ret; =20 if (!IS_ENABLED(CONFIG_CRASH_RESERVE)) return; =20 - ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), + ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), &crash_size, &crash_base, &low_size, &high); if (ret) return; =20 - reserve_crashkernel_generic(cmdline, crash_size, crash_base, - low_size, high); + reserve_crashkernel_generic(crash_size, crash_base, low_size, high); } =20 static phys_addr_t __init max_zone_phys(phys_addr_t zone_limit) diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index 56934fe58170..ece9c4266c3f 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -259,18 +259,17 @@ static void __init arch_reserve_crashkernel(void) int ret; unsigned long long low_size =3D 0; unsigned long long crash_base, crash_size; - char *cmdline =3D boot_command_line; bool high =3D false; =20 if (!IS_ENABLED(CONFIG_CRASH_RESERVE)) return; =20 - ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), + ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), &crash_size, &crash_base, &low_size, &high); if (ret) return; =20 - reserve_crashkernel_generic(cmdline, crash_size, crash_base, low_size, hi= gh); + reserve_crashkernel_generic(crash_size, crash_base, low_size, high); } =20 static void __init fdt_setup(void) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index fc53ce748c80..750991df9e52 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -1377,21 +1377,19 @@ static void __init arch_reserve_crashkernel(void) { unsigned long long low_size =3D 0; unsigned long long crash_base, crash_size; - char *cmdline =3D boot_command_line; bool high =3D false; int ret; =20 if (!IS_ENABLED(CONFIG_CRASH_RESERVE)) return; =20 - ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), + ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), &crash_size, &crash_base, &low_size, &high); if (ret) return; =20 - reserve_crashkernel_generic(cmdline, crash_size, crash_base, - low_size, high); + reserve_crashkernel_generic(crash_size, crash_base, low_size, high); } =20 void __init paging_init(void) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index f1fea506e20f..15b6823556c8 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -469,14 +469,13 @@ static void __init memblock_x86_reserve_range_setup_d= ata(void) static void __init arch_reserve_crashkernel(void) { 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_CRASH_RESERVE)) return; =20 - ret =3D parse_crashkernel(cmdline, memblock_phys_mem_size(), + ret =3D parse_crashkernel(boot_command_line, memblock_phys_mem_size(), &crash_size, &crash_base, &low_size, &high); if (ret) @@ -487,8 +486,7 @@ static void __init arch_reserve_crashkernel(void) return; } =20 - reserve_crashkernel_generic(cmdline, crash_size, crash_base, - low_size, high); + reserve_crashkernel_generic(crash_size, crash_base, low_size, high); } =20 static struct resource standard_io_resources[] =3D { diff --git a/include/linux/crash_reserve.h b/include/linux/crash_reserve.h index 5a9df944fb80..1fe7e7d1b214 100644 --- a/include/linux/crash_reserve.h +++ b/include/linux/crash_reserve.h @@ -32,13 +32,12 @@ int __init parse_crashkernel(char *cmdline, unsigned lo= ng long system_ram, #define CRASH_ADDR_HIGH_MAX memblock_end_of_DRAM() #endif =20 -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); +void __init reserve_crashkernel_generic(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, +static inline void __init reserve_crashkernel_generic( unsigned long long crash_size, unsigned long long crash_base, unsigned long long crash_low_size, diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c index a620fb4b2116..aff7c0fdbefa 100644 --- a/kernel/crash_reserve.c +++ b/kernel/crash_reserve.c @@ -375,11 +375,10 @@ static int __init reserve_crashkernel_low(unsigned lo= ng long low_size) return 0; } =20 -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) +void __init reserve_crashkernel_generic(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; --=20 2.47.1 From nobody Thu Dec 18 05:38:59 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D51AB14E2DA for ; Tue, 17 Dec 2024 06:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418030; cv=none; b=QXwO6HQDUKhjSpvnDMEJNGb07s7IKl+3Xfk2nbjhKCl/9TbGT/afIS2vqhSsAcLxdSKT5NdAibFxSd0vjECadCEy2wuUaPgQWf7NZGfPAycIN3ao9ysdXUZJvF6jPHkCnd8q2LOfu/phrH05wKj9yaCfkGwb9mtu+UwzSg3KHCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418030; c=relaxed/simple; bh=W9FcTAysEz3KmOLXN99Ns611hXhfAyDWjKK3jbEHTRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mj7akxC/r+vd2gZLmHc7TgBSTct07BPadZQGBTH334e2y/ZVGjSPT51Bpd61VttWEW+gLMdZPSoCIG4UzgRRFGtRjEf8miEaRzhOZexGM/STw3bAKOsZ0yscuJ1GyD2qDzS067qqNfk5c2hQhP8avEm5QO/D/ktF54EXHnOt86s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=VzSREzqt; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="VzSREzqt" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGNaVru023385; Tue, 17 Dec 2024 06:46:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=EwscI7uVcdbmUY3L0 es/V7Diybjo/Bbg4ugn3C2Ls+o=; b=VzSREzqtxtkizVmTpzkKqJ1X2Fiso6dLl 29SGRZi+wrVZS1npmBOJqlaxjDcE82AZ1NAEQRB2bwdH2xho7GPB90OPPjWdAN2q 78cwod38PnNKWDg4c+ULVxHIS29Umm3DI/VOBpLhbrC/u3qVXIlm3dY5VAgxjqfx RysVHCYCQqzx8O2ci/VL/n5ryApAFRixMnIZhz+nN3D44gOMXyO6x0ZqBTJhQmDy ruoJDuoVlxRT6t7dJE7oxgW+KSw5DgdcuMl+6zMmlUE2VnOezbqUtLcGmxsC+DZn brecMsI55Ey43/KKzB2FO+ygJxlBbAyhpR6o7dM/Xrs4XXysZkV/g== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43jx1a9a40-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:46:53 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH3tDcC011295; Tue, 17 Dec 2024 06:46:53 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 43hpjk1bwr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:46:53 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BH6knBt60686736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2024 06:46:49 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA21D20043; Tue, 17 Dec 2024 06:46:49 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DEF320040; Tue, 17 Dec 2024 06:46:45 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.29.128]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2024 06:46:44 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@lists.ozlabs.org Cc: Sourabh Jain , Andrew Morton , Baoquan he , Hari Bathini , Madhavan Srinivasan , Michael Ellerman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] crash: let arch decide crash memory export to iomem_resource Date: Tue, 17 Dec 2024 12:16:10 +0530 Message-ID: <20241217064613.1042866-3-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> References: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: k63nIDxe6HsLNslYA99kBcErIbowGZeT X-Proofpoint-ORIG-GUID: k63nIDxe6HsLNslYA99kBcErIbowGZeT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 bulkscore=0 priorityscore=1501 spamscore=0 suspectscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170052 Content-Type: text/plain; charset="utf-8" insert_crashkernel_resources() adds crash memory to iomem_resource if generic crashkernel reservation is enabled on an architecture. On PowerPC, system RAM is added to iomem_resource. See commit c40dd2f766440 ("powerpc: Add System RAM to /proc/iomem"). Enabling generic crashkernel reservation on PowerPC leads to a conflict when system RAM is added to iomem_resource because a part of the system RAM, the crashkernel memory, has already been added to iomem_resource. The next commit in the series "powerpc/crash: use generic crashkernel reservation" enables generic crashkernel reservation on PowerPC. If the crashkernel is added to iomem_resource, the kernel fails to add system RAM to /proc/iomem and prints the following traces: CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.13.0-rc2+ snip... NIP [c000000002016b3c] add_system_ram_resources+0xf0/0x15c LR [c000000002016b34] add_system_ram_resources+0xe8/0x15c Call Trace: [c00000000484bbc0] [c000000002016b34] add_system_ram_resources+0xe8/0x15c [c00000000484bc20] [c000000000010a4c] do_one_initcall+0x7c/0x39c [c00000000484bd00] [c000000002005418] do_initcalls+0x144/0x18c [c00000000484bd90] [c000000002005714] kernel_init_freeable+0x21c/0x290 [c00000000484bdf0] [c0000000000110f4] kernel_init+0x2c/0x1b8 [c00000000484be50] [c00000000000dd3c] ret_from_kernel_user_thread+0x14/0x1c To avoid this, an architecture hook is added in insert_crashkernel_resources(), allowing the architecture to decide whether crashkernel memory should be added to iomem_resource. Cc: Andrew Morton Cc: Baoquan he Cc: Hari Bathini CC: Madhavan Srinivasan Cc: Michael Ellerman Cc: kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sourabh Jain --- include/linux/crash_reserve.h | 11 +++++++++++ kernel/crash_reserve.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/include/linux/crash_reserve.h b/include/linux/crash_reserve.h index 1fe7e7d1b214..f1205d044dae 100644 --- a/include/linux/crash_reserve.h +++ b/include/linux/crash_reserve.h @@ -18,6 +18,17 @@ int __init parse_crashkernel(char *cmdline, unsigned lon= g long system_ram, unsigned long long *crash_size, unsigned long long *crash_base, unsigned long long *low_size, bool *high); =20 +#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION + +#ifndef arch_add_crash_res_to_iomem +static inline bool arch_add_crash_res_to_iomem(void) +{ + return true; +} +#endif + +#endif + #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION #ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE #define DEFAULT_CRASH_KERNEL_LOW_SIZE (128UL << 20) diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c index aff7c0fdbefa..190104f32fe1 100644 --- a/kernel/crash_reserve.c +++ b/kernel/crash_reserve.c @@ -460,6 +460,9 @@ void __init reserve_crashkernel_generic(unsigned long l= ong crash_size, #ifndef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY static __init int insert_crashkernel_resources(void) { + if (!arch_add_crash_res_to_iomem()) + return 0; + if (crashk_res.start < crashk_res.end) insert_resource(&iomem_resource, &crashk_res); =20 --=20 2.47.1 From nobody Thu Dec 18 05:38:59 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B52D41DF96E for ; Tue, 17 Dec 2024 06:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418034; cv=none; b=NeKGHY8+v/bnPTWUDAcpw0AyfZC+vJ3n/XnXP2ep6Ym1JuThIi5b5xIHJ+NWG2GM8jcVgqoUBtqZ/ibe0M0zK0HX+QiXGNfwvpMKrYG0VoCOLyYT738Vj1db824n1NrfPSrU4BefORaLPVM7YUbiwX2xt0UMTLfHCACie69+TQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418034; c=relaxed/simple; bh=dlDQRI3prM2RhA26oYUO7b4mYDyx4hfzyLIFy+/VHz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S2dpza7Akmg1SS4gBWiPaZXVSL2gjfDkC7dkSqp+HqpVCH89MrOdUFoGXWYXxDzIDlhSit/9YFA7AXTzhWr55p7vnVwzX2hJm5YCgLUsXqmeVN634VKgSMS0PQRjFJAfkx1T2udVnVTJfwljqqZBZYyeM5nz0R8M0BQX2neY0gs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=KvkAYa2W; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="KvkAYa2W" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH3qbCL023635; Tue, 17 Dec 2024 06:46:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=WH86RupiIpV7nQbN+ Vsb8WGy3K790/g1ula/5WgtslI=; b=KvkAYa2WWMKIrp0md1cyAHmJtwwJ2CWfG pj3M+DAXOTAlLtFyWCTsV5OpjOrreJFZ46LWUlowGJnnLVlXQqxuxWY/w+/OQW55 j19/1YcxG7A+7ZsDievjeH278CmJKvKhmxFGWDk8RdT0EG0TveMvvyBYZ09tNlcq d5eu7lV+xVwq2oHmy+Wd/VKuXrWh6bMTkKsVxBEPl7vkP3UMcLYhEL/0b/Jrt6Pe 2T3nnWnCYcdTuI0Md6Wh6hH4gYhGXGQBCYpOd07AyiEfVMqIR9QrIoISQZivb3rH auGUT18D6gJv5avDiLrYJ7PQGCAh0U15FRmQ6Hr9wOQUGGTIkTf4Q== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43k1sb0jcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:46:58 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH3tGGH011271; Tue, 17 Dec 2024 06:46:57 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 43hpjk1bwt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:46:57 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BH6krCZ26149512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2024 06:46:54 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAB8A2004B; Tue, 17 Dec 2024 06:46:53 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E164C20040; Tue, 17 Dec 2024 06:46:50 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.29.128]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2024 06:46:50 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@lists.ozlabs.org Cc: Sourabh Jain , Andrew Morton , Baoquan he , Hari Bathini , Madhavan Srinivasan , Michael Ellerman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] powerpc/kdump: preserve user-specified memory limit Date: Tue, 17 Dec 2024 12:16:11 +0530 Message-ID: <20241217064613.1042866-4-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> References: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Np-xWnIy8W1mKryoou7nF-12SVirY23I X-Proofpoint-ORIG-GUID: Np-xWnIy8W1mKryoou7nF-12SVirY23I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170052 Content-Type: text/plain; charset="utf-8" Commit 59d58189f3d9 ("crash: fix crash memory reserve exceed system memory bug") fails crashkernel parsing if the crash size is found to be higher than system RAM, which makes the memory_limit adjustment code ineffective due to an early exit from reserve_crashkernel(). Regardless lets not violated the user-specified memory limit by adjusting it. Remove this adjustment to ensure all reservations stay within the limit. Commit f94f5ac07983 ("powerpc/fadump: Don't update the user-specified memory limit") did the same for fadump. Cc: Andrew Morton Cc: Baoquan he Cc: Hari Bathini CC: Madhavan Srinivasan Cc: Michael Ellerman Cc: kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sourabh Jain --- arch/powerpc/kexec/core.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c index b8333a49ea5d..4945b33322ae 100644 --- a/arch/powerpc/kexec/core.c +++ b/arch/powerpc/kexec/core.c @@ -150,14 +150,6 @@ void __init reserve_crashkernel(void) return; } =20 - /* Crash kernel trumps memory limit */ - if (memory_limit && memory_limit <=3D crashk_res.end) { - memory_limit =3D crashk_res.end + 1; - total_mem_sz =3D memory_limit; - printk("Adjusted memory limit for crashkernel, now 0x%llx\n", - memory_limit); - } - printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " "for crashkernel (System RAM: %ldMB)\n", (unsigned long)(crash_size >> 20), --=20 2.47.1 From nobody Thu Dec 18 05:38:59 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49FF01DFD9D for ; Tue, 17 Dec 2024 06:47:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418039; cv=none; b=k67fzA0wZTKJ5l4q9Mh9l2LhEs+eb782dZg8gfvLcz0cwV3OrvUi+zNSqM3RTxupLi7RZmHSpTrRApSmrhFQwIPQEpMs2y1hCeJQuVBeQloqbPIOppfPWnLhWTmmAhcQrBjIsB5vdWANQ3ywNSre8jruY45ZYBCgCbSO4/q3o1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418039; c=relaxed/simple; bh=ybZGEQk8lAhvbxhk9+0mzDUbeMGDaW25NuvLWxXrKm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E8OnNbMI9fmu40O3LHWsuJnP9jLWfB/tmnq77/Ur4aHO8yKW2vbarBEeJc2RkmynNzStPF/cxOvfRMiNRmktBnUE38Fvb/4LJ1p5SUU67oVPzBWG9nUfNncf6NLjbtXfisUv+sIAQItm1v7XiPN6+00YX559RrEhEtC02sP0eSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=mWS5fWPg; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="mWS5fWPg" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH3rLpb026223; Tue, 17 Dec 2024 06:47:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=l5YP8r2VmvweWZw4/ 9zj/3mPN9vQQRZUcaCX+Kau0iM=; b=mWS5fWPgsmib67mAPQl6YlaoMKMz21sU7 8EkJXJC3m4AjOiXW4+XtxX6slGCA7Ttplx7KuaPtA+VEhLDMOtRnyIdNgWGgY2mk FUyzcmXxDD6XdN3eTPtcc3Bq4jpl39L8wXeCNonkVeYQLUIeQ2QuJCaP/6HH1aZp MtkWfs89CD7CVh4G6HYebrrqFLwr2LRTJMsqEg2FSX+edVwUz24/zy0ory6Wcn/a L6VnKw+mN/uTscRaBf9tiReozVeiie+9cd6ArVnnsPJ6PjB/SyMkixAF7wQYWnQD D3xbxlJwws5meVziZxS9Eo5+P16tIt29BCZSmffCSXDVE90A6L0sA== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43k1sh0ja8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:47:04 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH4OVdd014438; Tue, 17 Dec 2024 06:47:03 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 43hq21h7y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:47:03 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BH6kxFZ57606438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2024 06:46:59 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35B7D2004B; Tue, 17 Dec 2024 06:46:59 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3619220040; Tue, 17 Dec 2024 06:46:55 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.29.128]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2024 06:46:54 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@lists.ozlabs.org Cc: Sourabh Jain , Andrew Morton , Baoquan he , Hari Bathini , Madhavan Srinivasan , Michael Ellerman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] powerpc/crash: use generic crashkernel reservation Date: Tue, 17 Dec 2024 12:16:12 +0530 Message-ID: <20241217064613.1042866-5-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> References: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: b3XEQY0YK5ypgppnZpA558HyquExlsio X-Proofpoint-GUID: b3XEQY0YK5ypgppnZpA558HyquExlsio X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170052 Content-Type: text/plain; charset="utf-8" Commit 0ab97169aa05 ("crash_core: add generic function to do reservation") added a generic function to reserve crashkernel memory. So let's use the same function on powerpc and remove the architecture-specific code that essentially does the same thing. The generic crashkernel reservation also provides a way to split the crashkernel reservation into high and low memory reservations, which can be enabled for powerpc in the future. Along with moving to the generic crashkernel reservation, the code related to finding the base address for the crashkernel has been separated into its own function name get_crash_base() for better readability and maintainability. To prevent crashkernel memory from being added to iomem_resource, the function arch_add_crash_res_to_iomem() has been introduced. For further details on why this should not be done for the PowerPC architecture, please refer to the previous commit titled "crash: let arch decide crash memory export to iomem_resource. Cc: Andrew Morton Cc: Baoquan he Cc: Hari Bathini CC: Madhavan Srinivasan Cc: Michael Ellerman Cc: kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sourabh Jain --- arch/powerpc/Kconfig | 3 + arch/powerpc/include/asm/crash_reserve.h | 18 +++++ arch/powerpc/include/asm/kexec.h | 4 +- arch/powerpc/kernel/prom.c | 2 +- arch/powerpc/kexec/core.c | 90 ++++++++++-------------- 5 files changed, 63 insertions(+), 54 deletions(-) create mode 100644 arch/powerpc/include/asm/crash_reserve.h diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index a0ce777f9706..8df8871215f8 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -717,6 +717,9 @@ config ARCH_SUPPORTS_CRASH_HOTPLUG def_bool y depends on PPC64 =20 +config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION + def_bool CRASH_RESERVE + config FA_DUMP bool "Firmware-assisted dump" depends on CRASH_DUMP && PPC64 && (PPC_RTAS || PPC_POWERNV) diff --git a/arch/powerpc/include/asm/crash_reserve.h b/arch/powerpc/includ= e/asm/crash_reserve.h new file mode 100644 index 000000000000..f5e60721de41 --- /dev/null +++ b/arch/powerpc/include/asm/crash_reserve.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_POWERPC_CRASH_RESERVE_H +#define _ASM_POWERPC_CRASH_RESERVE_H + +/* crash kernel regions are Page size agliged */ +#define CRASH_ALIGN PAGE_SIZE + +#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION + +static inline bool arch_add_crash_res_to_iomem(void) +{ + return false; +} +#define arch_add_crash_res_to_iomem arch_add_crash_res_to_iomem +#endif + +#endif /* _ASM_POWERPC_CRASH_RESERVE_H */ + diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/ke= xec.h index 270ee93a0f7d..64741558071f 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -113,9 +113,9 @@ int setup_new_fdt_ppc64(const struct kimage *image, voi= d *fdt, struct crash_mem =20 #ifdef CONFIG_CRASH_RESERVE int __init overlaps_crashkernel(unsigned long start, unsigned long size); -extern void reserve_crashkernel(void); +extern void arch_reserve_crashkernel(void); #else -static inline void reserve_crashkernel(void) {} +static inline void arch_reserve_crashkernel(void) {} static inline int overlaps_crashkernel(unsigned long start, unsigned long = size) { return 0; } #endif =20 diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index e0059842a1c6..9ed9dde7d231 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -860,7 +860,7 @@ void __init early_init_devtree(void *params) */ if (fadump_reserve_mem() =3D=3D 0) #endif - reserve_crashkernel(); + arch_reserve_crashkernel(); early_reserve_mem(); =20 if (memory_limit > memblock_phys_mem_size()) diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c index 4945b33322ae..b21cfa814492 100644 --- a/arch/powerpc/kexec/core.c +++ b/arch/powerpc/kexec/core.c @@ -80,38 +80,20 @@ void machine_kexec(struct kimage *image) } =20 #ifdef CONFIG_CRASH_RESERVE -void __init reserve_crashkernel(void) -{ - unsigned long long crash_size, crash_base, total_mem_sz; - int ret; =20 - 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, 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; - } - - if (crashk_res.end =3D=3D crashk_res.start) { - crashk_res.start =3D crashk_res.end =3D 0; - return; - } - - /* We might have got these values via the command line or the - * device tree, either way sanitise them now. */ - - crash_size =3D resource_size(&crashk_res); +static unsigned long long __init get_crash_base(unsigned long long crash_b= ase) +{ =20 #ifndef CONFIG_NONSTATIC_KERNEL - if (crashk_res.start !=3D KDUMP_KERNELBASE) + if (crash_base !=3D KDUMP_KERNELBASE) printk("Crash kernel location must be 0x%x\n", KDUMP_KERNELBASE); =20 - crashk_res.start =3D KDUMP_KERNELBASE; + return KDUMP_KERNELBASE; #else - if (!crashk_res.start) { + unsigned long long crash_base_align; + + if (!crash_base) { #ifdef CONFIG_PPC64 /* * On the LPAR platform place the crash kernel to mid of @@ -123,45 +105,51 @@ void __init reserve_crashkernel(void) * kernel starts at 128MB offset on other platforms. */ if (firmware_has_feature(FW_FEATURE_LPAR)) - crashk_res.start =3D min_t(u64, ppc64_rma_size / 2, SZ_512M); + crash_base =3D min_t(u64, ppc64_rma_size / 2, SZ_512M); else - crashk_res.start =3D min_t(u64, ppc64_rma_size / 2, SZ_128M); + crash_base =3D min_t(u64, ppc64_rma_size / 2, SZ_128M); #else - crashk_res.start =3D KDUMP_KERNELBASE; + crash_base =3D KDUMP_KERNELBASE; #endif } =20 - crash_base =3D PAGE_ALIGN(crashk_res.start); - if (crash_base !=3D crashk_res.start) { - printk("Crash kernel base must be aligned to 0x%lx\n", - PAGE_SIZE); - crashk_res.start =3D crash_base; - } + crash_base_align =3D PAGE_ALIGN(crash_base); + if (crash_base !=3D crash_base_align) + pr_warn("Crash kernel base must be aligned to 0x%lx\n", PAGE_SIZE); =20 + return crash_base_align; #endif - crash_size =3D PAGE_ALIGN(crash_size); - crashk_res.end =3D crashk_res.start + crash_size - 1; +} =20 - /* The crash region must not overlap the current kernel */ - if (overlaps_crashkernel(__pa(_stext), _end - _stext)) { - printk(KERN_WARNING - "Crash kernel can not overlap current kernel\n"); - crashk_res.start =3D crashk_res.end =3D 0; +void __init arch_reserve_crashkernel(void) +{ + unsigned long long crash_size, crash_base, crash_end; + unsigned long long kernel_start, kernel_size; + unsigned long long total_mem_sz; + int ret; + + 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, NULL, NULL); + + if (ret) return; - } =20 - printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " - "for crashkernel (System RAM: %ldMB)\n", - (unsigned long)(crash_size >> 20), - (unsigned long)(crashk_res.start >> 20), - (unsigned long)(total_mem_sz >> 20)); + crash_base =3D get_crash_base(crash_base); + crash_end =3D crash_base + crash_size - 1; =20 - if (!memblock_is_region_memory(crashk_res.start, crash_size) || - memblock_reserve(crashk_res.start, crash_size)) { - pr_err("Failed to reserve memory for crashkernel!\n"); - crashk_res.start =3D crashk_res.end =3D 0; + kernel_start =3D __pa(_stext); + kernel_size =3D _end - _stext; + + /* The crash region must not overlap the current kernel */ + if ((kernel_start + kernel_size > crash_base) && (kernel_start <=3D crash= _end)) { + pr_warn("Crash kernel can not overlap current kernel\n"); return; } + + reserve_crashkernel_generic(crash_size, crash_base, 0, false); } =20 int __init overlaps_crashkernel(unsigned long start, unsigned long size) --=20 2.47.1 From nobody Thu Dec 18 05:38:59 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 096B11E32D9 for ; Tue, 17 Dec 2024 06:47:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418044; cv=none; b=tYjNz82rH0vJwCOOkBWzsvh/Vu7zXJUA5gzZTZMyJ4QnHjWd5BSk69pF6KeTDx2hvDS4IxyMXdUkJqsgcbozyU7zWz3QR4k2u+XSnF+MjD1jgEHTIuEj9Bk0CGYUqain7axudgvBBbWLvA6O9q7qwUQ3T2g33sJep3bW7i4mmjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734418044; c=relaxed/simple; bh=68MVemKVjrWvsDaZ2B9zKpmUOv+r6+1Zk22mAGq2dak=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G2oKsiZ68gKfcmghQpQjuRQCL9PJQlh5lqQYz9ywhQwlrdfYOwE3LdpJSoRF+a541sWPURx17UrZJKl8zoz1Tgs/toz0KRvnQcE2zwu1VD432206WEpmgmmy7WCB+JLSDFc5Lkitv03H89CiLFDhiAsQ/LHZ6jIxU0Q4UEmhF7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=VtQc36Tj; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="VtQc36Tj" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH16JJZ013078; Tue, 17 Dec 2024 06:47:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=dCDK6BOsU4ZX7A04s KP0HMI7l9HAPh7z4+ZQG7MoYvY=; b=VtQc36TjvM5fvJHlT506feBCvqiJTF7H6 oxwolecRAtV5MFNPjZsm5JYxDW1Apm1y8nCCoYIAGRG724wl5bl4HXzGGBXfk8mF /NbeqwrXAUNuCyQbijZx0znO2iiajWLk4riGWZCsllUHTKnIgoQyJyC6H0Na+0Bq kLGfTMFERwFOLOjJDg9vVvC8bNX2OWoQw753gSVD8Byq/0/DddQC9FyavPmtb286 EK865XbcphZkm2INiHh/Ltb5OrVUSwOIKuEaiYon6eqqO5f0P7pKq9Wuru8Thtrg UDEQwcX2cbQhhaE40Ur7aAVSBCKAMPCn6+WdsjO1ShUxJyNgMelRA== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43jnp4ks37-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:47:08 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH6OduF014340; Tue, 17 Dec 2024 06:47:07 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 43hmqy1qve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 06:47:07 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BH6l4Q231981902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2024 06:47:04 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E30192004B; Tue, 17 Dec 2024 06:47:03 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4084F20040; Tue, 17 Dec 2024 06:47:01 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.29.128]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2024 06:47:00 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@lists.ozlabs.org Cc: Sourabh Jain , Andrew Morton , Baoquan he , Hari Bathini , Madhavan Srinivasan , Michael Ellerman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] crash: option to let arch decide mem range is usable Date: Tue, 17 Dec 2024 12:16:13 +0530 Message-ID: <20241217064613.1042866-6-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> References: <20241217064613.1042866-1-sourabhjain@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: SdvJdPM8P27VchBEF8GkxHQecpPbbdXl X-Proofpoint-ORIG-GUID: SdvJdPM8P27VchBEF8GkxHQecpPbbdXl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 malwarescore=0 adultscore=0 bulkscore=0 mlxscore=0 spamscore=0 priorityscore=1501 phishscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170052 Content-Type: text/plain; charset="utf-8" On PowerPC, the memory reserved for the crashkernel can contain components like RTAS, TCE, OPAL, etc., which should be avoided when loading kexec segments into crashkernel memory. Due to these special components, PowerPC has its own set of functions to locate holes in the crashkernel memory for loading kexec segments for kdump. However, for loading kexec segments in the kexec case, PowerPC uses generic functions to locate holes. So, let's use generic functions to locate memory holes for kdump on PowerPC by adding an arch hook to handle such special regions while loading kexec segments, and remove the PowerPC functions to locate holes. Cc: Andrew Morton Cc: Baoquan he Cc: Hari Bathini CC: Madhavan Srinivasan Cc: Michael Ellerman Cc: kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sourabh Jain --- arch/powerpc/include/asm/kexec.h | 6 +- arch/powerpc/kexec/file_load_64.c | 259 ++---------------------------- include/linux/kexec.h | 9 ++ kernel/kexec_file.c | 12 ++ 4 files changed, 34 insertions(+), 252 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/ke= xec.h index 64741558071f..5e4680f9ff35 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -95,8 +95,10 @@ int arch_kexec_kernel_image_probe(struct kimage *image, = void *buf, unsigned long int arch_kimage_file_post_load_cleanup(struct kimage *image); #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_clea= nup =20 -int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf); -#define arch_kexec_locate_mem_hole arch_kexec_locate_mem_hole +int arch_check_excluded_range(struct kimage *image, unsigned long start, + unsigned long end); +#define arch_check_excluded_range arch_check_excluded_range + =20 int load_crashdump_segments_ppc64(struct kimage *image, struct kexec_buf *kbuf); diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_lo= ad_64.c index dc65c1391157..e7ef8b2a2554 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -49,201 +49,18 @@ const struct kexec_file_ops * const kexec_file_loaders= [] =3D { NULL }; =20 -/** - * __locate_mem_hole_top_down - Looks top down for a large enough memory h= ole - * in the memory regions between buf_min & bu= f_max - * for the buffer. If found, sets kbuf->mem. - * @kbuf: Buffer contents and memory parameters. - * @buf_min: Minimum address for the buffer. - * @buf_max: Maximum address for the buffer. - * - * Returns 0 on success, negative errno on error. - */ -static int __locate_mem_hole_top_down(struct kexec_buf *kbuf, - u64 buf_min, u64 buf_max) -{ - int ret =3D -EADDRNOTAVAIL; - phys_addr_t start, end; - u64 i; - - for_each_mem_range_rev(i, &start, &end) { - /* - * memblock uses [start, end) convention while it is - * [start, end] here. Fix the off-by-one to have the - * same convention. - */ - end -=3D 1; - - if (start > buf_max) - continue; - - /* Memory hole not found */ - if (end < buf_min) - break; - - /* Adjust memory region based on the given range */ - if (start < buf_min) - start =3D buf_min; - if (end > buf_max) - end =3D buf_max; - - start =3D ALIGN(start, kbuf->buf_align); - if (start < end && (end - start + 1) >=3D kbuf->memsz) { - /* Suitable memory range found. Set kbuf->mem */ - kbuf->mem =3D ALIGN_DOWN(end - kbuf->memsz + 1, - kbuf->buf_align); - ret =3D 0; - break; - } - } - - return ret; -} - -/** - * locate_mem_hole_top_down_ppc64 - Skip special memory regions to find a - * suitable buffer with top down approach. - * @kbuf: Buffer contents and memory parameters. - * @buf_min: Minimum address for the buffer. - * @buf_max: Maximum address for the buffer. - * @emem: Exclude memory ranges. - * - * Returns 0 on success, negative errno on error. - */ -static int locate_mem_hole_top_down_ppc64(struct kexec_buf *kbuf, - u64 buf_min, u64 buf_max, - const struct crash_mem *emem) +int arch_check_excluded_range(struct kimage *image, unsigned long start, + unsigned long end) { - int i, ret =3D 0, err =3D -EADDRNOTAVAIL; - u64 start, end, tmin, tmax; - - tmax =3D buf_max; - for (i =3D (emem->nr_ranges - 1); i >=3D 0; i--) { - start =3D emem->ranges[i].start; - end =3D emem->ranges[i].end; - - if (start > tmax) - continue; - - if (end < tmax) { - tmin =3D (end < buf_min ? buf_min : end + 1); - ret =3D __locate_mem_hole_top_down(kbuf, tmin, tmax); - if (!ret) - return 0; - } - - tmax =3D start - 1; - - if (tmax < buf_min) { - ret =3D err; - break; - } - ret =3D 0; - } - - if (!ret) { - tmin =3D buf_min; - ret =3D __locate_mem_hole_top_down(kbuf, tmin, tmax); - } - return ret; -} - -/** - * __locate_mem_hole_bottom_up - Looks bottom up for a large enough memory= hole - * in the memory regions between buf_min & b= uf_max - * for the buffer. If found, sets kbuf->mem. - * @kbuf: Buffer contents and memory parameters. - * @buf_min: Minimum address for the buffer. - * @buf_max: Maximum address for the buffer. - * - * Returns 0 on success, negative errno on error. - */ -static int __locate_mem_hole_bottom_up(struct kexec_buf *kbuf, - u64 buf_min, u64 buf_max) -{ - int ret =3D -EADDRNOTAVAIL; - phys_addr_t start, end; - u64 i; - - for_each_mem_range(i, &start, &end) { - /* - * memblock uses [start, end) convention while it is - * [start, end] here. Fix the off-by-one to have the - * same convention. - */ - end -=3D 1; - - if (end < buf_min) - continue; - - /* Memory hole not found */ - if (start > buf_max) - break; - - /* Adjust memory region based on the given range */ - if (start < buf_min) - start =3D buf_min; - if (end > buf_max) - end =3D buf_max; - - start =3D ALIGN(start, kbuf->buf_align); - if (start < end && (end - start + 1) >=3D kbuf->memsz) { - /* Suitable memory range found. Set kbuf->mem */ - kbuf->mem =3D start; - ret =3D 0; - break; - } - } - - return ret; -} - -/** - * locate_mem_hole_bottom_up_ppc64 - Skip special memory regions to find a - * suitable buffer with bottom up approa= ch. - * @kbuf: Buffer contents and memory parameters. - * @buf_min: Minimum address for the buffer. - * @buf_max: Maximum address for the buffer. - * @emem: Exclude memory ranges. - * - * Returns 0 on success, negative errno on error. - */ -static int locate_mem_hole_bottom_up_ppc64(struct kexec_buf *kbuf, - u64 buf_min, u64 buf_max, - const struct crash_mem *emem) -{ - int i, ret =3D 0, err =3D -EADDRNOTAVAIL; - u64 start, end, tmin, tmax; - - tmin =3D buf_min; - for (i =3D 0; i < emem->nr_ranges; i++) { - start =3D emem->ranges[i].start; - end =3D emem->ranges[i].end; - - if (end < tmin) - continue; - - if (start > tmin) { - tmax =3D (start > buf_max ? buf_max : start - 1); - ret =3D __locate_mem_hole_bottom_up(kbuf, tmin, tmax); - if (!ret) - return 0; - } - - tmin =3D end + 1; + struct crash_mem *emem; + int i; =20 - if (tmin > buf_max) { - ret =3D err; - break; - } - ret =3D 0; - } + emem =3D image->arch.exclude_ranges; + for (i =3D 0; i < emem->nr_ranges; i++) + if (start < emem->ranges[i].end && end > emem->ranges[i].start) + return 1; =20 - if (!ret) { - tmax =3D buf_max; - ret =3D __locate_mem_hole_bottom_up(kbuf, tmin, tmax); - } - return ret; + return 0; } =20 #ifdef CONFIG_CRASH_DUMP @@ -1004,64 +821,6 @@ int setup_new_fdt_ppc64(const struct kimage *image, v= oid *fdt, struct crash_mem return ret; } =20 -/** - * arch_kexec_locate_mem_hole - Skip special memory regions like rtas, opa= l, - * tce-table, reserved-ranges & such (exclude - * memory ranges) as they can't be used for k= exec - * segment buffer. Sets kbuf->mem when a suit= able - * memory hole is found. - * @kbuf: Buffer contents and memory parameters. - * - * Assumes minimum of PAGE_SIZE alignment for kbuf->memsz & kbuf->buf_alig= n. - * - * Returns 0 on success, negative errno on error. - */ -int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) -{ - struct crash_mem **emem; - u64 buf_min, buf_max; - int ret; - - /* Look up the exclude ranges list while locating the memory hole */ - emem =3D &(kbuf->image->arch.exclude_ranges); - if (!(*emem) || ((*emem)->nr_ranges =3D=3D 0)) { - pr_warn("No exclude range list. Using the default locate mem hole method= \n"); - return kexec_locate_mem_hole(kbuf); - } - - buf_min =3D kbuf->buf_min; - buf_max =3D kbuf->buf_max; - /* Segments for kdump kernel should be within crashkernel region */ - if (IS_ENABLED(CONFIG_CRASH_DUMP) && kbuf->image->type =3D=3D KEXEC_TYPE_= CRASH) { - buf_min =3D (buf_min < crashk_res.start ? - crashk_res.start : buf_min); - buf_max =3D (buf_max > crashk_res.end ? - crashk_res.end : buf_max); - } - - if (buf_min > buf_max) { - pr_err("Invalid buffer min and/or max values\n"); - return -EINVAL; - } - - if (kbuf->top_down) - ret =3D locate_mem_hole_top_down_ppc64(kbuf, buf_min, buf_max, - *emem); - else - ret =3D locate_mem_hole_bottom_up_ppc64(kbuf, buf_min, buf_max, - *emem); - - /* Add the buffer allocated to the exclude list for the next lookup */ - if (!ret) { - add_mem_range(emem, kbuf->mem, kbuf->memsz); - sort_memory_ranges(*emem, true); - } else { - pr_err("Failed to locate memory buffer of size %lu\n", - kbuf->memsz); - } - return ret; -} - /** * arch_kexec_kernel_image_probe - Does additional handling needed to setup * kexec segments. diff --git a/include/linux/kexec.h b/include/linux/kexec.h index f0e9f8eda7a3..407f8b0346aa 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -205,6 +205,15 @@ static inline int arch_kimage_file_post_load_cleanup(s= truct kimage *image) } #endif =20 +#ifndef arch_check_excluded_range +static inline int arch_check_excluded_range(struct kimage *image, + unsigned long start, + unsigned long end) +{ + return 0; +} +#endif + #ifdef CONFIG_KEXEC_SIG #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_le= n); diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 3eedb8c226ad..52e1480dbfa1 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -464,6 +464,12 @@ static int locate_mem_hole_top_down(unsigned long star= t, unsigned long end, continue; } =20 + /* Make sure this does not conflict exclude range */ + if (arch_check_excluded_range(image, temp_start, temp_end)) { + temp_start =3D temp_start - PAGE_SIZE; + continue; + } + /* We found a suitable memory range */ break; } while (1); @@ -498,6 +504,12 @@ static int locate_mem_hole_bottom_up(unsigned long sta= rt, unsigned long end, continue; } =20 + /* Make sure this does not conflict exclude range */ + if (arch_check_excluded_range(image, temp_start, temp_end)) { + temp_start =3D temp_start + PAGE_SIZE; + continue; + } + /* We found a suitable memory range */ break; } while (1); --=20 2.47.1