From nobody Sun May 17 19:56:15 2026 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 4gJWsC2hNkz6cvpN for ; Sun, 17 May 2026 19:56:15 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gJWsC1nTXz3MVk for ; Sun, 17 May 2026 19:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779047775; 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=3lQ6AoBzSnUq78saSfSCOQQz2YG7z/cnWAjZe9mQfEw=; b=FZ8qDd0bmWugfKb73lpPFWFzcm3yP0lX4slRVsqK5+eOOg5C+8cm92jOqqKnbkOcBL8p4o UFmOWqfCW8DmjF9abNa1BjWce/4h2yP8v0/oPzpNGeopPAPTn6SLhhCYiYum6Pu/ZZ/Itb Wj3bnPo7fHkdKfq61v46QhOvnJO/lNLBL7dxCq5qSIivehd7AOOA+rxy+m0cchqz7ClMOl m6PSL+hxmCap6NGTwCyvjm0eYY0Z+xR4EdN0prdauV/pRkxP62QWRpdnALCKJ9MCNoP953 yHl8MEdE64/sCc5jpCrvEBsjKODiJq3kPhYncPpqBP38pliPGIvJxH8/SjyTBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779047775; a=rsa-sha256; cv=none; b=BUVRIyKKv8/H3UFfqTFeQtl/eVX9cMpjBWcAJ9YeVlVpFxuFu1Jiz85JGFc5ufNj+Ux9jh lQkXwAnrpdGAFUm+VAk+m8gmIlS6hl90t8B5aFYF3wednvGyJNEe/vtoi//VMWbC3ImNdk x3kLXuYpjR8JNJMrcqODdTjiDF8NeP651wy9YqWP4Nx3D9IvoZTrTJvn3/cfv+eZS1AJGU raBux9qW7VpMyZp+d9HrwVKosmpL7aWRGgmxsntOg+NoPS9dzBZ6IF+DFYCHT6e31H6UNh w8ABo+AnZFjf4WLbFWOwpBG/FSX+Jb3bAQtWZykuuGBmy7YIzqKusNlJNZ8e4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779047775; 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=3lQ6AoBzSnUq78saSfSCOQQz2YG7z/cnWAjZe9mQfEw=; b=Mf9qzBCyxETBxl02sX6UM6Erx70ex3s1Ld4YKf8LIoti94yrW7XlqwWqAKu8oRNoxFkSKj 2D4U7S+NVJ78Mq1jswTavyZgb7yqxJd3xbV3XnOc69EiQR232mgvJUWkOScEYW7GD6FPMD wycLv1eotvfz07I0mP7e7aSSHrX/3/mnkLcBJtGPxsmv6RN14BNzQqV7oOU3WiDZgGIUFB PMVtOOzePBSGuvbzcIakhK5ecaeN0FxPcCMX3ypGPiI6vRWgqUuMawhpE/i9EHmJ+Cf1RG +RMVAHL71CRegA8xtSIwfn1c6DbGczdKm1yYKB02k6f4RarnS599I6pHsoswZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gJWsC1KcHzvqg for ; Sun, 17 May 2026 19:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31478 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 17 May 2026 19:56:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 56bc43f5d02b - main - locking.9: warn about using sleepable lock address as a sleep channel 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: 56bc43f5d02bd0745d597db44c285bf78d083762 Auto-Submitted: auto-generated Date: Sun, 17 May 2026 19:56:15 +0000 Message-Id: <6a0a1d5f.31478.7a5c2aa@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56bc43f5d02bd0745d597db44c285bf78d083762 commit 56bc43f5d02bd0745d597db44c285bf78d083762 Author: Konstantin Belousov AuthorDate: 2026-05-15 11:05:45 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-17 19:55:23 +0000 locking.9: warn about using sleepable lock address as a sleep channel Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D57012 --- share/man/man9/locking.9 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/share/man/man9/locking.9 b/share/man/man9/locking.9 index ad044b6e1d46..9afdcd56f4f6 100644 --- a/share/man/man9/locking.9 +++ b/share/man/man9/locking.9 @@ -205,11 +205,6 @@ The functions and .Fn wakeup_one also handle event-based thread blocking. -Unlike condition variables, -arbitrary addresses may be used as wait channels and a dedicated -structure does not need to be allocated. -However, care must be taken to ensure that wait channel addresses are -unique to an event. If a thread must wait for an external event, it is put to sleep by .Fn tsleep , .Fn msleep , @@ -222,6 +217,16 @@ Threads may also wait using one of the locking primitive sleep routines or .Xr sx_sleep 9 . .Pp +Unlike condition variables, +arbitrary addresses may be used as wait channels and a dedicated +structure does not need to be allocated. +However, care must be taken to ensure that wait channel addresses are +unique to an event. +For example, the memory address of a sleepable lock such as a +.Xr sx 9 +must not be used as a sleep channel, because the lock implementation +will internally use the same address as a wait channel. +.Pp The parameter .Fa chan is an arbitrary address that uniquely identifies the event on which