Thread (34 messages) 34 messages, 9 authors, 2016-11-25

Re: [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE()

flat view

From: Mark Rutland <mark.rutland@arm.com>
Date: 2016-11-25 16:18:01
Also in: kvm, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help