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 Wed, 2014-10-29 at 19:18 +0100, Torvald Riegel wrote:
> Currently, x86 and x86_64 do not define any of the barriers.  The
> generic default for the barriers is that full barriers are just compiler
> barriers and read and write barriers default to using the full barrier
> definition.  On x86 and x86_64, however, only read/write barriers (ie,
> acquire and release fences in how glibc uses them) are just compiler
> barriers -- a full barrier needs an mfence instruction.  This patch
> defines atomic_full_barrier accordingly without making read/write
> barriers stronger than compiler barriers.
> 
> The only use of atomic_full_barrier on x86/x86_64 is in
> sysdeps/nptl/fork.c, but there, ISTM that this actually only needs an
> acquire barrier.  So, this patch doesn't fix existing bugs in *current*
> code, and only makes fork a tiny tiny bit slower.
> 
> Nonetheless, there are other uses of full barriers in generic code
> (e.g., semaphores).  Those don't apply for x86/x86_64 because we
> currently have arch-specific code for those, but would if we start using
> the generic code on x86 too (and we couldn't do until we fix the x86
> full barrier).
> 
>         * sysdeps/x86_64/bits/atomic.h: (atomic_full_barrier,
>         atomic_read_barrier, atomic_write_barrier): Define.
>         * sysdeps/i386/i486/bits/atomic.h (atomic_full_barrier,
>         atomic_read_barrier, atomic_write_barrier): Define.
> 
> 

Forgot to add the BZ to the Changelog:

	[BZ #17403]
	* sysdeps/x86_64/bits/atomic.h: (atomic_full_barrier,
	atomic_read_barrier, atomic_write_barrier): Define.
	* sysdeps/i386/i486/bits/atomic.h (atomic_full_barrier,
	atomic_read_barrier, atomic_write_barrier): Define.



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