On 08/11/25 08:14, Ritesh Harjani (IBM) wrote:
Sourabh Jain <[email protected]> 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 <[email protected]>
Cc: Jiri Bohac <[email protected]>
Cc: Hari Bathini <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Mahesh Salgaonkar <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Ritesh Harjani (IBM) <[email protected]>
Cc: Shivang Upadhyay <[email protected]>
Cc: [email protected]
Signed-off-by: Sourabh Jain <[email protected]>
---
Changelog:
v6 -> v7
https://lore.kernel.org/all/[email protected]/
- 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) <[email protected]>
[1]:
https://lore.kernel.org/linuxppc-dev/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.l...@gmail.com/
Thanks for the Review Ritesh.
- Sourabh Jain