[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.2002271133300.1730-100000@iolanthe.rowland.org>
Date: Thu, 27 Feb 2020 11:34:55 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Boqun Feng <boqun.feng@...il.com>
cc: linux-kernel@...r.kernel.org,
Andrea Parri <parri.andrea@...il.com>,
Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Nicholas Piggin <npiggin@...il.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
"Paul E. McKenney" <paulmck@...nel.org>,
Akira Yokosawa <akiyks@...il.com>,
Daniel Lustig <dlustig@...dia.com>,
Jonathan Corbet <corbet@....net>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Rob Herring <robh@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
<linux-arch@...r.kernel.org>, <linux-doc@...r.kernel.org>
Subject: Re: [PATCH v3 2/5] Documentation/locking/atomic: Fix atomic-set
litmus test
On Thu, 27 Feb 2020, Boqun Feng wrote:
> Currently the litmus test "atomic-set" in atomic_t.txt has a few things
> to be improved:
>
> 1) The CPU/Processor numbers "P1,P2" are not only inconsistent with
> the rest of the document, which uses "CPU0" and "CPU1", but also
> unacceptable by the herd tool, which requires processors start
> at "P0".
>
> 2) The initialization block uses a "atomic_set()", which is OK, but
> it's better to use ATOMIC_INIT() to make clear this is an
> initialization.
>
> 3) The return value of atomic_add_unless() is discarded
> inexplicitly, which is OK for C language, but it will be helpful
> to the herd tool if we use a void cast to make the discard
> explicit.
>
> Therefore fix these and this is the preparation for adding the litmus
> test into memory-model litmus-tests directory so that people can
> understand better about our requirements of atomic APIs and klitmus tool
> can be used to generate tests.
>
> Signed-off-by: Boqun Feng <boqun.feng@...il.com>
Patch 5/5 in this series does basically the same thing for
Atomic-RMW+mb__after_atomic-is-stronger-than-acquire. How come you
used one patch for that, but this is split into two patches (2/5 and
4/5)?
Alan
> ---
> Documentation/atomic_t.txt | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt
> index 0ab747e0d5ac..ceb85ada378e 100644
> --- a/Documentation/atomic_t.txt
> +++ b/Documentation/atomic_t.txt
> @@ -91,15 +91,15 @@ ops. That is:
> C atomic-set
>
> {
> - atomic_set(v, 1);
> + atomic_t v = ATOMIC_INIT(1);
> }
>
> - P1(atomic_t *v)
> + P0(atomic_t *v)
> {
> - atomic_add_unless(v, 1, 0);
> + (void)atomic_add_unless(v, 1, 0);
> }
>
> - P2(atomic_t *v)
> + P1(atomic_t *v)
> {
> atomic_set(v, 0);
> }
>
Powered by blists - more mailing lists