From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by kanga.kvack.org (Postfix) with ESMTP id 289056B003A for ; Fri, 27 Sep 2013 11:34:58 -0400 (EDT) Received: by mail-pa0-f53.google.com with SMTP id kq14so2951788pab.12 for ; Fri, 27 Sep 2013 08:34:57 -0700 (PDT) Date: Fri, 27 Sep 2013 17:34:34 +0200 From: Peter Zijlstra Subject: Re: [PATCH] checkpatch: Make the memory barrier test noisier Message-ID: <20130927153434.GG15690@laptop.programming.kicks-ass.net> References: <1380236265.3467.103.camel@schen9-DESK> <20130927060213.GA6673@gmail.com> <20130927112323.GJ3657@laptop.programming.kicks-ass.net> <1380289495.17366.91.camel@joe-AO722> <20130927134802.GA15690@laptop.programming.kicks-ass.net> <1380291257.17366.103.camel@joe-AO722> <20130927142605.GC15690@laptop.programming.kicks-ass.net> <1380292495.17366.106.camel@joe-AO722> <20130927145007.GD15690@laptop.programming.kicks-ass.net> <20130927151749.GA2149@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130927151749.GA2149@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: "Paul E. McKenney" Cc: Joe Perches , Ingo Molnar , Tim Chen , Jason Low , Davidlohr Bueso , Ingo Molnar , Andrew Morton , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Rik van Riel , Peter Hurley , linux-kernel@vger.kernel.org, linux-mm On Fri, Sep 27, 2013 at 08:17:50AM -0700, Paul E. McKenney wrote: > > Barriers are fundamentally about order; and order only makes sense if > > there's more than 1 party to the game. > > Oddly enough, there is one exception that proves the rule... On Itanium, > suppose we have the following code, with x initially equal to zero: > > CPU 1: ACCESS_ONCE(x) = 1; > > CPU 2: r1 = ACCESS_ONCE(x); r2 = ACCESS_ONCE(x); > > Itanium architects have told me that it really is possible for CPU 2 to > see r1==1 and r2==0. Placing a memory barrier between CPU 2's pair of > fetches prevents this, but without any other memory barrier to pair with. Oh man.. its really past time to sink that itanic already. I suppose it allows the cpu to reorder the reads in its pipeline and the memory barrier disallows this. Curious.. does our memory-barriers.txt file mention this 'fun' fact? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org