From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753611AbbINMMD (ORCPT ); Mon, 14 Sep 2015 08:12:03 -0400 Received: from casper.infradead.org ([85.118.1.10]:36330 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753269AbbINMMB (ORCPT ); Mon, 14 Sep 2015 08:12:01 -0400 Date: Mon, 14 Sep 2015 14:11:56 +0200 From: Peter Zijlstra To: Will Deacon Cc: "Paul E. McKenney" , Boqun Feng , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Ingo Molnar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Gleixner , Waiman Long Subject: Re: [RFC 3/5] powerpc: atomic: implement atomic{,64}_{add,sub}_return_* variants Message-ID: <20150914121156.GZ18673@twins.programming.kicks-ass.net> References: <20150828104854.GB16853@twins.programming.kicks-ass.net> <20150828120614.GC29325@fixme-laptop.cn.ibm.com> <20150828141602.GA924@fixme-laptop.cn.ibm.com> <20150828153921.GF19282@twins.programming.kicks-ass.net> <20150901190027.GP1612@arm.com> <20150901214540.GI4029@linux.vnet.ibm.com> <20150902095906.GC25720@arm.com> <20150911124507.GB16833@arm.com> <20150914113520.GP18489@twins.programming.kicks-ass.net> <20150914120153.GY18673@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150914120153.GY18673@twins.programming.kicks-ass.net> 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 Mon, Sep 14, 2015 at 02:01:53PM +0200, Peter Zijlstra wrote: > The scenario is: > > CPU0 CPU1 > > unlock(x) > smp_store_release(&x->lock, 0); > > unlock(y) > smp_store_release(&next->lock, 1); /* next == &y */ > > lock(y) > while (!(smp_load_acquire(&y->lock)) > cpu_relax(); > > > Where the lock does _NOT_ issue a store to acquire the lock at all. Now > I don't think any of our current primitives manage this, so we should be > good, but it might just be possible. So with a bit more through this seems fundamentally impossible, you always needs some stores in a lock() implementation, the above for instance needs to queue itself, otherwise CPU0 will not be able to find it etc..