From mboxrd@z Thu Jan 1 00:00:00 1970 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 6E9D21F1503 for ; Tue, 21 Jan 2025 11:55:09 +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=1737460511; cv=none; b=Mvifml3ewpBnI8ox8I6oQEGG2RvsCM+8ks5Ml7j+V/hSYoJLzuLy3Z6lq+HmTTsXAcCfj0yxpfCIxLRLl27UEBGREfHnzBhFaZSp4WJZ3krXO9hD3HR/Mr4wmo46s81pObiiL9iJwwmXxfdG41XBjea5u+zVVl/JeHuMdzGWj/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737460511; c=relaxed/simple; bh=mzZkE6MtHxih1pqYNiYixkeYHE5/QZF3FIyK51wfrck=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rzMKUSFkZky/LSn2LV2SjHW348IYZ75QDo6pHQRUBMiO5QpGN41SK+r4l0TCqjPunCBYfbHaKttRBj2GMJINfl0H4afeyPP9+vX7iDVqSVqdV8zwpG9ilvTpl/nh0mAnZg2GZmb1HnHkGhQxXwiqaXKwRlQE7/8mHK7Jlk31jzo= 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=HwD6PcpE; 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="HwD6PcpE" 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 50L1950Q023030; Tue, 21 Jan 2025 11:54:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=dLbhr622cQ1xIK0R85mQA3G5m9RnW7dW6gcJ5N4+q Vk=; b=HwD6PcpE81dnGL3Doy1ZUNd7DYKiW41wc2QIzqnjwS0oPlsMotiL9NVWu NChiGlqer4g3Kp2L7GXOwzbADOiHlWSiXk5QXostGHwneg3jWoUFUa5fr4VWN/EQ rBCDdHX2ihn5M8EyQde0Rvd2yONq9OAjg1tu3Carp/MqSpQQ+4+7V1ujuWMa171N 13MW/BgK7PvEqZkaAf6DqyI3zlClG6SoOKVEYYy7ih1GMjNSlwQXf+iN3CIIgn4Y mzY7/2DvTJa5LUYYnGIsGtvWnXlJsTwwtHI1XfMtJ32UB3Eho3bBqEuBy7bZVIWI 4hv/3zsaXxkltXMDRnZeIO4sqL9vg== 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 44a1n9ah3x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jan 2025 11:54: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 50LAufS6032261; Tue, 21 Jan 2025 11:54:52 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 448rujjpk4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jan 2025 11:54:52 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50LBsn7Z59441448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jan 2025 11:54:49 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0ECFA2004B; Tue, 21 Jan 2025 11:54:49 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C3CF20040; Tue, 21 Jan 2025 11:54:46 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.54.128]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 21 Jan 2025 11:54:46 +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 v2 0/6] powerpc/crash: use generic crashkernel reservation Date: Tue, 21 Jan 2025 17:24:36 +0530 Message-ID: <20250121115442.1278458-1-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: s2Fd2Q7__MB_-Yrqi3Ft05a6Eb_k7m0U X-Proofpoint-GUID: s2Fd2Q7__MB_-Yrqi3Ft05a6Eb_k7m0U X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_05,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=939 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501210095 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. Additionally move powerpc to use generic APIs to locate memory hole for kexec segments while loading kdump kernel. Patch series summary: ===================== Patch 1-3: generic changes Patch 4-5: powerpc changes Patch 6: generic + powerpc changes Changelog: v1 Resend: - Rebased on top of 6.13-rc6 v2: - 01/06 new patch, fixes a bug with ELF load address It was posted in community as individual path but since it align with this patch series so include here: https://lore.kernel.org/all/20241210091314.185785-1-sourabhjain@linux.ibm.com/ - Fixed a typo 06/06 - Added Acked-by and Reviewed-by tags - Rebased it on 6.13 - It was suggested to try HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY and see if 03/06 patch can be avoided: https://lore.kernel.org/all/Z35gnO2N%2FLFt1E7E@MiWiFi-R3L-srv/ But after adding HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY the issue persisted and kernel prints below logs on boot: [ 0.646339] ------------[ cut here ]------------ [ 0.646351] WARNING: CPU: 0 PID: 1 at arch/powerpc/mm/mem.c:379 add_system_ram_resources+0xf0/0x15c [ 0.646369] Modules linked in: [ 0.646376] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.13.0-rc6+ #1 [ 0.646386] Hardware name: IBM,9105-22A POWER10 (architected) 0x800200 0xf000006 of:IBM,FW1060.00 (NL1060_027) hv:phyp pSeries [ 0.646397] NIP: c000000002016b3c LR: c000000002016b34 CTR: 0000000000000000 [ 0.646406] REGS: c000000004817920 TRAP: 0700 Not tainted (6.13.0-rc6+) e8/0x15c (unreliable) [ 0.646603] [c000000004817c20] [c000000000010a4c] do_one_initcall+0x7c/0x39c [ 0.646618] [c000000004817d00] [c000000002005418] do_initcalls+0x144/0x18c 0x290 [ 0.646648] [c000000004817df0] [c0000000000110f4] kernel_init+0x2c/0x1b8 +0x14/0x1c [ 0.646676] --- interrupt: 0 at 0x0 010020 [ 0.646720] ---[ end trace 0000000000000000 ]--- So 03/06 is not removed from patch series. 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 Cc: sourabhjain@linux.ibm.com Sourabh Jain (6): kexec: Initialize ELF lowest address to ULONG_MAX crash: remove an unused argument from reserve_crashkernel_generic() crash: let arch decide crash memory export to iomem_resource powerpc/kdump: preserve user-specified memory limit powerpc/crash: use generic crashkernel reservation crash: option to let arch decide mem range is usable arch/arm64/mm/init.c | 6 +- arch/loongarch/kernel/setup.c | 5 +- arch/powerpc/Kconfig | 3 + arch/powerpc/include/asm/crash_reserve.h | 18 ++ arch/powerpc/include/asm/kexec.h | 10 +- arch/powerpc/kernel/prom.c | 2 +- arch/powerpc/kexec/core.c | 96 ++++----- arch/powerpc/kexec/file_load_64.c | 259 +---------------------- arch/riscv/mm/init.c | 6 +- arch/x86/kernel/setup.c | 6 +- include/linux/crash_reserve.h | 22 +- include/linux/kexec.h | 9 + kernel/crash_reserve.c | 12 +- kernel/kexec_elf.c | 2 +- kernel/kexec_file.c | 12 ++ 15 files changed, 128 insertions(+), 340 deletions(-) create mode 100644 arch/powerpc/include/asm/crash_reserve.h -- 2.47.1