git: 987c5a194418 - main - arm: Implement atomic_testandset_acq_long as a simple wrapper
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Nov 2024 15:28:42 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=987c5a1944183cf82884fdb96b0432bd810aa8b9 commit 987c5a1944183cf82884fdb96b0432bd810aa8b9 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-11-19 15:22:50 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-11-19 15:22:50 +0000 arm: Implement atomic_testandset_acq_long as a simple wrapper Use a memory barrier after calling the existing atomic_testandset_long rather than using the fcmpset-based fallback version from <sys/_atomic_subword.h>. Reviewed by: kib Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47628 --- sys/arm/include/atomic.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index cd6f5cf90d8a..c9232a4f97ef 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -954,6 +954,17 @@ atomic_testandset_long(volatile u_long *p, u_int v) } #define atomic_testandset_long atomic_testandset_long +static __inline int +atomic_testandset_acq_long(volatile u_long *p, u_int v) +{ + int ret; + + ret = atomic_testandset_32((volatile uint32_t *)p, v); + dmb(); + return (ret); +} +#define atomic_testandset_acq_long atomic_testandset_acq_long + static __inline int atomic_testandset_64(volatile uint64_t *p, u_int v) { @@ -1098,7 +1109,6 @@ atomic_thread_fence_seq_cst(void) * For: * - atomic_load_acq_8 * - atomic_load_acq_16 - * - atomic_testandset_acq_long */ #include <sys/_atomic_subword.h>