From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423369AbbFERI0 (ORCPT ); Fri, 5 Jun 2015 13:08:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43102 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752071AbbFERIY (ORCPT ); Fri, 5 Jun 2015 13:08:24 -0400 Message-ID: <5571D77E.3080203@redhat.com> Date: Fri, 05 Jun 2015 13:08:14 -0400 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Zijlstra , Ingo Molnar , Jiri Olsa CC: linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH] stop_machine: Fix deadlock between multiple stop_two_cpus() References: <20150605153023.GH19282@twins.programming.kicks-ass.net> In-Reply-To: <20150605153023.GH19282@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/2015 11:30 AM, Peter Zijlstra wrote: > > Jiri reported a machine stuck in multi_cpu_stop() with > migrate_swap_stop() as function and with the following src,dst cpu > pairs: {11, 4} {13, 11} { 4, 13} > > 4 11 13 > > cpuM: queue(4 ,13) > *Ma > cpuN: queue(13,11) > *N Na > *M Mb > cpuO: queue(11, 4) > *O Oa > *Nb > *Ob > > Where *X denotes the cpu running the queueing of cpu-X and X[ab] denotes > the first/second queued work. > > You'll observe the top of the workqueue for each cpu: 4,11,13 to be work > from cpus: M, O, N resp. IOW. deadlock. > > Do away with the queueing trickery and introduce lg_double_lock() to > lock both CPUs and fully serialize the stop_two_cpus() callers instead > of the partial (and buggy) serialization we have now. > > Completely untested.. > > Reported-by: Jiri Olsa > Signed-off-by: Peter Zijlstra (Intel) Certainly looks like it would work. I suspect we should probably apply this patch after some basic testing, since the race is so incredibly hard to reproduce. -- All rights reversed