From nobody Sun Jan 29 12:38:21 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 4P4W7f33Wvz3cQ8S; Sun, 29 Jan 2023 12:38:22 +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 4P4W7f078wz3rXv; Sun, 29 Jan 2023 12:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674995902; 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=acgzdSgZBM0574/8mQMitE/v9aLrclCsR+eWp8CpjLg=; b=h0SxZoZ4kMkzpR802ZV3wLGtIBOATWVGRgsecSAPteoY3F+iNbKVgogOt+n5eSC82Q/Ftl ofjPlVULlkge4cdg9KF9t29U6ySJuJ6BextChS9AdGWzxPSGjO6Rd9k/GbifbUHeU0RfKG eVy5Gl6T02ejM1hvKD8aeynP457/FlAAnpEw0S4L3ws9QVljr/2Ee77fLXQeQ+ku4cpocG cF61qJJ1YOMGBq3VuQTyW40qVkuOAqOa0yqzWyDMaLf/i7iMGt1Ba1IiG+TAIAHQmvwONz Q8Xd6jxeuAjfVddpsyyNaDTKMVVyQZSakqonXpeADLUIai5wW5egySvENhlTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674995902; 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=acgzdSgZBM0574/8mQMitE/v9aLrclCsR+eWp8CpjLg=; b=LDPy/Mr3uuv1m0aq7+AkBOfk4Mo92Cl7yMhXXtEOTRBf2Cdefx3UWP4GPtoscEmrg+1VcZ YfDxev81pRZ/8ULtcKsk1bO5XOaNDbrCOk5li0JUozXzeY2X3kYtYchxa0wcohOWSdeTpx hb0uVHz6UKwaPKR7Rz72Q2QCQZlFWGEgr1BLmIIyKm4FOpKjOl2dAPwvdcJenmc6/ssOeF PtH8QruDGRs8GoVASRKqVbpGTe+JneuXWIMxuulHj5ppuCan056MPx6qJAmGjOSj9FirWM QDL77PId2M0JXJBmq0AjwB3rrDT1mNe53ZKOLlOlbJ00HHrWcOuYBaBUZkfZNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674995902; a=rsa-sha256; cv=none; b=FSArUVbW+nZZul0SJNsNGOvraVm7EIZC6nXrtGlErQ5qLJL5h11xJ8WWOPh2ZmtpH5iLgY trBFEPjgI0fcNKu91uz3sIV0AznasWmYZcJCBfMxl18/DfnbZMhIRul6dt2aOK0AvywNEQ twn5yhn8LfaUoRfVQ7zpaBLVJmgPBcx0YrUb3H4kHikzFlbD/QdQPTetqJInEzwfaQxTnc oN8z8is+BomoOGJolnH5nWwIdyNGtRpS1ssuS+VOyIidkelizI68eAo3jN2GwhD7oPPWUn IEYgHf45uwCl6S0j89HiSknIg7Q8FgBqB4IyaWG7IQ5WqQGCnNHbxGyWKbghKQ== 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 4P4W7d6HFFzTFG; Sun, 29 Jan 2023 12:38:21 +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 30TCcLVU050983; Sun, 29 Jan 2023 12:38:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30TCcLBQ050982; Sun, 29 Jan 2023 12:38:21 GMT (envelope-from git) Date: Sun, 29 Jan 2023 12:38:21 GMT Message-Id: <202301291238.30TCcLBQ050982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 62801712dfc1 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 62801712dfc17fed6f8d4c9b64dca18d51a2bf9b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=62801712dfc17fed6f8d4c9b64dca18d51a2bf9b commit 62801712dfc17fed6f8d4c9b64dca18d51a2bf9b Author: Dmitry Chagin AuthorDate: 2023-01-29 12:36:25 +0000 Commit: Dmitry Chagin CommitDate: 2023-01-29 12:36:25 +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 --- 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.