Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753750AbdGUQcG (ORCPT ); Fri, 21 Jul 2017 12:32:06 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41880 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751504AbdGUQcE (ORCPT ); Fri, 21 Jul 2017 12:32:04 -0400 Date: Fri, 21 Jul 2017 09:31:59 -0700 From: "Paul E. McKenney" To: Boqun Feng Cc: Akira Yokosawa , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] documentation: Fix two-CPU control-dependency example Reply-To: paulmck@linux.vnet.ibm.com References: <20170719215602.GK3730@linux.vnet.ibm.com> <20170720013112.fmrml6abdhi2nqdt@tardis> <20170720054704.GM3730@linux.vnet.ibm.com> <20170720161152.GQ3730@linux.vnet.ibm.com> <20170720214234.GY3730@linux.vnet.ibm.com> <55457ca1-a8db-213c-3b9c-ead441f97200@gmail.com> <20170720230714.GA3730@linux.vnet.ibm.com> <20170721002440.m6e5sdsa53lxygo4@tardis> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170721002440.m6e5sdsa53lxygo4@tardis> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17072116-0036-0000-0000-0000024CEB32 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007400; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00890838; UDB=6.00445116; IPR=6.00671005; BA=6.00005482; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016316; XFM=3.00000015; UTC=2017-07-21 16:32:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072116-0037-0000-0000-0000412BE6C9 Message-Id: <20170721163159.GE3730@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-21_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707210256 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1456 Lines: 30 On Fri, Jul 21, 2017 at 08:24:40AM +0800, Boqun Feng wrote: > On Thu, Jul 20, 2017 at 04:07:14PM -0700, Paul E. McKenney wrote: > [...] > > > > > > So if I respin the patch with the extern, would you still feel reluctant? > > > > Yes, because I am not seeing how this change helps. What is this telling > > the reader that the original did not, and how does it help the reader > > generate good concurrent code? > > One thing I think we probably should do is to make READ_ONCE() semantics > more clear, i.e. call it out that in our conceptual model for kernel > programming we always rely on the compiler to be serious about the > return value of READ_ONCE(). I didn't find the comment before > READ_ONCE() or memory-barriers.txt talking about something similar. > > Or am I the only one having this kinda semantics guarantee in mind? That sounds like a good idea to me. The C++ standards committee might be reluctant to provide a good definition of "volatile", but we can at least provide a definition of our own. It should be possible to leverage the need for "volatile" to support MMIO accesses, as there is general agreement that this was and still is its main purpose. Given those guarantees, there is no reason we cannot apply them in other situations, for example, interacting with irq handlers and preventing inappropriate optimizations for concurrent code. Even better, with tests to find compiler bugs in this area! Thanx, Paul