From nobody Sun Nov 02 21:22:22 2025 X-Original-To: dev-commits-src-main@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 4d07342q65z6FWCs; Sun, 02 Nov 2025 21:22:24 +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 4d073275B2z3nsZ; Sun, 02 Nov 2025 21:22:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762118543; 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=HDjkYkaOoGmgwzIBijD83FvlI9adDRkuWZO+N1LoMsI=; b=MWPZ4mGC5upYSY5BnJ07KY3RrQC9SKEThYKRscNEFFqtT3k/9qeKAxZ2MM2df2aQK5HK0R MKPee2JCsoRecJz3AxpCXhJIrc2b5KILJbUrvjk+Ngn5uEDBsQA6qTZZE8vHD0FlewDyEl 1Z9KLmSch/mHxmqUOzzu7RkUlV2LDaIdn81YbPHnTTfnLn8L1Wm7fghsdvYoYLoSmc9y+K b5w4/oxp1Y1g9YNPXE7HuOAhq9XiTo9QWHy7Mf8jC6YbpkdCY1kJtgR/5Dq7/13jjaFSc+ WKQfgrnxMg2jDa4bH08++7KKoeaMUilWtdN4HIEH6n3KBKk0CHGSb1oKeFKCCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762118543; 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=HDjkYkaOoGmgwzIBijD83FvlI9adDRkuWZO+N1LoMsI=; b=MMv6xtCEri6tG64eSzxjhNcUyBmOgxeNpIqgol4A2jBiuFM41ODl35ARpSuwddJDgx79gy 2S+xUFOYtS1ikLw4jhzJRO00oWB9U4BH3Xk0Ph9jRbpJGUfGNlvv8OETeSOHM1ZkX+psOc 8rxdTm+yNhCmXd1FSMrSirhS/MdEp9kgBbUl1Yfgoh6HW1VNM8JEa0gsTGiV7XhAbdFEFa UAqXHovKOW1tHBFcLCt+1Mkzp8tAWoWr1LQb0TZPHuyDBap3drUfhn1h3WO/kAbIfrCtim RfPvyrarNIAdu3bTTCc8ylF4e4GOqv6HTqJMKTuj43/PgqUnVMOpUTTpjfuzRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762118543; a=rsa-sha256; cv=none; b=yXemZtyOHTaCnEpN4CFTVzcqYRSCqo4c40adZrj+gxAx6Yiz7wBg7rpKsVt4F2As5xmvQE 3zYF1YqsyayoUk8qFGetdRIx/UY2QJXCBkEK+Lhnqvx61vba3w9ZNwFTFOPi3fXoYBS9GM 9j0S2H5Nj6OeFHfszLaBHpnuGgi/lqvaKTXQavKFw+avpNmcWljuT5psM6mRAzbY2jqOMB cz4Nn3s3+dXIMoXVHpz2pNSuwa6aVqWkyh8atUN7ZAzhHO3ot43zFwH0OC0KCKFQGVZ/A/ vruPShHhRs/tu6DNPinoCqYsztWCIKF2jMEl8ndvHS9hqvmn8Eoi8tTBtDCp2g== 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 4d07326hlQzjrP; Sun, 02 Nov 2025 21:22:22 +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 5A2LMM8u047043; Sun, 2 Nov 2025 21:22:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A2LMMSn047040; Sun, 2 Nov 2025 21:22:22 GMT (envelope-from git) Date: Sun, 2 Nov 2025 21:22:22 GMT Message-Id: <202511022122.5A2LMMSn047040@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: f26382dd72df - main - atomic.9: fix description of acquire and release List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: f26382dd72dfc710a8cc7159364a8166e22a4254 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f26382dd72dfc710a8cc7159364a8166e22a4254 commit f26382dd72dfc710a8cc7159364a8166e22a4254 Author: Konstantin Belousov AuthorDate: 2025-10-05 08:39:32 +0000 Commit: Konstantin Belousov CommitDate: 2025-11-02 21:22:08 +0000 atomic.9: fix description of acquire and release The ordering point is not the atomic operation itself, but the load for acquire or store for release done as part of the atomic. This does not matter for atomic_load_acq and atomic_store_rel, but does matter for RWM operations. Noted by: alc Reviewed by: markj Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52744 --- share/man/man9/atomic.9 | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index c9133c6311a5..674959648330 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -182,35 +182,42 @@ This variant is the default. The second variant has acquire semantics, and the third variant has release semantics. .Pp -When an atomic operation has acquire semantics, the operation must have +An atomic operation can only have +.Em acquire +semantics if it performs a load +from memory. +When an atomic operation has acquire semantics, a load performed as +part of the operation must have completed before any subsequent load or store (by program order) is performed. Conversely, acquire semantics do not require that prior loads or stores have -completed before the atomic operation is performed. -An atomic operation can only have acquire semantics if it performs a load -from memory. +completed before a load from the atomic operation is performed. To denote acquire semantics, the suffix .Dq Li _acq is inserted into the function name immediately prior to the .Dq Li _ Ns Aq Fa type suffix. -For example, to subtract two integers ensuring that the subtraction is +For example, to subtract two integers ensuring that the load of +the value from memory is completed before any subsequent loads and stores are performed, use .Fn atomic_subtract_acq_int . .Pp +An atomic operation can only have +.Em release +semantics if it performs a store to memory. When an atomic operation has release semantics, all prior loads or stores -(by program order) must have completed before the operation is performed. -Conversely, release semantics do not require that the atomic operation must +(by program order) must have completed before a store executed as part of +the operation that is performed. +Conversely, release semantics do not require that a store from the atomic +operation must have completed before any subsequent load or store is performed. -An atomic operation can only have release semantics if it performs a store -to memory. To denote release semantics, the suffix .Dq Li _rel is inserted into the function name immediately prior to the .Dq Li _ Ns Aq Fa type suffix. For example, to add two long integers ensuring that all prior loads and -stores are completed before the addition is performed, use +stores are completed before the store of the result is performed, use .Fn atomic_add_rel_long . .Pp When a release operation by one thread