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

Re: [Xen-devel] [PATCH] ia64: introduce atomic_{read,write}NN()



Hi Jan,

Excuse me for too late response. Thank you for your work.
But I have a question.

>>>>> On Fri, 11 Nov 2011 16:09:25 +0000
>>>>> JBeulich@xxxxxxxx("Jan Beulich")  said:
> 
> +#define build_atomic_read(tag, type) \
> +static inline type atomic_read##tag(const volatile type *addr) \
> +{ \
> +     type ret; \
> +     asm volatile("ld%2.acq %0 = %1" \
> +                  : "=r" (ret) \
> +                  : "m" (*addr), "i" (sizeof(type))); \
> +     return ret; \
> +}
> +
> +#define build_atomic_write(tag, type) \
> +static inline void atomic_write##tag(volatile type *addr, type val) \
> +{ \
> +     asm volatile("st%2.rel %0 = %1" \
> +                  : "=m" (*addr) \
> +                  : "r" (val), "i" (sizeof(type))); \
> +}

Why do you use explicitly ld.acq and st.rel?
I think that volatile variables are always accessed using ld.acq and
st.rel and they are not required.
For example, The implementation of Linux is as follows:

#define atomic_read(v)          (*(volatile int *)&(v)->counter)
#define atomic64_read(v)        (*(volatile long *)&(v)->counter)

Best regards,
-- 
  KUWAMURA Shin'ya

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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