Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp788899lqm; Wed, 1 May 2024 16:21:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnH44+D4ixYHymo8bNOUQL3Ww3ZZYeWBEESUqYgIts32PjDk8fK3dGk6ICCjf48s5yNzMunH6lARVEzkX75YNAjDMb30/vUgAALB5D+w== X-Google-Smtp-Source: AGHT+IEyLzNiqhBp4WI/aLkjiX0rD4W9w4w42ne3TQrhBQRVS8QyGTLkKHEIMuw8fNNwv7k+kxG0 X-Received: by 2002:a17:906:3c52:b0:a58:9c9b:61ad with SMTP id i18-20020a1709063c5200b00a589c9b61admr2449573ejg.43.1714605713947; Wed, 01 May 2024 16:21:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714605713; cv=pass; d=google.com; s=arc-20160816; b=QCRCjk6cnPIfvl9/sesi+za0ZCw2h0lYJNE2MPq3sAom+C2wVK1XKfILkWDXlulK5U ui6W2Lygs2OGGzW+NCuzsF3mmUhoDR6t6Vu6HIQ72RwBPevo+8MWvsTSxwnjb4gJFk0b zgOOUQfb3rdpK9mFM2QGlx+GF+AhrQs9K4XF0702Ha6Gmm+pyT7pfjO9GeAPj4L13h6M 4EF06yvdy3zAJyT+yVkmToAYyr0w5ZZz1xuS9SlWUHtITbUi1RxHLhDj17qAGnT/b55D GERSnybZqoG6nhEKTaINUHvSQxfaJCQpEYKNd9sqzYxknOMPwJvzxYuqrwJonDDXcawV xA7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/F6/2ec11m+zIxGlR6y3bR8KCOjbLqn3DZT95u0fl6w=; fh=NDJRGXS70NFTiN/5QYNfvyLKSNR6wwd7uvFgyhTi/r4=; b=RwcKqy4zfUgmoy4mYGAc/nCDjJILvUqGUWr7hr4WjZDqaIrt13VabjAJtMH0T9ovgM 1ncjFiruo4BoiDpWZdmK+3fxYW+5+3LOoHHi8tmKhkj6LtkNmzzq01EMvB6tWzn8N+Oj jThcLq7UezmRR6uZAU5IJ4YN4irmHeNotRTsxZQD/9Ufq61P2jMD0Zl837DI9egSwJ2W n+VFBlUcbBcuCxAZnDV0RKxkvAzHmqUeAsJmw4GWqDib/gTzR0zkaQs6xY3fyMJPdDiN Y9dEVGAE9fZaZYlyQnanpEtZ+QZI4HCw1qqO+LPvOItp+zHLOQOqMUI+44s6sQpdCzVM QEcQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ey/sscED"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165838-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165838-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t22-20020a1709060c5600b00a526d2a5aabsi16149148ejf.708.2024.05.01.16.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165838-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ey/sscED"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165838-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165838-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AC8931F223FE for ; Wed, 1 May 2024 23:21:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FCEB16ABF7; Wed, 1 May 2024 23:21:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ey/sscED" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 241C7168AEB; Wed, 1 May 2024 23:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605695; cv=none; b=giEuHvAQYRlLe8WgMBQych5xyyeIF4WeB4MXoSW7phZwl8L7oRDoODKBeXgIkUpu8nzSp7HpNLQSJXd7GnMzKipTxy6dVp/ugI7wwneFii7tEjD3Qifo+J0q3cigX+Bd22u/OgqViA3kOfuTb1K5O/cK6I5UR+/KPm/jUYfKcZs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714605695; c=relaxed/simple; bh=ibJ7tBfcSHE8gIrgfKmrh4eEE1rQM1LM/7svDbVFHa0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AAhHyW4kXgGt3Jd/gKKaRbIHNHXeVIY0trZuPOclA8KzXC7/U0izFBYW0L6853oNYEb5d8bVGkGcPkoSfQ8cs8Thegu1KOiQlMF2TkBhYA03b15YHH6zN+KVc22RGZQb9Rt1Rp2vsohqAgz4GpgTEnJeAqiTZIQ5xPvVVWfL8FE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ey/sscED; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5CD3C072AA; Wed, 1 May 2024 23:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714605694; bh=ibJ7tBfcSHE8gIrgfKmrh4eEE1rQM1LM/7svDbVFHa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ey/sscEDF9TXLGAIQyztoHiDad6TZo3EhhsYRD4q8JDRioozq1/o2dJh3aNT281YM Far2IKzktYWQpiz89L7i+DRjK/X9rnpeGjqEDMzsQKNif9JBWeDWmkqg2XnnYRQPtQ 1TfLNqGbktjclvRFZNpukKhgWTLxUMsiib3gb8K4wTWzB56t4IsU6MzI8O4gS/13XD c8SdgCkmYXy6npvGuvsLMSmfiljQwt8oAnBk1SmXf+jLWCve/s+XUnyt+tzIhJjZ+I E6yGTk6qIeN+fkhaIYAIz87TLOSOw1HF/+4QXO1yFeY6U6Zir6OqQcflq7K3KHxqmF wvZaESnZdl6uQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 62DB5CE1073; Wed, 1 May 2024 16:21:34 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, kernel-team@meta.com, mingo@kernel.org Cc: stern@rowland.harvard.edu, parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, "Paul E. McKenney" , Daniel Lustig , Joel Fernandes , Mark Rutland , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH memory-model 1/4] Documentation/litmus-tests: Add locking tests to README Date: Wed, 1 May 2024 16:21:29 -0700 Message-Id: <20240501232132.1785861-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <42a43181-a431-44bd-8aff-6b305f8111ba@paulmck-laptop> References: <42a43181-a431-44bd-8aff-6b305f8111ba@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This commit documents the litmus tests in the "locking" directory. [ paulmck: Apply formatting feedback from Andrea Parri. ] Signed-off-by: Paul E. McKenney Cc: Alan Stern Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Nicholas Piggin Cc: David Howells Cc: Jade Alglave Cc: Luc Maranget Cc: "Paul E. McKenney" Cc: Akira Yokosawa Cc: Daniel Lustig Cc: Joel Fernandes Cc: Mark Rutland Cc: Jonathan Corbet Cc: Cc: --- Documentation/litmus-tests/README | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/litmus-tests/README b/Documentation/litmus-tests/README index 658d37860d397..26ca56df02125 100644 --- a/Documentation/litmus-tests/README +++ b/Documentation/litmus-tests/README @@ -22,6 +22,35 @@ Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus NOTE: Require herd7 7.56 or later which supports "(void)expr". +locking (/locking directory) +---------------------------- + +DCL-broken.litmus + Demonstrates that double-checked locking needs more than just + the obvious lock acquisitions and releases. + +DCL-fixed.litmus + Demonstrates corrected double-checked locking that uses + smp_store_release() and smp_load_acquire() in addition to the + obvious lock acquisitions and releases. + +RM-broken.litmus + Demonstrates problems with "roach motel" locking, where code is + freely moved into lock-based critical sections. This example also + shows how to use the "filter" clause to discard executions that + would be excluded by other code not modeled in the litmus test. + Note also that this "roach motel" optimization is emulated by + physically moving P1()'s two reads from x under the lock. + + What is a roach motel? This is from an old advertisement for + a cockroach trap, much later featured in one of the "Men in + Black" movies. "The roaches check in. They don't check out." + +RM-fixed.litmus + The counterpart to RM-broken.litmus, showing P0()'s two loads from + x safely outside of the critical section. + + RCU (/rcu directory) -------------------- -- 2.40.1