From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934274AbcI2PzS (ORCPT ); Thu, 29 Sep 2016 11:55:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34520 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932366AbcI2PzK (ORCPT ); Thu, 29 Sep 2016 11:55:10 -0400 Date: Thu, 29 Sep 2016 08:55:06 -0700 From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@kernel.org, dhowells@redhat.com, will.deacon@arm.com, peterz@infradead.org Subject: [PATCH locking/Documentation 2/2] No speculated stores Reply-To: paulmck@linux.vnet.ibm.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092915-0004-0000-0000-0000107FA212 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005825; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00762743; UDB=6.00363582; IPR=6.00537870; BA=6.00004771; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012820; XFM=3.00000011; UTC=2016-09-29 15:55:06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092915-0005-0000-0000-00007951D6F5 Message-Id: <20160929155506.GA5255@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-29_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609290278 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit reworks an erroneous example that claims that dependency barriers are needed to prevent speculation of dependent stores. Signed-off-by: Paul E. McKenney --- Documentation/memory-barriers.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index a57679ec9441..b6307139b81a 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -598,7 +598,9 @@ between the address load and the data load: This enforces the occurrence of one of the two implications, and prevents the third possibility from arising. -A data-dependency barrier must also order against dependent writes: +However, writes are never speculated, so it is not necessary (but is +good documentation practice) to use data-dependency barrier to order +against dependent writes: CPU 1 CPU 2 =============== =============== @@ -607,11 +609,11 @@ A data-dependency barrier must also order against dependent writes: WRITE_ONCE(P, &B); Q = READ_ONCE(P); - *Q = 5; -The data-dependency barrier must order the read into Q with the store -into *Q. This prohibits this outcome: +The prohibition against speculating writes means that even without a +data-dependency barrier, the system must order the read into Q with the +store into *Q. This prohibits this outcome: (Q == &B) && (B == 4) -- 2.5.2