Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1312309ybf; Thu, 27 Feb 2020 08:35:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwZ2GXXmPEvJLy6Mx+DUyVVAFfowrF9PFA58EwfeBK+jUhWnkqJUQK2xzHsUCuuyKBvn1Vf X-Received: by 2002:aca:aa0e:: with SMTP id t14mr4166479oie.149.1582821320131; Thu, 27 Feb 2020 08:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582821320; cv=none; d=google.com; s=arc-20160816; b=dc9DKrlmga/OQyJHDMeZp19hmmpBCnraqWsvAP/apygfW+KkgY5KyoSwn4Qaha6PEK iHAS4b0NRB3zocON04cipQ/ViycwI3KmTjUf/phyqDnxQNHuJenKXKChGF4pxaUaUXiF 9ohVnuPuop3Xi8fzrUzSERtNfDVyuBInX+VYPO1dqC03wAKnkpF4EBtLx4xmKjLfi2ua ui2ZqLDSyRL/XSBPPMaFq6kiyU+H2RIpA/drvzeQfBPNji0fJldbbdbdFoq7fTDZPQhu t5JX0AGFZRfKAbQOTrGKYAtb43be/b/Q/ph2+/hag+irnOPy6HpXUiVQJNmXj+zJW4F9 /Q1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=14QLB0rp0iWia3bAPurjw5C3rsHfDVmp4dtTCQ2qEzE=; b=aVa65WRhQ8foMLg0wuuRsVw1njGUcK9fN+CXUv9Z2PEi08JU38Gjr0g/FOnIcj7Yah cVXSZ/uxc7JqoaE78CWLbf2DfsQUiv11JJQ6D4KX0gfY9iKZmDbFv6v1ZPLh+Vf3eKoQ IQ5SvE7hYtA1Zx8kUZD2PkOqaJp4wiiuwErpAGsFShi04n6i2tORrBNkKBV53wJ6PXiU 7NiY6AhMJjTapCueHHfOfryl9joXk19y8qkmQxmmOMGM2o4tDn6LU6Zy3YK2WjZ3tw+n NP5YGgQwHGl2GkhbA6y2bzjrPlPfb7ImxdLN0RchobdlrGj8sAqzTDS/1Y/W3nPbcL7Z rQkQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si1988084otq.115.2020.02.27.08.35.08; Thu, 27 Feb 2020 08:35:20 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730206AbgB0Qe6 (ORCPT + 99 others); Thu, 27 Feb 2020 11:34:58 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:38832 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1730194AbgB0Qe4 (ORCPT ); Thu, 27 Feb 2020 11:34:56 -0500 Received: (qmail 3344 invoked by uid 2102); 27 Feb 2020 11:34:55 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 27 Feb 2020 11:34:55 -0500 Date: Thu, 27 Feb 2020 11:34:55 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Boqun Feng 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 , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , Greg Kroah-Hartman , Jonathan Cameron , , Subject: Re: [PATCH v3 2/5] Documentation/locking/atomic: Fix atomic-set litmus test In-Reply-To: <20200227004049.6853-3-boqun.feng@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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); > } >