Received: by 2002:a05:7208:c24f:b0:81:d631:dc8 with SMTP id w15csp395545rbd; Thu, 4 Apr 2024 12:28:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5HKqPNlYhLgo3AfLwjhJ3rdmmYJH8RaTse5MpxrDypKVivvTqHEgdP10pvsMyvTGth15ts2Xktwr6YCj8Sd0mv1MmM/+Dq7naiKLpPw== X-Google-Smtp-Source: AGHT+IG5QQH+AzH5j9ESghGrgWU9gslToF6nH8s4Q2Qj9kxEPjVedABMlrHAdaAFclapiAXX2rNz X-Received: by 2002:a50:9ea5:0:b0:56c:d1b:e088 with SMTP id a34-20020a509ea5000000b0056c0d1be088mr2293264edf.19.1712258890245; Thu, 04 Apr 2024 12:28:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712258890; cv=pass; d=google.com; s=arc-20160816; b=Hrww4VNvhEwOJqdLN3B5Bp9Igbs+4+jF+pz8SBCQj5+0050sUaN2XhDLF7eHwciVMP +QnVzMP/gzjo8I3WjBwB+Lv1h5DKFVBNsrLxUz5LzOi2moiVKxjpqu8p9LfRgIqgXhB3 QYPsRr3P8seuQgRAMidqdKiJ+BOVjqyoapuE8wgJAi+Yf9Ktv6SAjvvYWNL7uDk2a7XV XSc6ZokADn841MruQom/1UYc3hnWND/BznUOjCZ713+UfkzHcq9iXT5i5vHvH+TBotFr 15mgCvGk0X4+bcgxyWyfu3uyC1dUCTq5mqsYJptU7xCrGS6O9CavNqVyUG2ldhiuN5QT 5m9A== 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=9B9or5hXqTQyyMrMMy+7UjRtbeqhfojJBQAXlRmWEdQ=; fh=NDJRGXS70NFTiN/5QYNfvyLKSNR6wwd7uvFgyhTi/r4=; b=JHkSORvSrqfegOzp6D+AjXaVj/OFBs2xUvhMe8Zj/R88oqRrVwaETzshHuZ9lsCJqe IdXhvqX6gHvPCyOWY7z3982acEIJqXG9umKMvABMWx5uWx9VbhBXuGt5iyC4LnmWhg4Z Fi20WqVMPSK7iKqoyafrFJy8czZXryS7DSch3tqHvsmwm/t8V3lY0JrnLQEtan7eqPVa cq28HUOCpL90YpGlO8gdOf6DoLMg/ShUt800l74yMbLU1VQ9b1n/XA5CvIPRaMihDGg9 kO02nwZVYqPlM1j6qKlx1A6JLyQJGYpQmUc2/6qsjIhJzg6pRMA9Cv2DTO+Oug5SzV6H +ZvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iK0hUQTw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132034-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 e17-20020a056402191100b0056dface1272si2482743edz.538.2024.04.04.12.28.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 12:28:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132034-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=iK0hUQTw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132034-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 01B4E1F25E72 for ; Thu, 4 Apr 2024 19:27:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33A871369B2; Thu, 4 Apr 2024 19:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iK0hUQTw" 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 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-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. 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