linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* ARM: Disable preemption along with interrupts during shutdown
@ 2014-05-08 13:23 arunks.linux at gmail.com
  2014-05-08 13:49 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: arunks.linux at gmail.com @ 2014-05-08 13:23 UTC (permalink / raw)
  To: linux-arm-kernel

From: Arun KS <arunks.linux@gmail.com>

'irqs disabled' is funtamentally unsafe way of disabling preemption.
Any spin_unlock() decreasing the preemption count to 0 might trigger
a reschedule. A simple printk() might trigger a reschedule.

To be on safe side disable preemption as well using preempt_disable()

Signed-off-by: Arun KS <getarunks@gmail.com>
---
 arch/arm/kernel/process.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 81ef686..9ecb7b5 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -193,6 +193,7 @@ void machine_shutdown(void)
 void machine_halt(void)
 {
 	local_irq_disable();
+	preempt_disable();
 	smp_send_stop();
 
 	local_irq_disable();
@@ -208,6 +209,7 @@ void machine_halt(void)
 void machine_power_off(void)
 {
 	local_irq_disable();
+	preempt_disable();
 	smp_send_stop();
 
 	if (pm_power_off)
@@ -228,6 +230,7 @@ void machine_power_off(void)
 void machine_restart(char *cmd)
 {
 	local_irq_disable();
+	preempt_disable();
 	smp_send_stop();
 
 	arm_pm_restart(reboot_mode, cmd);
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-09  2:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-08 13:23 ARM: Disable preemption along with interrupts during shutdown arunks.linux at gmail.com
2014-05-08 13:49 ` Russell King - ARM Linux
2014-05-08 14:16   ` Arun KS
2014-05-08 15:22     ` Russell King - ARM Linux
2014-05-09  2:43       ` Arun KS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).