Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752378AbbGPFm3 (ORCPT ); Thu, 16 Jul 2015 01:42:29 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:35383 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbbGPFm2 (ORCPT ); Thu, 16 Jul 2015 01:42:28 -0400 Date: Thu, 16 Jul 2015 07:42:14 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch , Davidlohr Bueso , will.deacon@arm.com Subject: Re: [PATCH v2 1/6] locking/pvqspinlock: Unconditional PV kick with _Q_SLOW_VAL Message-ID: <20150716054214.GU19282@twins.programming.kicks-ass.net> References: <1436926417-20256-1-git-send-email-Waiman.Long@hp.com> <1436926417-20256-2-git-send-email-Waiman.Long@hp.com> <20150715091012.GG2859@worktop.programming.kicks-ass.net> <55A6F84F.5050502@hp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55A6F84F.5050502@hp.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 Content-Length: 1219 Lines: 30 On Wed, Jul 15, 2015 at 08:18:23PM -0400, Waiman Long wrote: > On 07/15/2015 05:10 AM, Peter Zijlstra wrote: > > /* > >+ * A failed cmpxchg doesn't provide any memory-ordering guarantees, > >+ * so we need a barrier to order the read of the node data in > >+ * pv_unhash *after* we've read the lock being _Q_SLOW_VAL. > >+ * > >+ * Matches the cmpxchg() in pv_wait_head() setting _Q_SLOW_VAL. > >+ */ > >+ smp_rmb(); > > According to memory_barriers.txt, cmpxchg() is a full memory barrier. It > didn't say a failed cmpxchg will lose its memory guarantee. So is the > documentation right? The documentation is not entirely clear on this; but there are hints that this is so. > Or is that true for some architectures? I think it is > not true for x86. On x86 LOCK CMPXCHG is always a sync point, but yes there are archs for which a failed cmpxchg does _NOT_ provide any barrier semantics. The reason I started looking was because Will made Argh64 one of those. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/