Received: by 10.223.185.116 with SMTP id b49csp1763398wrg; Thu, 22 Feb 2018 02:43:01 -0800 (PST) X-Google-Smtp-Source: AH8x226P7NVzD4ZgRnZSZftmR2ENx2klo+7/4gch6tANETAm1gWIqg1a+5lLBd1rrSLanHMA+DQE X-Received: by 10.99.6.85 with SMTP id 82mr5207266pgg.181.1519296181745; Thu, 22 Feb 2018 02:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519296181; cv=none; d=google.com; s=arc-20160816; b=EShs/U5p22H5SCD6Ua1evli8bqqy16QCkJ86CYw8GhI7sv9Rs99xOSTN1ThJuDrEy4 lF1QeghDTm3bElDUSR1D3X4SwFYI8NfKqSdVYr4bwdMoBQ0U3ikkcpYl9zXOIzUlaAWg PHe71QEay4xKZkZ11rCZRTTJqlxPqkgLYoCtbJrl9kRNCQ9gu0J1h3zvzuo/W1QzAS9E dVX9bleg3XHxYfu+8LErmj2MYUQtqt4rQ030d2uCkqZZgpULjbEt2W2LO6/ibTl6zDoa miUnFxTxLDjpztsomt26sBKlWsTqSAiN0id0vrvqsHuic31yzqOvrqCftU7hiheO+0er MYqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=6JMq/VwlP3nwgVREyZ1nFTms11SrRXvtbbTtvMPSLfo=; b=mFMSYL/ESRz11hFZsTfYiwOyLSDLCj1jrnua4Z1UYBCvzkGBqzL6eHRIHeE4izLbhc 7nmBtKdnEJE3PLxsB86cmdvTAVUZg5kPximjNgdVAm9HLMGiiO8UmVsk7/wed+e7ArVD 55FT6x4ReofTt/QWvL1f/7h3w+wmMDmo8RBHV+KEG03pmWDJuv2tjnxGUM6yeAEkoWcH yAjUiLouQ92OzagXAou5zOIwty+tCHdtnMYQA3uqyAjUQX8qgWtvMCdvEdZu6dZ7ZTMy +RdrzyajAGHaV+ODAkZVvNS+6h9c6V+sJ2B7BTETaIPUJwmKWQDVHf063m5vsqT2kPYn HwSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LJd/GMj7; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2-v6si1130305plk.240.2018.02.22.02.42.47; Thu, 22 Feb 2018 02:43:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LJd/GMj7; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753497AbeBVKmK (ORCPT + 99 others); Thu, 22 Feb 2018 05:42:10 -0500 Received: from mail-ot0-f176.google.com ([74.125.82.176]:46190 "EHLO mail-ot0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753288AbeBVKmI (ORCPT ); Thu, 22 Feb 2018 05:42:08 -0500 Received: by mail-ot0-f176.google.com with SMTP id 41so4187599otd.13; Thu, 22 Feb 2018 02:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6JMq/VwlP3nwgVREyZ1nFTms11SrRXvtbbTtvMPSLfo=; b=LJd/GMj7ITriKjbGhRyORvGXZEGGTOT9Kc42/MIq9oHe2zBrf/Bq9MDprbAn3TkI5j Sg6yubYtxM/gw77LaK+bJa31BTwm77Eh8vj6bYB/wSiC9nCA3tdE3qqbh923awwGjRTK L+Lp4ZeS2jtsZ23/nhvLid/5E6GCIJ9b7tbrMPbPdj9HU+N4jGF8GvD4sC/XDTkwCTU5 49nndYXh0ALYTEyGAejrgz0wXNzuOJvm5pI4MR7ALKKe1beyrIrMiOQoJYjd6ji7iifq qocCNQojiQDCIlnjT2QMUcAUmFsz3fL2a+A0FLg2G+RqtvLL/+UAjsE0MYOildVuC9rv wssg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6JMq/VwlP3nwgVREyZ1nFTms11SrRXvtbbTtvMPSLfo=; b=RZ6a3J2JKN/oWRAss+KnuuqhJwJA+C8Cxnbob7fOOFjvi04JJ+5oVfdhA73+L8hhGn CWybjoTwc9lrDFXinBxtge2NDLKQ/pLRfp3mtUh0p60QBbFc6jDT/rN+I6OwW7SY+c5s aFHeZ6X5MQWMOKS964WKAe85WbUIWiBnMok6/e9me3zClzAmU8ByPipgl5fepLOZN6bF dx28O/fJGbcw3/Xzv+99EH7+SmxQ80tufBZmoA6Vo8AzkHwkUksgKGBBP6QeXe8Kj3mD hbjMa49rk7z2fOCcn5vKwnEjG1Dr1gAHYBXyFTVfLPAumHlaZ5EnFy4hxjI9w9ABuKnv 21nw== X-Gm-Message-State: APf1xPCavEO5y4xgLJ5hooB0Qh+AyTFCGiO9JN79UbI3skAmjDBtsZq0 njQFlxjxET5HdT97AYyFpkA= X-Received: by 10.157.12.229 with SMTP id o34mr4933018otd.352.1519296127705; Thu, 22 Feb 2018 02:42:07 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id j196sm7019010oih.3.2018.02.22.02.42.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 02:42:04 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 1CC2D20FED; Thu, 22 Feb 2018 05:42:03 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 22 Feb 2018 05:42:03 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id 92A4E243C4; Thu, 22 Feb 2018 05:42:02 -0500 (EST) Date: Thu, 22 Feb 2018 18:45:32 +0800 From: Boqun Feng To: Peter Zijlstra Cc: Daniel Lustig , "Paul E. McKenney" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, mingo@kernel.org, stern@rowland.harvard.edu, parri.andrea@gmail.com, will.deacon@arm.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, nborisov@suse.com, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: Re: [PATCH RFC tools/lkmm 10/12] tools/memory-model: Add a S lock-based external-view litmus test Message-ID: <20180222104532.6znly3zespgfga4i@tardis> References: <20180220232405.GA19274@linux.vnet.ibm.com> <1519169112-20593-10-git-send-email-paulmck@linux.vnet.ibm.com> <20180222032349.klcuiq23f52sfop6@tardis> <20180222041357.GB2855@linux.vnet.ibm.com> <20180222052746.vofmqbpnmfahck3z@tardis> <20180222065847.zqiquiyehvzgiiht@tardis> <20180222101504.GQ25201@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ci7ab5w6tv3ramfs" Content-Disposition: inline In-Reply-To: <20180222101504.GQ25201@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ci7ab5w6tv3ramfs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 22, 2018 at 11:15:04AM +0100, Peter Zijlstra wrote: > On Thu, Feb 22, 2018 at 02:58:47PM +0800, Boqun Feng wrote: > > > And yes, if we go with a purely RCpc interpretation of acquire and > > > release, then I don't believe the writes in the previous critical > > > section would be ordered with the writes in the subsequent critical > > > section. That's really all the argument boils down to. We'd like > >=20 > > I think atomics in Linux kernel(and in LKMM) are purely RCpc, right? > > Alan and Andrea?=20 > >=20 > > And we are not going to change it, are we? > >=20 > > If atomics in Linux kernel are purely RCpc, then it cerntainly makes > > sense for riscv to provide purely RCpc atomics. >=20 > So there's 3 things: >=20 > smp_load_acquire(), smp_store_release() >=20 > atomic*_{acquire,release}() >=20 > *_{lock,unlock}(); >=20 > Which are all quite distinct. >=20 > smp_load_acquire() and smp_store_release() are RCpc, and there is no > discussion of ever wanting to change that. >=20 > The atomics also follow this and are RCpc, in fact the RELEASE only > applies to the STORE and the ACQUIRE only applies to the LOAD of the > atomics. >=20 > The locking primitives OTOH we would really rather like to be RCsc, and > everybody except PPC has them as such, PPC being the only one having > RCpc locks. >=20 > I read the part you quoted from Daniel as being purely about spinlocks, > the 'critical section' wording being a dead give away, so I'm then > somewhat confused why you talk about atomics. Maybe it's me who misunderstand Daniel's words. But my understanding is that riscv people are on a debate about whether their "RCpc" atomic instructions need to be more strict: release+acquire pair orders two writes. And I thought that atomics(including RmW atomics) in kernel only have purely RCpc semantics, which I needed to check with you guy. And if I'm right, it's cerntainly fine for riscv "RCpc" instruction to be purely RCpc. Note that even on PPC, the release+acquire pair of atomics orders writes before and after, and on x86, writes are ordered since it's TSO. So strictly speaking, I think our current implementation of atomics are a little more strict than purely RCpc. If we think this is an requirement for implementation of atomic primitives, than the current version of riscv's "RCpc" atomics don't suffice. Regards, Boqun --ci7ab5w6tv3ramfs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlqOn0gACgkQSXnow7UH +rgiBQgAqeS8IrnlHw0UjeeKk0dteFu5Z/677/DyBE8hO7Jo280fXe64EoU2d0XH BD3g7plUWVB2NxzWYZkePnYuZD34Rqtknt6Do+liuaeB/ifEeRMCZ+51nHaNA5Id jF0sr36/QcjAe7IVPloimH7q72+HEJ1NGt2FvDNPCoHrcCEUoQPxuIPRaUX6ePey vD63CQSy/fSNoCGzMYOsgmMNWtzYkTm3HGJNSn1KJ8mTy7KU1m0FBAc/ZBXyUBb2 HkweoPDZmpP+S2FwIVs8HAIVeASIEKQKnruZ357DCGq94MwjUBhkmBAVveDj0A/L Upy6iXq352/mRmj0FzOy3ltkSBxqMg== =G/un -----END PGP SIGNATURE----- --ci7ab5w6tv3ramfs--