From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764162AbdJQUS4 (ORCPT ); Tue, 17 Oct 2017 16:18:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59158 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753410AbdJQUSy (ORCPT ); Tue, 17 Oct 2017 16:18:54 -0400 Date: Tue, 17 Oct 2017 13:18:46 -0700 From: "Paul E. McKenney" To: Andrea Parri Cc: stern@rowland.harvard.edu, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, linux-kernel@vger.kernel.org Subject: Re: Linux-kernel examples for LKMM recipes Reply-To: paulmck@linux.vnet.ibm.com References: <20171011223229.GA31650@linux.vnet.ibm.com> <20171012132744.GA4818@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171012132744.GA4818@andrea> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17101720-0048-0000-0000-000001F7333C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007907; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000237; SDB=6.00932568; UDB=6.00469636; IPR=6.00712859; BA=6.00005643; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017579; XFM=3.00000015; UTC=2017-10-17 20:18:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101720-0049-0000-0000-000042E6F49F Message-Id: <20171017201846.GX3521@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-17_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710170287 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 12, 2017 at 03:27:44PM +0200, Andrea Parri wrote: > Hi Paul, > > On Wed, Oct 11, 2017 at 03:32:30PM -0700, Paul E. McKenney wrote: > > Hello! > > > > At Linux Plumbers Conference, we got requests for a recipes document, > > and a further request to point to actual code in the Linux kernel. > > I have pulled together some examples for various litmus-test families, > > as shown below. The decoder ring for the abbreviations (ISA2, LB, SB, > > MP, ...) is here: > > > > https://www.cl.cam.ac.uk/~pes20/ppc-supplemental/test6.pdf > > > > This document is also checked into the memory-models git archive: > > > > https://github.com/aparri/memory-model.git > > > > I would be especially interested in simpler examples in general, and > > of course any example at all for the cases where I was unable to find > > any. Thoughts? > > Below are some examples we did discuss (at some point): > > The comment in kernel/events/ring_buffer.c:perf_output_put_handle() > describes instances of MP+wmb+rmb and LB+ctrl+mb. I added this as an alternative for MP and as the example for LB. > The comments in kernel/sched/core.c:try_to_wake_up() describes more > instances of MP ("plus locking") and LB (see finish_lock_switch()). This one looks a bit more messy, so I will set it aside, for the moment, anyway. > The comment in kernel/sched/core.c:task_rq_lock() describes an ins- > tance of MP+wmb+addr-acqpo. This one also looks a bit messy, so I am setting it aside as well. > The comment in include/linux/wait.h:waitqueue_active() describes an > instance of SB+mb+mb. Very good, I took this as the generic pattern for the current pair of SB examples. > 63cae12bce986 ("perf/core: Fix sys_perf_event_open() vs. hotplug") > describes an instance of W+RWC+porel+mb+mb. Well, this one certainly is of historical interest. After all, it might well be the first Linux-kernel commit containing a litmus test. ;-) I put it in recipes-LKcode-63cae12bce986.txt and reference it from recipes-LKcode.txt. > [...] > > I wish we could say "any barrier (explicit or implicit) in sources > is accompanied by a comment mentioning the interested pattern...", > but life is not always this simple. ;-) Well, at least scripts/checkpatch.pl now complains if you try to add a new comment-free barrier. Not that these complaints are always paid attention to... Thanx, Paul