Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2299481ybv; Fri, 14 Feb 2020 15:52:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxZcxwv5Ug/rArrhuLeVW+BlUxFWpmD3f7F2cci8O3cRT7XFWxt1u+FWE6bdI8t+kXPeC4s X-Received: by 2002:aca:f305:: with SMTP id r5mr3675400oih.174.1581724370400; Fri, 14 Feb 2020 15:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581724370; cv=none; d=google.com; s=arc-20160816; b=FtZTzC+p235pCu0Wklbwa6MXfift34Pg97FraVks5iuPfVpX6kfaLzwjAg92fnotb3 C+76/Bh477a+4IaSo7VCeZCBQ4PuEaAkg86lf33UKIPF+vrV9BbO7+eV8YSItfrOa3Om 91IEcHJNptgXq+dMfJ24tjN9hFdcekBHZNbkJ7ztranPThG5ARr49YOnAyyqbE+Svq3/ mTe2r28rQikZj3Jr7mXN8kJ2VpT0XljFHUB2YGKlahng/CDPu3bHjQCMmazd9V45rE/O Sw3WXwuhpKneF4q5E5NFlekvotVQAp3OVwtJ4MCHWsWwzWUi2VfhU9Xh1lBrpSXYp1ZJ st3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=q1VFlGpNJsAugpu1KvzTN0fxzKwDkCIDswD9pZg8AZw=; b=brqc8SzyylWZ+SVjd1/Ttgn6iBI6pAs1xsSv3BJYqgIwM67lCGDXqiiXAShzSE9kHX +So0TLxKXx85HSEHyoniM/OEGcL/pba+WAPtwYfkPA05wfavUeNoF2j+Hx8EdAuxf7cq w5RAPr2GzMelNl0xVAbyYuZz7+vb2qixRpNBA/Pf93gqmjdF5xcgd298HJrzs0rBeYJd Z/WHU9VdQqmHnLvtXvV2J+FsrMdyHGtwDtsjklSIKgkWWs2qzRrCQIAtHKbSYG+7ogt4 uv4+JEFvN1oIsdHD/RAapux7MTsZpn/v57fhxbDvWClBX2BWGbjwEhA4qvulDQ/WG2EM n/bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lnaPM1Ux; 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 p191si3447483oic.257.2020.02.14.15.52.37; Fri, 14 Feb 2020 15:52:50 -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=lnaPM1Ux; 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 S1728417AbgBNXw1 (ORCPT + 99 others); Fri, 14 Feb 2020 18:52:27 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:44139 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbgBNXw1 (ORCPT ); Fri, 14 Feb 2020 18:52:27 -0500 Received: by mail-qt1-f193.google.com with SMTP id k7so8139171qth.11; Fri, 14 Feb 2020 15:52: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; bh=q1VFlGpNJsAugpu1KvzTN0fxzKwDkCIDswD9pZg8AZw=; b=lnaPM1Ux7tMqY7Inxp1gY8SCVAynAufvY1Hi8Y6GQ4RGy5gFWjw57QwwxBok/gbR1F O9SDtPaytcJmOabGw23EiZCD4DcE6H5kTRx3JnGFlohLLtsEoAa4LxmKZ8N6fUTaH+zv Ko54oPJOOFpamXNIKus06PywT60wkFP0guepQjVP85Y+/kE4ljhU1VripiRPgEYAOtKe DGtwr09TDhMdcMRTjcBqGjwr6OO2FJl+gyVvqVoKScxO/MPsTRAG6ZM9gUvN5xtlv+zx V1Yenr5y2V4b01mLsQhchPEc8nBj8O9K4t+0T3GjFooSOOh7cvVwgAg+wdSw+Zh5mTnr qXsQ== 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; bh=q1VFlGpNJsAugpu1KvzTN0fxzKwDkCIDswD9pZg8AZw=; b=QTuQ/FutNTXUw2b+8eSaazkt0NsrR2kjsd11ie3ThJ25cVtRy3Yu+Czqb+53REf83j cYiZ9tMRmTwVvUmoFo/xIDzNAyW/tGtR94amZVc2jcimv3MBba0u6HT7nVmCGBxZkNLd zPD3z4Q0+KB5GVigL2GzKepUbaDYE+XhMorWj3ef6MSq8Fvcbrg39r75u3xbGGVRUoRP t/BYkNSxvns0r1RDPm9qou56zXu2gB45iB/dzo4Mxg+gdPHkHZzWfUEGipqpyUBmF24x W4Q4yXzL3ACjKDCQRiZpmREjGDlSxPy/eQ+4gkUyzH8B22bcCbyZ+6SRT1dES2/HzcmB Ehfw== X-Gm-Message-State: APjAAAWCOrocm5iOEtsuo2030TZpQTD9KbxpEGTcFfuDIJJSYJn4Yn/I sWGzJtTWamoN6kXmF6CuZL0= X-Received: by 2002:ac8:5502:: with SMTP id j2mr4753304qtq.127.1581724345607; Fri, 14 Feb 2020 15:52:25 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id u4sm4264894qkh.59.2020.02.14.15.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Feb 2020 15:52:25 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 7C566216CA; Fri, 14 Feb 2020 18:52:24 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 14 Feb 2020 18:52:24 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrjedugddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucfkphephedvrd duheehrdduuddurdejudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqd eiledvgeehtdeigedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhl rdgtohhmsehfihigmhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 7B7A93060BD1; Fri, 14 Feb 2020 18:52:17 -0500 (EST) Date: Sat, 15 Feb 2020 07:52:15 +0800 From: Boqun Feng To: Alan Stern Cc: linux-kernel@vger.kernel.org, Andrea Parri , Will Deacon , Peter Zijlstra , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Jonathan Corbet , linux-arch@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [RFC 2/3] tools/memory-model: Add a litmus test for atomic_set() Message-ID: <20200214235215.GB110915@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> References: <20200214040132.91934-3-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 14, 2020 at 10:47:48AM -0500, Alan Stern wrote: > On Fri, 14 Feb 2020, Boqun Feng wrote: > > > We already use a litmus test in atomic_t.txt to describe the behavior of > > an atomic_set() with the an atomic RMW, so add it into the litmus-tests > > directory to make it easily accessible for anyone who cares about the > > semantics of our atomic APIs. > > > > Signed-off-by: Boqun Feng > > --- > > .../Atomic-set-observable-to-RMW.litmus | 24 +++++++++++++++++++ > > tools/memory-model/litmus-tests/README | 3 +++ > > 2 files changed, 27 insertions(+) > > create mode 100644 tools/memory-model/litmus-tests/Atomic-set-observable-to-RMW.litmus > > I don't like that name, or the corresponding sentence in atomic_t.txt: > > A subtle detail of atomic_set{}() is that it should be > observable to the RMW ops. > > "Observable" doesn't get the point across -- the point being that the > atomic RMW ops have to be _atomic_ with respect to all atomic store > operations, including atomic_set. > > Suggestion: Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus, with > corresponding changes to the comment in the litmus test and the entry > in README. > I agree, and thanks for the suggestion! And I change the sentence in atomic_t.txt with: A note for the implementation of atomic_set{}() is that it cannot break the atomicity of the RMW ops. , since I think that part of the doc is more about the suggestion to anyone who want to implement the atomic_set(). Peter, is that OK to you? Regards, Boqun > Alan > > > diff --git a/tools/memory-model/litmus-tests/Atomic-set-observable-to-RMW.litmus b/tools/memory-model/litmus-tests/Atomic-set-observable-to-RMW.litmus > > new file mode 100644 > > index 000000000000..4326f56f2c1a > > --- /dev/null > > +++ b/tools/memory-model/litmus-tests/Atomic-set-observable-to-RMW.litmus > > @@ -0,0 +1,24 @@ > > +C Atomic-set-observable-to-RMW > > + > > +(* > > + * Result: Never > > + * > > + * Test of the result of atomic_set() must be observable to atomic RMWs. > > + *) > > + > > +{ > > + atomic_t v = ATOMIC_INIT(1); > > +} > > + > > +P0(atomic_t *v) > > +{ > > + (void)atomic_add_unless(v,1,0); > > +} > > + > > +P1(atomic_t *v) > > +{ > > + atomic_set(v, 0); > > +} > > + > > +exists > > +(v=2) > > diff --git a/tools/memory-model/litmus-tests/README b/tools/memory-model/litmus-tests/README > > index 681f9067fa9e..81eeacebd160 100644 > > --- a/tools/memory-model/litmus-tests/README > > +++ b/tools/memory-model/litmus-tests/README > > @@ -2,6 +2,9 @@ > > LITMUS TESTS > > ============ > > > > +Atomic-set-observable-to-RMW.litmus > > + Test of the result of atomic_set() must be observable to atomic RMWs. > > + > > CoRR+poonceonce+Once.litmus > > Test of read-read coherence, that is, whether or not two > > successive reads from the same variable are ordered. > > >