* [PATCH V2 1/2] MIPS: smp: Make stop_this_cpu() actually stop the CPU
@ 2015-03-25 17:25 Andrew Bresticker
2015-03-25 17:25 ` [PATCH V2 2/2] MIPS: Provide fallback reboot/poweroff/halt implementations Andrew Bresticker
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Bresticker @ 2015-03-25 17:25 UTC (permalink / raw)
To: Ralf Baechle
Cc: linux-mips, linux-kernel, Andrew Bresticker, James Hogan,
Maciej W. Rozycki
Since cpu_wait() enables interrupts upon return, CPUs which have
entered stop_this_cpu() may still end up handling interrupts.
This can lead to the softlockup detector firing on a panic or
restart/poweroff/halt. Just disable interrupts and spin to ensure
nothing else runs on the CPU once it has entered stop_this_cpu().
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
---
New for v2.
---
arch/mips/kernel/smp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 1c0d8c5..5b020bd 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -176,10 +176,8 @@ static void stop_this_cpu(void *dummy)
* Remove this CPU:
*/
set_cpu_online(smp_processor_id(), false);
- for (;;) {
- if (cpu_wait)
- (*cpu_wait)(); /* Wait if available. */
- }
+ local_irq_disable();
+ while (1);
}
void smp_send_stop(void)
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH V2 2/2] MIPS: Provide fallback reboot/poweroff/halt implementations
2015-03-25 17:25 [PATCH V2 1/2] MIPS: smp: Make stop_this_cpu() actually stop the CPU Andrew Bresticker
@ 2015-03-25 17:25 ` Andrew Bresticker
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Bresticker @ 2015-03-25 17:25 UTC (permalink / raw)
To: Ralf Baechle
Cc: linux-mips, linux-kernel, Andrew Bresticker, James Hogan,
Maciej W. Rozycki
If a machine-specific hook is not implemented for restart, poweroff,
or halt, fall back to halting secondary CPUs, disabling interrupts,
and spinning. In the case of restart, attempt to restart the system
via do_kernel_restart() (which will call any registered restart
handlers) before halting.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
---
Changes from v1:
- disable preemption before calling smp_send_stop()
- add a 1s delay after do_kernel_restart()
---
arch/mips/kernel/reset.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 07fc524..7c746d3 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -11,6 +11,7 @@
#include <linux/pm.h>
#include <linux/types.h>
#include <linux/reboot.h>
+#include <linux/delay.h>
#include <asm/reboot.h>
@@ -29,16 +30,40 @@ void machine_restart(char *command)
{
if (_machine_restart)
_machine_restart(command);
+
+#ifdef CONFIG_SMP
+ preempt_disable();
+ smp_send_stop();
+#endif
+ do_kernel_restart(command);
+ mdelay(1000);
+ pr_emerg("Reboot failed -- System halted\n");
+ local_irq_disable();
+ while (1);
}
void machine_halt(void)
{
if (_machine_halt)
_machine_halt();
+
+#ifdef CONFIG_SMP
+ preempt_disable();
+ smp_send_stop();
+#endif
+ local_irq_disable();
+ while (1);
}
void machine_power_off(void)
{
if (pm_power_off)
pm_power_off();
+
+#ifdef CONFIG_SMP
+ preempt_disable();
+ smp_send_stop();
+#endif
+ local_irq_disable();
+ while (1);
}
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-25 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 17:25 [PATCH V2 1/2] MIPS: smp: Make stop_this_cpu() actually stop the CPU Andrew Bresticker
2015-03-25 17:25 ` [PATCH V2 2/2] MIPS: Provide fallback reboot/poweroff/halt implementations Andrew Bresticker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®