Re: [PATCH v6 1/5] powerpc/crash: sort crash memory ranges before preparing elfcorehdr

From: Jinjie Ruan

Date: Thu Feb 26 2026 - 04:50:26 EST




On 2026/2/26 17:24, Baoquan He wrote:
> On 02/24/26 at 04:53pm, Jinjie Ruan wrote:
>> From: Sourabh Jain <sourabhjain@xxxxxxxxxxxxx>
>>
>> During a memory hot-remove event, the elfcorehdr is rebuilt to exclude
>> the removed memory. While updating the crash memory ranges for this
>> operation, the crash memory ranges array can become unsorted. This
>> happens because remove_mem_range() may split a memory range into two
>> parts and append the higher-address part as a separate range at the end
>> of the array.
>>
>> So far, no issues have been observed due to the unsorted crash memory
>> ranges. However, this could lead to problems once crash memory range
>> removal is handled by generic code, as introduced in the upcoming
>> patches in this series.
>>
>> Currently, powerpc uses a platform-specific function,
>> remove_mem_range(), to exclude hot-removed memory from the crash memory
>> ranges. This function performs the same task as the generic
>> crash_exclude_mem_range() in crash_core.c. The generic helper also
>> ensures that the crash memory ranges remain sorted. So remove the
>> redundant powerpc-specific implementation and instead call
>> crash_exclude_mem_range_guarded() (which internally calls
>> crash_exclude_mem_range()) to exclude the hot-removed memory ranges.
>>
>> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>> Cc: Baoquan he <bhe@xxxxxxxxxx>
>> Cc: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
>> Cc: Hari Bathini <hbathini@xxxxxxxxxxxxx>
>> Cc: Madhavan Srinivasan <maddy@xxxxxxxxxxxxx>
>> Cc: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxx>
>> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
>> Cc: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>
>> Cc: Shivang Upadhyay <shivangu@xxxxxxxxxxxxx>
>> Cc: linux-kernel@xxxxxxxxxxxxxxx
>> Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
>> Signed-off-by: Sourabh Jain <sourabhjain@xxxxxxxxxxxxx>
>
> You should add your own Signed-off-by since you sent it out.

Ack, I'll add my Signed-off-by in the next revision.
Thanks,

>
>> ---
>> arch/powerpc/include/asm/kexec_ranges.h | 4 +-
>> arch/powerpc/kexec/crash.c | 5 +-
>> arch/powerpc/kexec/ranges.c | 87 +------------------------
>> 3 files changed, 7 insertions(+), 89 deletions(-)
> ......snip...
>
>