From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753456AbcDND4V (ORCPT ); Wed, 13 Apr 2016 23:56:21 -0400 Received: from smtprelay0057.hostedemail.com ([216.40.44.57]:42839 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751150AbcDND4U (ORCPT ); Wed, 13 Apr 2016 23:56:20 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2893:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4605:5007:6119:6120:6261:6742:7875:7903:8957:10004:10400:10450:10455:10471:10848:10967:11026:11232:11658:11914:12043:12517:12519:12555:12740:13069:13255:13311:13357:13439:14096:14097:14181:14659:14721:19904:19999:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: horn76_19c2404a77143 X-Filterd-Recvd-Size: 3027 Date: Wed, 13 Apr 2016 23:56:14 -0400 From: Steven Rostedt To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com Subject: Re: [PATCH memory-barriers.txt 1/7] documentation: Clarify relationship of barrier() to control dependencies Message-ID: <20160413235614.3517e030@grimm.local.home> In-Reply-To: <1460476375-27803-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20160412155228.GA27257@linux.vnet.ibm.com> <1460476375-27803-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Apr 2016 08:52:49 -0700 "Paul E. McKenney" wrote: > The current documentation claims that the compiler ignores barrier(), > which is not the case. Instead, the compiler carefully pays attention > to barrier(), but in a creative way that still manages to destroy > the control dependency. This commit sets the story straight. > > Reported-by: Mathieu Desnoyers > Signed-off-by: Paul E. McKenney > --- > Documentation/memory-barriers.txt | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt > index 3729cbe60e41..ec1289042396 100644 > --- a/Documentation/memory-barriers.txt > +++ b/Documentation/memory-barriers.txt > @@ -813,9 +813,10 @@ In summary: > the same variable, then those stores must be ordered, either by > preceding both of them with smp_mb() or by using smp_store_release() > to carry out the stores. Please note that it is -not- sufficient > - to use barrier() at beginning of each leg of the "if" statement, > - as optimizing compilers do not necessarily respect barrier() > - in this case. > + to use barrier() at beginning of each leg of the "if" statement > + because, as shown by the example above, optimizing compilers can > + destroy the control dependency while respecting the letter of the > + barrier() law. Which country has the jurisdiction over this barrier() law? What about "the letter of the barrier() rules"? -- Steve > > (*) Control dependencies require at least one run-time conditional > between the prior load and the subsequent store, and this