From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754921AbcDATxd (ORCPT ); Fri, 1 Apr 2016 15:53:33 -0400 Received: from casper.infradead.org ([85.118.1.10]:55959 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754577AbcDATxc (ORCPT ); Fri, 1 Apr 2016 15:53:32 -0400 Date: Fri, 1 Apr 2016 21:53:29 +0200 From: Peter Zijlstra To: Will Deacon Cc: Waiman Long , Ingo Molnar , linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [PATCH] locking/qrwlock: Allow multiple spinning readers Message-ID: <20160401195329.GO3448@twins.programming.kicks-ass.net> References: <1458444079-59601-1-git-send-email-Waiman.Long@hpe.com> <20160329202050.GN3408@twins.programming.kicks-ass.net> <56FDA0D6.4090904@hpe.com> <20160401103143.GJ3448@twins.programming.kicks-ass.net> <20160401104119.GA3604@arm.com> <20160401105457.GO3430@twins.programming.kicks-ass.net> <20160401114303.GA24771@twins.programming.kicks-ass.net> <20160401164742.GD3991@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160401164742.GD3991@arm.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 Fri, Apr 01, 2016 at 05:47:43PM +0100, Will Deacon wrote: > > +#define smp_cond_load_acquire(ptr, cond_expr) ({ \ > > + typeof(ptr) __PTR = (ptr); \ > > + typeof(*ptr) VAL; \ > > It's a bit grim having a magic variable name, but I have no better > suggestion. Right; we had this discussion and this is the best we could come up with. lkml.kernel.org/r/CA+55aFzZA9EB3hFptSpdmeMOifeM5BWQGOW+ib7SLvyMTETzaA@mail.gmail.com > > + for (;;) { \ > > + VAL = READ_ONCE(*__PTR); \ > > + if (cond_expr) \ > > + break; \ > > + cpu_relax(); \ > > + } \ > > + smp_rmb(); /* ctrl + rmb := acquire */ \ > > + VAL; \ > > +}) > > Can you stick some #ifndef guards around this, please? Oh sure; I'll even compile and boot it when I find a moment ;-)