Received: by 10.223.185.116 with SMTP id b49csp2338097wrg; Thu, 22 Feb 2018 12:04:00 -0800 (PST) X-Google-Smtp-Source: AH8x227axWIft8DArbf3J75FhUOTFQcqxve9w6slRVSUNFfdqjkNjI6bbID4PpGBcTzG+uVuVVXn X-Received: by 10.98.90.132 with SMTP id o126mr7879364pfb.239.1519329839923; Thu, 22 Feb 2018 12:03:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519329839; cv=none; d=google.com; s=arc-20160816; b=IFzrYurejNO8DueEvutVVRZvl/9606r3V9X6aDjnnqvX6Ru2ft82QixONxXUeBp1en VhPe/W1Lc7RkxRAFHO5Y1Sb2rM5wYZ4T1vAXqNqsTl4VKER5jlL6XngDG6EMVDsLuubh j3hQenFsZ+LTSlTnN2IdGVDxuWJDUFXGNrYidnShE2R9I9H9EadvvuSUTh81v5oF0VxG wrKjuAEhUYyp73tskmYYhdvtM4YOy2qd79x/fYrJZKnnLIVQ+RcaHS2qet0J6qxlqq+J LbkETlKAjXLKj/4wXGTpKWgRT9sWjLTaODuFF8/XXRiXaPT0cYjYC9KTwgYzH5x+jr+r 8QQg== 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=5HAYeV0LfglIaSHWP0thWIIraEE2eoBHGKild2+/Gpk=; b=himHcMsB+/jk/hPyn8uDy+zhAjiQ1nLbXxSTJmHageNdw0ZSL9tsuVaOKLh0bmsLp1 hTgHPThvK4JcZ1YuZnLxk0XAm9r5OXJiWN9NlywfbYi34uIkdqVuurpMtdHm1qN2ZBLy +IbTrOBVNTEXXppQMX099GoeDtyuPABhKosvGcAUC84MugXu8nNZDEBsYRNndfYd8/QQ iyz3ZaItRTva+1DEPMz/dk2sXcVNqX2RVd3oBPgx3Dd0Km/G+JQvIML5gXpw/cAa/E02 f2vp8hsT795dzB692uKW2HbGGqfABq+BjIPlLPODQGnqqY0KzQJLXSyNmZPQhh9ippjA gggg== 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 o13-v6si500805pli.799.2018.02.22.12.03.41; Thu, 22 Feb 2018 12:03:59 -0800 (PST) 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 S1751329AbeBVUCX (ORCPT + 99 others); Thu, 22 Feb 2018 15:02:23 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36880 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750776AbeBVUCW (ORCPT ); Thu, 22 Feb 2018 15:02:22 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1MJxSui124646 for ; Thu, 22 Feb 2018 15:02:21 -0500 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ga25twska-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Feb 2018 15:02:20 -0500 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Feb 2018 15:02:19 -0500 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Feb 2018 15:02:13 -0500 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 w1MK2DwQ45809832; Thu, 22 Feb 2018 20:02:13 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D88BB204E; Thu, 22 Feb 2018 16:04:31 -0500 (EST) Received: from paulmck-ThinkPad-W541 (unknown [9.85.154.79]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id DD630B2050; Thu, 22 Feb 2018 16:04:30 -0500 (EST) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 0456216C86CD; Thu, 22 Feb 2018 12:02:37 -0800 (PST) Date: Thu, 22 Feb 2018 12:02:37 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Daniel Lustig , Andrea Parri , linux-kernel@vger.kernel.org, Palmer Dabbelt , Albert Ou , Alan Stern , Will Deacon , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Ingo Molnar , Linus Torvalds , linux-riscv@lists.infradead.org Subject: Re: [RFC PATCH] riscv/locking: Strengthen spin_lock() and spin_unlock() Reply-To: paulmck@linux.vnet.ibm.com References: <1519301990-11766-1-git-send-email-parri.andrea@gmail.com> <20180222134004.GN25181@hirez.programming.kicks-ass.net> <20180222141249.GA14033@andrea> <82beae6a-2589-6136-b563-3946d7c4fc60@nvidia.com> <20180222181317.GI2855@linux.vnet.ibm.com> <20180222182717.GS25181@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180222182717.GS25181@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18022220-0008-0000-0000-000002D9D27A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008578; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00993577; UDB=6.00504877; IPR=6.00772917; MB=3.00019692; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-22 20:02:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022220-0009-0000-0000-0000385A7283 Message-Id: <20180222200237.GK2855@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-22_07:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802220252 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 22, 2018 at 07:27:17PM +0100, Peter Zijlstra wrote: > On Thu, Feb 22, 2018 at 10:13:17AM -0800, Paul E. McKenney wrote: > > So we have something that is not all that rare in the Linux kernel > > community, namely two conflicting more-or-less concurrent changes. > > This clearly needs to be resolved, either by us not strengthening the > > Linux-kernel memory model in the way we were planning to or by you > > strengthening RISC-V to be no weaker than PowerPC for these sorts of > > externally viewed release-acquire situations. > > > > Other thoughts? > > Like said in the other email, I would _much_ prefer to not go weaker > than PPC, I find that PPC is already painfully weak at times. And here are the four PowerPC litmus tests. As expected, a release-acquire pair within a given process orders everything except for prior stores against later loads, from the viewpoint of some other process. And yes, a few of the filenames are unfortunate. Thanx, Paul ------------------------------------------------------------------------ PPC MP+o-r-a-o+o-rmb-o "" (* 22-Feb-2018: ppcmem says "Never" *) { 0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z; 1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z; } P0 | P1 ; stw r1,0(r4) | lwz r7,0(r6) ; lwsync | lwsync ; stw r1,0(r5) | lwz r8,0(r4) ; lwz r7,0(r5) | ; lwsync | ; stw r1,0(r6) | ; exists (1:r7=1 /\ 1:r8=0) ------------------------------------------------------------------------ PPC SB+o-r-a-o+o-rmb-o "" (* 22-Feb-2018: ppcmem says "Sometimes" *) { 0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z; 1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z; } P0 | P1 ; stw r1,0(r4) | stw r1,0(r6) ; lwsync | lwsync ; stw r1,0(r5) | lwz r7,0(r4) ; lwz r8,0(r5) | ; lwsync | ; lwz r7,0(r6) | ; exists (0:r7=0 /\ 1:r7=0) ------------------------------------------------------------------------ PPC LB+o-r-a-o+o-rmb-o "" (* 22-Feb-2018: ppcmem says "Never" *) { 0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z; 1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z; } P0 | P1 ; lwz r7,0(r4) | lwz r7,0(r6) ; lwsync | lwsync ; stw r1,0(r5) | stw r1,0(r4) ; lwz r8,0(r5) | ; lwsync | ; stw r1,0(r6) | ; exists (0:r7=1 /\ 1:r7=1) ------------------------------------------------------------------------ PPC MP+o-rmb-o+o-r-a-o.litmus "" (* 22-Feb-2018: ppcmem says "Never" *) { 0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z; 1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z; } P0 | P1 ; lwz r7,0(r4) | stw r1,0(r6) ; lwsync | lwsync ; stw r1,0(r5) | stw r1,0(r4) ; lwz r8,0(r5) | ; lwsync | ; lwz r9,0(r6) | ; exists (0:r7=1 /\ 0:r9=0)