From: Mark Rutland <mark.rutland@arm.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Boqun Feng <boqun.feng@gmail.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
dbueso@suse.de, jasowang@redhat.com,
KVM list <kvm@vger.kernel.org>, netdev <netdev@vger.kernel.org>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
virtualization@lists.linux-foundation.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE()
Date: Fri, 25 Nov 2016 17:43:00 +0000 [thread overview]
Message-ID: <20161125174259.GB30811@leverpostej> (raw)
In-Reply-To: <CACT4Y+YJUUjU_FCR1FOcF2DmkkcjiRFpnU7Q4=yzbgvKv0VhyQ@mail.gmail.com>
On Fri, Nov 25, 2016 at 06:28:53PM +0100, Dmitry Vyukov wrote:
> On Fri, Nov 25, 2016 at 5:17 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> >> > What are use cases for such primitive that won't be OK with "read once
> >> > _and_ atomically"?
> >>
> >> I have none to hand.
> >
> > Whatever triggers the __builtin_memcpy() paths, and even the size==8
> > paths on 32bit.
> >
> > You could put a WARN in there to easily find them.
> >
> > The advantage of introducing the SINGLE_{LOAD,STORE}() helpers is that
> > they compiletime validate this the size is 'right' and can runtime check
> > alignment constraints.
> >
> > IE, they are strictly stronger than {READ,WRITE}_ONCE().
>
> Uh, so, READ/WRITE_ONCE are non-atomic now. I missed that.
Yes, but *only* for types larger than word size. That has *always* been
the case.
It's still assumed that *_ONCE are single-copy-atomic for word size (or
smaller). Some architectures may also provide that guarnatee for
accesses larger than word size (e.g. 32-bit ARM w/ LPAE).
... It's just that as things stand we can't put checks in *_ONCE() for
the access size, since they're *also* used for larger accesses that
don't need atomicity.
> If READ/WRITE_ONCE are non-atomic, half of kernel is broken. All these
> loads of flags, ringbuffer positions, pointers, etc are broken.
Most of these will be fine, as above.
> What about restoring READ/WRITE_ONCE as atomic, and introducing
> separate primitives for _non_ atomic loads/stores?
Having a separate *_ONCE_TEARABLE() would certainly limit the number of
things we have to fix up, and would also make it clear that atomicity is
not expected.
... but we might have to go with SINGLE_*() if we can't convince Linus.
Thanks,
Mark.
next prev parent reply other threads:[~2016-11-25 17:43 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 10:25 [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE() Mark Rutland
2016-11-24 10:25 ` [PATCH 1/3] tools/virtio: fix READ_ONCE() Mark Rutland
2016-11-24 11:34 ` Cornelia Huck
2016-11-25 2:38 ` Jason Wang
2016-11-24 10:25 ` [PATCH 2/3] vringh: kill off ACCESS_ONCE() Mark Rutland
2016-11-24 11:10 ` Christian Borntraeger
2016-11-24 11:35 ` Cornelia Huck
2016-11-25 2:40 ` Jason Wang
2016-11-24 10:25 ` [PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h Mark Rutland
2016-11-24 11:37 ` Cornelia Huck
2016-11-25 2:40 ` Jason Wang
2016-11-24 20:36 ` [PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE() Michael S. Tsirkin
2016-11-25 11:22 ` Mark Rutland
2016-11-25 11:33 ` Christian Borntraeger
2016-11-25 12:23 ` Mark Rutland
2016-11-25 12:40 ` Peter Zijlstra
2016-11-25 12:44 ` Peter Zijlstra
2016-11-25 14:56 ` Boqun Feng
2016-11-25 15:21 ` Dmitry Vyukov
2016-11-25 16:10 ` Mark Rutland
2016-11-25 16:17 ` Peter Zijlstra
2016-11-25 16:32 ` Mark Rutland
2016-11-25 16:49 ` Christian Borntraeger
2016-11-25 17:28 ` Mark Rutland
2016-11-25 17:42 ` Peter Zijlstra
2016-11-25 18:46 ` Christian Borntraeger
2016-11-25 21:08 ` Michael S. Tsirkin
2016-11-25 21:45 ` Christian Borntraeger
2016-11-25 17:28 ` Dmitry Vyukov
2016-11-25 17:43 ` Mark Rutland [this message]
2016-11-25 17:52 ` Linus Torvalds
2016-11-25 18:07 ` Mark Rutland
2016-11-25 18:47 ` Linus Torvalds
2016-11-25 14:35 ` Mark Rutland
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=20161125174259.GB30811@leverpostej \
--to=mark.rutland@arm.com \
--cc=boqun.feng@gmail.com \
--cc=borntraeger@de.ibm.com \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=dvyukov@google.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=virtualization@lists.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