powerpc/crash: save cpu register data in crash_smp_send_stop()
PATCH v2 1/1 powerpc/crash: save cpu register data in crash_smp_send_stop()
During kdump, two set of NMI IPIs are sent to secondary CPUs, if 'crash_kexec_post_notifiers' option is set. The first set of NMI IPIs to stop the CPUs and the other set to collect register data. Instead, capture register data for secondary CPUs while stopping them itself. Also, fallback to smp_send_stop() in case the function gets called without kdump configured.
---
Changes in v2:
* For INTERRUPT_SYSTEM_RESET case, stopped sending IPIs again to secondary CPUs via crash_kexec_prepare_cpus().
* Added comments where appropriate.
arch/powerpc/include/asm/kexec.h | 1 + arch/powerpc/kernel/smp.c | 29 ++++-------- arch/powerpc/kexec/crash.c | 77 +++++++++++++++++++------------- 3 files changed, 57 insertions(+), 50 deletions(-)
arch/powerpc/include/asm/kexec.h +1 -0
@@ -83,6 +83,7 @@ extern void default_machine_crash_shutdown(struct pt_regs *regs);extern int crash_shutdown_register (crash_shutdown_t handler);extern int crash_shutdown_unregister (crash_shutdown_t handler); +extern void crash_kexec_prepare (void );extern void crash_kexec_secondary (struct pt_regs *regs);int __init overlaps_crashkernel (unsigned long start,unsigned long size);extern void reserve_crashkernel (void );
arch/powerpc/kernel/smp.c +9 -20
@@ -35,6 +35,7 @@#include <linux/stackprotector.h> #include <linux/pgtable.h> #include <linux/clockchips.h> +#include <linux/kexec.h> #include <asm/ptrace.h> #include <linux/atomic.h>
@@ -55,7 +56,6 @@#endif #include <asm/vdso.h> #include <asm/debug.h> -#include <asm/kexec.h> #include <asm/cpu_has_feature.h> #include <asm/ftrace.h> #include <asm/kup.h>
@@ -619,20 +619,6 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) }#endif -#ifdef CONFIG_NMI_IPI -static void crash_stop_this_cpu(struct pt_regs *regs) -#else -static void crash_stop_this_cpu(void *dummy) -#endif -{ -/* -* Just busy wait here and avoid marking CPU as offline to ensure -* register data is captured appropriately. -*/ -while (1 ) -cpu_relax (); -} -void crash_smp_send_stop (void ) {static bool stopped = false;
@@ -651,11 +637,14 @@ void crash_smp_send_stop(void) stopped = true; -#ifdef CONFIG_NMI_IPI -smp_send_nmi_ipi (NMI_IPI_ALL_OTHERS , crash_stop_this_cpu,1000000 ); -#else -smp_call_function (crash_stop_this_cpu,NULL ,0 ); -#endif /* CONFIG_NMI_IPI */ +#ifdef CONFIG_KEXEC_CORE +if (kexec_crash_image) { +crash_kexec_prepare (); +return ; + } +#endif + +smp_send_stop (); }#ifdef CONFIG_NMI_IPI
arch/powerpc/kexec/crash.c +47 -30
115 lines not on this page · raw message
Signature · 1 line
2.35.3
Michael Ellerman
AppliedQuoted 8 lines · Hari Bathini
During kdump, two set of NMI IPIs are sent to secondary CPUs, if '
crash_kexec_post_notifiers' option is set. The first set of NMI IPIs to stop the CPUs and the other set to collect register data. Instead, capture register data for secondary CPUs while stopping them itself. Also, fallback tosmp_send_stop()in case the function gets called without kdump configured.[...]
Applied to powerpc/next.
[1/1] powerpc/crash: save cpu register data in crash_smp_send_stop()
https://git.kernel.org/powerpc/c/c7255058b5430b5c42932383bd8887d591e7973a
cheers