From nobody Tue Jan 24 00:53:07 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 4P17kC6P1dz2v6tS; Tue, 24 Jan 2023 00:53:07 +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 4P17kC5xgcz424K; Tue, 24 Jan 2023 00:53:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674521587; 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=grS77jV9v3o8VxSuAwtIkEE0SNHCwdbyDlBm0EbalKQ=; b=lN55ctkIweY+4t2ld2xun8OFYaQLdQHpqC5TlF6C4unKnkgXTue3AfnbPorv0vX2zn2+kR G3EBxuzW5QWEhVCs7O8pnYn8qVqdfrvd4lkAcvRRiIQn7dwYPLcMO0jNAkTgOcKSVLJAWC PPWyki6IoYhz1/37lGQxVVxGfnZee9ii9qzz9EMbrjpbWdfEFlsHOFNN3Ct1EQQ0TdJh6C B3w0eP7XynT83M0KU4yoHNMFfPV70+dZWwZDDGKajdc2Zkt7QheCDvFmsRr86qywX9oqnC /YlX2GgCLDpycvt8nzXFlMaNyYVzejoJtG464AVZ5wD3zktY5xllu7BH47LLkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674521587; 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=grS77jV9v3o8VxSuAwtIkEE0SNHCwdbyDlBm0EbalKQ=; b=kk/iO4BUdqA5Yu29b6uQ1A2Wn0yCE3wJnIL3OhmWkTR6jA4+dD5275eUnBoA+N/pparBSB tNHuYKZDkSTFjDe+O7rfLELLbc+CG8F/wDDRSp+pHAY2LgRsY0vcKJBjR0LSTPXA6LyV1N gW6n2SQHLI+2CNTMyMF5fyp/kkue2AP5Qi6ZWbD1IJMvKW34djBTCgMmZuKY93lHLZSmUL ClTD6hOge9Fnflwche/mrM4YNwx8gN2WSMXDqTfuMymrNa6frFKg1jOUCNSSwQRGZa8J/O 3U5KsmZC49yMXgtPYxXGG8FZqdrFh0XTm2vFgGBr8CdVvVeRgzy6Vl5JFqs9SA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674521587; a=rsa-sha256; cv=none; b=XUSFJ2xxU9wdzbuGT+J6cOWPECxMilqEoHGywG7BPZBAeOrGy0WzRUtuDtk6OpgqPnc0Ai wjGlgOy5eiOF13+XMMwHnBgn3TlAg+LfxxPujOdo+ZvFqwdOaQWfrTB38XPkTbHWaYtcvO XKrRt0SOjdDHAxZDZdMD9Rff+C+ACdLkTnA/KDxXjIAQog3GhLdjbHzyrLj+2gX0RYteZY I1iDXE5i/9ccdTcoZp+WNpU2z6QPv/SLOtiptsAaA4XOlCQDkAl2ZbngTtuhbbaF3Wm5Eo MiArf9iPXNV798cceRxqmZJz9aLaN7mIkwqsgVz+bjacOGPqnv8MWSrqak4q7A== 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 4P17kC50JRzqPJ; Tue, 24 Jan 2023 00:53:07 +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 30O0r7bL046670; Tue, 24 Jan 2023 00:53:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30O0r7TZ046669; Tue, 24 Jan 2023 00:53:07 GMT (envelope-from git) Date: Tue, 24 Jan 2023 00:53:07 GMT Message-Id: <202301240053.30O0r7TZ046669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9c996882b0ed - main - 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/main X-Git-Reftype: branch X-Git-Commit: 9c996882b0ed279ca314d995f2eb1d538b94e3f8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9c996882b0ed279ca314d995f2eb1d538b94e3f8 commit 9c996882b0ed279ca314d995f2eb1d538b94e3f8 Author: Konstantin Belousov AuthorDate: 2023-01-20 02:57:26 +0000 Commit: Konstantin Belousov CommitDate: 2023-01-24 00:52:42 +0000 libcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches Only 64bit architectures can be supported this way, because libcxx defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit arches do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation. LLVM review: https://reviews.llvm.org/D142134 Tested by: emaste Reviewed by: dim, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38132 --- 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