[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v7 02/17] Add cmpxchg16b support for x86-64




> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: Tuesday, September 22, 2015 9:51 PM
> To: Wu, Feng
> Cc: Andrew Cooper; xen-devel@xxxxxxxxxxxxx; Keir Fraser
> Subject: Re: [PATCH v7 02/17] Add cmpxchg16b support for x86-64
> > +#define cmpxchg16b(ptr,o,n)
> \
> > +    ( ({ ASSERT(((unsigned long)ptr & 0xF) == 0); }),                  \
> > +      (BUILD_BUG_ON(sizeof(*o) != sizeof(__uint128_t))),
> \
> > +      (BUILD_BUG_ON(sizeof(*n) != sizeof(__uint128_t))),
> \
> > +      (__cmpxchg16b((ptr), (void *)(o), (void *)(n))) )
> 
> Sigh - this is _still_ not properly parenthesized, and evaluates ptr
> twice:
> 
> #define cmpxchg16b(ptr, o, n) ({                       \
>     volatile void *_p = (ptr);                         \
>     ASSERT(!((unsigned long)_p & 0xf));                \
>     BUILD_BUG_ON(sizeof(*(o)) != sizeof(__uint128_t)); \
>     BUILD_BUG_ON(sizeof(*(n)) != sizeof(__uint128_t)); \
>     __cmpxchg16b(_p, (void *)(o), (void *)(n));        \
> })

Thanks a lot for the review!

Thanks,
Feng

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.