All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Parri <andrea.parri@amarulasolutions.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: LKMM Maintainers -- Akira Yokosawa <akiyks@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Daniel Lustig <dlustig@nvidia.com>,
	David Howells <dhowells@redhat.com>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	Luc Maranget <luc.maranget@inria.fr>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will.deacon@arm.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] tools: memory-model: Improve data-race detection
Date: Fri, 21 Jun 2019 10:41:29 +0200	[thread overview]
Message-ID: <20190621084129.GA6827@andrea> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1906201153470.1512-100000@iolanthe.rowland.org>

On Thu, Jun 20, 2019 at 11:55:58AM -0400, Alan Stern wrote:
> Herbert Xu recently reported a problem concerning RCU and compiler
> barriers.  In the course of discussing the problem, he put forth a
> litmus test which illustrated a serious defect in the Linux Kernel
> Memory Model's data-race-detection code.
> 
> The defect was that the LKMM assumed visibility and executes-before
> ordering of plain accesses had to be mediated by marked accesses.  In
> Herbert's litmus test this wasn't so, and the LKMM claimed the litmus
> test was allowed and contained a data race although neither is true.
> 
> In fact, plain accesses can be ordered by fences even in the absence
> of marked accesses.  In most cases this doesn't matter, because most
> fences only order accesses within a single thread.  But the rcu-fence
> relation is different; it can order (and induce visibility between)
> accesses in different threads -- events which otherwise might be
> concurrent.  This makes it relevant to data-race detection.
> 
> This patch makes two changes to the memory model to incorporate the
> new insight:
> 
> 	If a store is separated by a fence from another access,
> 	the store is necessarily visible to the other access (as
> 	reflected in the ww-vis and wr-vis relations).  Similarly,
> 	if a load is separated by a fence from another access then
> 	the load necessarily executes before the other access (as
> 	reflected in the rw-xbstar relation).
> 
> 	If a store is separated by a strong fence from a marked access
> 	then it is necessarily visible to any access that executes
> 	after the marked access (as reflected in the ww-vis and wr-vis
> 	relations).
> 
> With these changes, the LKMM gives the desired result for Herbert's
> litmus test and other related ones.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Reported-by: Herbert Xu <herbert@gondor.apana.org.au>

For the entire series:

Acked-by: Andrea Parri <andrea.parri@amarulasolutions.com>

Two nits, but up to Paul AFAIAC:

 - This is a first time for "tools: memory-model:" in Subject; we were
   kind of converging to "tools/memory-model:"...

 - The report preceded the patch; we might as well reflect this in the
   order of the tags.

Thanks,

  Andrea

  reply	other threads:[~2019-06-21  8:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 15:55 [PATCH 3/3] tools: memory-model: Improve data-race detection Alan Stern
2019-06-21  8:41 ` Andrea Parri [this message]
2019-06-21 14:25   ` Alan Stern
2019-06-21 23:54     ` Paul E. McKenney
2019-06-23  9:37       ` Akira Yokosawa
2019-06-23 15:15         ` Alan Stern
2019-06-24  4:34           ` Paul E. McKenney
2019-06-24 15:21             ` Paul E. McKenney
2019-06-24 15:39               ` Alan Stern
2019-06-24 16:18                 ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190621084129.GA6827@andrea \
    --to=andrea.parri@amarulasolutions.com \
    --cc=akiyks@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=j.alglave@ucl.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=paulmck@linux.ibm.com \
    --cc=peterz@infradead.org \
    --cc=stern@rowland.harvard.edu \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.