[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v8 02/17] Add cmpxchg16b support for x86-64
>>> On 12.10.15 at 10:54, <feng.wu@xxxxxxxxx> wrote: > --- a/xen/include/asm-x86/x86_64/system.h > +++ b/xen/include/asm-x86/x86_64/system.h > @@ -6,6 +6,39 @@ > (unsigned long)(n),sizeof(*(ptr)))) > > /* > + * Atomic 16 bytes compare and exchange. Compare OLD with MEM, if > + * identical, store NEW in MEM. Return the initial value in MEM. > + * Success is indicated by comparing RETURN with OLD. > + * > + * This function can only be called when cpu_has_cx16 is true. > + */ > + > +static always_inline __uint128_t __cmpxchg16b( > + volatile void *ptr, const __uint128_t *old, const __uint128_t *new) > +{ > + __uint128_t prev; > + uint64_t new_high = *new >> 64; > + uint64_t new_low = *new; > + > + ASSERT(cpu_has_cx16); > + > + asm volatile ( "lock; cmpxchg16b %3" > + : "=A" (prev) > + : "c" (new_high), "b" (new_low), > + "m" (*__xg(ptr)), "0" (*old) ); I was about to apply this when I spotted that this is still wrong: The (requested) removal of the memory clobber requires that the memory location (all 16 bytes of it) appear as output. With __xg() covering 100 bytes, it should be possible to simply make the operand an in- and output ("+m") instead of just an input. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |