This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix atomic_full_barrier on x86 and x86_64.


On 25 Nov 2014 11:51, Torvald Riegel wrote:
> --- a/sysdeps/i386/i486/bits/atomic.h
> +++ b/sysdeps/i386/i486/bits/atomic.h
> @@ -535,3 +535,12 @@ typedef uintmax_t uatomic_max_t;
>  #define atomic_or(mem, mask) __arch_or_body (LOCK_PREFIX, mem, mask)
>  
>  #define catomic_or(mem, mask) __arch_or_body (__arch_cprefix, mem, mask)
> +
> +#ifdef __SSE2__
> +# define atomic_full_barrier() __asm ("mfence" ::: "memory")
> +#else
> +# define atomic_full_barrier() \
> +    __asm __volatile (LOCK_PREFIX "orl $0, (%%esp)" ::: "memory")
> +#endif

so this will kick in only when glibc itself is compiled with -msse2/etc...
support.  then again, these barriers only get used by glibc internal code,
so i guess this is the best answer.  plus it only impacts x86, and it's not
like anyone really cares about that anymore ;).

lgtm
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]