From nobody Sun Nov 09 00:36:24 2025 X-Original-To: dev-commits-src-branches@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 4d3v492FGHz6Ft28; Sun, 09 Nov 2025 00:36:25 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d3v485ywqz3RLy; Sun, 09 Nov 2025 00:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762648584; 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=CIDM0PZhIxJkdDFzppU3gs1c2f+Ess4gGVEVVNXBwyg=; b=B7zK/zwjnTntxIYvMrggOTizSazDG6IgOVRbVNByU21lLb0fo6S6B5eZDSz2WN9A7GSgtv WasuHD8849ePufcQ8kgEAfTXsgutjhmN5vnObd/T9g0n4o17YRF/0VeC6ZrYJxTIQg4Lbc wq7BUgbvglEX84PgxNtsyNyw6T6k7lGIdkAEACJz62nPAt4F1W4WenlG2DNEGtP8b2XN3B VTa48ZNZ+VKgcxPGne0iCS88fiCR40EefqAHhABfNr+Pf8nnnU7NBFm2+22VWp8DDbHFeF QEebnnfclpbxFlWPClHMXfcIqx9M1UKGFeHIVOSaK+1Y6qSoUqIO2l5ZVlReOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762648584; 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=CIDM0PZhIxJkdDFzppU3gs1c2f+Ess4gGVEVVNXBwyg=; b=qdZYGw8iyFJinqmdPiCA3Y94tkJG1VkhcFVJQEAk7wNWcxzXIoCa40bfW2yvK2wAvKoSvg Ho9FpAM3nL2iEad3g4tGNmzYgolnRcsJbRxnczvTICv4VJ3lfQSg2KN9WOTz3xTtMg7RS2 YyWn+tS4A4xeQuYk8tVVhuLTdCg+C9JxAFWjYw4TfpZXwtFGazP9xIGH0R3Rytn6GSzrMR XuGKPAsqcSVk76/6s2pFTcQiehgjb65GMemrfiLuoBMU6SLQatSiJIS1Q8KVbZL5gvNEEc 5wbL8FeN88O5mY+snoe8q5TY4ijcz0Q9UPx9zUgac2SIIhtlNJ2T/qDvvVLY4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762648584; a=rsa-sha256; cv=none; b=T0Vn8htx7mucICLH9xbiRxlLHSMjK92xESBr5P+afGNkZrFpDIJVndGe4msAy5nIy/LTp1 +jOFvfRIjOoPQBDp/SwMxF9HPvZx2eJb+Uux//a1AkckhX2Eiu40oitnjffCUiJ7z6+b0j in5Po7Hv0cgyuZh5zjj3K8p/kO95sFoWkqkf7hY7EF/ywaIwMjrM+NhMObKfWprCNLqMjy 0c8S6N0j6hDVQUiKUF5bp3xc7Gr4tXbV7cQbgc8gZNVqm0Fq0wNFQmePpNFk1hN3RoeEwM 8zvLBsxnutoT0tqGpB+yMW/Wug4Ex0+iba2B28K7eSUY6GjqfWMoNifhtrod2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4d3v484t37z17RJ; Sun, 09 Nov 2025 00:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5A90aO2W096954; Sun, 9 Nov 2025 00:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A90aOpg096951; Sun, 9 Nov 2025 00:36:24 GMT (envelope-from git) Date: Sun, 9 Nov 2025 00:36:24 GMT Message-Id: <202511090036.5A90aOpg096951@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: 074fc34c842c - stable/15 - atomic.9: provide fine details about CAS memory model MD semantic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/15 X-Git-Reftype: branch X-Git-Commit: 074fc34c842c00d31f6c4edc13cea66110652062 Auto-Submitted: auto-generated The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=074fc34c842c00d31f6c4edc13cea66110652062 commit 074fc34c842c00d31f6c4edc13cea66110652062 Author: Konstantin Belousov AuthorDate: 2025-09-26 06:58:36 +0000 Commit: Konstantin Belousov CommitDate: 2025-11-09 00:35:53 +0000 atomic.9: provide fine details about CAS memory model MD semantic (cherry picked from commit 269b1c238806c7fb8835a0510b224c466ca3efa0) --- share/man/man9/atomic.9 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 674959648330..b027a0ff0bca 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -242,6 +242,33 @@ section. However, they will not prevent the compiler or processor from moving loads or stores into the critical section, which does not violate the semantics of a mutex. +.Ss Architecture-dependent caveats for compare-and-swap +The +.Fn atomic_[f]cmpset_ +operations, specifically those without explicitly specified memory +ordering, are defined as relaxed. +Consequently, a thread's accesses to memory locations different from +that of the atomic operation can be reordered in relation to the +atomic operation. +.Pp +However, the implementation on the +.Sy amd64 +and +.Sy i386 +architectures provide sequentially consistent semantics. +In particular, the reordering mentioned above cannot occur. +.Pp +On the +.Sy arm64/aarch64 +architecture, the operation may include either acquire +semantics on the constituent load or release semantics +on the constituent store. +This means that accesses to other locations in program order +before the atomic, might be observed as executed after the load +that is the part of the atomic operation (but not after the store +from the operation due to release). +Similarly, accesses after the atomic might be observed as executed +before the store. .Ss Thread Fence Operations Alternatively, a programmer can use atomic thread fence operations to constrain the reordering of accesses.