Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp894190imm; Wed, 11 Jul 2018 12:55:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeQTSlWWqmoLEyEJyUsklh4uQZ9FrhL27wfELqVgIAoFctt4evdhVI4Ey5l2kEyC8SR4uJr X-Received: by 2002:a17:902:7c8b:: with SMTP id y11-v6mr35262pll.222.1531338953155; Wed, 11 Jul 2018 12:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531338953; cv=none; d=google.com; s=arc-20160816; b=Jcb25HxWqUOQEY/LRmxqUt6JSAakwOhxRfzbENE8djmfU1R3w9CGCKOeWGBAyEv19V MQwAu4px8sibvm4sCyGMyMcFDwIVOuIk9wlNi+T2QthaOPDisrr7FirdTt58kSqSWx5a Oh2a0uLd22tXD2fWQCR3P6InxCgXqJGItJDDIIsZ+rCYDKRYFaBvEia4jzgx1EvrKzDs wNSaE21TGTbv09Xin14NVOAEI4BMjcmWjKS7603unYUhNybJVLX3isSZF3se2fVVMpZD dPX7wLYLHCq4lQz1hoJSrOfwt4bmDdoS9Hy6D9d1feaXqMNw1buo04lYh+Qu6Q86QoSu zgHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=HcsEGl/14+YR+l2T+I6BXUcX7Xx//RU3VEs8TZP/luU=; b=HZGx3xI+AVwQdrjk1JLYaUGlJQTjb71AtLP6FhPYcCCeArvqt60qUMEego+Q1OxuD5 FbHqeVS3lIrM3ULz2tLcuJddwJ79rP5S3o8PWQJMmsYVCNiR3M6ttuuUCY3xIAeLF2r2 Xw8DX2w73SQODDBjUwFlBmkokmHWj9QsmxmcHkEzAM7T8KdJhOh8JAwRMJzpgv8YZCU1 AlZbipt4znYOLncxf1Fd8r6sWjuXZqHviKpJOPnRbC6Q4HbdASwdOxNWNq3ic4+JXbwD pTTyx8zC9lPhx6hWNeUxVzgzq1tCFDcLh2TwmKcDPq1nVox4NhXIp0DgLnu0K7e2cg+V oUCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z137-v6si404091pgz.144.2018.07.11.12.55.37; Wed, 11 Jul 2018 12:55:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732868AbeGKSN5 (ORCPT + 99 others); Wed, 11 Jul 2018 14:13:57 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55116 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732542AbeGKSN5 (ORCPT ); Wed, 11 Jul 2018 14:13:57 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6BI4Fsw138799 for ; Wed, 11 Jul 2018 14:08:27 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k5m70q4a7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 11 Jul 2018 14:08:27 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Jul 2018 14:08:26 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 11 Jul 2018 14:08:23 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6BI8MSW36503694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Jul 2018 18:08:22 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B30E5B2065; Wed, 11 Jul 2018 14:08:21 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9393BB2064; Wed, 11 Jul 2018 14:08:21 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.159]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 11 Jul 2018 14:08:21 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 8699D16C2EED; Wed, 11 Jul 2018 11:10:41 -0700 (PDT) Date: Wed, 11 Jul 2018 11:10:41 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Will Deacon , Alan Stern , LKMM Maintainers -- Akira Yokosawa , Andrea Parri , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Kernel development list Subject: Re: [PATCH v3] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire Reply-To: paulmck@linux.vnet.ibm.com References: <20180710162555.GV3593@linux.vnet.ibm.com> <20180711094344.GE13963@arm.com> <20180711163456.GL2476@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711163456.GL2476@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18071118-2213-0000-0000-000002C93E99 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009352; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01059888; UDB=6.00544000; IPR=6.00837808; MB=3.00022105; MTD=3.00000008; XFM=3.00000015; UTC=2018-07-11 18:08:26 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071118-2214-0000-0000-00005ACC3D0F Message-Id: <20180711181041.GZ3593@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-11_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807110191 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 06:34:56PM +0200, Peter Zijlstra wrote: > On Wed, Jul 11, 2018 at 10:43:45AM +0100, Will Deacon wrote: > > Hi Alan, > > > > On Tue, Jul 10, 2018 at 02:18:13PM -0400, Alan Stern wrote: > > > More than one kernel developer has expressed the opinion that the LKMM > > > should enforce ordering of writes by locking. In other words, given > > > the following code: > > > > > > WRITE_ONCE(x, 1); > > > spin_unlock(&s): > > > spin_lock(&s); > > > WRITE_ONCE(y, 1); > > > > > > the stores to x and y should be propagated in order to all other CPUs, > > > even though those other CPUs might not access the lock s. In terms of > > > the memory model, this means expanding the cumul-fence relation. > > > > > > Locks should also provide read-read (and read-write) ordering in a > > > similar way. Given: > > > > > > READ_ONCE(x); > > > spin_unlock(&s); > > > spin_lock(&s); > > > READ_ONCE(y); // or WRITE_ONCE(y, 1); > > > > > > the load of x should be executed before the load of (or store to) y. > > > The LKMM already provides this ordering, but it provides it even in > > > the case where the two accesses are separated by a release/acquire > > > pair of fences rather than unlock/lock. This would prevent > > > architectures from using weakly ordered implementations of release and > > > acquire, which seems like an unnecessary restriction. The patch > > > therefore removes the ordering requirement from the LKMM for that > > > case. > > > > > > All the architectures supported by the Linux kernel (including RISC-V) > > > do provide this ordering for locks, albeit for varying reasons. > > > Therefore this patch changes the model in accordance with the > > > developers' wishes. > > > > > > Signed-off-by: Alan Stern > > > > Thanks, I'm happy with this version of the patch: > > > > Reviewed-by: Will Deacon > > Me too! Thanks Alan. > > Acked-by: Peter Zijlstra (Intel) And I applies you ask as well, thank you! Thanx, Paul