From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255AbcHLC77 (ORCPT ); Thu, 11 Aug 2016 22:59:59 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:34697 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbcHLC76 (ORCPT ); Thu, 11 Aug 2016 22:59:58 -0400 Date: Fri, 12 Aug 2016 10:59:46 +0800 From: Boqun Feng To: Davidlohr Bueso Cc: Peter Zijlstra , "Paul E. McKenney" , Manfred Spraul , Benjamin Herrenschmidt , Michael Ellerman , Andrew Morton , Linux Kernel Mailing List , Susanne Spraul <1vier1@web.de>, parri.andrea@gmail.com Subject: Re: spin_lock implicit/explicit memory barrier Message-ID: <20160812025946.GA6290@tardis.cn.ibm.com> References: <1470787537.3015.83.camel@kernel.crashing.org> <4bd34301-0c63-66ae-71b1-6fd68c9fecdd@colorfullife.com> <20160810205202.GL3482@linux.vnet.ibm.com> <20160810222316.GA22336@linux-80c1.suse> <20160810225814.GR3482@linux.vnet.ibm.com> <20160810232922.GA24645@linux-80c1.suse> <20160811081139.GT30192@twins.programming.kicks-ass.net> <20160811183106.GA18261@linux-80c1.suse> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LQksG6bCIzRHxTLp" Content-Disposition: inline In-Reply-To: <20160811183106.GA18261@linux-80c1.suse> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 11, 2016 at 11:31:06AM -0700, Davidlohr Bueso wrote: > On Thu, 11 Aug 2016, Peter Zijlstra wrote: >=20 > > On Wed, Aug 10, 2016 at 04:29:22PM -0700, Davidlohr Bueso wrote: > >=20 > > > (1) As Manfred suggested, have a patch 1 that fixes the race against = mainline > > > with the redundant smp_rmb, then apply a second patch that gets rid o= f it > > > for mainline, but only backport the original patch 1 down to 3.12. > >=20 > > I have not followed the thread closely, but this seems like the best > > option. Esp. since 726328d92a42 ("locking/spinlock, arch: Update and fix > > spin_unlock_wait() implementations") is incomplete, it relies on at > > least 6262db7c088b ("powerpc/spinlock: Fix spin_unlock_wait()") to sort > > PPC. >=20 > Yeah, and we'd also need the arm bits; which reminds me, aren't alpha > ldl_l/stl_c sequences also exposed to this delaying of the publishing > when a non-owner peeks at the lock? Right now sysv sem's would be busted > when doing either is_locked or unlock_wait, shouldn't these be pimped up > to full smp_mb()s? >=20 You are talking about a similar problem as this one: http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1018307.html right? The trick of this problem is whether the barrier or operation in spin_lock() could order the STORE part of the lock-acquire with memory operations in critical sections. On PPC, we use lwsync, which doesn't order STORE->LOAD, so there is problem. On ARM64 and qspinlock in x86, there are similiar reasons. But if an arch implements its spin_lock() with a full barrier, even though the atomic is implemented by ll/sc, the STORE part of which can't be reordered with memory operations in the critcal sections. I think maybe that's the case for alpha(and also for ARM32). Regards, Boqun > Thanks, > Davidlohr >=20 --LQksG6bCIzRHxTLp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXrTugAAoJEEl56MO1B/q4ALUIAJU2dSA5CuWa7HdUik4t9r3l cBb+VvVWSy4fUqTX+M+y0HMTkJoiWOuJUSY410BEbLXJ/Vxrf+RPIBNApom8ea66 pHQ+ksi0iLFUaKSaffOUTNEqI7ledfgnX9u7fengocUYQpiy+iwLTY+1eu817eVy lHhVrPveC+PmOFZ8au/QaqwO+Q0VkMLq9HYau3VQUSSktnd+zhSCpjPpc9hVl2or vMgD22e+9hW/RNBVTh8ZSw1ITzQv/bFbDyTmoGwQL3vpf4+xHlNNJox3dZT5HCyO SI0RMdrOOvhgmkwuL1cTTZR6OYNyB1ExSCJNnTCLPUzuF7mXR380N+o1aClVbTY= =Bwyi -----END PGP SIGNATURE----- --LQksG6bCIzRHxTLp--