tegrakernel/kernel/kernel-4.9/rt-patches/0142-stop_machine-convert-s...

42 lines
1.2 KiB
Diff

From a487707c9b0d0666f6f899460818cc8c245c8741 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 3 Jul 2009 08:30:27 -0500
Subject: [PATCH 142/365] stop_machine: convert stop_machine_run() to
PREEMPT_RT
Instead of playing with non-preemption, introduce explicit
startup serialization. This is more robust and cleaner as
well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bigeasy: XXX: stopper_lock -> stop_cpus_lock]
---
kernel/stop_machine.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 9b8cd7ebf27b..ca834ec48b99 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -475,6 +475,16 @@ static void cpu_stopper_thread(unsigned int cpu)
struct cpu_stop_done *done = work->done;
int ret;
+ /*
+ * Wait until the stopper finished scheduling on all
+ * cpus
+ */
+ lg_global_lock(&stop_cpus_lock);
+ /*
+ * Let other cpu threads continue as well
+ */
+ lg_global_unlock(&stop_cpus_lock);
+
/* cpu stop callbacks must not sleep, make in_atomic() == T */
preempt_count_inc();
ret = fn(arg);
--
2.28.0