Re: [PATCH v7] powerpc/kdump: Add support for crashkernel CMA reservation
From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Date: 2025-11-08 03:14:43
Also in:
kexec
Sourabh Jain [off-list ref] writes:
Commit 35c18f2933c5 ("Add a new optional ",cma" suffix to the
crashkernel= command line option") and commit ab475510e042 ("kdump:
implement reserve_crashkernel_cma") added CMA support for kdump
crashkernel reservation.
Extend crashkernel CMA reservation support to powerpc.Yup, would be nice to see this support landing in powerpc!
The following changes are made to enable CMA reservation on powerpc: - Parse and obtain the CMA reservation size along with other crashkernel parameters - Call reserve_crashkernel_cma() to allocate the CMA region for kdump - Include the CMA-reserved ranges in the usable memory ranges for the kdump kernel to use. - Exclude the CMA-reserved ranges from the crash kernel memory to prevent them from being exported through /proc/vmcore. With the introduction of the CMA crashkernel regions, crash_exclude_mem_range() needs to be called multiple times to exclude both crashk_res and crashk_cma_ranges from the crash memory ranges. To avoid repetitive logic for validating mem_ranges size and handling reallocation when required, this functionality is moved to a new wrapper function crash_exclude_mem_range_guarded(). To ensure proper CMA reservation, reserve_crashkernel_cma() is called after pageblock_order is initialized. Update kernel-parameters.txt to document CMA support for crashkernel on powerpc architecture. Cc: Baoquan he <bhe@redhat.com> Cc: Jiri Bohac <redacted> Cc: Hari Bathini <hbathini@linux.ibm.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Cc: Shivang Upadhyay <redacted> Cc: kexec@lists.infradead.org Signed-off-by: Sourabh Jain <redacted> --- Changelog: v6 -> v7 https://lore.kernel.org/all/20251104132818.1724562-1-sourabhjain@linux.ibm.com/ (local) - declare crashk_cma_size static --- .../admin-guide/kernel-parameters.txt | 2 +- arch/powerpc/include/asm/kexec.h | 2 + arch/powerpc/kernel/setup-common.c | 4 +- arch/powerpc/kexec/core.c | 10 ++++- arch/powerpc/kexec/ranges.c | 43 ++++++++++++++----- 5 files changed, 47 insertions(+), 14 deletions(-)
Although my reviewed by may not count much here since I am not deeply familiar with arch/powerpc/kexec/** part.. But FWIW, the patch overall looks logical to me. Keeping cma reservation in setup_arch() is the right thing to do to avoid issues like these in past [1]. The error handling logic and the loop logic for handling CMA ranges also looks correct to me. So feel free to add: Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> [1]: https://lore.kernel.org/linuxppc-dev/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.list@gmail.com/ (local)