From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Prarit Bhargava , Rik van Riel , Mel Gorman , Christoph Hellwig , Andrew Morton , Ingo Molnar Subject: [PATCH 3.13 17/46] stop_machine: Fix^2 race between stop_two_cpus() and stop_cpus() Date: Fri, 28 Mar 2014 10:32:01 -0700 Message-Id: <20140328173136.990894110@linuxfoundation.org> In-Reply-To: <20140328173134.630198216@linuxfoundation.org> References: <20140328173134.630198216@linuxfoundation.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra 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 Cc: Prarit Bhargava Cc: Rik van Riel Cc: Mel Gorman Cc: Christoph Hellwig Cc: Andrew Morton Link: http://lkml.kernel.org/r/20140228123905.GK3104@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- kernel/stop_machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -293,7 +293,7 @@ int stop_two_cpus(unsigned int cpu1, uns */ smp_call_function_single(min(cpu1, cpu2), &irq_cpu_stop_queue_work, - &call_args, 0); + &call_args, 1); lg_local_unlock(&stop_cpus_lock); preempt_enable();