Skip to contentSkip to conversation

x86-crash-optimize-cpu-changes.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Aug 24, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: x86/crash: optimize CPU changes
has been removed from the -mm tree. Its filename was
x86-crash-optimize-cpu-changes.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Eric DeVolder <[email protected]>
Subject: x86/crash: optimize CPU changes
Date: Mon, 14 Aug 2023 17:44:46 -0400

crash_prepare_elf64_headers() writes into the elfcorehdr an ELF PT_NOTE for all possible CPUs. As such, subsequent changes to CPUs (ie. hot un/plug, online/offline) do not need to rewrite the elfcorehdr.

The kimage->file_mode term covers kdump images loaded via the kexec_file_load() syscall. Since crash_prepare_elf64_headers() wrote the initial elfcorehdr, no update to the elfcorehdr is needed for CPU changes.

The kimage->elfcorehdr_updated term covers kdump images loaded via the kexec_load() syscall. At least one memory or CPU change must occur to cause crash_prepare_elf64_headers() to rewrite the elfcorehdr. Afterwards, no update to the elfcorehdr is needed for CPU changes.

This code is intentionally *NOT* hoisted into crash_handle_hotplug_event() as it would prevent the arch-specific handler from running for CPU changes. This would break PPC, for example, which needs to update other information besides the elfcorehdr, on CPU changes.

Cc Akhil Raj <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Borislav Petkov (AMD) <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Dave Young <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Eric W. Biederman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Mimi Zohar <[email protected]>
Cc Naveen N. Rao <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Sean Christopherson <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Thomas Weißschuh <[email protected]>
Cc Valentin Schneider <[email protected]>
Cc Vivek Goyal <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 arch/x86/kernel/crash.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/x86/kernel/crash.c renamed from arch/x86/kernel/crash.c~x86-crash-optimize-cpu-changes +10 -0
@@ -470,6 +470,16 @@ void arch_crash_handle_hotplug_event(str
 	unsigned long elfsz = 0;
 
 	/*
+	 * As crash_prepare_elf64_headers() has already described all
+	 * possible CPUs, there is no need to update the elfcorehdr
+	 * for additional CPU changes.
+	 */
+	if ((image->file_mode || image->elfcorehdr_updated) &&
+		((image->hp_action == KEXEC_CRASH_HP_ADD_CPU) ||
+		(image->hp_action == KEXEC_CRASH_HP_REMOVE_CPU)))
+		return;
+
+	/*
 	 * Create the new elfcorehdr reflecting the changes to CPU and/or
 	 * memory resources.
 	 */

_

Patches currently in -mm which might be from [email protected] are