[PATCH 4/4] MIPS: kexec: add SMP hooks for generic platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use disable_nonboot_cpus to shutdown all cores when preparing to switch
to a new kexec'ed kernel.

This new method of switching is preferred to the earlier used (and now
guarded by CONFIG_SYS_KEXEC_SMP_BOOT_SECONDARY) for all systems that
boot with all cores/threads stopped that are expected to be started by
linux kernel, but the kexec switch to the new kernel is very
platform-specific, so neither of the solutions may be applicable to all
existing platforms.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@xxxxxxxxxx>
---
 arch/mips/Kconfig         | 2 +-
 arch/mips/generic/kexec.c | 7 +++++++
 arch/mips/kernel/crash.c  | 5 +++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 77e6b5a..11bd8d7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2781,7 +2781,7 @@ source "kernel/Kconfig.preempt"
 config KEXEC
 	bool "Kexec system call"
 	select KEXEC_CORE
-	depends on SYS_KEXEC_SMP_BOOT_SECONDARY || !SMP
+	depends on SYS_KEXEC_SMP_BOOT_SECONDARY || !SMP || PM_SLEEP_SMP
 	help
 	  kexec is a system call that implements the ability to shutdown your
 	  current kernel, and to start another kernel.  It is like a reboot
diff --git a/arch/mips/generic/kexec.c b/arch/mips/generic/kexec.c
index 61f812b..cdfd966 100644
--- a/arch/mips/generic/kexec.c
+++ b/arch/mips/generic/kexec.c
@@ -8,6 +8,7 @@
  * option) any later version.
  */
 
+#include <linux/cpu.h>
 #include <linux/kexec.h>
 #include <linux/libfdt.h>
 #include <linux/uaccess.h>
@@ -36,9 +37,15 @@ static int generic_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
+static void generic_kexec_machine_shutdown(void)
+{
+	disable_nonboot_cpus();
+}
+
 static int __init register_generic_kexec(void)
 {
 	_machine_kexec_prepare = generic_kexec_prepare;
+	_machine_kexec_shutdown = generic_kexec_machine_shutdown;
 	return 0;
 }
 arch_initcall(register_generic_kexec);
diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c
index feeb3b0..e9d36d7 100644
--- a/arch/mips/kernel/crash.c
+++ b/arch/mips/kernel/crash.c
@@ -3,6 +3,7 @@
 #include <linux/reboot.h>
 #include <linux/kexec.h>
 #include <linux/bootmem.h>
+#include <linux/cpu.h>
 #include <linux/crash_dump.h>
 #include <linux/delay.h>
 #include <linux/irq.h>
@@ -60,6 +61,10 @@ static void crash_kexec_prepare_cpus(void)
 	smp_call_function(crash_shutdown_secondary, NULL, 0);
 	smp_wmb();
 
+#ifndef CONFIG_SYS_KEXEC_SMP_BOOT_SECONDARY
+	disable_nonboot_cpus();
+#endif
+
 	/*
 	 * The crash CPU sends an IPI and wait for other CPUs to
 	 * respond. Delay of at least 10 seconds.
-- 
2.7.4





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux