Received: by 10.223.176.5 with SMTP id f5csp1100330wra; Wed, 31 Jan 2018 01:06:00 -0800 (PST) X-Google-Smtp-Source: AH8x225UOw6fiESrA9vXpz80Qk25VC0ZRIB7kswWF78wd2xWxnQxWNUvsF1DjSHeHg7zjRwI/an8 X-Received: by 2002:a17:902:68ca:: with SMTP id x10-v6mr27251551plm.367.1517389560501; Wed, 31 Jan 2018 01:06:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517389560; cv=none; d=google.com; s=arc-20160816; b=AwAUrOIzp90kDbk/z0J0r7pao84UlGpL4HmqsuTLysL1/XZRMtubNW/IkkJqZX8F+P yYrtJB6FQjQt1pIE2l/xHEX2UsfGs0S2ZP012WvFNwvqVGdKUnELC6Lioc6ZolO3a4Mo /lthWplZSjx8w2l3vcNAe361FdRDLQtDHqYWwtLcTJ517gUqBAfer4/UMq6mmcJ+udjX mCubdZL/Pw7mkHZLptpXT5dyz/2OtB4okuivvgv4iiwclDK4PwB4TPYxQ07eUUVDyuY2 jDZ1aUUP5EL2mIiRtQkeSJDzLpp9Yy3Ja23y8YpNG6zXtAd+83VWGj7lDFwn96hgP+wt Yctg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ZwsR8h5vnUqSAEHfAfhaOPo5Y2leeuN1g3WsfF/0dfk=; b=YcRyBCWONR/0lhK5DW+PPkVmS8ycWsuV353OoeFr5tR6v5dcStbXBcm8UVKvkPdrrZ IbOtPOmiVQ1J0+GQocdpODwFHchnIYyL+oU1IzDVrgLP6NGzGXYjiTn8hMLqHLnD/1tj KPVMJSUk8UT3tYE7lMyomx1C089EQwCzXO4A/718IZ8jAVe2SZpU3tH0pGqQIedGyk9x GTR5RMnrWmVuBm8A4FM9J1OJP+PrFA4xtV9aB1L1/zZdXaOUDK/5enm7ivx5OZ6FKohm NusvcRrkCH+RSp5zsaPYGHDhK5zMIJ0mjIB1uCDLvO6q2BF9qBRzL5jzf4CLM4qn6kaF fpFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=cmiDhkRY; 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 3-v6si741366plv.727.2018.01.31.01.05.46; Wed, 31 Jan 2018 01:06:00 -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=fail header.i=@gmail.com header.s=20161025 header.b=cmiDhkRY; 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 S1753109AbeAaJAO (ORCPT + 99 others); Wed, 31 Jan 2018 04:00:14 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35911 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbeAaJAM (ORCPT ); Wed, 31 Jan 2018 04:00:12 -0500 Received: by mail-wr0-f195.google.com with SMTP id y3so4250363wrh.3; Wed, 31 Jan 2018 01:00:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZwsR8h5vnUqSAEHfAfhaOPo5Y2leeuN1g3WsfF/0dfk=; b=cmiDhkRYZr4LECkYGZZsSPnO6OSpgOd06jGPdBK0uohM4L9xaGcBjBt+p4VqHABb9G Mw1nWLRGN8R/74Cz9m9zfDFekTJM3XRvnNwuS/wf68b2NcfJpkhv5/RSC+nqqen1KVtc 0KJvIjzn5WC/AWPD7+z6Z5jFc4R6gmIuKiYckplot0y/CvGoFpITnO1uZDihSXVPcH3I w9rFSSBTBXjio5ACenAPZma0QL8Z/ynG/CPcZBlv1iM6QzUz712b7/Nmh0EYSBquuHrp SBbGykTQOBXEp9+t+xroPe8AW3kNHtHC/QEwwHVb3iQUn5iFbnJwMyV9Gh2J+oU9Fdsc lKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ZwsR8h5vnUqSAEHfAfhaOPo5Y2leeuN1g3WsfF/0dfk=; b=ZWwVBZZkXhB8sL2dsT/RrKRrlIQeECLuHcjlfbAxVFvfshSxFcJ/JsdAA8R21buZ7P 96kDV1R5MH1LvBJSGQ9bB/462s0K+PtbLBSx6eJxbR3EwaImLdbnZvPvsS/hRWrp+wkq YboQS/cXYdCV1OxbYJcUZ0j44bab8k701saRha5KBOATnDmBHGHt0e9MB9N85A2OayRH MSbK9nrfuUE6tfjqD2ZgsEDTgw4sfAg1emp4CRsLRCpCIaWqNkGSCKLn2ps3PQLgz0vd NhdkoOhHr/rMKy1mQ04Mxc2VKtffKfndzTcinx/a2a4MbX2tWlaSrQ74ZJ4r7dIDuqkm rzfg== X-Gm-Message-State: AKwxytcxNIpddPKJgfeJG4aaW6VkbKubEtUZKq7/d9/calTQ76OV0blE IMgTpMb2HdGFw5d/bOUGHHA= X-Received: by 10.223.182.165 with SMTP id j37mr13719351wre.85.1517389209728; Wed, 31 Jan 2018 01:00:09 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id z74sm16176639wmz.21.2018.01.31.01.00.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jan 2018 01:00:08 -0800 (PST) Date: Wed, 31 Jan 2018 10:00:06 +0100 From: Ingo Molnar To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, stern@rowland.harvard.edu, parri.andrea@gmail.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, boqun.feng@gmail.com, will.deacon@arm.com, peterz@infradead.org, npiggin@gmail.com, dhowells@redhat.com, elena.reshetova@intel.com, mhocko@suse.com, akiyks@gmail.com, Thomas Gleixner , Peter Zijlstra , Linus Torvalds Subject: Re: [GIT PULL tools] Linux kernel memory model Message-ID: <20180131090006.onaopgyqthppoysi@gmail.com> References: <20180125093440.GA875@linux.vnet.ibm.com> <20180129065724.ybrdsabvktq7fbqg@gmail.com> <20180129095449.GT3741@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180129095449.GT3741@linux.vnet.ibm.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Paul E. McKenney wrote: > On Mon, Jan 29, 2018 at 07:57:24AM +0100, Ingo Molnar wrote: > > > > hi Paul, > > > > * Paul E. McKenney wrote: > > > > > Hello, Ingo, > > > > > > This pull request contains a single commit that adds a memory model to > > > the tools directory. This memory model can (roughly speaking) be thought > > > of as an automated version of memory-barriers.txt. It is written in the > > > "cat" language, which is executable by the externally provided "herd7" > > > simulator, which exhaustively explores the state space of small litmus > > > tests. > > > > > > This memory model is accompanied by extensive documentation on its use > > > and its design. Two versions have been sent to LKML and feedback > > > incorporated: > > > > > > 1. http://lkml.kernel.org/r/20171113184031.GA26302@linux.vnet.ibm.com > > > 2. http://lkml.kernel.org/r/20180119035855.GA29296@linux.vnet.ibm.com > > > > > > This model has been presented and demoed at a number of Linux gatherings, > > > including the 2016 LinuxCon EU, the 2016 Linux Plumbers Conference, > > > the 2016 Linux Kernel Summit, the 2017 linux.conf.au, and the 2017 Linux > > > Plumbers Conference, which featured a workshop helping a number of Linux > > > kernel hackers install and use the tool. > > > > > > This memory model has matured to the point where it would be good to include > > > it in the Linux kernel, for example, to allow it to track changes as new > > > hardware and use cases are added. We expect the rate of change to be similar > > > to that of Documentation/memory-barriers.txt. > > > > > > This memory model is available in the git repository at: > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > > > > > > for you to fetch changes up to 1c27b644c0fdbc61e113b8faee14baeb8df32486: > > > > > > Automate memory-barriers.txt; provide Linux-kernel memory model (2018-01-24 20:53:49 -0800) > > > > Looks good to me, but the commit is not in the master branch of your tree, which > > branch should I pull? > > Oops!!! The branch is lkmm-for-mingo. > > Please accept my apologies for the implicit maintainer treasure hunt! No problem, was able to pull it! I really like this formal description of of the Linux kernel memory coherency model and the extensive documentation around it. Clearly a lot of effort went into this work! A couple of questions: - Would it be possible to include all the nice descriptions of the litmus tests in the tests themselves? Right now it's a bit weird that most of them come with zero explanations, but the tools/memory-model/litmus-tests/README lists most of them. - Similary, some of the high level descriptions in tools/memory-model/README should probably propagated into the source code files as well: for example both tools/memory-model/lock.cat and linux-kernel.cat could be improved that way. - Could tools/memory-model/MAINTAINERS be added to the main Linux MAINTAINERS file as well, like we do for other bits of tooling? - There's no description about why the .bell file is called 'bell' and what language/syntax it is in - I had to search around to figure out that it's a "Bell extension" to .cat files. This aspect IMHO isn't really obvious to first time readers so a bit more explanation would be nice. - A high level question: have you considered calling it the "Linux kernel memory coherency model", instead of the "Linux memory model"? Another naming would be the "Linux kernel memory access model" as memory-barriers.txt calls it. The "memory model" name is overly generic, ambiguous and somewhat misleading, as we usually mean the virtual memory layout/model when we say "memory model". GCC too uses it in that sense: 'small memory model' and 'large memory model' - which too is about VM layout, not multiprocessing coherency. - A long term question: have you considered and would it make sense to generate a memory-barriers.txt like file directly into Documentation/locking/, using the formal description? That way any changes/extensions/fixes to the model could be tracked on a high level, without readers having to understand the formal representation. In any case, the base commit is certainly nice and clean and I've pulled it into tip:locking/core for a v4.17 merge. I believe these additional improvements (to the extent you agree with doing them!) could/should be done as add-on commits on top of this existing commit. Thanks, Ingo