Received: by 10.223.185.116 with SMTP id b49csp1585313wrg; Wed, 21 Feb 2018 22:57:12 -0800 (PST) X-Google-Smtp-Source: AH8x226CjI/AD0wjmN2EVR2e/Jit7wOEzhk0gc1EdKHgx3+GMs5S3WRacKHMjKkbC2UW3RKDjFqO X-Received: by 10.98.10.219 with SMTP id 88mr3907346pfk.202.1519282632817; Wed, 21 Feb 2018 22:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519282632; cv=none; d=google.com; s=arc-20160816; b=wJwAh+1gmUZFA7Dk/y2glDCVxrTCpbgcLaqJ6xi8i51tlnsGsn+NiG6Kxq65lyc1bQ tzNnMPXGzAvdVU4fpPMTlOr5+BcB5To5vBuN+cDs0Y9sUjZwWY3SmVIZuoX08bJovn6y 2iw8usvh0908r2Hq+9UV7UP/t7Yfm3kWnee39WxfihIqi4f/ZEuSZIgRTxrDF39Iz47q aY1Y9YSb9nw5BOjgbykbfLiv4AcC2fXNKggBbRq4wlwPy84eCPV/2dZGTQlUmnyS7iDb Sxesva0fimP2Jc7UcZlxuymR+xIRXlsTMRyzxqPHOj1lMgHUtaN0i/wre+9VWc2z2FQG LQEA== 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=ayjUocyhOjkKLPAgbeeTSJoljLRayulD8KK0u3bmm94=; b=aIAOutO/ZBHjRkMDMvclsbXUqcBVDkIcn/vwiw5uVx4e2uBi61XobsVksK6aglsVlL llrgNcwcghqUkk96Gr3AT/TMrICJfTkGAbCtyRTTRovGPHz23piwzgb46nwYz9KDRdZ3 1unkOWIJ1o37gsr/Y+sDS3xpGoWTis/j8E3B2rHG7RBQb/EWbtc+UlEWipIOtpfHR7aK KHxSe4VAxe4+m7mDlg2lixVDprz+PvwSLDyck3Isj7N+tPW0nF6lSwSWP/HXKZ/sIZhS Kb9BIkpIX9jpaVDCaIXYIqjfGHZDMxH69I4jgo26VHHN07+r5Ic1z9fj13CTBzhv+Kiy SKjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H6pP8T5a; 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 f69si780908pfd.211.2018.02.21.22.56.58; Wed, 21 Feb 2018 22:57:12 -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=H6pP8T5a; 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 S1752601AbeBVGza (ORCPT + 99 others); Thu, 22 Feb 2018 01:55:30 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36320 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752396AbeBVGz1 (ORCPT ); Thu, 22 Feb 2018 01:55:27 -0500 Received: by mail-wm0-f66.google.com with SMTP id f3so1674409wmc.1; Wed, 21 Feb 2018 22:55:26 -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=ayjUocyhOjkKLPAgbeeTSJoljLRayulD8KK0u3bmm94=; b=H6pP8T5ar9jKhv0VKwSm4SFVhe4JoiMXxszIzF12d7KukbnGkvsVxX27nO0tPz3HK+ zLbJQmQsBSf/hCmztHiWmW+Ao/ctTF5P1m/IcIeOjK1WMfZA1urlzbjEi/16gma7tyHd ub29NjbsXfSb3DWtOp1NvljqPW0R+7zpCtIZGHlxMUmQgD7GnqaQbgBDiQlS+2JmRIFg +l5AdGN8EZVR/UMT0QUKMWXQVMiVTLe0Xubb+bSk8iZp94zr7UHH6t5e6tDYQi36GTOV SCQ9Xkq+Jz6sEO2GhIumwUNt10ZWTsUFKRT4JRA/5k3iFEtKlq67Pnab3T1NiJMU4xh7 a7kQ== 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=ayjUocyhOjkKLPAgbeeTSJoljLRayulD8KK0u3bmm94=; b=VvWXSaolYUC5EEmiFoV5voFaE/bgab9ydqHEKAw7BRp2UF8xClheXwXcYi3jn2laCj LqY0qP9dfdq1/Wq/PpWaRCoijw0cxTqp7etCzpoo4PZmmkvSiQ2POAng7FODz/emwEWs ADge89R0Z3GPRuDFWiHqeXrW5zmOjh162P9CCXHGTfJ4Z/L+mld8ls0ejZAo94vk6Xov xOEAc9cRTCWVA4//6HlwnMsoiQ77wnSA36o4gWb+7SanfZ6PMEOKm3AZJ70/fWyxSdVH ifX/NQ6xZjTfY2ClUI8nGbcVwiNEelLCX3DZtE7/F5Q8h7qav0w3WIHLa19CeJuKYsAt l+DA== X-Gm-Message-State: APf1xPCtVIrnFGQERLHFZdVrywAxFfl2VavwAm8Jw0c8sJ1P1hMY9t9F U9807vak6A6WaciG3i8jpq0= X-Received: by 10.80.142.83 with SMTP id 19mr7965793edx.141.1519282525911; Wed, 21 Feb 2018 22:55:25 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id d22sm10035752eda.70.2018.02.21.22.55.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 22:55:25 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 944E820D56; Thu, 22 Feb 2018 01:55:21 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 22 Feb 2018 01:55:21 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id 13F3B241A9; Thu, 22 Feb 2018 01:55:20 -0500 (EST) Date: Thu, 22 Feb 2018 14:58:47 +0800 From: Boqun Feng To: Daniel Lustig Cc: "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, peterz@infradead.org, 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: <20180222065847.zqiquiyehvzgiiht@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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ormwxexxgtj5uoi4" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ormwxexxgtj5uoi4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 21, 2018 at 09:42:08PM -0800, Daniel Lustig wrote: > On 2/21/2018 9:27 PM, Boqun Feng wrote: > > On Wed, Feb 21, 2018 at 08:13:57PM -0800, Paul E. McKenney wrote: > >> On Thu, Feb 22, 2018 at 11:23:49AM +0800, Boqun Feng wrote: > >>> On Tue, Feb 20, 2018 at 03:25:10PM -0800, Paul E. McKenney wrote: > >>>> From: Alan Stern > >>>> > >>>> This commit adds a litmus test in which P0() and P1() form a lock-ba= sed S > >>>> litmus test, with the addition of P2(), which observes P0()'s and P1= ()'s > >>>> accesses with a full memory barrier but without the lock. This litm= us > >>>> test asks whether writes carried out by two different processes unde= r the > >>>> same lock will be seen in order by a third process not holding that = lock. > >>>> The answer to this question is "yes" for all architectures supporting > >>> > >>> Hmm.. it this true? Our spin_lock() is RCpc because of PowerPC, so > >>> spin_lock()+spin_unlock() pairs don't provide transitivity, and that's > >>> why we have smp_mb__after_unlock_lock(). Is there something I'm missi= ng? > >>> Or there is an upcomming commit to switch PowerPC's lock implementati= on? > >> > >> The PowerPC lock implementation's unlock-lock pair does not order writ= es > >> from the previous critical section against reads from the later critic= al > >> section, but it does order other combinations of reads and writes. > >=20 > > Ah.. right! Thanks for the explanation ;-) > >=20 > >> Some have apparently said that RISC-V 's unlock-lock pair also does not > >> order writes from the previous critical section against writes from the > >> later critical section. And no, I don't claim to have yet gotten my > >> head around RISC-V memory ordering. ;-) > >> > >=20 > > Me neither. Now I remember this: we have a off-list(accidentally) > > discussion about this, and IIRC at that moment riscv people confirmed > > that riscv's unlock-lock pair doesn't order write->write, but that was > > before their memory model draft posted for discussions, so things may > > change now...=20 > >=20 > > Besides, I think the smp_mb() on P2 can be relaxed to smp_rmb(), no? > >=20 > > Regards, > > Boqun > >=20 > >> Thanx, Paul > >> >=20 > As a matter of fact, the RISC-V memory model committee is debating this > exact question at the moment. Now that I see this thread I'll have to > go back and catch up on what I've missed, but at least I can be on cc > from this point on to answer any RISC-V questions that come up from > here on. >=20 Hi Daniel ;-) > (Is there some place I should add my name as a RISC-V memory model > contact, so I don't miss threads like this in the future?) >=20 You can submit a patch to add yourself as a Maintainer or Reviewer for LKMM, Patch #6 in this series is a good example: https://marc.info/?l=3Dlinux-kernel&m=3D151916916630299&w=3D2 , and "get_maintainer.pl" will help people find you for memory model stuffs.=20 > 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 I think atomics in Linux kernel(and in LKMM) are purely RCpc, right? Alan and Andrea?=20 And we are not going to change it, are we? If atomics in Linux kernel are purely RCpc, then it cerntainly makes sense for riscv to provide purely RCpc atomics. > to support RCpc if we can since that's all some software needs, but > we also obviously want to make sure we can support RCsc and these > kinds of LKMM subtleties efficiently too when needed. So we have a I think the problem here is that locks in Linux kernel are more strict than RCpc but weaker than RCsc, and there is not a well-known concept for the semantics of locks in Linux kernel AFAIK. Regards, Boqun > few encoding details that we're still finalizing, because questions > like this one are still popping up :) >=20 > Let me know if you had other RISC-V-specific questions I can help > answer. >=20 > Dan --ormwxexxgtj5uoi4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlqOaiQACgkQSXnow7UH +rjVoQf/R8bGFPon+fc+tjp0aODo15iaOVZTWWj92q7lXmwAnhKPnyQ6nK9VPHOF B85UfBLV9kO20KsuHwW4kB/Nr22i0V1Y/rh2QyDQq8mcwQ6auVBjQp9Ii02LML12 op6m2WSJDvt536+ihxf938GW5fpdI//T3TdGS86fCJYO2coBvUUJKnHaBnp6dSOu LB60x6VAushKRLZwHS9WApP0qaKG1kNFOg+hKU49gGCp3Ux3R/HBbSIjXqlZgLkT PYGJ4di4cONuXMgAoyO3ZQ8J5BNZ/hHCNYnXdqHBGwIaPYxX0ulVt10HenDQeEHS 9FBL50w6Cjdfq2lGyUz2l9v2Rfq+Qw== =ude3 -----END PGP SIGNATURE----- --ormwxexxgtj5uoi4--