[PATCH v2 0/5] arm64: crash: Add crash hotplug support

From: Jinjie Ruan

Date: Tue Jul 28 2026 - 23:17:41 EST


When CPU or memory hotplug events occur, the elfcorehdr in the kdump
image becomes stale, potentially leading to incomplete crash dumps.

Currently, userspace udev rules reload the entire kdump image upon such
events, which is inefficient and leaves kdump inactive for a long time.

Commit 247262756121 ("crash: add generic infrastructure for crash hotplug
support") introduced a kernel mechanism to update only the elfcorehdr.
This patch set implements crash hotplug support for arm64.

As Baoquan suggested, it also addresses and fixes several
pre-existing code issues and Sashiko AI review findings extracted
from the previous patch set.

The major improvements and fixes included in this series are:
- Fix several memory leaks for arm64.
- Simplify arm64 load_other_segments().
- Implement infrastructure for arm64 crash memory hotplug support.

This patch set is rebased on liveupdate/crashkernel-cma.

Link: https://lore.kernel.org/all/20260601094805.2928614-1-ruanjinjie@xxxxxxxxxx/

Changes in v2:
- Split out Powerpc bugfix patch as Mike suggested.
- Use phys_to_virt() instead of __va() in update_crash_elfcorehdr().
- Convert pnum_hdr_sz() to a function.
- Only assign elfcorehdr_index after kexec_add_buffer succeeds, considering
crash_handle_hotplug_event() already performs validity check on
elfcorehdr_index:
- We can safely remove the check for CPU hotplug
in arch_crash_handle_hotplug_event().
- The elfcorehdr_index's segment mem will be valid in
update_crash_elfcorehdr(), so we can safely remove the NULL check.
- Simplify the commit message.
- v1: https://lore.kernel.org/all/20260723131242.1537633-1-ruanjinjie@xxxxxxxxxx/#t

Jinjie Ruan (5):
kexec: Extract kexec_free_segment_cma() from kimage_free_cma()
arm64: kexec_file: Fix CMA page leaks in segment placement retry loops
arm64: kexec_file: Fix image->elf_headers memory leak in retry loop
arm64: kexec_file: Simplify load_other_segments()
arm64: crash: Add crash hotplug support

arch/arm64/Kconfig | 3 +
arch/arm64/include/asm/kexec.h | 16 +++
arch/arm64/kernel/Makefile | 2 +-
arch/arm64/kernel/crash.c | 143 +++++++++++++++++++++++++
arch/arm64/kernel/kexec_image.c | 1 +
arch/arm64/kernel/machine_kexec_file.c | 78 +++++++-------
include/linux/kexec.h | 2 +
kernel/kexec_core.c | 25 +++--
8 files changed, 216 insertions(+), 54 deletions(-)
create mode 100644 arch/arm64/kernel/crash.c

--
2.34.1