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

From: Ritesh Harjani (IBM) <[email-masked]>
Date: Wed, 25 Feb 2026 08:45:56 +0530

Jinjie Ruan <[email-masked]> writes:

> From: Sourabh Jain <[email-masked]>
>
> 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 <[email-masked]>
> Cc: Baoquan he <[email-masked]>
> Cc: Jinjie Ruan <[email-masked]>
> Cc: Hari Bathini <[email-masked]>
> Cc: Madhavan Srinivasan <[email-masked]>
> Cc: Mahesh Salgaonkar <[email-masked]>
> Cc: Michael Ellerman <[email-masked]>
> Cc: Ritesh Harjani (IBM) <[email-masked]>
> Cc: Shivang Upadhyay <[email-masked]>
> Cc: [email-masked]
> Acked-by: Mike Rapoport (Microsoft) <[email-masked]>
> Signed-off-by: Sourabh Jain <[email-masked]>

I had gone through the generic implementation v/s the powerpc specific
remove_mem_range() implementation, when it was posted by Sourabh
separately. And it make sense to use the generic implementation in this
case, rather than keeping a duplicate powerpc specific version. So...

LGTM. Please feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <[email-masked]>