]> git.ipfire.org Git - thirdparty/glibc.git/commit
atomic: Consolidate atomic_full_barrier implementation
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 11 Sep 2025 13:49:44 +0000 (10:49 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 4 Nov 2025 07:14:01 +0000 (04:14 -0300)
commit70ee250fb8b1ea870d5d7e2e7fdf4ea7850efa11
treea97fa309d9d8c3e7c9c0144326898c462f6a9c77
parentc79730323706637468d10ef8515cd3447d2a0d06
atomic: Consolidate atomic_full_barrier implementation

All ABIs save for sparcv9 and s390 defines it to __sync_synchronize,
which can be mapped to __atomic_thread_fence (__ATOMIC_SEQ_CST).

For Sparc, it uses a stricter #StoreStore|#LoadStore|#StoreLoad|#LoadLoad
instead of the #StoreLoad generated by __sync_synchronize.

For s390x, it defaults to a memory barrier where __sync_synchronize
emits a 'bcr 15,0' (which the manual describes as pipeline synchronization).

The barrier is used only in one place (pthread_mutex_setprioceiling),
and using a stricter barrier for s390 is ok performance-wise.

Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
14 files changed:
include/atomic.h
sysdeps/aarch64/atomic-machine.h
sysdeps/alpha/atomic-machine.h
sysdeps/arc/atomic-machine.h
sysdeps/arm/atomic-machine.h
sysdeps/generic/malloc-machine.h
sysdeps/hppa/atomic-machine.h
sysdeps/loongarch/atomic-machine.h
sysdeps/mips/atomic-machine.h
sysdeps/mips/sys/asm.h
sysdeps/or1k/atomic-machine.h
sysdeps/powerpc/atomic-machine.h
sysdeps/riscv/atomic-machine.h
sysdeps/x86/atomic-machine.h