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

Re: [Xen-devel] [PATCHv4 2/5] arm: provide add_sized()



On 11/05/15 15:37, David Vrabel wrote:
> add_sized(ptr, inc) adds inc to the value at ptr using only the correct
> size of loads and stores for the type of *ptr.  The add is /not/ atomic.
> 
> This is needed for ticket locks to ensure the increment of the head ticket
> does not affect the tail ticket.
[...]
>  
> +#define add_sized(p, x) ({                                              \
> +    typeof(*p) __x = (x);                                               \
> +    switch ( sizeof(*p) )                                               \
> +    {                                                                   \
> +    case 1: add_u8_sized((uint8_t *)p, (uint8_t)__x); break;            \
> +    case 2: add_u16_sized((uint16_t *)p, (uint16_t)__x); break;         \
> +    case 4: add_u32_sized((uint32_t *)p, (uint32_t)__x); break;         \
> +    default: __bad_atomic_size(); break;                                \
> +    }                                                                   \
> +    __x;                                                                \

I should have cleaned up this arm implementation in the same way I did
x86.  Please drop this "__x;" before committing, or I can resubmit if it
is preferred.

Sorry.

David

_______________________________________________
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®.