Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2015-01-15 Thread Julien Grall
Hi, On 17/12/14 17:52, Andrew Cooper wrote: > On 17/12/14 17:10, Jan Beulich wrote: > Julien Grall 12/17/14 1:55 PM >>> >>> On 17/12/14 10:05, Jan Beulich wrote: >> On 16.12.14 at 21:08, wrote: > +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) Any reason not to simply use

Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-18 Thread Julien Grall
Hi Andrew Cooper, On 17/12/2014 17:52, Andrew Cooper wrote: On 17/12/14 17:10, Jan Beulich wrote: Julien Grall 12/17/14 1:55 PM >>> On 17/12/14 10:05, Jan Beulich wrote: On 16.12.14 at 21:08, wrote: +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) Any reason not to simply use {read,w

Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-18 Thread Julien Grall
Hi Andrew, On 17/12/2014 17:52, Andrew Cooper wrote: On 17/12/14 17:10, Jan Beulich wrote: Julien Grall 12/17/14 1:55 PM >>> On 17/12/14 10:05, Jan Beulich wrote: On 16.12.14 at 21:08, wrote: +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) Any reason not to simply use {read,write}_a

Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-17 Thread Andrew Cooper
On 17/12/14 17:10, Jan Beulich wrote: Julien Grall 12/17/14 1:55 PM >>> >> On 17/12/14 10:05, Jan Beulich wrote: > On 16.12.14 at 21:08, wrote: +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) >>> Any reason not to simply use {read,write}_atomic() instead, which we >>> already

Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-17 Thread Jan Beulich
>>> Julien Grall 12/17/14 1:55 PM >>> >On 17/12/14 10:05, Jan Beulich wrote: On 16.12.14 at 21:08, wrote: >>> +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) >> >> Any reason not to simply use {read,write}_atomic() instead, which we >> already have? > >To avoid modifying Linux drivers

Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-17 Thread Julien Grall
Hi Jan, On 17/12/14 10:05, Jan Beulich wrote: On 16.12.14 at 21:08, wrote: >> --- a/xen/include/xen/compiler.h >> +++ b/xen/include/xen/compiler.h >> @@ -90,4 +90,18 @@ >> __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ >> (typeof(ptr)) (__ptr + (off)); }) >> >> +/* >> + * Prevent

Re: [Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-17 Thread Jan Beulich
>>> On 16.12.14 at 21:08, wrote: > --- a/xen/include/xen/compiler.h > +++ b/xen/include/xen/compiler.h > @@ -90,4 +90,18 @@ > __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ > (typeof(ptr)) (__ptr + (off)); }) > > +/* > + * Prevent the compiler from merging or refetching accesses. The c

[Xen-devel] [PATCH for 4.6 03/13] xen: Introduce ACCESS_ONCE macro

2014-12-16 Thread Julien Grall
This macro can be used in drivers imported from Linux. Signed-off-by: Julien Grall CC: Ian Jackson CC: Jan Beulich CC: Keir Fraser --- xen/include/xen/compiler.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index 4