From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932701AbbFWKJx (ORCPT ); Tue, 23 Jun 2015 06:09:53 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:56531 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932560AbbFWKJo (ORCPT ); Tue, 23 Jun 2015 06:09:44 -0400 Date: Tue, 23 Jun 2015 12:09:32 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: paulmck@linux.vnet.ibm.com, tj@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, der.herr@hofr.at, dave@stgolabs.net, riel@redhat.com, viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org Subject: Re: [RFC][PATCH 12/13] stop_machine: Remove lglock Message-ID: <20150623100932.GB3644@twins.programming.kicks-ass.net> References: <20150622121623.291363374@infradead.org> <20150622122256.765619039@infradead.org> <20150622222152.GA4460@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150622222152.GA4460@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2015 at 12:21:52AM +0200, Oleg Nesterov wrote: > Suppose that stop_two_cpus(cpu1 => 0, cpu2 => 1) races with stop_machine(). > > - stop_machine takes the lock on CPU 0, adds the work > and drops the lock > > - cpu_stop_queue_work() queues both works cpu_stop_queue_work() only ever queues _1_ work. > - stop_machine takes the lock on CPU 1, etc > > In this case both CPU 0 and 1 will run multi_cpu_stop() but they will > use different multi_stop_data's, so they will wait for each other > forever? So what you're saying is: queue_stop_cpus_work() stop_two_cpus() cpu_stop_queue_work(0,..); spin_lock(0); spin_lock(1); __cpu_stop_queue_work(0,..); __cpu_stop_queue_work(1,..); spin_unlock(1); spin_unlock(0); cpu_stop_queue_work(1,..); Indeed, I don't know what I was thinking... We can of course slap a percpu-rwsem in, but I wonder if there's anything smarter we can do here.