[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161125161004.GA30181@leverpostej>
Date: Fri, 25 Nov 2016 16:10:04 +0000
From: Mark Rutland <mark.rutland@....com>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Boqun Feng <boqun.feng@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Christian Borntraeger <borntraeger@...ibm.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Davidlohr Bueso <dave@...olabs.net>, dbueso@...e.de,
jasowang@...hat.com, KVM list <kvm@...r.kernel.org>,
netdev <netdev@...r.kernel.org>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
virtualization@...ts.linux-foundation.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE()
On Fri, Nov 25, 2016 at 04:21:39PM +0100, Dmitry Vyukov wrote:
>
> READ/WRITE_ONCE imply atomicity. Even if their names don't spell it (a
> function name doesn't have to spell all of its guarantees). Most of
> the uses of READ/WRITE_ONCE will be broken if they are not atomic.
In practice, this is certainly the assumption made by many/most users of
the *_ONCE() accessors.
Looking again, Linus does seem to agree that word-sized accesses should
result in single instructions (and be single-copy atomic) [1], so in
contrast to [2], that's clearly *part* of the point of the *_ONCE()
accessors...
> "Read once but not necessary atomically" is a very subtle primitive
> which is very easy to misuse.
I agree. Unfortunately, Linus does not appear to [2].
> What are use cases for such primitive that won't be OK with "read once
> _and_ atomically"?
I have none to hand.
Thanks,
Mark.
[1] http://lkml.iu.edu/hypermail/linux/kernel/1503.3/02674.html
[2] http://lkml.iu.edu/hypermail/linux/kernel/1503.3/02670.html
Powered by blists - more mailing lists