Make sure the entire for loop has stop_cpus_in_progress set. Cc: Valentin Schneider <valentin.schnei...@arm.com> Cc: Aaron Lu <aaron....@gmail.com> Cc: keesc...@chromium.org Cc: mi...@kernel.org Cc: Pawan Gupta <pawan.kumar.gu...@linux.intel.com> Cc: Phil Auld <pa...@redhat.com> Cc: torva...@linux-foundation.org Cc: Tim Chen <tim.c.c...@linux.intel.com> Cc: fweis...@gmail.com Cc: subhra.mazum...@oracle.com Cc: t...@linutronix.de Cc: Julien Desfossez <jdesfos...@digitalocean.com> Cc: p...@google.com Cc: Nishanth Aravamudan <naravamu...@digitalocean.com> Cc: Aubrey Li <aubrey.in...@gmail.com> Cc: Mel Gorman <mgor...@techsingularity.net> Cc: kerr...@google.com Cc: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org> Link: https://lkml.kernel.org/r/0fd8fd4b99b9b9aa88d8b2dff897f7fd0d88f72c.1559129225.git.vpil...@digitalocean.com --- kernel/stop_machine.c | 2 ++ 1 file changed, 2 insertions(+)
--- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -383,6 +383,7 @@ static bool queue_stop_cpus_work(const s */ preempt_disable(); stop_cpus_in_progress = true; + barrier(); for_each_cpu(cpu, cpumask) { work = &per_cpu(cpu_stopper.stop_work, cpu); work->fn = fn; @@ -391,6 +392,7 @@ static bool queue_stop_cpus_work(const s if (cpu_stop_queue_work(cpu, work)) queued = true; } + barrier(); stop_cpus_in_progress = false; preempt_enable();