Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1286840ybv; Thu, 13 Feb 2020 20:02:19 -0800 (PST) X-Google-Smtp-Source: APXvYqw7EKs4LE+MnzPRhqTfUSIi2a4fHqdzG8j+DkbV8cAbsjDU0Sa7/OROdgRIg7hXAHKxDSR2 X-Received: by 2002:a05:6830:1289:: with SMTP id z9mr684988otp.317.1581652939399; Thu, 13 Feb 2020 20:02:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581652939; cv=none; d=google.com; s=arc-20160816; b=w/fEyQiUbhpO/pBIVLu+m7zHnSRs9W5rp5Xq24Sde+kZqm+YgqDRtSj8j7H/hUt9+e RZd+OErrY4XAZ4pNK4kkocwD57STMk9DNQswp/zLku1UKV9ySidCBOXEAj8dLhAZrbmp pYYGqKhnp15zs0Sj6MZ0hnWsTT1XyhbqjltFRccPVwmmrN2PMky5YWUoBlLNZJl91LwL iJ9fnjIgMt+/msO4dK0o4n2ZM2Lha2JH/YRf7VmjXWSJLmxrgadHgYNfzhLcFJh1uw+n 9Vec7+vKzc92Quad1JtxrQRz9U2zWpwTmAoR+Mwlg85XAljA1VfMmhg6SYOPdrz9wR40 lW5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xZ2H7GSAMnnXMQ7tQkUf2nC+EabJVUC+NrDmPk4E/8c=; b=CJlZXiSLqu+1M/3bxVflQITpHdWTFjg/PJWAmiek4ShUNe2MPb0e7jCndxqB8ZfH00 Nkr7K5kue7B6vyqtJmyD/06ahvq+MhKxMcaX+Y8OU1bhAZkwhNoe2SaoaixcfKdTjgIK 1TAowyg26SCDBBk3zJG/3B4GwA4z4mp2yA9vtzOdWCuEAm4TEENEdx1USttoS1RsoZMG nG1bjpG2Cwq29OkkKLA/rqI0fAhV4sziAr8mF/mtlqngthIlr4c0+gQv9joCrNARjbg0 upaM1kZ/+Gb7YYUAm7vhSlRriqsywggtrsT7BFAhLnj0yk/sxRiw5RqAjCcaVLrQN+mT hmTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tfw+i46C; 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 l14si2246553otk.225.2020.02.13.20.02.07; Thu, 13 Feb 2020 20:02:19 -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=tfw+i46C; 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 S1728621AbgBNEBw (ORCPT + 99 others); Thu, 13 Feb 2020 23:01:52 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:43204 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728422AbgBNEBv (ORCPT ); Thu, 13 Feb 2020 23:01:51 -0500 Received: by mail-qt1-f193.google.com with SMTP id d18so6128026qtj.10; Thu, 13 Feb 2020 20:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xZ2H7GSAMnnXMQ7tQkUf2nC+EabJVUC+NrDmPk4E/8c=; b=tfw+i46CoImuNrXLomkqtzbpyGPjfqqMaQ20+xnbCM4U6AdsXDLV6cd0KQkdB2tkBP DlSm8x9WPztoXOtNQU8bnnkvG7k7xkEdwRJ8TJsNB4mQ3Sz7WPgzzoIQ61VwdcjtcKoZ RhMOJlTjUtVPqhXLLZlzSjF7MBEuv7Hh2bSFX2tStHUApSxgq6cjSw174aSv7OhlsP4x tbtufKSUUuarF3UFmlanaI1FmAeEYqAUcEZfUJeKBjXtpVmMUvkESkieuHhn3X3SnZ0w hTD8dIHViQ9QoN0+1K2WqMn0xMKB0sEQ81EZNpZRvADaH4Kz7e+oFUUptKpo6OoSOXnd 3dEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xZ2H7GSAMnnXMQ7tQkUf2nC+EabJVUC+NrDmPk4E/8c=; b=N+rfumG20yTwbljf2+rrwGEtmy/AFylmdygEuDOx7okl3LzV1egF9f2GymlqDdbi7s l9wuGIn/Q1ipH5YnZ412xZ7T2eek5Rmss2VzjEepaDTYc9RJzDJv4mRiGmDbrGcagPLs p980Fkkn9A46nW2nThRSL6VcWvLOKbTZqYAipgfda83tamFLum8EPFy7p2icggz5xUzF x9GCWFV5RblkEtnPe7JxUY7ktz5uwsj0uKGlPdK7+CpoWe4Gym0hs8p6lpgzsFhPubWS fpijw23eyM+Fsqk0gL2a3TwIGB1Bq7hzbHrCOnhwUcZKZxNvqOp6sJvyIvwjRhRaQ+RZ kZow== X-Gm-Message-State: APjAAAU3xT7yD3DwhmUG+Btv0bt3jGWvb3kCJMpSw1vojftrJaBxVQ5A GC+YAOsYFqmcmRfERntyxIo= X-Received: by 2002:ac8:2afb:: with SMTP id c56mr1109339qta.112.1581652908940; Thu, 13 Feb 2020 20:01:48 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id d20sm2652885qto.2.2020.02.13.20.01.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Feb 2020 20:01:48 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id C498022171; Thu, 13 Feb 2020 23:01:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 13 Feb 2020 23:01:46 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieelgdeiiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucfkphephedvrd duheehrdduuddurdejudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqd eiledvgeehtdeigedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhl rdgtohhmsehfihigmhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 2AD7330606E9; Thu, 13 Feb 2020 23:01:40 -0500 (EST) From: Boqun Feng To: linux-kernel@vger.kernel.org Cc: Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , 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: [RFC 1/3] Documentation/locking/atomic: Fix atomic-set litmus test Date: Fri, 14 Feb 2020 12:01:30 +0800 Message-Id: <20200214040132.91934-2-boqun.feng@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200214040132.91934-1-boqun.feng@gmail.com> References: <20200214040132.91934-1-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); } -- 2.25.0