From nobody Mon Feb 6 19:07:45 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 4P9bPG4M7Tz3n4L4; Mon, 6 Feb 2023 19:07:46 +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 4P9bPG02PWz3Pxd; Mon, 6 Feb 2023 19:07:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675710466; 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=WrviYzgvofCt6qjtsqfMYO4DILgT+GbLdM6LitVMMuI=; b=J+CNGMRVn5HgKnu77cOTgM8olwHVIbF+GHORGej3vfY35LWmKRIQ/mDkBypw6drmKtQj5O 1F/GgxrolISp2PsI9mtAeD5DAC/mTVwB8NyyxK9HmjNLa8WsC2VbdWyv+/FpeYN6g+jKCD U34m6yPFCk4+12GnBR3+9y8z4L0EBNK8NkD2SF7NL3oNxEzJc4oiknajhnlZmE8DmVsSO8 4Ye2fBlrUPbopqrob2okBnJ/M0RimXBuuMSOU4TfbDzZDm+jSBFLKKuJmY2oPvYUpVqCwm 7wNL45tEPhdNDFx94jpF4Y+6xc9xXBNJnKTryd48i+0KmyjI88mjhMe4anZH2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675710466; 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=WrviYzgvofCt6qjtsqfMYO4DILgT+GbLdM6LitVMMuI=; b=XDScyIxU82Fj4Pd5ad7B4+KL4N7HOay7TQm21MQ+DBTCRyD6wnPRZ332+vjLWroDKJ+478 GOmI/2KdCgk4DvrrcEcHdXSW8AymJkKWpXYEDibSJwaHwCGzoSDLC127Twr1hujY87m454 V1QzK+37Jmm6Zz9S72Wqmdxms8ZnXQh5paXzv71cOkbB6MKi5BN8rONh6o9V7+JOyudL4y mcnPA0fsI/JiO9piTJLi721bzRs8L2gq7HS/cVWBauh777aBwkTdZQ7ffBx8+2EZwI9Do4 t0VpMNnruBvWZBhLWeiCq6CArepA3HQpa/01mTGcsoSnipSibuHbF12QduWgPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675710466; a=rsa-sha256; cv=none; b=E3IRrMSmMf8+D/WQPNTmfiTnbs0j+NFEHe8R+2spdsfcp3yaLE2TgcprA1T//Xj5TZZfFO TYbxltT7HnkL+0JjPqAKQk4OwhAf/upsS5Ss1VjV8KXKmT1hoyxMXsq+vvSBZ3/W4PBjgQ NsBglHQt8G/47fS1fgZrglnXaXvQW5cRRIx6D5vkLzsHenhDxVDnVsdsXSv79bqUB9GfY+ 4NUNeX99oDOCmutnjS+tsfWVzOLW+2FvRpM76LSyCmjFwm3ZVCGuV/HTwsHzp8kGuS6YKZ nI6zY07cRJwTf4hUG0lPpIf875mRn1wFohCi3WXo+IH+vHUKsrX3DxM9huBy2A== 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 4P9bPF6FcbzmLw; Mon, 6 Feb 2023 19:07:45 +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 316J7jfg076907; Mon, 6 Feb 2023 19:07:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316J7j2N076906; Mon, 6 Feb 2023 19:07:45 GMT (envelope-from git) Date: Mon, 6 Feb 2023 19:07:45 GMT Message-Id: <202302061907.316J7j2N076906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: d365be955fef - stable/13 - libthr: Fix pthread_[g|s]etaffinity_np manual. 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d365be955fef0e3faf4983edf62183aa51dee011 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=d365be955fef0e3faf4983edf62183aa51dee011 commit d365be955fef0e3faf4983edf62183aa51dee011 Author: Dmitry Chagin AuthorDate: 2023-01-29 12:36:25 +0000 Commit: Dmitry Chagin CommitDate: 2023-02-06 19:06:30 +0000 libthr: Fix pthread_[g|s]etaffinity_np manual. Since f35093f8 semantics of a thread affinity functions is changed to be a compatible with Linux: In case of getaffinity(), the minimum cpuset_t size that the kernel permits is the maximum CPU id, present in the system, / NBBY bytes, the maximum size is not limited. In case of setaffinity(), the kernel does not limit the size of the user-provided cpuset_t, internally using only the meaningful part of the set, where the upper bound is the maximum CPU id, present in the system, no larger than the size of the kernel cpuset_t. Reviewed by: jhb, kib Differential Revision: https://reviews.freebsd.org/D38111 MFC after: 1 week (cherry picked from commit 62801712dfc17fed6f8d4c9b64dca18d51a2bf9b) --- share/man/man3/pthread_affinity_np.3 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/share/man/man3/pthread_affinity_np.3 b/share/man/man3/pthread_affinity_np.3 index 0a52add2ee3c..b36e5772c1e3 100644 --- a/share/man/man3/pthread_affinity_np.3 +++ b/share/man/man3/pthread_affinity_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2021 +.Dd January 29, 2023 .Dt PTHREAD_AFFINITY_NP 3 .Os .Sh NAME @@ -50,14 +50,19 @@ Masks of type are composed using the .Dv CPU_SET macros. -The kernel tolerates large sets as long as all CPUs specified -in the set exist. -Sets smaller than the kernel uses generate an error on calls to +If the user-supplied mask is not large enough to fit all of the matching CPUs, .Fn pthread_getaffinity_np -even if the result set would fit within the user supplied set. +fails with +.Er ERANGE . Calls to .Fn pthread_setaffinity_np -tolerate small sets with no restrictions. +tolerate masks of any size with no restrictions. +The kernel uses the meaningful part of the mask, where the upper bound is +the maximum CPU id present in the system. +If bits for non-existing CPUs are set, calls to +.Fn pthread_setaffinity_np +fails with +.Er EINVAL . .Pp The supplied mask should have a size of .Fa cpusetsize @@ -96,6 +101,12 @@ and .Fn pthread_setaffinity_np functions may fail if: .Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa cpusetp +argument specified when calling +.Fn pthread_setaffinity_np +was not a valid value. .It Bq Er EDEADLK The .Fn pthread_setaffinity_np @@ -112,7 +123,7 @@ argument could not be found. .It Bq Er ERANGE The .Fa cpusetsize -was either preposterously large or smaller than the kernel set size. +was smaller than needed to fit all of the matching CPUs. .It Bq Er EPERM The calling thread did not have the credentials required to complete the operation.