Commit 7054a071ff7448ab1ca764a5b67f1d16fd981a50

Authored by Peter Zijlstra
Committed by Greg Kroah-Hartman
1 parent 7be87249f8

stop_machine: Fix^2 race between stop_two_cpus() and stop_cpus()

commit 177c53d943368fc97644ebc0a250dc8e2d124250 upstream.

We must use smp_call_function_single(.wait=1) for the
irq_cpu_stop_queue_work() to ensure the queueing is actually done under
stop_cpus_lock. Without this we could have dropped the lock by the time
we do the queueing and get the race we tried to fix.

Fixes: 7053ea1a34fa ("stop_machine: Fix race between stop_two_cpus() and stop_cpus()")

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20140228123905.GK3104@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

kernel/stop_machine.c
... ... @@ -293,7 +293,7 @@
293 293 */
294 294 smp_call_function_single(min(cpu1, cpu2),
295 295 &irq_cpu_stop_queue_work,
296   - &call_args, 0);
  296 + &call_args, 1);
297 297 lg_local_unlock(&stop_cpus_lock);
298 298 preempt_enable();
299 299