Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1125704imm; Tue, 2 Oct 2018 03:13:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Wwfco8gaNXGCVLfbpKwQJQYnU7s3LmVPdxTzuq8XwOlgDLRI1ynUmx/gnJ3D+0RoCGnK2 X-Received: by 2002:a62:e511:: with SMTP id n17-v6mr15532223pff.210.1538475204029; Tue, 02 Oct 2018 03:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538475203; cv=none; d=google.com; s=arc-20160816; b=bE6ElGS9cn6VPsCqyEue4qKLQKvFO56fcPiVGD/LXAjfNT8habn/E6FzFjSp5d5oie AuUHqs8wBXYdU8SNdy1LRHCJaGRvtEjJQNUfezkN0Ic5HPOFYrCNDzfIHK+tNnAwbt8g T2SV4N8VqYRdgsjDL1ozms3EtXNu38X2LM2DS15sI4cMWo620iAJskE55yTFhPQAEcFz tJYsfLnkL9QQHAennTfhYcrJKr8MI+AH7eeQ00JJenNtaKVe9JFCyxuz7lfyaAS720X3 ths9PobJT+n4uUHlzA8PjvaewrcXUXvptnJHmKUDc4gA4a3RRgs2g6pvYM4ABYk/gE77 xJxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=5876/n9ZfSEIr27nM1bL5w/+dfwom2VZf0zWLQjZur0=; b=upd55RUAfDzUPt6CUx5sx8vthERgGgdpv0FdkBY6aJaNsFYwpL3YDh+Wj4gRVLueEe Suoxq9FQPbwgT0dwChwIdVkrWGtzPCGrymai9yp9+oeBapJ1dUQ9CAlff1NePp0rtFMf kvjXndPVTTTYXyKRspXZsdH1XlB+0QCg74JXLiwbWyvAf+I1xNr/U/Jg5ySqvc6M2EYH Z6hIl9/i21AW75NYPezBehBs8B6crpzOtoECQqgf1nKVE14rLQoX9zyTiqoe9aNDBG79 j2o9q3OowEycLNSX3YgRXmskKBnQnFdhlz8G4RM+KrkTWfsrjNNHwNxOqXunmLdT3WAi qr/w== 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 y34-v6si3207561pgk.479.2018.10.02.03.13.09; Tue, 02 Oct 2018 03:13:23 -0700 (PDT) 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 S1727044AbeJBQz2 (ORCPT + 99 others); Tue, 2 Oct 2018 12:55:28 -0400 Received: from terminus.zytor.com ([198.137.202.136]:43987 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbeJBQz2 (ORCPT ); Tue, 2 Oct 2018 12:55:28 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w92ACHum1916508 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 Oct 2018 03:12:17 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w92ACHqQ1916505; Tue, 2 Oct 2018 03:12:17 -0700 Date: Tue, 2 Oct 2018 03:12:17 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: "tip-bot for Paul E. McKenney" Message-ID: Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, eranian@google.com, acme@redhat.com, mingo@kernel.org, andrea.parri@amarulasolutions.com, jolsa@redhat.com, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, vincent.weaver@maine.edu, alexander.shishkin@linux.intel.com, hpa@zytor.com, peterz@infradead.org Reply-To: alexander.shishkin@linux.intel.com, hpa@zytor.com, vincent.weaver@maine.edu, peterz@infradead.org, paulmck@linux.vnet.ibm.com, tglx@linutronix.de, jolsa@redhat.com, andrea.parri@amarulasolutions.com, acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, eranian@google.com In-Reply-To: <20180926182920.27644-4-paulmck@linux.ibm.com> References: <20180926182920.27644-4-paulmck@linux.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] tools/memory-model: Add more LKMM limitations Git-Commit-ID: d8fa25c4efde0e5f31a427202e583d73d3f021c4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d8fa25c4efde0e5f31a427202e583d73d3f021c4 Gitweb: https://git.kernel.org/tip/d8fa25c4efde0e5f31a427202e583d73d3f021c4 Author: Paul E. McKenney AuthorDate: Wed, 26 Sep 2018 11:29:19 -0700 Committer: Ingo Molnar CommitDate: Tue, 2 Oct 2018 10:28:04 +0200 tools/memory-model: Add more LKMM limitations This commit adds more detail about compiler optimizations and not-yet-modeled Linux-kernel APIs. Signed-off-by: Paul E. McKenney Reviewed-by: Andrea Parri Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: akiyks@gmail.com Cc: boqun.feng@gmail.com Cc: dhowells@redhat.com Cc: j.alglave@ucl.ac.uk Cc: linux-arch@vger.kernel.org Cc: luc.maranget@inria.fr Cc: npiggin@gmail.com Cc: parri.andrea@gmail.com Cc: stern@rowland.harvard.edu Cc: will.deacon@arm.com Link: http://lkml.kernel.org/r/20180926182920.27644-4-paulmck@linux.ibm.com Signed-off-by: Ingo Molnar --- tools/memory-model/README | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tools/memory-model/README b/tools/memory-model/README index ee987ce20aae..acf9077cffaa 100644 --- a/tools/memory-model/README +++ b/tools/memory-model/README @@ -171,6 +171,12 @@ The Linux-kernel memory model has the following limitations: particular, the "THE PROGRAM ORDER RELATION: po AND po-loc" and "A WARNING" sections). + Note that this limitation in turn limits LKMM's ability to + accurately model address, control, and data dependencies. + For example, if the compiler can deduce the value of some variable + carrying a dependency, then the compiler can break that dependency + by substituting a constant of that value. + 2. Multiple access sizes for a single variable are not supported, and neither are misaligned or partially overlapping accesses. @@ -190,6 +196,36 @@ The Linux-kernel memory model has the following limitations: However, a substantial amount of support is provided for these operations, as shown in the linux-kernel.def file. + a. When rcu_assign_pointer() is passed NULL, the Linux + kernel provides no ordering, but LKMM models this + case as a store release. + + b. The "unless" RMW operations are not currently modeled: + atomic_long_add_unless(), atomic_add_unless(), + atomic_inc_unless_negative(), and + atomic_dec_unless_positive(). These can be emulated + in litmus tests, for example, by using atomic_cmpxchg(). + + c. The call_rcu() function is not modeled. It can be + emulated in litmus tests by adding another process that + invokes synchronize_rcu() and the body of the callback + function, with (for example) a release-acquire from + the site of the emulated call_rcu() to the beginning + of the additional process. + + d. The rcu_barrier() function is not modeled. It can be + emulated in litmus tests emulating call_rcu() via + (for example) a release-acquire from the end of each + additional call_rcu() process to the site of the + emulated rcu-barrier(). + + e. Sleepable RCU (SRCU) is not modeled. It can be + emulated, but perhaps not simply. + + f. Reader-writer locking is not modeled. It can be + emulated in litmus tests using atomic read-modify-write + operations. + The "herd7" tool has some additional limitations of its own, apart from the memory model: @@ -204,3 +240,6 @@ the memory model: Some of these limitations may be overcome in the future, but others are more likely to be addressed by incorporating the Linux-kernel memory model into other tools. + +Finally, please note that LKMM is subject to change as hardware, use cases, +and compilers evolve.