From mboxrd@z Thu Jan 1 00:00:00 1970 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 4C0B6135A55; Thu, 4 Apr 2024 19:26:52 +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=1712258812; cv=none; b=E49Xkp+tbPi0dcRz0loCVeDATPJ0nUgEKU3BkkwbvXx8HQVMn2Fs9wF446LYm0luFJ3S+aa2/vZNq91WSo/qDb6ITsUg3DhA0osjsXYR1dseN4heBPMKkX3pCP+32ImCKm+PQFaw9NHbpsKUBI+vfRB0Uw4cgaywZo1GqG5iU1s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712258812; c=relaxed/simple; bh=0guQJ43kZOeFK9RaRxxK/HF/2Akt543i2YM1yup2VqY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dI3gXCeXLT3u9Zop3jV4rmRxep6hDuI9dOdWWTzPyq8IqVsgBOOzM3ij09asChpTvK+5A+dlqA2/TUBJ46CZho9aYYRhCB0tgIKQwAwVv4Oxdb0nI8LdIYgFXVIV8aSCSnVXhMHFjryam5nqJIZu8Xcf5o7qGKSA7FOwP6tLLfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iK0hUQTw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iK0hUQTw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB8C7C43399; Thu, 4 Apr 2024 19:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712258811; bh=0guQJ43kZOeFK9RaRxxK/HF/2Akt543i2YM1yup2VqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iK0hUQTwRSYy33JiDwuEUeSQBqdgS5YZ1GNoaKUX2jKwdjibAtwKzF3/ScOLNEKsB waNLctbwNPfTnLkOS5FUPocf2RHHfPLzDmzzNAmCHqYyqvH8Ly1BQJhoV8xT8p2pFF cmMVgYIsfD6E9oacNfMRrnZO9kBb9d3VE8pHNLLUVz5zBkatO4s7sUhCG7NiVrM/iv o8SfU/eb5jl+bkR5F6d2KdssDw4GMyeXOcs+7IYBJpSayNfq1UjAG264wNoO9WFu3x +8gqb49hGbAmM2+bwxHSi2yVzi2mCQdIA+so3BH2mkMFue/fHDL/W++rhaa1/ADMhL pMMyMfalYxPuw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 90EDECE0D0C; Thu, 4 Apr 2024 12:26:51 -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/3] Documentation/litmus-tests: Add locking tests to README Date: Thu, 4 Apr 2024 12:26:47 -0700 Message-Id: <20240404192649.531112-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <8550daf1-4bfd-4607-8325-bfb7c1e2d8c7@paulmck-laptop> References: <8550daf1-4bfd-4607-8325-bfb7c1e2d8c7@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-arch@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. 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..5c8915e6fb684 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