[PATCH v4] powerpc/kdump: Add support for crashkernel CMA reservation

Ritesh Harjani (IBM) ritesh.list at gmail.com
Fri Oct 31 22:01:41 AEDT 2025


Sourabh Jain <sourabhjain at linux.ibm.com> writes:

> Hi Ritesh,
>
> On 31/10/25 09:27, Ritesh Harjani (IBM) wrote:
>> Sourabh Jain <sourabhjain at linux.ibm.com> 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.
>>>
>>> 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.
>>>
>>> Cc: Baoquan he <bhe at redhat.com>
>>> Cc: Jiri Bohac <jbohac at suse.cz>
>>> Cc: Hari Bathini <hbathini at linux.ibm.com>
>>> Cc: Madhavan Srinivasan <maddy at linux.ibm.com>
>>> Cc: Mahesh Salgaonkar <mahesh at linux.ibm.com>
>>> Cc: Michael Ellerman <mpe at ellerman.id.au>
>>> Cc: Ritesh Harjani (IBM) <ritesh.list at gmail.com>
>>> Cc: Shivang Upadhyay <shivangu at linux.ibm.com>
>>> Cc: linuxppc-dev at lists.ozlabs.org
>>> Signed-off-by: Sourabh Jain <sourabhjain at linux.ibm.com>
>>> ---
>>> Changlog:
>>>
>>> v3 -> v4
>>>   - Removed repeated initialization to tmem in
>>>     crash_exclude_mem_range_guarded()
>>>   - Call crash_exclude_mem_range() with right crashk ranges
>>>
>>> ---
>>>   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 ++++++++++++++++++++++--------
>>>   4 files changed, 46 insertions(+), 13 deletions(-)
>>
>> I am not much familiar with the crash kernel workings but was curious
>> about the following query related to this patch:
>>
>> As I understand this patch allows for the remaining crash kernel
>> memory to come from CMA region. But do we limit the CMA region to be lower
>> than 4G?
>
> No we are not and we don't need to.
>
>> Is this patch dependent over your other patch series [1] which
>> supports high crashkernel reservation?
>>
>> [1]: https://lore.kernel.org/linuxppc-dev/20251027151338.819957-1-sourabhjain@linux.ibm.com/
>
> No, this is an independent patch.
>

Say, if we are in Hash mode and if the CMA reservations have come from
higher addresses. Will that work with kdump kernel when it boots with Hash
mmu? Because memory region beyond RMA is not accessible in Hash correct?

-ritesh

>>
>>
>> A minor comment: I guess we could reflect the support for ,cma for PPC
>> too in Documentation/admin-guide/kernel-parameters.txt like how it is
>> done for x86.
>
> Yes we should. I will make the change in the next version.
>
> Thanks for the review.
>
> - Sourabh Jain


More information about the Linuxppc-dev mailing list