[PATCH v7 5/8] crash: pass hotplug action type to arch crash hotplug handler
Sourabh Jain
sourabhjain at linux.ibm.com
Mon Jan 16 02:02:03 AEDT 2023
On PowerPC, the crash update action for CPU and Memory hotplug events
is not the same. Since arch_crash_handle_hotplug_event is a common
crash hotplug handler for both CPU and Memory hot un/plug events,
it is hard to differentiate which hotplug event triggered the arch
crash hotplug handler and decide the crash update action accordingly.
Pass the hotplug action type to arch specific crash hotplug handler
so that corresponding crash update action can be taken based on the
hotplug action type.
Signed-off-by: Sourabh Jain <sourabhjain at linux.ibm.com>
---
arch/x86/include/asm/kexec.h | 2 +-
arch/x86/kernel/crash.c | 3 ++-
include/linux/kexec.h | 2 +-
kernel/crash_core.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index 1bc852ce347d4..ec33a592a2ddd 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -213,7 +213,7 @@ extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss;
extern void kdump_nmi_shootdown_cpus(void);
#ifdef CONFIG_CRASH_HOTPLUG
-void arch_crash_handle_hotplug_event(struct kimage *image);
+void arch_crash_handle_hotplug_event(struct kimage *image, unsigned int hp_action);
#define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_event
#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 5186df48ce6c6..0026c5ad828d7 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -465,12 +465,13 @@ int crash_load_segments(struct kimage *image)
/**
* arch_crash_handle_hotplug_event() - Handle hotplug elfcorehdr changes
* @image: the active struct kimage
+ * @hp_action: the hot un/plug action being handled
*
* To accurately reflect hot un/plug changes, the new elfcorehdr
* is prepared in a kernel buffer, and then it is written on top
* of the existing/old elfcorehdr.
*/
-void arch_crash_handle_hotplug_event(struct kimage *image)
+void arch_crash_handle_hotplug_event(struct kimage *image, unsigned int hp_action)
{
void *elfbuf = NULL, *old_elfcorehdr;
unsigned long mem, memsz;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 0b1ad1ac06e37..ea8ff85b0b436 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -509,7 +509,7 @@ static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) {
#endif
#ifndef arch_crash_handle_hotplug_event
-static inline void arch_crash_handle_hotplug_event(struct kimage *image) { }
+static inline void arch_crash_handle_hotplug_event(struct kimage *image, unsigned int hp_action) { }
#endif
#ifndef crash_hotplug_cpu_support
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 19f987b3851e8..bdf8c363a90aa 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -707,7 +707,7 @@ static void handle_hotplug_event(unsigned int hp_action, unsigned int cpu)
cpu : KEXEC_CRASH_HP_INVALID_CPU;
/* Now invoke arch-specific update handler */
- arch_crash_handle_hotplug_event(image);
+ arch_crash_handle_hotplug_event(image, hp_action);
/* No longer handling a hotplug event */
image->hotplug_event = false;
--
2.39.0
More information about the Linuxppc-dev
mailing list