Date: Tue, 19 Nov 2024 15:28:43 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: fa2091d7571f - main - atomic(9): Remove fcmpset-based fallback for atomic_testand(clear|set) Message-ID: <202411191528.4AJFShhJ041302@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fa2091d7571ffbae82dfc828f554745f283adeb0 commit fa2091d7571ffbae82dfc828f554745f283adeb0 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-11-19 15:23:15 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-11-19 15:23:15 +0000 atomic(9): Remove fcmpset-based fallback for atomic_testand(clear|set) All architectures implement a MD version Reviewed by: kib Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47629 --- sys/arm/include/atomic.h | 4 --- sys/powerpc/include/atomic.h | 6 ----- sys/sys/_atomic_subword.h | 64 -------------------------------------------- 3 files changed, 74 deletions(-) diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index c9232a4f97ef..1fef40aea2e8 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -892,8 +892,6 @@ atomic_testandclear_long(volatile u_long *p, u_int v) return (atomic_testandclear_32((volatile uint32_t *)p, v)); } -#define atomic_testandclear_long atomic_testandclear_long - static __inline int atomic_testandclear_64(volatile uint64_t *p, u_int v) @@ -952,7 +950,6 @@ atomic_testandset_long(volatile u_long *p, u_int v) return (atomic_testandset_32((volatile uint32_t *)p, v)); } -#define atomic_testandset_long atomic_testandset_long static __inline int atomic_testandset_acq_long(volatile u_long *p, u_int v) @@ -963,7 +960,6 @@ atomic_testandset_acq_long(volatile u_long *p, u_int 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) diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h index 77ee5d8c6d46..47fd9ce30fd6 100644 --- a/sys/powerpc/include/atomic.h +++ b/sys/powerpc/include/atomic.h @@ -1093,12 +1093,6 @@ atomic_testandset_acq_long(volatile u_long *p, u_int v) return (a); } -#define atomic_testandclear_int atomic_testandclear_int -#define atomic_testandset_int atomic_testandset_int -#define atomic_testandclear_long atomic_testandclear_long -#define atomic_testandset_long atomic_testandset_long -#define atomic_testandset_acq_long atomic_testandset_acq_long - static __inline void atomic_thread_fence_acq(void) { diff --git a/sys/sys/_atomic_subword.h b/sys/sys/_atomic_subword.h index dc1b2f23e731..dad23383f642 100644 --- a/sys/sys/_atomic_subword.h +++ b/sys/sys/_atomic_subword.h @@ -205,68 +205,4 @@ atomic_load_acq_16(volatile uint16_t *p) #undef _ATOMIC_BYTE_SHIFT #undef _ATOMIC_HWORD_SHIFT -/* - * Provide generic testandset_long implementation based on fcmpset long - * primitive. It may not be ideal for any given arch, so machine/atomic.h - * should define the macro atomic_testandset_long to override with an - * MD-specific version. - * - * (Organizationally, this isn't really subword atomics. But atomic_common is - * included too early in machine/atomic.h, so it isn't a good place for derived - * primitives like this.) - */ -#ifndef atomic_testandset_acq_long -static __inline int -atomic_testandset_acq_long(volatile u_long *p, u_int v) -{ - u_long bit, old; - bool ret; - - bit = (1ul << (v % (sizeof(*p) * NBBY))); - - old = atomic_load_acq_long(p); - ret = false; - while (!ret && (old & bit) == 0) - ret = atomic_fcmpset_acq_long(p, &old, old | bit); - - return (!ret); -} -#endif - -#ifndef atomic_testandset_long -static __inline int -atomic_testandset_long(volatile u_long *p, u_int v) -{ - u_long bit, old; - bool ret; - - bit = (1ul << (v % (sizeof(*p) * NBBY))); - - old = atomic_load_long(p); - ret = false; - while (!ret && (old & bit) == 0) - ret = atomic_fcmpset_long(p, &old, old | bit); - - return (!ret); -} -#endif - -#ifndef atomic_testandclear_long -static __inline int -atomic_testandclear_long(volatile u_long *p, u_int v) -{ - u_long bit, old; - bool ret; - - bit = (1ul << (v % (sizeof(*p) * NBBY))); - - old = atomic_load_long(p); - ret = false; - while (!ret && (old & bit) != 0) - ret = atomic_fcmpset_long(p, &old, old & ~bit); - - return (ret); -} -#endif - #endif /* _SYS__ATOMIC_SUBWORD_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411191528.4AJFShhJ041302>