From nobody Tue Jan 31 00:39:06 2023 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 4P5R4p6Z1Pz3btGb; Tue, 31 Jan 2023 00:39:06 +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 4P5R4p5nKnz4Vvd; Tue, 31 Jan 2023 00:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675125546; 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=dyFmbVsqvIb3HZlFhV40FY7zSx7Rob4nQS9TuMGguQw=; b=Ry/AmRxxvAeIi9/c0EUp8Dq3kSYxChWsbKrVKdsAxP0gYfxSzgllGHILj9aYWTSYImeA01 R+lt0AKjcKHWk02kh/FjIDhmKFgVcj0lZ0zrZjyLyVrAtBfgNJnGLxgs8vpjgC9EgPkPXB A8obkMS8AVyz0P5v16448btLoMIg8oU/LE0FMDZaL/BXEAzfw6iqq2s549fcPSWOkQwwkd NSmElrx9DjvhvRsGaeQ2VQivgJKtiwYpzxeTU3sJ2yLiN1u9qbiVfwFVc9pg9qkxfCZeWS wGWWcVBkESMzqq7kUq1SaWV54TIemVMAbytnjNOQQN+9mCuErGteBlOsHMAMmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675125546; 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=dyFmbVsqvIb3HZlFhV40FY7zSx7Rob4nQS9TuMGguQw=; b=JALddFE9F80N7dlxurQzT1UmG9ShpPGGxmDsan1c52jLmdgN0tsAsfPRh/hWm91jqk4WXU gmWESvip6rZjAdDgegbHo7YaLkfGNJRRGmYOEwdR++goda+GhawOFIbsij2sTdjoovUmbk GDCWkfZXYufUP6Lq1QRITEj4wlErUU4/MxhI4RX8ICid75NmskrP8IsFqMlq0P7zi2g82T 6Mrbhn0hgbn7SfwU+Qt3u2bppLV1St91tEtV4a5tf5fyq3Buc01HE54k6AVcSya1OlW6mh g3ymNNO9qhx5FtnDczOO5qdB/bZPNVV1DcW88flD7ceDFHkZD+9PG/8LMmUeMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675125546; a=rsa-sha256; cv=none; b=fzJ8qm16961Gqgse3WMBaZewnn30Wjgwf+I7AEt2dxROtaNi26Gy5IAux0ppxMSXo9Ure8 L3RjD3zMy+E/ezSXOXxfR6Qg4MyknndvPcpbZiWPrO/H5aJMmumPzz3jeebdx2hOIKGMQy S3OCcm0IzhQNs0DEpnoJU5KhJIS+3GWzjSgqGJhxWOUeZsGC0WbkT2zm6OK/WzAS2VO82F 59jA4yKFlv0axkgcGzut80J2G4LqZZ0JtkE+YYe9z4FCl1VhPRvdYw66JSsYIU1EqogD7E dCU9OtRMvGUKtAv3jQIOVJwY2JAFpHl7WCS49zHa80yvu//UZIl+/UOghBeQ6w== 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 4P5R4p4r7ZzTcS; Tue, 31 Jan 2023 00:39:06 +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 30V0d6aM059496; Tue, 31 Jan 2023 00:39:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30V0d6sv059495; Tue, 31 Jan 2023 00:39:06 GMT (envelope-from git) Date: Tue, 31 Jan 2023 00:39:06 GMT Message-Id: <202301310039.30V0d6sv059495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 17262e08af4e - stable/13 - libcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 17262e08af4e65a75484625417eb4ca0b916502e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=17262e08af4e65a75484625417eb4ca0b916502e commit 17262e08af4e65a75484625417eb4ca0b916502e Author: Konstantin Belousov AuthorDate: 2023-01-20 02:57:26 +0000 Commit: Konstantin Belousov CommitDate: 2023-01-31 00:38:18 +0000 libcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches (cherry picked from commit 9c996882b0ed279ca314d995f2eb1d538b94e3f8) --- contrib/llvm-project/libcxx/src/atomic.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/contrib/llvm-project/libcxx/src/atomic.cpp b/contrib/llvm-project/libcxx/src/atomic.cpp index 250d33e98b02..e7496fa43666 100644 --- a/contrib/llvm-project/libcxx/src/atomic.cpp +++ b/contrib/llvm-project/libcxx/src/atomic.cpp @@ -26,6 +26,11 @@ # define SYS_futex SYS_futex_time64 #endif +#elif defined(__FreeBSD__) + +#include +#include + #else // <- Add other operating systems here // Baseline needs no new headers @@ -72,6 +77,22 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo const_cast<__cxx_atomic_contention_t*>(__ptr), 0); } +#elif defined(__FreeBSD__) && defined(__LP64__) + +static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr, + __cxx_contention_t __val) +{ + _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), + UMTX_OP_WAIT, __val, NULL, NULL); +} + +static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr, + bool __notify_one) +{ + _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr), + UMTX_OP_WAKE, __notify_one ? 1 : INT_MAX, NULL, NULL); +} + #else // <- Add other operating systems here // Baseline is just a timed backoff