Re: [PATCH 13/13] rcutorture: formal: prepare for ACCESS_ONCE() removal

From: Mark Rutland
Date: Tue Oct 10 2017 - 05:56:17 EST


On Mon, Oct 09, 2017 at 12:51:12PM -0700, Paul E. McKenney wrote:
> On Mon, Oct 09, 2017 at 07:28:50PM +0100, Mark Rutland wrote:
> > diff --git a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h
> > index 6687acc..ee4e4f8 100644
> > --- a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h
> > +++ b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h
> > @@ -34,8 +34,9 @@
> > #define rs_smp_mb() do {} while (0)
> > #endif
> >
> > -#define ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x))
> > -#define READ_ONCE(x) ACCESS_ONCE(x)
> > -#define WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val))
> > +#define __ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x))
> > +#define ACCESS_ONCE(x) __ACCESS_ONCE(x)
> > +#define READ_ONCE(x) __ACCESS_ONCE(x)
> > +#define WRITE_ONCE(x, val) (__ACCESS_ONCE(x) = (val))
>
> How about something like the following?
>
> #define READ_ONCE(x) (*(volatile typeof(x) *) &(x))
> #define WRITE_ONCE(x) ((*(volatile typeof(x) *) &(x)) = (val))

Sure; folded in and pushed out. :)

I've assumed that the ACCESS_ONCE() definition needs to be kept until
that's ripped out treewide. Please shout if that's not the case!

Thanks,
Mark.