aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/stop_machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/stop_machine.c')
-rw-r--r--kernel/stop_machine.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index c39ed70af174..6116b25aa7cf 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -33,7 +33,7 @@ static int stopmachine(void *cpu)
33 set_cpus_allowed(current, cpumask_of_cpu((int)(long)cpu)); 33 set_cpus_allowed(current, cpumask_of_cpu((int)(long)cpu));
34 34
35 /* Ack: we are alive */ 35 /* Ack: we are alive */
36 mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */ 36 smp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */
37 atomic_inc(&stopmachine_thread_ack); 37 atomic_inc(&stopmachine_thread_ack);
38 38
39 /* Simple state machine */ 39 /* Simple state machine */
@@ -43,14 +43,14 @@ static int stopmachine(void *cpu)
43 local_irq_disable(); 43 local_irq_disable();
44 irqs_disabled = 1; 44 irqs_disabled = 1;
45 /* Ack: irqs disabled. */ 45 /* Ack: irqs disabled. */
46 mb(); /* Must read state first. */ 46 smp_mb(); /* Must read state first. */
47 atomic_inc(&stopmachine_thread_ack); 47 atomic_inc(&stopmachine_thread_ack);
48 } else if (stopmachine_state == STOPMACHINE_PREPARE 48 } else if (stopmachine_state == STOPMACHINE_PREPARE
49 && !prepared) { 49 && !prepared) {
50 /* Everyone is in place, hold CPU. */ 50 /* Everyone is in place, hold CPU. */
51 preempt_disable(); 51 preempt_disable();
52 prepared = 1; 52 prepared = 1;
53 mb(); /* Must read state first. */ 53 smp_mb(); /* Must read state first. */
54 atomic_inc(&stopmachine_thread_ack); 54 atomic_inc(&stopmachine_thread_ack);
55 } 55 }
56 /* Yield in first stage: migration threads need to 56 /* Yield in first stage: migration threads need to
@@ -62,7 +62,7 @@ static int stopmachine(void *cpu)
62 } 62 }
63 63
64 /* Ack: we are exiting. */ 64 /* Ack: we are exiting. */
65 mb(); /* Must read state first. */ 65 smp_mb(); /* Must read state first. */
66 atomic_inc(&stopmachine_thread_ack); 66 atomic_inc(&stopmachine_thread_ack);
67 67
68 if (irqs_disabled) 68 if (irqs_disabled)
@@ -77,7 +77,7 @@ static int stopmachine(void *cpu)
77static void stopmachine_set_state(enum stopmachine_state state) 77static void stopmachine_set_state(enum stopmachine_state state)
78{ 78{
79 atomic_set(&stopmachine_thread_ack, 0); 79 atomic_set(&stopmachine_thread_ack, 0);
80 wmb(); 80 smp_wmb();
81 stopmachine_state = state; 81 stopmachine_state = state;
82 while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads) 82 while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads)
83 cpu_relax(); 83 cpu_relax();