[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161125145512.GA4014@Boquns-MacBook-Pro.local>
Date: Fri, 25 Nov 2016 22:56:29 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Mark Rutland <mark.rutland@....com>,
Christian Borntraeger <borntraeger@...ibm.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
linux-kernel@...r.kernel.org, dave@...olabs.net, dbueso@...e.de,
dvyukov@...gle.com, jasowang@...hat.com, kvm@...r.kernel.org,
netdev@...r.kernel.org, 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 01:44:04PM +0100, Peter Zijlstra wrote:
> On Fri, Nov 25, 2016 at 01:40:44PM +0100, Peter Zijlstra wrote:
> > #define SINGLE_LOAD(x) \
> > {( \
> > compiletime_assert_atomic_type(typeof(x)); \
>
> Should be:
>
> compiletime_assert_atomic_type(x);
>
> > WARN_SINGLE_COPY_ALIGNMENT(&(x)); \
Do we need to worry about the side effect on x? Maybe
#define SINGLE_LOAD(x) \
({ \
typeof(x) *_____ptr; \
\
compiletime_assert_atomic_type(typeof(x)); \
\
_____ptr = &(x); \
\
WARN_SINGLE_COPY_ALIGNMENT(_____ptr); \
\
READ_ONCE(*_____ptr); \
})
Ditto for SINGLE_STORE()
Regards,
Boqun
> > READ_ONCE(x); \
> > })
> >
> > #define SINGLE_STORE(x, v) \
> > ({ \
> > compiletime_assert_atomic_type(typeof(x)); \
>
> idem
>
> > WARN_SINGLE_COPY_ALIGNMENT(&(x)); \
> > WRITE_ONCE(x, v); \
> > })
Powered by blists - more mailing lists