linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Hugh Dickins <hugh@veritas.com>,
	linux-arch@vger.kernel.org,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [patch 2/2] fix SMP data race in pagetable setup vs walking
Date: Tue, 13 May 2008 06:26:56 -0700	[thread overview]
Message-ID: <20080513132656.GB8738@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080513075532.GA19870@wotan.suse.de>

On Tue, May 13, 2008 at 09:55:32AM +0200, Nick Piggin wrote:
> Sorry for the delay, was busy or away from keyboard for various reasons...
> 
> On Tue, May 06, 2008 at 06:32:24AM -0700, Paul E. McKenney wrote:
> > On Tue, May 06, 2008 at 11:38:24AM +0200, Nick Piggin wrote:
> > > 
> > > I'm wondering about this... and the problem does not only exist in
> > > memory ordering situations, but also just when using a single loaded
> > > value in a lot of times.
> > > 
> > > I'd be slightly worried about requiring this of threaded code. Even
> > > the regular memory ordering bugs we even have in core mm code is kind of
> > > annoying (and it is by no means just this current bug).
> > > 
> > > Is it such an improvement to refetch a pointer versus spilling to stack?
> > > Can we just ask gcc for a -multithreading-for-dummies mode?
> > 
> > I have thus far not been successful on this one in the general case.
> > It would be nice to be able to tell gcc that you really mean it when
> > you assign to a local variable...
> 
> Yes, exactly...
> 
> > > In that case it isn't really an ordering issue between two variables,
> > > but an issue within a single variable. And I'm not exactly sure we want
> > > to go down the path of trying to handle this. At least it probably belongs
> > > in a different patch.
> > 
> > Well, I have seen this sort of thing in real life with gcc, so I can't say
> > that I agree...  I was quite surprised the first time around!
> 
> I didn't intend to suggest that you are incorrect, or that ACCESS_ONCE
> is not technically required for correctness. But I question whether it
> is better to try fixing this throughout our source code, or in gcc's.

And it turns out that there are some features being proposed for the
upcoming c++0x standard that would have this effect.  "Relaxed access to
atomic variables" covers the "ACCESS_ONCE" piece, and is in the current
working draft.  We are also proposing something that captures the ordering
constraints of rcu_dereference(), which prohibits the compiler from doing
things like value speculation based on future dereferences of the variable
in question ("dependency ordering").  This has been through several
stages of review, and hopefully will get into the working draft soon.

Those sufficiently masochistic to dig through standardese might be
interested in:

	http://open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2556.html

							Thanx, Paul

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-05-13 13:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05 11:20 [patch 1/2] read_barrier_depends fixlets Nick Piggin
2008-05-05 12:12 ` [patch 2/2] fix SMP data race in pagetable setup vs walking Nick Piggin
2008-05-05 14:35   ` Paul E. McKenney
2008-05-06  9:38     ` Nick Piggin
2008-05-06 13:32       ` Paul E. McKenney
2008-05-13  7:55         ` Nick Piggin
2008-05-13 13:26           ` Paul E. McKenney [this message]
2008-05-05 15:32   ` Linus Torvalds
2008-05-05 16:37     ` Hugh Dickins
2008-05-06  9:51     ` Nick Piggin
2008-05-06 14:53       ` Linus Torvalds
2008-05-06 19:11         ` Paul E. McKenney
2008-05-14  4:27           ` Nick Piggin
2008-05-13  8:01         ` Nick Piggin
2008-05-13 15:45           ` Linus Torvalds
2008-05-14  0:34             ` Nick Piggin
2008-05-14  0:55               ` Linus Torvalds
2008-05-14  1:18                 ` Nick Piggin
2008-05-14  4:35                 ` [patch 1/2] read_barrier_depends arch fixlets Nick Piggin
2008-05-14  4:37                   ` [patch 2/2] fix SMP data race in pagetable setup vs walking Nick Piggin
2008-05-14 13:26                   ` [patch 1/2] read_barrier_depends arch fixlets Paul E. McKenney
2008-05-05 16:57   ` [patch 2/2] fix SMP data race in pagetable setup vs walking Hugh Dickins
2008-05-06  9:52     ` Nick Piggin
2008-05-06  7:08   ` David Miller, Nick Piggin
2008-05-06  9:56     ` Nick Piggin
2008-05-05 14:27 ` [patch 1/2] read_barrier_depends fixlets Paul E. McKenney
2008-05-06  9:01   ` Nick Piggin
2008-05-06 14:06     ` Paul E. McKenney
2008-05-06 15:29 ` David Howells
2008-05-06 19:09   ` Paul E. McKenney
2008-05-13  8:05   ` Nick Piggin

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=20080513132656.GB8738@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=hugh@veritas.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).