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

Re: [Xen-devel] [PATCH v3 8/8] asm-x86/atomic.h: implement missing, add common prototypes



On 7/14/2016 12:44 PM, Andrew Cooper wrote:
On 14/07/16 10:39, Corneliu ZUZU wrote:
On 7/14/2016 12:29 PM, Andrew Cooper wrote:
On 14/07/16 10:14, Corneliu ZUZU wrote:
- implement missing functions atomic_{sub,inc,dec}_return(), atomic_add_unless()
  on X86 and also add prototypes for them in common <xen/atomic.h>

- add missing macro atomic_xchg for X86

Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

I'm not sure about atomic_sub_return(int i, atomic_t *v) implementation - is it ok? (calling arch_fetch_and_add(&v->counter, -i) with 2nd argument negative).

Looks ok to me.  Everything is signed integers in the internals.

There is a boundary condition when passing INT_MIN, but those exist elsewhere as well.

~Andrew

Thanks, thought so too - there should be no difference bit-wise when adding an unsigned int converted from an int vs adding the int directly.

Zuzu C.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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