[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200901052300.24951.nickpiggin@yahoo.com.au>
Date: Mon, 5 Jan 2009 23:00:24 +1100
From: Nick Piggin <nickpiggin@...oo.com.au>
To: Alan Cox <alan@...rguk.ukuu.org.uk>, paulmck@...ibm.com
Cc: Pavel Machek <pavel@...e.cz>,
kernel list <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...l.org>, mtk.manpages@...il.com,
rdunlap@...otime.net, linux-doc@...r.kernel.org
Subject: Re: atomics: document that linux expects certain atomic behaviour from unsigned long
On Monday 05 January 2009 22:23:50 Alan Cox wrote:
> > Pretty much everywhere that uses RCU for example does so using atomic
> > pointer loads and stores. The nastiest issue IMO actually is reloading
> > the value through the pointer even if it isn't explicitly dereferenced.
> > RCU gets this right with ACCESS_ONCE. Probably a lot of code using basic
> > types does not. x86 atomic_read maybe should be using ACCESS_ONCE too...
>
> I'm pretty sure it should. gcc makes no guarantees about not being clever
> with accesses.
Arguably it should. I don't know what the concurrent C standard looks like,
but prohibiting reloads of potentially concurrently modified memory when
there is no explicit pointer dereference is the natural complement to
prohibiting stores to potentially concurrently read memory when there is
no explicit store (which I think is begrudgingly agreed to be a problem).
http://lkml.org/lkml/2007/10/24/673
I think I would like to see multiple reloads to local variables prohibited,
to avoid potential really subtle problems... But if ACCESS_ONCE is here to
stay, then I do think that atomic_read etc should use it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists