From nobody Tue Dec 21 13:06:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DCC1618F480F; Tue, 21 Dec 2021 13:06:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JJGtl6RhPz3GPn; Tue, 21 Dec 2021 13:06:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B68E220C2; Tue, 21 Dec 2021 13:06:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BLD6dku087261; Tue, 21 Dec 2021 13:06:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BLD6dN4087260; Tue, 21 Dec 2021 13:06:39 GMT (envelope-from git) Date: Tue, 21 Dec 2021 13:06:39 GMT Message-Id: <202112211306.1BLD6dN4087260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 02c16e2174ba - main - Add atomic_testandset_acq_* on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02c16e2174baa756997600a8139f19f218da0a8f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640092000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HlLu3eoBT+HzBfTOb1eMQgoH9ESoC2odgxJ32HDgEp4=; b=afVdWOfFcbags05FyASZa7CbP9ZqXU1aYIjBggH8tvu1nNOSzV2lDODT2rSSB/+5y9q6A5 5fBaeePqEUXmMrhRiolbmqZ1uWiJjHFibZrMyWimzlNUAzi/YcKgNjGe8iuK3IebguF9Xg CZ4F30tO2iTicLlo73w3gsrHfYs20bugIOHx3j6ydFqRJtVRWJNVjKbf+toosytmP1pViS 3jsxmfNEq4pKfuHnE6hBp39QgPMoOu7yVMXOWTeqCyMjm72Hq3Jb76fAKVYzlcOTifun8v cJw/saoG4hY2xzqa6D7eNfdYgEL4FAy9yOE8/w7Odh9T+jVxvGy4dPy2EK6T4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640092000; a=rsa-sha256; cv=none; b=LAM07RV3vp36ioSukfeGL8f3LRgmw2p6UT/QCwrihRNrd/TxgTeYVhZrzgVIh9/W9Te6Y7 bdTcjTgaU0q66mE9rcnp0X1gMNFp5LAiQiLVSWcRnRr/SEfnoNF27TQTjado20LoqYgTFb x1x2k9/VFeRMgFUYBXhy7XGIROHEB2JtE+WYYTs3zZG87LyMuipGbKCVfGTnweL4TCuF4p f6zJOVoFmvzY+yMhDLFQACQHExzE8mxJatMzglWC5AsU9edzkmugKtWPu4Y3WDMV7hd/yj BURa3/rBYzky/J5kVgGWuqJJPeqhPCzptlIYjmd6GDd8ttVdUTTohLVofoeq7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=02c16e2174baa756997600a8139f19f218da0a8f commit 02c16e2174baa756997600a8139f19f218da0a8f Author: Andrew Turner AuthorDate: 2021-12-20 13:49:59 +0000 Commit: Andrew Turner CommitDate: 2021-12-21 13:06:27 +0000 Add atomic_testandset_acq_* on arm64 We only need to include sys/_atomic_subword.h on arm64 to provide atomic_testandset_acq_long. Add an implementation in the arm64 atomic.h based on the existing atomic_testandset macro. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33587 --- sys/arm64/include/atomic.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h index 6c63357f85b9..fe15b14181b4 100644 --- a/sys/arm64/include/atomic.h +++ b/sys/arm64/include/atomic.h @@ -399,19 +399,19 @@ _ATOMIC_READANDCLEAR_PROTO(t, ) \ _ATOMIC_SWAP_IMPL(32, w, wzr) _ATOMIC_SWAP_IMPL(64, , xzr) -#define _ATOMIC_TEST_OP_PROTO(t, op, flav) \ +#define _ATOMIC_TEST_OP_PROTO(t, op, bar, flav) \ static __inline int \ -atomic_testand##op##_##t##flav(volatile uint##t##_t *p, u_int val) +atomic_testand##op##_##bar##t##flav(volatile uint##t##_t *p, u_int val) -#define _ATOMIC_TEST_OP_IMPL(t, w, op, llsc_asm_op, lse_asm_op) \ -_ATOMIC_TEST_OP_PROTO(t, op, _llsc) \ +#define _ATOMIC_TEST_OP_IMPL(t, w, op, llsc_asm_op, lse_asm_op, bar, a) \ +_ATOMIC_TEST_OP_PROTO(t, op, bar, _llsc) \ { \ uint##t##_t mask, old, tmp; \ int res; \ \ mask = ((uint##t##_t)1) << (val & (t - 1)); \ __asm __volatile( \ - "1: ldxr %"#w"2, [%3]\n" \ + "1: ld"#a"xr %"#w"2, [%3]\n" \ " "#llsc_asm_op" %"#w"0, %"#w"2, %"#w"4\n" \ " stxr %w1, %"#w"0, [%3]\n" \ " cbnz %w1, 1b\n" \ @@ -423,14 +423,14 @@ _ATOMIC_TEST_OP_PROTO(t, op, _llsc) \ return ((old & mask) != 0); \ } \ \ -_ATOMIC_TEST_OP_PROTO(t, op, _lse) \ +_ATOMIC_TEST_OP_PROTO(t, op, bar, _lse) \ { \ uint##t##_t mask, old; \ \ mask = ((uint##t##_t)1) << (val & (t - 1)); \ __asm __volatile( \ ".arch_extension lse\n" \ - "ld"#lse_asm_op" %"#w"2, %"#w"0, [%1]\n" \ + "ld"#lse_asm_op#a" %"#w"2, %"#w"0, [%1]\n" \ ".arch_extension nolse\n" \ : "=r" (old) \ : "r" (p), "r" (mask) \ @@ -440,17 +440,19 @@ _ATOMIC_TEST_OP_PROTO(t, op, _lse) \ return ((old & mask) != 0); \ } \ \ -_ATOMIC_TEST_OP_PROTO(t, op, ) \ +_ATOMIC_TEST_OP_PROTO(t, op, bar, ) \ { \ if (_ATOMIC_LSE_SUPPORTED) \ - return (atomic_testand##op##_##t##_lse(p, val)); \ + return (atomic_testand##op##_##bar##t##_lse(p, val)); \ else \ - return (atomic_testand##op##_##t##_llsc(p, val)); \ + return (atomic_testand##op##_##bar##t##_llsc(p, val)); \ } #define _ATOMIC_TEST_OP(op, llsc_asm_op, lse_asm_op) \ - _ATOMIC_TEST_OP_IMPL(32, w, op, llsc_asm_op, lse_asm_op) \ - _ATOMIC_TEST_OP_IMPL(64, , op, llsc_asm_op, lse_asm_op) + _ATOMIC_TEST_OP_IMPL(32, w, op, llsc_asm_op, lse_asm_op, , ) \ + _ATOMIC_TEST_OP_IMPL(32, w, op, llsc_asm_op, lse_asm_op, acq_, a) \ + _ATOMIC_TEST_OP_IMPL(64, , op, llsc_asm_op, lse_asm_op, , ) \ + _ATOMIC_TEST_OP_IMPL(64, , op, llsc_asm_op, lse_asm_op, acq_, a) _ATOMIC_TEST_OP(clear, bic, clr) _ATOMIC_TEST_OP(set, orr, set) @@ -512,6 +514,7 @@ _ATOMIC_STORE_REL_IMPL(64, , ) #define atomic_load_acq_int atomic_load_acq_32 #define atomic_set_acq_int atomic_set_acq_32 #define atomic_subtract_acq_int atomic_subtract_acq_32 +#define atomic_testandset_acq_int atomic_testandset_acq_32 #define atomic_add_rel_int atomic_add_rel_32 #define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 @@ -550,6 +553,7 @@ _ATOMIC_STORE_REL_IMPL(64, , ) #define atomic_load_acq_long atomic_load_acq_64 #define atomic_set_acq_long atomic_set_acq_64 #define atomic_subtract_acq_long atomic_subtract_acq_64 +#define atomic_testandset_acq_long atomic_testandset_acq_64 #define atomic_add_acq_ptr atomic_add_acq_64 #define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_64 @@ -603,7 +607,5 @@ atomic_thread_fence_seq_cst(void) dmb(sy); } -#include - #endif /* KCSAN && !KCSAN_RUNTIME */ #endif /* _MACHINE_ATOMIC_H_ */