From nobody Mon Jul 28 12:43:11 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 4brJ6l2ymDz632p9; Mon, 28 Jul 2025 12:43:11 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brJ6l2Ft7z3lkY; Mon, 28 Jul 2025 12:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753706591; 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=WnuKuQMjlYcd5no0JuUlozOf7O3V3AIH93/0ZXrS8vs=; b=fo0uag0HFBPABS69TlwNeGXTDdfl92SquFAj0PnyVfRDctIiedMrkF9ItqfHCnh9hMmTfh jrvtNSPdZq47I0SuKdlTEWHMYAMKiS0icTcOpuyxj6FVMocTxrsro18PC00ZZPd6pQzHzr s8VYou49aps2O0ZD/W27b0iGb+2vpcDtX4noIAP5rexyDOw1tIy1p0Lp6jug7LrSFI5TqX YHywMIzCslJsjPvNUTOYX4qwi8jS8GAvpdybqbyf03TBuzNN0sQKRlqZg+V7d/GBqC1ZAy Hriad9Jd509TWPn8HsjYK7Zz51yxwV2l6xrrkyd76fGjlmZ46qIlXQo4tsGxFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753706591; 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=WnuKuQMjlYcd5no0JuUlozOf7O3V3AIH93/0ZXrS8vs=; b=OsTA/vaTYOT8wEck/W4b1lCXSunU1JLOR0KFjUEFKLX79wC834H2Dr5yLdB44jz7dti4lk XoO4b4uZC7JagIa7/LVOKuPH3hVXSOkuLotY4mz52gz/GeeU399LXgsAiWHZtYewwWSvH/ bc1fHhpcCKNhTbKSyU9+hTKeNk5q1lZyP22Lmuw3OwGFqxdnYYrlPxmR0XtezidTXSXW32 tqWU6rG0RblHtY2V49V2pzDD1crxEkbMa4zVjzfsBl7LVEVGh+CtNzNWBmg8s5HAwZOrqd FpA9wqjWiGaDRWtT3ijrDGJ6WFad+kcpVuCbbrot26Cc1bX3s0ZUnJJdwMNb/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753706591; a=rsa-sha256; cv=none; b=BKF8mqETo8Zfj0ILyWtLlO4THjXKf8hZz7kLKJ6w/CrClMp8hySpl+k/UcL1m4Tk305V2T RTwLONVNrlqnPOK8e7mt7ymEHxIEA4fhIPhPea+yMfCzYjCJB4IBGwS1j+t6MzXFsMBTSM iJYmwFU0hC+EuCMt7Jw1Rp8cVyKKuzply1LU7GDo1Q4IPyBDL+F0dXbzbPztE4hex9vixu 2F4nfIC2Sq4wuC1qOTwzI7mszheLOl7WI1NM88suHjL4MAP3+0S7ADRSniVDLWC7NjKe6S JSPLQbHlGmvXfI+WAQZinadbA8KLkmMnDjf8o6TudbQkydt2tuGk87RynJnwHA== 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 4brJ6l1k3tzlsn; Mon, 28 Jul 2025 12:43:11 +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 56SChBS2092084; Mon, 28 Jul 2025 12:43:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SChB7N092081; Mon, 28 Jul 2025 12:43:11 GMT (envelope-from git) Date: Mon, 28 Jul 2025 12:43:11 GMT Message-Id: <202507281243.56SChB7N092081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: 44a5649bc3a2 - stable/14 - tests/sys/net/if_bridge_test: fix MTU test 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 44a5649bc3a25b9e18980b80ecbbd8df41244d19 Auto-Submitted: auto-generated The branch stable/14 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=44a5649bc3a25b9e18980b80ecbbd8df41244d19 commit 44a5649bc3a25b9e18980b80ecbbd8df41244d19 Author: Lexi Winter AuthorDate: 2025-07-25 23:11:39 +0000 Commit: Lexi Winter CommitDate: 2025-07-28 09:20:44 +0000 tests/sys/net/if_bridge_test: fix MTU test "ifconfig gif0 ether" doesn't return any output, so this wasn't correctly checking the MTU on the gif interface. Remove "ether". Reviewed by: zlei, kp Differential Revision: https://reviews.freebsd.org/D51245 (cherry picked from commit e6ef675de261b15ed66d434d054a6e5e69308ce5) --- tests/sys/net/if_bridge_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 2698b5cb887b..5438f67cf637 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -537,7 +537,7 @@ get_mtu() { intf=$1 - ifconfig ${intf} ether | awk '$5 == "mtu" { print $6 }' + ifconfig ${intf} | awk '$5 == "mtu" { print $6 }' } check_mtu() @@ -546,7 +546,7 @@ check_mtu() expected=$2 mtu=$(get_mtu $intf) - if [ $mtu -ne $expected ]; + if [ "$mtu" -ne "$expected" ]; then atf_fail "Expected MTU of $expected on $intf but found $mtu" fi From nobody Mon Jul 28 12:43:12 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 4brJ6m3VX8z632T5; Mon, 28 Jul 2025 12:43:12 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brJ6m2mdzz3mBh; Mon, 28 Jul 2025 12:43:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753706592; 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=C92H34u3tQOJ+hSecqSgPZ2tCXzmxvWr4ZKTNEwV2+I=; b=mI0qoTF+MeTh0SJpe/BA0K5UaNq5vg/n4WLjH4GnsLqX2AcvnhtxzLYDSHznlmH3jWBf0q BioSa7ycdy9lvLfPV+0TCoqu7pl21EAhwmFZ+csUwKfdJdA17X4HbTVX19+fCrm4yzwVhL 05MU6+ucxKSRv+MdieamS2flpo9Q2/NT4F5ifBP7Wm8Ek83dc2D+BpNOjecBsz+xadpRG/ eoNs3H/WbAO5gV0yjGtYw5Fb4FbTX/8JLNykhTS5hKheEx6F5pV9ZBioPrk9orG827PjVq /iLd8LHi2x3UUZQoOYUMVZwDyvzz84658eMi0h6WU3RiwBFsF14saMrJfT3ivw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753706592; 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=C92H34u3tQOJ+hSecqSgPZ2tCXzmxvWr4ZKTNEwV2+I=; b=x8T2jpQTn2vLAkbPMTuwOyFrsmug9iAB+/w4hkq6c1FWdeAhpZ3cFxjloKyhHj7FYRknAC v1NMQQtuFsfO+P6atcuN60hfEKC7u7p9Tfb/GYwzqJ3CDR/mqiqDLNrLXZL72a7JZdACXR WIlZf3GqSmefu1ehXP9j85mdzPvBypUUrbjnjx6UuNVAaW4WOFV1eYBD/9Ey15El1M/0PD UjYOXmDboyYL66VuBy/xu0y4pxw8nNDRpg1RqPL6ddNZitvyP9JDoSk00lUR1U/mCNb0jN iq0X//90gQEhP/vr5MVQED98SSa7Kti0FXB+ajDea/fQT/Xl7W9XLWmCd9FEZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753706592; a=rsa-sha256; cv=none; b=l1kMP1fLEobI0Gu4att5F+7kdPdl5mSk1hyfpgmkyWWZM/34VIw8b79nce8LItArx5Bg2H xvLHn6V9NTMWNGVjvHXZ8S4RajjSMq8ZXOpeNIAeX0iU+oabRIlyd1vTLZ6RWkS6Ya0s+O mu6xzCOil6fZUbsaxmfsP7+k/BdrDwkhm1+/ojDDIjV5vEfgIFrG76lzDFVl+gI0T1wfN3 ec9beg/+51030WKLNB/APrKGztkI5HzANh4dnWZvc1dvrCowCveuwvavqa/UvtkHEf3Upo XZtOqfMooY8FDQlw8koQl6cILUqiTd/d3BLGMU+WqSnKSyTTROPRQ8yStqpEWg== 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 4brJ6m2Mq9zmCg; Mon, 28 Jul 2025 12:43:12 +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 56SChCS4092117; Mon, 28 Jul 2025 12:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SChCvM092114; Mon, 28 Jul 2025 12:43:12 GMT (envelope-from git) Date: Mon, 28 Jul 2025 12:43:12 GMT Message-Id: <202507281243.56SChCvM092114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: 4f2140aa9677 - stable/14 - crash.8: update a little 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4f2140aa96773ac6f9d4f63290d79b4b9a6d48bf Auto-Submitted: auto-generated The branch stable/14 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2140aa96773ac6f9d4f63290d79b4b9a6d48bf commit 4f2140aa96773ac6f9d4f63290d79b4b9a6d48bf Author: Lexi Winter AuthorDate: 2025-07-25 13:59:58 +0000 Commit: Lexi Winter CommitDate: 2025-07-28 09:21:39 +0000 crash.8: update a little Replace "cannot mount root" (which is no longer a panic) with a brief description of the mountroot> prompt, and recommend using "system install media" rather than the fixit floppy. Remove "timeout table full" entirely since this panic no longer exists. MFC after: 3 days Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D51512 (cherry picked from commit c9868af774ec24bcf6914fc971378e9723eb44ab) --- share/man/man8/crash.8 | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/share/man/man8/crash.8 b/share/man/man8/crash.8 index 27c9c56533a5..fdb9b7213847 100644 --- a/share/man/man8/crash.8 +++ b/share/man/man8/crash.8 @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 23, 2011 +.Dd July 25, 2025 .Dt CRASH 8 .Os .Sh NAME @@ -71,18 +71,19 @@ Left unstated in all cases is the possibility that hardware or software error produced the message in some unexpected way. .Pp .Bl -diag -compact -.It "cannot mount root" -This panic message results from a failure to mount the root file system -during the bootstrap process. -Either the root file system has been corrupted, -or the system is attempting to use the wrong device as root file system. -Usually, an alternate copy of the system binary or an alternate root -file system can be used to bring up the system to investigate. -Most often -this is done by the use of the boot floppy you used to install the system, -and then using the -.Dq fixit -floppy. +.It Mounting from failed with error +The system was unable to mount the configured root filesystem. +Either the root filesystem has been corrupted, +or the system is attempting to use the wrong device as root filesystem. +.Pp +This is not a panic message; rather it is followed by an interactive +.Sy mountroot> +prompt where the operator can list detected devices and filesystems, +and select an alternative root filesystem to mount. +Alternatively, the system can be booted from recovery media to repair +the situation. +The system install media provides a live environment which is suitable +for this task. .Pp .It "init: not found" This is not a panic message, as reboots are likely to be futile. @@ -108,11 +109,6 @@ after a crash, hardware failures, or other condition that should not normally occur. A file system check will normally correct the problem. .Pp -.It "timeout table full" -This really should not be a panic, but until the data structure -involved is made to be extensible, running out of entries causes a crash. -If this happens, make the timeout table bigger. -.Pp .\" .It "trap type %d, code = %x, v = %x" .\" An unexpected trap has occurred within the system; the trap types are: .\" .Bl -column xxxx -offset indent From nobody Mon Jul 28 12:43:13 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 4brJ6p3vXDz632RD; Mon, 28 Jul 2025 12:43:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brJ6p16jBz3lkj; Mon, 28 Jul 2025 12:43:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753706594; 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=+EmnI8gz//GYoYcYaClMAVE9tMtmxMBXx4Gxy+cQiTk=; b=RlWKrpSzkvFRy8HzJNtJcqaOgrMtG5YIKTTf9fpzdKyd1J64YSAPcXbgqjgsKFf+grMfPF qk+lnM6DmLyyGjiclRSHoYY9i1t5LrpRSMiOpHZ2yrljNGN0fMF5frDpG0jU1zLKwtoCSv uOauUzV24sne3jGUu+VSbf7LJub/XwrBRfxRiRJgVN2iwnry5m/H/QFsf5d43HfZP8Hzpe HW06CjcD/3W5nwEleYgxSXtNrsjzgwKPhr2wQ+onTccCcKxH7k5RxoBB+GdE3fqzzhan1r 8rxkcWgwEFdAwOdoTetubAmrSM4iqra6HFPc5M3PQiXh2jGwllcYO5vn/oLIbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753706594; 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=+EmnI8gz//GYoYcYaClMAVE9tMtmxMBXx4Gxy+cQiTk=; b=bwbJagKJp8EgbVMJ7GrKmp7/kxJeuhZ6ImtaVk3TWKg/87F3yOvIhh828vSdc5a7837Wp5 JupURKttZg09CPy24taCTMSoJC3PiM6t+6kCwIkfHSeZa/UP/LGHuKAjcn2dQV41JpipP4 jxiYIS0/WWFqQWgip5zUXH+LFP9b1PodmU6mrxzkv0mCTebwhO5gbX5QmkilC/LULWEYxc j5+KrLPXOtoxmsksGdRBpUjJL1Y00iR+QqnlYxrDyEaealjGfzcKi2Q2JGYz8joC3kKZI7 icRIfeOjR0eU0j756wrHMUdRt+lLtXzcM+aLiZwZ+8UbAg4IRE6egPAK0p56cQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753706594; a=rsa-sha256; cv=none; b=JoaV8er77GjXpmaHgcQpJfzrdUXQhAt25v3mR223uy/UxkZybESWLRxUzEMnLiBKEmjyz0 riPO16ZguS1UROK6nNaP6CWIYBFAgbaeEW8YaryN7Xxzd64wxhvy7xb83/JHIvja6BIuDt mtRzxiYMfKQqxLCt9nr0JxpmYK5EFlx5d25dn+lGznNys2Kyyl4PygFICCsbv/5oyBDk1U 4um/5IK0cpUyrlxBX59W6WYFTmruCrXn0gxsgABUl//1firudQLJzOF2fL2BSIYEWQIK3a NYDenobX8vbo3TUKGTPRS6k8WNmhdcZaS/ATR0NQUd7H5m1c6OdvTNDcdecyLQ== 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 4brJ6n3Md7zmdc; Mon, 28 Jul 2025 12:43:13 +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 56SChDpD092155; Mon, 28 Jul 2025 12:43:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SChDY5092152; Mon, 28 Jul 2025 12:43:13 GMT (envelope-from git) Date: Mon, 28 Jul 2025 12:43:13 GMT Message-Id: <202507281243.56SChDY5092152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: f72c7affddfe - stable/14 - pom.6: add a more complete bibliography 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f72c7affddfe2c97cb8b3fd11a4dbf03ef69c9ff Auto-Submitted: auto-generated The branch stable/14 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=f72c7affddfe2c97cb8b3fd11a4dbf03ef69c9ff commit f72c7affddfe2c97cb8b3fd11a4dbf03ef69c9ff Author: Lexi Winter AuthorDate: 2025-07-24 21:12:50 +0000 Commit: Lexi Winter CommitDate: 2025-07-28 09:22:13 +0000 pom.6: add a more complete bibliography Source: Wikipedia (cherry picked from commit bf0ee5f2175a3c6eb52f9fc74b93b445d37a6086) --- usr.bin/pom/pom.6 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.bin/pom/pom.6 b/usr.bin/pom/pom.6 index 7b8248ed78a0..7d41d0c5ec61 100644 --- a/usr.bin/pom/pom.6 +++ b/usr.bin/pom/pom.6 @@ -27,7 +27,7 @@ .\" .\" @(#)pom.6 8.1 (Berkeley) 5/31/93 .\" -.Dd July 14, 2010 +.Dd July 24, 2025 .Dt POM 6 .Os .Sh NAME @@ -62,4 +62,10 @@ but not has been specified, it will calculate the phase of the moon on that day at midnight. .Sh SEE ALSO -`Practical Astronomy with Your Calculator' by Duffett-Smith. +.Rs +.%A Peter Duffett-Smith +.%B Practical Astronomy with Your Calculator +.%I Cambridge University Press +.%C Cambridge, UK +.%D 1979 +.Re From nobody Mon Jul 28 13:31:07 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 4brKB320t0z634n2; Mon, 28 Jul 2025 13:31:07 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB30zr8z3tTm; Mon, 28 Jul 2025 13:31:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709467; 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=+o25H69hxQ3et0t8XhmqwxS4xlWzsx6yNtG2ujCPpYU=; b=DUIDpfqDGE9xpvBo+ujVkWa+0Xh0/ccznIdlMpq9VkL1eWVVR84qJwcisVUcf8SHCV399D nPWgZZnFR5gmWAl+td6pbueggYPbCc50Y7dnhkzPUDbi7jn1T4opCp8D3sjVIWuI7OzW0x f38SJjSrnUCZq42xrcMNYm6Z1xqEUJYWcr3Ro3+QAuOiOy8S5rHziNwglYLIuOGyKW3MB9 7648lNpiG7x98wrKtTdKXRY7KAbVtkdS5najUeIyUp5E3x9nh3ZmmaAWnQibMBTWxzT6wW Z9K7eNAzdS+BIfAPrJEKqdQc3hGGDGSjGhZ4Jegnvl/XJtiIWBXv78/1E0uZRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709467; 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=+o25H69hxQ3et0t8XhmqwxS4xlWzsx6yNtG2ujCPpYU=; b=UKAk1iDBEj/WSYswhCbPqAnG4ornSSZGPRCqWbp3u0GxxxDhF/eSWY9tV+oK+sx7nB1VjT ePBvh1ez7aS+ywJ+sywnfVsrhp6gHM2Cs+KPb0BXfWU5GeQ/GodwwuGrAGNFG4imljOVjT MZ6mbCbg5hsB+iMsV5xNJnJtNo8iBEcYJpn+hGo0kY0GuIjsbtyasXWLRYqMH/7H3yvo2C f1BUUwMQnnEFMfyXM0DyyUhh/etSm0qES4nYv5r7m4/xqaxO8fgkKOmmdX5fe/rYz1G06e qILykXGPYjk0hx2T0Z1GkOiEmpNdYWSDAu1p/Yk4EreyyEQHxY68iYZKjt5EZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709467; a=rsa-sha256; cv=none; b=gWh688OZaWjNpWe4lOmcHKvQuH6Vow8DjHbTrzqNHEhmPr1GHAhnpfxhE+Ek+55WzmHrjX SMs0mc2pNeVQ5Z8JZIX/PK8kXJiTmKnzQWifFjHzYwQFDtRcKAqxd4h3+2QHDtyOVDCZa8 xIjNUOzTnzxuSl6jY3TEh9yYXD20Raop6Bl2HNtZ8Upp9LowYu2bMp4ecJwbyueQ/qd+pR jkCoPDUydfLO4I0Kf0B4lJlynTm7T7S6Je8yofzmG78qem244P+XdGC4SToIOW/7UHBdea DCQVGX0sR4KhucptoBSMZTJsFZSRpyekANfyn8lL0mpt8FvzSNIgV5mhbFNARw== 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 4brKB30VmNznfC; Mon, 28 Jul 2025 13:31:07 +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 56SDV7xj079855; Mon, 28 Jul 2025 13:31:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDV7GU079852; Mon, 28 Jul 2025 13:31:07 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:07 GMT Message-Id: <202507281331.56SDV7GU079852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 68d289075c76 - stable/14 - sys/param.h: Split some macros into new 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 68d289075c766bd742913023a56569863121021b Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=68d289075c766bd742913023a56569863121021b commit 68d289075c766bd742913023a56569863121021b Author: Olivier Certner AuthorDate: 2025-06-06 20:25:21 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:27:52 +0000 sys/param.h: Split some macros into new Goal is to avoid having to include the full just to get some common useful macros. More macros can be moved into it as needed. This is in preparation for using NBBY and howmany() from . Reviewed by: kib, imp (both older version) MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50880 (cherry picked from commit b93161a7e38d37ce560ca562b1f1c18f73551cc2) --- sys/sys/_param.h | 28 ++++++++++++++++++++++++++++ sys/sys/param.h | 15 ++------------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/sys/sys/_param.h b/sys/sys/_param.h new file mode 100644 index 000000000000..a7ea071c456a --- /dev/null +++ b/sys/sys/_param.h @@ -0,0 +1,28 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + */ + +#ifndef _SYS__PARAM_H_ +#define _SYS__PARAM_H_ + +#define NBBY 8 /* number of bits in a byte */ +#define NBPW sizeof(int) /* number of bytes per word (integer) */ + +/* + * Macros for counting and rounding. + */ +#define nitems(x) (sizeof((x)) / sizeof((x)[0])) +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#define rounddown(x, y) (((x)/(y))*(y)) +#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ +#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ +#define powerof2(x) ((((x)-1)&(x))==0) + +#endif /* _SYS__PARAM_H_ */ diff --git a/sys/sys/param.h b/sys/sys/param.h index 68cbc92b5791..74490f5e6e0e 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -40,6 +40,7 @@ #define _SYS_PARAM_H_ #include +#include #define BSD 199506 /* System version (year & month). */ #define BSD4_3 1 @@ -251,9 +252,6 @@ #define NZERO 0 /* default "nice" */ -#define NBBY 8 /* number of bits in a byte */ -#define NBPW sizeof(int) /* number of bytes per word (integer) */ - #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ #define NODEV (dev_t)(-1) /* non-existent device */ @@ -317,16 +315,7 @@ #define isclr(a,i) \ ((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) -/* Macros for counting and rounding. */ -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif -#define nitems(x) (sizeof((x)) / sizeof((x)[0])) -#define rounddown(x, y) (((x)/(y))*(y)) -#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ -#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ -#define powerof2(x) ((((x)-1)&(x))==0) +/* Macros for counting and rounding provided by . */ /* Macros for min/max. */ #define MIN(a,b) (((a)<(b))?(a):(b)) From nobody Mon Jul 28 13:31:08 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 4brKB44d9Gz634vW; Mon, 28 Jul 2025 13:31:08 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB42MMyz3tDd; Mon, 28 Jul 2025 13:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709468; 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=zTqj4DKyDqXD6giLw6lwz9FQ4wZGKhsxw2QMIgt3T9Q=; b=fY0X6+CB+wdRrom/zhxwOnFo3cYwO12rlpS2tWGECXnFW8YuDkVO23mN8HynFHWN6ITwfy VtNBNAbSqL7CMVFsuqeOs208phV8Ck8hCGBW6P89GE7j8Vz/vMGRfnmQ/VTHv5tKu/lsF0 CA1oMUok0V5tXEMEmPw2uLFaghE6YN+e4hu8ytRj0/HX/9VUVeztfFJcsm5HEYcJ5JGalr rSY8QwGH14NMEgVxuvqjAiJ0Tp0AxO0bAaY8XT+jY4R0RnZusj4Alm605jvzw9l79Dht05 eTbgaCmm0zKDl6M7FzkO7ptZXlBWDQllAxY0dsgZjz64R6o3WpbkzW0elBjk7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709468; 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=zTqj4DKyDqXD6giLw6lwz9FQ4wZGKhsxw2QMIgt3T9Q=; b=dKFtYecV4rMfmizWqCFFprXJ+8AAq1MYzxaDcilYY1a8p/uPd85Ee3yw3zGAKMP5vBN0bI qX6J9aHTY2ucXbYYDamwGiXF+63WoPfuhn8gmbUn3ffgX6Sd5IMB/TYSICBC72w9NZAOqk 2NMVV9WXsErxr48i1/99uUXIPG+95/+RavBbfPZCd8XY1beN6xEdsmwAnYTMq8lhTwbJvl XzB2WunquCUlaEbw8U4PMFsntGCYDQnR52hSJmVePaw+Z19YKfNtExTK6aA63oeu55o6GK K5ht0OgqCc2ZGmNxYahzna3f80IvUTd5v4rNpRQSvbfHH17Ba0WPDl4urv5ByQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709468; a=rsa-sha256; cv=none; b=md43TV0XDHD6IRGyBP7Ft0732dWMdCMQRbjfG8ve7WE608lQ3pnrVXUQDmi/yTWqGn43vN V7Uqj0pTkAd/ZWCc7c90jdHBiXV1OQFIJNHws4yUS+t/GOUtkTzPWaHLWJ+bvsrv3tViF7 YhYUJbx9j9E6XcN6pDw8UUEz6gcSbzXMLXk9cwOs/W7BF2FQKU/DXWVLsry/tT6/YOgyNJ 7BT8r9ZY+Y5d4+g0R8BtWCQ8OX+3CWROJ5/fo6qHFtg1W0vQfJXx6WfzHwseWGKfN9D9Zf 4ZLNYCLEJtKuVbxiTj8HcH5eg5lqot3X+FyNgugeq0UKXCzODY0bMUeqFhAG7g== 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 4brKB41BWHznfD; Mon, 28 Jul 2025 13:31:08 +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 56SDV8dT079889; Mon, 28 Jul 2025 13:31:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDV8bm079886; Mon, 28 Jul 2025 13:31:08 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:08 GMT Message-Id: <202507281331.56SDV8bm079886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: fac3e1d3bc19 - stable/14 - runq: Deduce most parameters, remove machine headers 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fac3e1d3bc1900617c1995289b2eefaf55e96c68 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=fac3e1d3bc1900617c1995289b2eefaf55e96c68 commit fac3e1d3bc1900617c1995289b2eefaf55e96c68 Author: Olivier Certner AuthorDate: 2024-02-26 18:12:42 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:27:58 +0000 runq: Deduce most parameters, remove machine headers The 'runq' machinery now depends on only two settable parameters, RQ_MAX_PRIO, the maximum priority number that can be accepted, the minimum being 0, and RQ_PPQ, the number of priorities per queue (to reduce the number of queues). All other parameters are deduced from these ones. Also, all architectures automatically get a runq word that is their natural word. RQB_FFS() always was 'ffsl() - 1' except for amd64 where it was 'bsfq()'. Now that all these finally call compiler builtins, the resulting assembly code is the same, so there is no cost to removing this special case. After all these changes, headers have no more purpose, so remove them. While here, fix potentially confusing parameter name for RQB_WORD() and RQB_BIT(). While here, include all necessary headers so that can be included standalone. No functional change (intended). Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 2fefe2c88b31dc7f173c9424f3eb13d49e98d55a) --- sys/amd64/include/runq.h | 46 -------------------------------------- sys/arm/include/runq.h | 46 -------------------------------------- sys/arm64/include/runq.h | 50 ----------------------------------------- sys/i386/include/runq.h | 46 -------------------------------------- sys/kern/kern_switch.c | 6 ++--- sys/kern/sched_ule.c | 6 ++--- sys/powerpc/include/runq.h | 55 ---------------------------------------------- sys/riscv/include/runq.h | 44 ------------------------------------- sys/sys/runq.h | 25 ++++++++++++++++++--- 9 files changed, 27 insertions(+), 297 deletions(-) diff --git a/sys/amd64/include/runq.h b/sys/amd64/include/runq.h deleted file mode 100644 index 8d3b55be11a8..000000000000 --- a/sys/amd64/include/runq.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (1) /* Number of priority status words. */ -#define RQB_L2BPW (6) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1<> RQB_L2BPW) - -#define RQB_FFS(word) (bsfq(word)) - -/* - * Type of run queue status word. - */ -typedef u_int64_t rqb_word_t; - -#endif diff --git a/sys/arm/include/runq.h b/sys/arm/include/runq.h deleted file mode 100644 index c461a0702599..000000000000 --- a/sys/arm/include/runq.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (2) /* Number of priority status words. */ -#define RQB_L2BPW (5) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1<> RQB_L2BPW) - -#define RQB_FFS(word) (ffs(word) - 1) - -/* - * Type of run queue status word. - */ -typedef u_int32_t rqb_word_t; - -#endif diff --git a/sys/arm64/include/runq.h b/sys/arm64/include/runq.h deleted file mode 100644 index 5076bd9169df..000000000000 --- a/sys/arm64/include/runq.h +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifdef __arm__ -#include -#else /* !__arm__ */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (1) /* Number of priority status words. */ -#define RQB_L2BPW (6) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1<> RQB_L2BPW) - -#define RQB_FFS(word) (ffsl(word) - 1) - -/* - * Type of run queue status word. - */ -typedef unsigned long rqb_word_t; - -#endif - -#endif /* !__arm__ */ diff --git a/sys/i386/include/runq.h b/sys/i386/include/runq.h deleted file mode 100644 index c461a0702599..000000000000 --- a/sys/i386/include/runq.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (2) /* Number of priority status words. */ -#define RQB_L2BPW (5) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1<> RQB_L2BPW) - -#define RQB_FFS(word) (ffs(word) - 1) - -/* - * Type of run queue status word. - */ -typedef u_int32_t rqb_word_t; - -#endif diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 191d58edf4c4..610566bcfacf 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -57,8 +57,6 @@ #endif #endif -CTASSERT((RQB_BPW * RQB_LEN) == RQ_NQS); - /* * kern.sched.preemption allows user space to determine if preemption support * is compiled in or not. It is not currently a boot or runtime flag that @@ -297,7 +295,7 @@ runq_findbit(struct runq *rq) rqb = &rq->rq_status; for (i = 0; i < RQB_LEN; i++) if (rqb->rqb_bits[i]) { - pri = RQB_FFS(rqb->rqb_bits[i]) + (i << RQB_L2BPW); + pri = RQB_FFS(rqb->rqb_bits[i]) + i * RQB_BPW; CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d pri=%d", rqb->rqb_bits[i], i, pri); return (pri); @@ -323,7 +321,7 @@ again: mask = rqb->rqb_bits[i] & mask; if (mask == 0) continue; - pri = RQB_FFS(mask) + (i << RQB_L2BPW); + pri = RQB_FFS(mask) + i * RQB_BPW; CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d pri=%d", mask, i, pri); return (pri); diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 1aa95e984033..b30e3ac673f5 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -397,7 +397,7 @@ runq_print(struct runq *rq) i, rq->rq_status.rqb_bits[i]); for (j = 0; j < RQB_BPW; j++) if (rq->rq_status.rqb_bits[i] & (1ul << j)) { - pri = j + (i << RQB_L2BPW); + pri = j + i * RQB_BPW; rqh = &rq->rq_queues[pri]; TAILQ_FOREACH(td, rqh, td_runq) { printf("\t\t\ttd %p(%s) priority %d rqindex %d pri %d\n", @@ -1203,7 +1203,7 @@ again: for (; bit < RQB_BPW; bit++) { if ((rqb->rqb_bits[i] & (1ul << bit)) == 0) continue; - rqh = &rq->rq_queues[bit + (i << RQB_L2BPW)]; + rqh = &rq->rq_queues[bit + i * RQB_BPW]; TAILQ_FOREACH(td, rqh, td_runq) { if (first) { if (THREAD_CAN_MIGRATE(td) && @@ -1244,7 +1244,7 @@ runq_steal(struct runq *rq, int cpu) for (bit = 0; bit < RQB_BPW; bit++) { if ((rqb->rqb_bits[word] & (1ul << bit)) == 0) continue; - rqh = &rq->rq_queues[bit + (word << RQB_L2BPW)]; + rqh = &rq->rq_queues[bit + word * RQB_BPW]; TAILQ_FOREACH(td, rqh, td_runq) if (THREAD_CAN_MIGRATE(td) && THREAD_CAN_SCHED(td, cpu)) diff --git a/sys/powerpc/include/runq.h b/sys/powerpc/include/runq.h deleted file mode 100644 index 83ffacde4053..000000000000 --- a/sys/powerpc/include/runq.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#ifdef __powerpc64__ -#define RQB_LEN (1UL) /* Number of priority status words. */ -#define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#else -#define RQB_LEN (2) /* Number of priority status words. */ -#define RQB_L2BPW (5) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#endif -#define RQB_BPW (1UL<> RQB_L2BPW) - -#define RQB_FFS(word) (ffsl(word) - 1) - -/* - * Type of run queue status word. - */ -#ifdef __powerpc64__ -typedef u_int64_t rqb_word_t; -#else -typedef u_int32_t rqb_word_t; -#endif - -#endif diff --git a/sys/riscv/include/runq.h b/sys/riscv/include/runq.h deleted file mode 100644 index 3a7de010cd72..000000000000 --- a/sys/riscv/include/runq.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (1) /* Number of priority status words. */ -#define RQB_L2BPW (6) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1<> RQB_L2BPW) - -#define RQB_FFS(word) (ffsl(word) - 1) - -/* - * Type of run queue status word. - */ -typedef unsigned long rqb_word_t; - -#endif diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 1a54e83a7db3..d40fee25846e 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -29,7 +29,14 @@ #ifndef _RUNQ_H_ #define _RUNQ_H_ -#include +#include +#include + +#ifdef _KERNEL +#include +#else +#include +#endif struct thread; @@ -37,8 +44,20 @@ struct thread; * Run queue parameters. */ -#define RQ_NQS (64) /* Number of run queues. */ -#define RQ_PPQ (4) /* Priorities per queue. */ +#define RQ_MAX_PRIO (255) /* Maximum priority (minimum is 0). */ +#define RQ_PPQ (4) /* Priorities per queue. */ + +/* + * Deduced from the above parameters and machine ones. + */ +typedef unsigned long rqb_word_t; /* runq's status words type. */ + +#define RQ_NQS (howmany(RQ_MAX_PRIO + 1, RQ_PPQ)) /* Number of run queues. */ +#define RQB_BPW (sizeof(rqb_word_t) * NBBY) /* Bits per runq word. */ +#define RQB_LEN (howmany(RQ_NQS, RQB_BPW)) /* Words to cover RQ_NQS queues. */ +#define RQB_WORD(idx) ((idx) / RQB_BPW) +#define RQB_BIT(idx) (1ul << ((idx) % RQB_BPW)) +#define RQB_FFS(word) (ffsl((long)(word)) - 1) /* Assumes two-complement. */ /* * Head of run queues. From nobody Mon Jul 28 13:31:09 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 4brKB60FGyz634yF; Mon, 28 Jul 2025 13:31:10 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB54jK3z3tBJ; Mon, 28 Jul 2025 13:31:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709469; 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=SXKCrmdvD5uf+moFyvJPcZsUlgX2/dihjNuZiWC/92A=; b=lxJtrOxJBeCMP7McV9j+ROAS4gQXnxM1CTb1YsdEApVaFNaKqIvC4UQhNpvH13qgctiuq1 nM7k0u+oQY86ZXziFQwV060BNlDOUG13Kufmu0AAZkOo7/P3OAw+egF85GoJWr8MqUFfAP /K9+krFjWUfnWKyRemhnzW8nNYcV/Zv5nvakvwdGq/oL21uBfGSIKXlqE80mDweJtUlu/B 5QhhZBeNG0Snm3rmI2Nmx6GVfy4Rah95lgQV6kpGJifju3ej+2hWNIOCqALPR4qCgFKAy2 iWRJ9yHd+oKuHOa/cpbwcmtPo6zGEzjBX9Y8zPUK2WJIXAfB7pO+Ni87RkpL9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709469; 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=SXKCrmdvD5uf+moFyvJPcZsUlgX2/dihjNuZiWC/92A=; b=G3mof4PRyC3CY86PugtkcD6xWkE6Rv2UjPtDdJdvSCK+q7uTYO8nQhKrC7iI2blndoHYEw +SkOcVJs4zv5DK7vlbfGi8H9IzKPyd0wY8yFayyKN8HD8uypwyU5KkJWvIi9MOmbt9I8Id l5cZftvCkQH8OvYbX44zaXZeCUudzc/ZD1XjSOo1pvy/Ay0zhGksvcbZBB0QlTTX2G1/nd lE7Ztw+82eCGiuEba4Hcvbi5DzkWnt61SDQd1qeLOvw5Vx/k1xcWfnbydwvUkQ40KKcF2E Z5EDmA1UKI6MQzMPOHwAM5FyDH1dMSNdGEjROGzXhli+r2P4L+WVgqnf597GnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709469; a=rsa-sha256; cv=none; b=rJLfa7ioogNcuPUN32A62srbf9gR4SuwW7xlOmKl6IOJ0kgqu+kwr/B6OPVYBX7XrFHIoZ oxJuEI3MViTGTl3dDP2Inm0TYS8rcvaact87JH5uy0ut7YG4GeGYY4EbInw5HCvrvZZo3L X8+TfIdxUKosT1xNzEN+R32SKKJWhwSgit8NmCtt1yVaHwk2lwk44EQwHMEXOXs01WM66l CtwNKBYYd2ND1ioYYOSEShewe7X2I98N1coi6z1E8M4hNRMSmdWKPnlwtGV8bH/wcuaqL3 XSYB5ZQ22kkX5ymkVmw7bH3VEfr50zLqgHTcnRDDPwUWoLq/8NlTlYldgWE/vg== 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 4brKB52RbvznFx; Mon, 28 Jul 2025 13:31:09 +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 56SDV9uT079922; Mon, 28 Jul 2025 13:31:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDV9pk079919; Mon, 28 Jul 2025 13:31:09 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:09 GMT Message-Id: <202507281331.56SDV9pk079919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 3f5f50ca526f - stable/14 - runq: More selective includes of to reduce pollution 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3f5f50ca526fd485aacf0198c6f1ecc948e4bade Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=3f5f50ca526fd485aacf0198c6f1ecc948e4bade commit 3f5f50ca526fd485aacf0198c6f1ecc948e4bade Author: Olivier Certner AuthorDate: 2024-03-27 17:54:54 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:00 +0000 runq: More selective includes of to reduce pollution doesn't need . Remove this include and add it back for kernel files that relied on the pollution. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit c21c24adde9822a7f364e131ad7b0c4008723502) --- sys/dev/usb/usb_process.h | 1 - sys/kern/kern_switch.c | 1 + sys/kern/sched_4bsd.c | 1 + sys/kern/sched_ule.c | 1 + sys/sys/proc.h | 1 - 5 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/usb_process.h b/sys/dev/usb/usb_process.h index 745d214d2106..1962bdb8b607 100644 --- a/sys/dev/usb/usb_process.h +++ b/sys/dev/usb/usb_process.h @@ -31,7 +31,6 @@ #ifndef USB_GLOBAL_INCLUDE_FILE #include #include -#include #endif /* defines */ diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 610566bcfacf..58dfc8fc8497 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index ff1e57746404..bd8da419736a 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index b30e3ac673f5..c3b980dd2924 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 4981a5894941..a094af09a21a 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -55,7 +55,6 @@ #include #include #include /* XXX. */ -#include #include #include #include From nobody Mon Jul 28 13:31:10 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 4brKB83QfPz634n5; Mon, 28 Jul 2025 13:31:12 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB70TjFz3tDx; Mon, 28 Jul 2025 13:31:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709471; 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=MiLz85OTmOwdDybECKhTFf4LBiDzMbq2wA1qPTgjZ8s=; b=ou3YGMcONJEo8tSll2RdrpcCW5rZ8wuvtHc1dAJWJRu8TpvjjtXd59bKdkis+xpODn9ELJ CEf36me/eSmlPpurVUZAjPxvH74KLV+WVBOJ07Wr+VZCyJOlk9aZ+sOG9EO5x708Cj7qYW pN657uUSXtxyD8nVerY4yVxirZ698zJ27ULHxETjaYiWGQ2lqnxXzex4g6izA/mMahSCA5 NMQ4qNzdlPzACwv2yTwLiTwK5Zq26+utA2i8CQzLmY31Nhkpc/4tj078ta6q2qMJ5AxQhf V64eWvWx2Iw8UZK/rnD8MoBelhgV58exGrQzne0X4htJMy2NI8Z1MvMCM8pMIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709471; 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=MiLz85OTmOwdDybECKhTFf4LBiDzMbq2wA1qPTgjZ8s=; b=IvocnxePQfoQRSFVmIuSCUIi9E6b5d+QX9iznMQx2sMUApeXnbXRqtktu6jOPfHZEb0Qup G1rd8Bnnzfr3Uj2lOK0hFRT7iCTh56iVqUX+pIutYBijb7BhYtX2HfWVwHH6952TzCgzcd IltVLB46xTrdLn05OlL/0RIdsOS5SL5ha3iXgIhyePpkGYpee5G5N7FJXNXnAtXmaJI6Nk qG5cpNT2vVL+HdqrVoFfcPi2best+CYvVrljkGG7W5LxHLs7dLWh4lz1uCzd2kxlwOIipB GrWkVZqCLH+3RbBEb9agHRwfAtkYpRSevQdddP9hOxDOMV26kHH6nb+FCM7C7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709471; a=rsa-sha256; cv=none; b=ZgdHiyh2hCbKdZ31WGskTUSU4avDoN33WzPO+I01eQAB331TIV8sCpT82ErhOWplzxfU+7 KTdPaQZGdCJr46FUl0E5ImdjUJ5UC//oi6uEIgQwQ3Hj7uLNyP0yuk89HlZXuLZ+DmiNiS I7RXtCp1r7ppbIbcnTVNsnbQXmPBqMBS6KhpLETUdvR+iDs5ucgLVh/4ijRqIWk98d3QSC +EKDAduOvBQLoHAYawjnzhh2YD1/Wmq8lpJZDtZqQrndoKTd9G8MauBNpRENp5IYxl0enm w+hekO61ot/0MWZF/pGugOgCfjf5MbP5ug7l/c8xEfMPNz/4E1jjDmY3K9sTkA== 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 4brKB63JMBznfF; Mon, 28 Jul 2025 13:31:10 +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 56SDVAdq079958; Mon, 28 Jul 2025 13:31:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVAaB079955; Mon, 28 Jul 2025 13:31:10 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:10 GMT Message-Id: <202507281331.56SDVAaB079955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 3020792db818 - stable/14 - runq: Hide function prototypes under _KERNEL 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3020792db81819455f3b9ad6ca29f420c54e6971 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=3020792db81819455f3b9ad6ca29f420c54e6971 commit 3020792db81819455f3b9ad6ca29f420c54e6971 Author: Olivier Certner AuthorDate: 2024-03-28 13:32:17 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:01 +0000 runq: Hide function prototypes under _KERNEL And some structure definitions as well. This header really is not supposed to be included by userland, so should just error in this case. However, there is one remaining use for it in a test: Getting the value of RQ_PPQ to ensure a big enough priority level difference in order to guarantee that a realtime thread preempts another. This use will soon be obsoleted by guaranteeing that a realtime thread always preempts another one with lower priority, even if the priority level is very close. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 28b54827f5c10212de752a8e2c4eaf07170d242c) --- sys/sys/runq.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/sys/runq.h b/sys/sys/runq.h index d40fee25846e..b9cfa847617b 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -30,7 +30,6 @@ #define _RUNQ_H_ #include -#include #ifdef _KERNEL #include @@ -38,8 +37,6 @@ #include #endif -struct thread; - /* * Run queue parameters. */ @@ -59,6 +56,12 @@ typedef unsigned long rqb_word_t; /* runq's status words type. */ #define RQB_BIT(idx) (1ul << ((idx) % RQB_BPW)) #define RQB_FFS(word) (ffsl((long)(word)) - 1) /* Assumes two-complement. */ + +#ifdef _KERNEL +#include + +struct thread; + /* * Head of run queues. */ @@ -90,5 +93,6 @@ struct thread *runq_choose_fuzz(struct runq *, int); void runq_init(struct runq *); void runq_remove(struct runq *, struct thread *); void runq_remove_idx(struct runq *, struct thread *, u_char *); +#endif /* _KERNEL */ #endif From nobody Mon Jul 28 13:31:11 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 4brKB91vwjz634vY; Mon, 28 Jul 2025 13:31:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB74g5dz3tN2; Mon, 28 Jul 2025 13:31:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709471; 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=o4UBIjDp/xuFGSJqD14xAevRmboeDlpgrNH1d3Xq2ec=; b=B7mXg8T+cQVjewAxJOGs6bY6FgXllpZFUUdydSfglRXp9cR2BWejKPo733EGskTSx16H6Y rU2Y/BlzcGh0t2L4Pz/+SGgGasaSiaQp5jDtjTwsAJby1tC/YPYKmVLAi6MOM6ZXn2ZYbh ypaYCY7Vi3AYehEEpdkutqEBjmM2csR8/ETbLCj2gvK+O4kgEOq1nF7CH0nZv7FwrQZnIf AmD2eHkhdheQVAg50/hCX/fZDdu00x1CTJQpUugt5vCt9/BX0WSB5LZ8QK+OkzfoEr9eTg fUsXJD5/YssDYVtPEt24tkQKUSJKJAvdTlrJDOpQY+QKNRXETRdHB34KYQWmmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709471; 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=o4UBIjDp/xuFGSJqD14xAevRmboeDlpgrNH1d3Xq2ec=; b=Ttiu3pujESHIZZE0zZlmDKTVtc4LjCFsWTFBWXW2SVIxGncnYqTOOnWasT7VR6Dn0p84SU /8JNeikUpLXiRR4IX9wFPvzc7gL0u1jYPJUckiFgTAdBfHnHgYm9jVUvSRk6cEhi8etvix JhlPBFiTHKxnr7M5LhrcofXwQjoaA+a/OhxUYcOwRh5z/riopFL9nOEJGDD733PoBBbdFX MH1EUdjbPwgObhAzt2S5D5q1EwvftN9fz3dgEDc/8TDWUk8eKDBw0hAu7p4niH+UcWg95A h8ovBMPLHT6s0iHZ7UzscTPlJo4SwjyEYC8b+yCO6Pm2hRGo3hKMAkrl8QrMsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709471; a=rsa-sha256; cv=none; b=CWzbc8TiODzTmHypinRrsgk/BkMCH65HRfCrrZlTj5fRjt8INGqRUb1FDTIDunaZfGBSOM cCnW4+8S1OguOGIQp85Qs8vD4zVumrKW5CNHmDyiz47CwPgMnTPsCXxgwGtkh2CHvQe/uV OxOvq8GAU5fC35YXCwP8qDrA7/2Z2m4y5KwsmJEW5XwdmDPxnid8Z6OD9uZoT8cC250Nj3 /juKRi/ww6Wax/QI9W0i7EZ+qLQwjjtLbErRy6Nj4g+0hmvAbewSZQwxTucgMdNboj5cXU e2Svp5TEtzs17RVbvIgzU2PQVy5Y80ZeHiMP4a8SzjqMsKSjdEUFJ/RKiQvu/Q== 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 4brKB73zQKznfH; Mon, 28 Jul 2025 13:31:11 +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 56SDVBAi079993; Mon, 28 Jul 2025 13:31:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVBQ3079990; Mon, 28 Jul 2025 13:31:11 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:11 GMT Message-Id: <202507281331.56SDVBQ3079990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 55731b34c3ff - stable/14 - runq: API tidy up: 'pri' => 'idx', 'idx' as int, remove runq_remove_idx() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 55731b34c3ffa651c7b4bb78ff797e58d95a8b59 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=55731b34c3ffa651c7b4bb78ff797e58d95a8b59 commit 55731b34c3ffa651c7b4bb78ff797e58d95a8b59 Author: Olivier Certner AuthorDate: 2024-02-27 17:44:12 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:03 +0000 runq: API tidy up: 'pri' => 'idx', 'idx' as int, remove runq_remove_idx() Make sure that external and internal users are aware that the runqueue API always expects queue indices, and not priority levels. Name arithmetic arguments in 'runq.h' for better immediate reference. Use plain integers to pass indices instead of 'u_char' (using the latter probably doesn't bring any gain, and an 'int' makes the API agnostic to a number of queues greater than 256). Add a static assertion that RQ_NQS can't be strictly greater than 256 as long as the 'td_rqindex' thread field is of type 'u_char'. Add a new macro CHECK_IDX() that checks that an index is non-negative and below RQ_NQS, and use it in all low-level functions (and "public" ones when they don't need to call the former). While here, remove runq_remove_idx(), as it knows a bit too much of ULE's internals, in particular by treating the whole runqueue as round-robin, which we are going to change. Instead, have runq_remove() return whether the queue from which the thread was removed is now empty, and leverage this information in tdq_runq_rem() (sched_ule(4)). While here, re-implement runq_add() on top of runq_add_idx() to remove its duplicated code (all lines except one). Introduce the new RQ_PRI_TO_IDX() macro to convert a priority to a queue index, and use it in runq_add() (many more uses will be introduced in later commits). While here, rename runq_check() to runq_not_empty() and have it return a boolean instead of an 'int', and same for sched_runnable() as an impact (and while here, fix a small style violation in sched_4bsd(4)'s version). While here, simplify sched_runnable(). While here, make standalone include-wise. No functional change intended. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit a11926f2a5f00b57ebff5bd548c9904b7f6e5800) --- sys/kern/kern_switch.c | 199 ++++++++++++++++++++++++------------------------- sys/kern/sched_4bsd.c | 11 +-- sys/kern/sched_ule.c | 37 ++++----- sys/sys/runq.h | 16 ++-- sys/sys/sched.h | 11 ++- 5 files changed, 137 insertions(+), 137 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 58dfc8fc8497..5c529862bc53 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -252,6 +252,15 @@ critical_exit_KBI(void) /************************************************************************ * SYSTEM RUN QUEUE manipulations and tests * ************************************************************************/ +_Static_assert(RQ_NQS <= 256, + "'td_rqindex' must be turned into a bigger unsigned type"); +/* A macro instead of a function to get the proper calling function's name. */ +#define CHECK_IDX(idx) ({ \ + __typeof(idx) _idx __unused = (idx); \ + KASSERT(0 <= _idx && _idx < RQ_NQS, \ + ("%s: %s out of range: %d", __func__, __STRING(idx), _idx)); \ +}) + /* * Initialize a run structure. */ @@ -266,92 +275,93 @@ runq_init(struct runq *rq) } /* - * Clear the status bit of the queue corresponding to priority level pri, - * indicating that it is empty. + * Clear the status bit of the queue at index 'idx', indicating that it is + * empty. */ static __inline void -runq_clrbit(struct runq *rq, int pri) +runq_clrbit(struct runq *rq, int idx) { struct rqbits *rqb; + CHECK_IDX(idx); rqb = &rq->rq_status; CTR4(KTR_RUNQ, "runq_clrbit: bits=%#x %#x bit=%#x word=%d", - rqb->rqb_bits[RQB_WORD(pri)], - rqb->rqb_bits[RQB_WORD(pri)] & ~RQB_BIT(pri), - RQB_BIT(pri), RQB_WORD(pri)); - rqb->rqb_bits[RQB_WORD(pri)] &= ~RQB_BIT(pri); + rqb->rqb_bits[RQB_WORD(idx)], + rqb->rqb_bits[RQB_WORD(idx)] & ~RQB_BIT(idx), + RQB_BIT(idx), RQB_WORD(idx)); + rqb->rqb_bits[RQB_WORD(idx)] &= ~RQB_BIT(idx); } /* * Find the index of the first non-empty run queue. This is done by - * scanning the status bits, a set bit indicates a non-empty queue. + * scanning the status bits, a set bit indicating a non-empty queue. */ static __inline int runq_findbit(struct runq *rq) { struct rqbits *rqb; - int pri; - int i; + int idx, i; rqb = &rq->rq_status; for (i = 0; i < RQB_LEN; i++) if (rqb->rqb_bits[i]) { - pri = RQB_FFS(rqb->rqb_bits[i]) + i * RQB_BPW; - CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d pri=%d", - rqb->rqb_bits[i], i, pri); - return (pri); + idx = RQB_FFS(rqb->rqb_bits[i]) + i * RQB_BPW; + CHECK_IDX(idx); + CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d idx=%d", + rqb->rqb_bits[i], i, idx); + return (idx); } return (-1); } static __inline int -runq_findbit_from(struct runq *rq, u_char pri) +runq_findbit_from(struct runq *rq, int idx) { struct rqbits *rqb; rqb_word_t mask; int i; - /* - * Set the mask for the first word so we ignore priorities before 'pri'. - */ - mask = (rqb_word_t)-1 << (pri & (RQB_BPW - 1)); + CHECK_IDX(idx); + /* Set the mask for the first word so we ignore indices before 'idx'. */ + mask = (rqb_word_t)-1 << (idx & (RQB_BPW - 1)); rqb = &rq->rq_status; again: - for (i = RQB_WORD(pri); i < RQB_LEN; mask = -1, i++) { + for (i = RQB_WORD(idx); i < RQB_LEN; mask = -1, i++) { mask = rqb->rqb_bits[i] & mask; if (mask == 0) continue; - pri = RQB_FFS(mask) + i * RQB_BPW; - CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d pri=%d", - mask, i, pri); - return (pri); + idx = RQB_FFS(mask) + i * RQB_BPW; + CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d idx=%d", + mask, i, idx); + return (idx); } - if (pri == 0) + if (idx == 0) return (-1); /* * Wrap back around to the beginning of the list just once so we * scan the whole thing. */ - pri = 0; + idx = 0; goto again; } /* - * Set the status bit of the queue corresponding to priority level pri, - * indicating that it is non-empty. + * Set the status bit of the queue at index 'idx', indicating that it is + * non-empty. */ static __inline void -runq_setbit(struct runq *rq, int pri) +runq_setbit(struct runq *rq, int idx) { struct rqbits *rqb; + CHECK_IDX(idx); rqb = &rq->rq_status; CTR4(KTR_RUNQ, "runq_setbit: bits=%#x %#x bit=%#x word=%d", - rqb->rqb_bits[RQB_WORD(pri)], - rqb->rqb_bits[RQB_WORD(pri)] | RQB_BIT(pri), - RQB_BIT(pri), RQB_WORD(pri)); - rqb->rqb_bits[RQB_WORD(pri)] |= RQB_BIT(pri); + rqb->rqb_bits[RQB_WORD(idx)], + rqb->rqb_bits[RQB_WORD(idx)] | RQB_BIT(idx), + RQB_BIT(idx), RQB_WORD(idx)); + rqb->rqb_bits[RQB_WORD(idx)] |= RQB_BIT(idx); } /* @@ -361,46 +371,38 @@ runq_setbit(struct runq *rq, int pri) void runq_add(struct runq *rq, struct thread *td, int flags) { - struct rqhead *rqh; - int pri; - - pri = td->td_priority / RQ_PPQ; - td->td_rqindex = pri; - runq_setbit(rq, pri); - rqh = &rq->rq_queues[pri]; - CTR4(KTR_RUNQ, "runq_add: td=%p pri=%d %d rqh=%p", - td, td->td_priority, pri, rqh); - if (flags & SRQ_PREEMPTED) { - TAILQ_INSERT_HEAD(rqh, td, td_runq); - } else { - TAILQ_INSERT_TAIL(rqh, td, td_runq); - } + + runq_add_idx(rq, td, RQ_PRI_TO_IDX(td->td_priority), flags); } void -runq_add_pri(struct runq *rq, struct thread *td, u_char pri, int flags) +runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) { struct rqhead *rqh; - KASSERT(pri < RQ_NQS, ("runq_add_pri: %d out of range", pri)); - td->td_rqindex = pri; - runq_setbit(rq, pri); - rqh = &rq->rq_queues[pri]; - CTR4(KTR_RUNQ, "runq_add_pri: td=%p pri=%d idx=%d rqh=%p", - td, td->td_priority, pri, rqh); + /* + * runq_setbit() asserts 'idx' is non-negative and below 'RQ_NQS', and + * a static assert earlier in this file ensures that 'RQ_NQS' is no more + * than 256. + */ + td->td_rqindex = idx; + runq_setbit(rq, idx); + rqh = &rq->rq_queues[idx]; + CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqh=%p", + td, td->td_priority, idx, rqh); if (flags & SRQ_PREEMPTED) { TAILQ_INSERT_HEAD(rqh, td, td_runq); } else { TAILQ_INSERT_TAIL(rqh, td, td_runq); } } + /* - * Return true if there are runnable processes of any priority on the run - * queue, false otherwise. Has no side effects, does not modify the run - * queue structure. + * Return true if there are some processes of any priority on the run queue, + * false otherwise. Has no side effects. */ -int -runq_check(struct runq *rq) +bool +runq_not_empty(struct runq *rq) { struct rqbits *rqb; int i; @@ -408,13 +410,13 @@ runq_check(struct runq *rq) rqb = &rq->rq_status; for (i = 0; i < RQB_LEN; i++) if (rqb->rqb_bits[i]) { - CTR2(KTR_RUNQ, "runq_check: bits=%#x i=%d", + CTR2(KTR_RUNQ, "runq_not_empty: bits=%#x i=%d", rqb->rqb_bits[i], i); - return (1); + return (true); } - CTR0(KTR_RUNQ, "runq_check: empty"); + CTR0(KTR_RUNQ, "runq_not_empty: empty"); - return (0); + return (false); } /* @@ -425,10 +427,10 @@ runq_choose_fuzz(struct runq *rq, int fuzz) { struct rqhead *rqh; struct thread *td; - int pri; + int idx; - while ((pri = runq_findbit(rq)) != -1) { - rqh = &rq->rq_queues[pri]; + while ((idx = runq_findbit(rq)) != -1) { + rqh = &rq->rq_queues[idx]; /* fuzz == 1 is normal.. 0 or less are ignored */ if (fuzz > 1) { /* @@ -451,10 +453,10 @@ runq_choose_fuzz(struct runq *rq, int fuzz) td = TAILQ_FIRST(rqh); KASSERT(td != NULL, ("runq_choose_fuzz: no proc on busy queue")); CTR3(KTR_RUNQ, - "runq_choose_fuzz: pri=%d thread=%p rqh=%p", pri, td, rqh); + "runq_choose_fuzz: idx=%d thread=%p rqh=%p", idx, td, rqh); return (td); } - CTR1(KTR_RUNQ, "runq_choose_fuzz: idleproc pri=%d", pri); + CTR1(KTR_RUNQ, "runq_choose_fuzz: idleproc idx=%d", idx); return (NULL); } @@ -467,71 +469,64 @@ runq_choose(struct runq *rq) { struct rqhead *rqh; struct thread *td; - int pri; + int idx; - while ((pri = runq_findbit(rq)) != -1) { - rqh = &rq->rq_queues[pri]; + while ((idx = runq_findbit(rq)) != -1) { + rqh = &rq->rq_queues[idx]; td = TAILQ_FIRST(rqh); KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); CTR3(KTR_RUNQ, - "runq_choose: pri=%d thread=%p rqh=%p", pri, td, rqh); + "runq_choose: idx=%d thread=%p rqh=%p", idx, td, rqh); return (td); } - CTR1(KTR_RUNQ, "runq_choose: idlethread pri=%d", pri); + CTR1(KTR_RUNQ, "runq_choose: idlethread idx=%d", idx); return (NULL); } struct thread * -runq_choose_from(struct runq *rq, u_char idx) +runq_choose_from(struct runq *rq, int from_idx) { struct rqhead *rqh; struct thread *td; - int pri; + int idx; - if ((pri = runq_findbit_from(rq, idx)) != -1) { - rqh = &rq->rq_queues[pri]; + if ((idx = runq_findbit_from(rq, from_idx)) != -1) { + rqh = &rq->rq_queues[idx]; td = TAILQ_FIRST(rqh); KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); CTR4(KTR_RUNQ, - "runq_choose_from: pri=%d thread=%p idx=%d rqh=%p", - pri, td, td->td_rqindex, rqh); + "runq_choose_from: idx=%d thread=%p idx=%d rqh=%p", + idx, td, td->td_rqindex, rqh); return (td); } - CTR1(KTR_RUNQ, "runq_choose_from: idlethread pri=%d", pri); + CTR1(KTR_RUNQ, "runq_choose_from: idlethread idx=%d", idx); return (NULL); } /* * Remove the thread from the queue specified by its priority, and clear the * corresponding status bit if the queue becomes empty. - * Caller must set state afterwards. + * + * Returns whether the corresponding queue is empty after removal. */ -void +bool runq_remove(struct runq *rq, struct thread *td) -{ - - runq_remove_idx(rq, td, NULL); -} - -void -runq_remove_idx(struct runq *rq, struct thread *td, u_char *idx) { struct rqhead *rqh; - u_char pri; - - KASSERT(td->td_flags & TDF_INMEM, - ("runq_remove_idx: thread swapped out")); - pri = td->td_rqindex; - KASSERT(pri < RQ_NQS, ("runq_remove_idx: Invalid index %d\n", pri)); - rqh = &rq->rq_queues[pri]; - CTR4(KTR_RUNQ, "runq_remove_idx: td=%p, pri=%d %d rqh=%p", - td, td->td_priority, pri, rqh); + int idx; + + KASSERT(td->td_flags & TDF_INMEM, ("runq_remove: Thread swapped out")); + idx = td->td_rqindex; + CHECK_IDX(idx); + rqh = &rq->rq_queues[idx]; + CTR4(KTR_RUNQ, "runq_remove: td=%p pri=%d idx=%d rqh=%p", + td, td->td_priority, idx, rqh); TAILQ_REMOVE(rqh, td, td_runq); if (TAILQ_EMPTY(rqh)) { - CTR0(KTR_RUNQ, "runq_remove_idx: empty"); - runq_clrbit(rq, pri); - if (idx != NULL && *idx == pri) - *idx = (pri + 1) % RQ_NQS; + runq_clrbit(rq, idx); + CTR1(KTR_RUNQ, "runq_remove: queue at idx=%d now empty", idx); + return (true); } + return (false); } diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index bd8da419736a..c6b789d060c3 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -684,13 +684,14 @@ schedinit_ap(void) /* Nothing needed. */ } -int +bool sched_runnable(void) { #ifdef SMP - return runq_check(&runq) + runq_check(&runq_pcpu[PCPU_GET(cpuid)]); + return (runq_not_empty(&runq) || + runq_not_empty(&runq_pcpu[PCPU_GET(cpuid)])); #else - return runq_check(&runq); + return (runq_not_empty(&runq)); #endif } @@ -872,7 +873,7 @@ sched_priority(struct thread *td, u_char prio) if (td->td_priority == prio) return; td->td_priority = prio; - if (TD_ON_RUNQ(td) && td->td_rqindex != (prio / RQ_PPQ)) { + if (TD_ON_RUNQ(td) && td->td_rqindex != RQ_PRI_TO_IDX(prio)) { sched_rem(td); sched_add(td, SRQ_BORING | SRQ_HOLDTD); } @@ -1683,7 +1684,7 @@ sched_idletd(void *dummy) for (;;) { mtx_assert(&Giant, MA_NOTOWNED); - while (sched_runnable() == 0) { + while (!sched_runnable()) { cpu_idle(stat->idlecalls + stat->oldidlecalls > 64); stat->idlecalls++; } diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index c3b980dd2924..13bef8ca9c1c 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -514,14 +514,14 @@ tdq_runq_add(struct tdq *tdq, struct thread *td, int flags) pri = (unsigned char)(pri - 1) % RQ_NQS; } else pri = tdq->tdq_ridx; - runq_add_pri(ts->ts_runq, td, pri, flags); + runq_add_idx(ts->ts_runq, td, pri, flags); return; } else ts->ts_runq = &tdq->tdq_idle; runq_add(ts->ts_runq, td, flags); } -/* +/* * Remove a thread from a run-queue. This typically happens when a thread * is selected to run. Running threads are not on the queue and the * transferable count does not reflect them. @@ -530,6 +530,7 @@ static __inline void tdq_runq_rem(struct tdq *tdq, struct thread *td) { struct td_sched *ts; + bool queue_empty; ts = td_get_sched(td); TDQ_LOCK_ASSERT(tdq, MA_OWNED); @@ -540,13 +541,16 @@ tdq_runq_rem(struct tdq *tdq, struct thread *td) tdq->tdq_transferable--; ts->ts_flags &= ~TSF_XFERABLE; } - if (ts->ts_runq == &tdq->tdq_timeshare) { - if (tdq->tdq_idx != tdq->tdq_ridx) - runq_remove_idx(ts->ts_runq, td, &tdq->tdq_ridx); - else - runq_remove_idx(ts->ts_runq, td, NULL); - } else - runq_remove(ts->ts_runq, td); + queue_empty = runq_remove(ts->ts_runq, td); + /* + * If thread has a batch priority and the queue from which it was + * removed is now empty, advance the batch's queue removal index if it + * lags with respect to the batch's queue insertion index. + */ + if (queue_empty && PRI_MIN_BATCH <= td->td_priority && + td->td_priority <= PRI_MAX_BATCH && + tdq->tdq_idx != tdq->tdq_ridx && tdq->tdq_ridx == td->td_rqindex) + tdq->tdq_ridx = (tdq->tdq_ridx + 1) % RQ_NQS; } /* @@ -2656,24 +2660,13 @@ sched_estcpu(struct thread *td __unused) * Return whether the current CPU has runnable tasks. Used for in-kernel * cooperative idle threads. */ -int +bool sched_runnable(void) { struct tdq *tdq; - int load; - - load = 1; tdq = TDQ_SELF(); - if ((curthread->td_flags & TDF_IDLETD) != 0) { - if (TDQ_LOAD(tdq) > 0) - goto out; - } else - if (TDQ_LOAD(tdq) - 1 > 0) - goto out; - load = 0; -out: - return (load); + return (TDQ_LOAD(tdq) > (TD_IS_IDLETHREAD(curthread) ? 0 : 1)); } /* diff --git a/sys/sys/runq.h b/sys/sys/runq.h index b9cfa847617b..693a3666d7a8 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -50,6 +50,8 @@ typedef unsigned long rqb_word_t; /* runq's status words type. */ #define RQ_NQS (howmany(RQ_MAX_PRIO + 1, RQ_PPQ)) /* Number of run queues. */ +#define RQ_PRI_TO_IDX(pri) ((pri) / RQ_PPQ) /* Priority to queue index. */ + #define RQB_BPW (sizeof(rqb_word_t) * NBBY) /* Bits per runq word. */ #define RQB_LEN (howmany(RQ_NQS, RQB_BPW)) /* Words to cover RQ_NQS queues. */ #define RQB_WORD(idx) ((idx) / RQB_BPW) @@ -58,6 +60,7 @@ typedef unsigned long rqb_word_t; /* runq's status words type. */ #ifdef _KERNEL +#include /* For bool. */ #include struct thread; @@ -84,15 +87,14 @@ struct runq { struct rqhead rq_queues[RQ_NQS]; }; -void runq_add(struct runq *, struct thread *, int); -void runq_add_pri(struct runq *, struct thread *, u_char, int); -int runq_check(struct runq *); +void runq_add(struct runq *, struct thread *, int _flags); +void runq_add_idx(struct runq *, struct thread *, int _idx, int _flags); +bool runq_not_empty(struct runq *); struct thread *runq_choose(struct runq *); -struct thread *runq_choose_from(struct runq *, u_char); -struct thread *runq_choose_fuzz(struct runq *, int); +struct thread *runq_choose_from(struct runq *, int _idx); +struct thread *runq_choose_fuzz(struct runq *, int _fuzz); void runq_init(struct runq *); -void runq_remove(struct runq *, struct thread *); -void runq_remove_idx(struct runq *, struct thread *, u_char *); +bool runq_remove(struct runq *, struct thread *); #endif /* _KERNEL */ #endif diff --git a/sys/sys/sched.h b/sys/sys/sched.h index 933f05385675..f5f48c5323c0 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -63,6 +63,15 @@ #define _SCHED_H_ #ifdef _KERNEL + +#include +#ifdef SCHED_STATS +#include +#endif + +struct proc; +struct thread; + /* * General scheduling info. * @@ -74,7 +83,7 @@ */ int sched_load(void); int sched_rr_interval(void); -int sched_runnable(void); +bool sched_runnable(void); /* * Proc related scheduling hooks. From nobody Mon Jul 28 13:31:12 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 4brKBB1rCmz634XX; Mon, 28 Jul 2025 13:31:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB86Xsrz3tHB; Mon, 28 Jul 2025 13:31:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709472; 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=1fOrEZIOnL+2H38XdyPblSpcJYUVPHbQ6RkSvPAC2oI=; b=ywO8Jmb/cJAsE++K+DV8ILkgW+RAldPs4gsUmM3juZrwUXcAGKuB+y8UW18SV/IBsvQG8F kH3LS5JZKyxKghtoQTN+9qqs4UAsLZ6O2P0q8BAkfrmhZ6iC90t+byLYePkX/hSYfMVVfS dQxCvkBqqW6ZAwG7Hyw4pYRV1FyNhnLCa0yJsWzV5bOFEmva6zOb0oHkGrTd9Ve0BgrAUt DuACgqBRzrjxzUisTRt7kTTRZe/jI3qOav8Mzg5gB1YuxPiBEJPGVmulNACQZhVrtR4HfI mKosmeeOhY0eUejyPxSJXRzGHvxvkf0FTO/N6n9CtIvyj4FV/8ebc8SXH2nwjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709472; 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=1fOrEZIOnL+2H38XdyPblSpcJYUVPHbQ6RkSvPAC2oI=; b=D1CcOasflOavDK4J21rF2RPV+jbAZAW9MP8zuJhcU7SmCmpifukWIsY04fH1agdOd4OMSn t5OI1YZC9eQGcPZLE3eFGogM8uPmcNuAjtz9R0CUB9wYTO37Vp6PG+Ue/M58FmmBz8DOpd /PC0/Aj0KMAID/CIWN/YB1q7KOpgWC3XqWO7uVOTo1GtFJEXsJCHLhmfn0wL4kL+PUweDi JVtsCsGO0a+V5DwOdXAuKdynb3AQ3FYCA28y71EL+znmx/3ufB33VlTuiMt0FlUYTjCgtz sWE80VvzgmtmTb56WWffc84P9C97Q6YRolylTxBoUSo42rbmD4YBvQdPYJNvyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709472; a=rsa-sha256; cv=none; b=aGBg1Drghs9CrxVD3dWBSrJyDElyNxNkvKGWnuz5t8JFN8vatrZJdOzqj2bIIFYMAEfWuM QMna8/Ygdg+pG8FENECXxnBLy0/XJcMlLl+l6DL6ZLVUdEOJAfMWp7h0ZvuVSWjzko/Swq LeIRoJNcT25HJTwmMuyn2k80/hPq5zCJu/XaS8sUkztBvOxhenD2lkO2aaoiAk0GY/nqRd SkbLeqAiFr3wN9W26D+XB9DLdWuAppCeplcH5PAlNdNnKdDOS8PkOUJeUWETdUTr4O5oE4 wNi2OL1Z7KAwwwCxEnF6goVVoc3C4/GXpkhiEIOMcauVFcrCQAu8PQXaS4+NUA== 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 4brKB84fJFznJQ; Mon, 28 Jul 2025 13:31:12 +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 56SDVCs9080025; Mon, 28 Jul 2025 13:31:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVCP9080022; Mon, 28 Jul 2025 13:31:12 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:12 GMT Message-Id: <202507281331.56SDVCP9080022@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: b6e0a4f51747 - stable/14 - runq: Clarity and style pass 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b6e0a4f51747375dfe80fda19a64930912a8ac33 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=b6e0a4f51747375dfe80fda19a64930912a8ac33 commit b6e0a4f51747375dfe80fda19a64930912a8ac33 Author: Olivier Certner AuthorDate: 2024-03-01 09:47:13 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:04 +0000 runq: Clarity and style pass In runq_choose() and runq_choose_fuzz(), replace an unnecessary 'while' with an 'if', and separate assignment and test of 'idx' into two lines. Add missing parentheses to one 'sizeof' operator. Remove superfluous brackets for one-line "then" and "else" branches (to match style elsewhere in the file). Declare loop indices in their 'for'. Test for non-empty bit sets with an explicit '!= 0'. Move TABs in some prototypes of (should not split the return type specifier, but instead separate the type specifier with the function declarator). No functional change intended. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 57540a0666f6bfebf55c905dceac36230c0743c5) --- sys/kern/kern_switch.c | 24 ++++++++++++------------ sys/sys/runq.h | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 5c529862bc53..906efca4bb51 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -269,7 +269,7 @@ runq_init(struct runq *rq) { int i; - bzero(rq, sizeof *rq); + bzero(rq, sizeof(*rq)); for (i = 0; i < RQ_NQS; i++) TAILQ_INIT(&rq->rq_queues[i]); } @@ -300,11 +300,11 @@ static __inline int runq_findbit(struct runq *rq) { struct rqbits *rqb; - int idx, i; + int idx; rqb = &rq->rq_status; - for (i = 0; i < RQB_LEN; i++) - if (rqb->rqb_bits[i]) { + for (int i = 0; i < RQB_LEN; i++) + if (rqb->rqb_bits[i] != 0) { idx = RQB_FFS(rqb->rqb_bits[i]) + i * RQB_BPW; CHECK_IDX(idx); CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d idx=%d", @@ -390,11 +390,10 @@ runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) rqh = &rq->rq_queues[idx]; CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqh=%p", td, td->td_priority, idx, rqh); - if (flags & SRQ_PREEMPTED) { + if (flags & SRQ_PREEMPTED) TAILQ_INSERT_HEAD(rqh, td, td_runq); - } else { + else TAILQ_INSERT_TAIL(rqh, td, td_runq); - } } /* @@ -405,11 +404,10 @@ bool runq_not_empty(struct runq *rq) { struct rqbits *rqb; - int i; rqb = &rq->rq_status; - for (i = 0; i < RQB_LEN; i++) - if (rqb->rqb_bits[i]) { + for (int i = 0; i < RQB_LEN; i++) + if (rqb->rqb_bits[i] != 0) { CTR2(KTR_RUNQ, "runq_not_empty: bits=%#x i=%d", rqb->rqb_bits[i], i); return (true); @@ -429,7 +427,8 @@ runq_choose_fuzz(struct runq *rq, int fuzz) struct thread *td; int idx; - while ((idx = runq_findbit(rq)) != -1) { + idx = runq_findbit(rq); + if (idx != -1) { rqh = &rq->rq_queues[idx]; /* fuzz == 1 is normal.. 0 or less are ignored */ if (fuzz > 1) { @@ -471,7 +470,8 @@ runq_choose(struct runq *rq) struct thread *td; int idx; - while ((idx = runq_findbit(rq)) != -1) { + idx = runq_findbit(rq); + if (idx != -1) { rqh = &rq->rq_queues[idx]; td = TAILQ_FIRST(rqh); KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 693a3666d7a8..030b4bb370a8 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -90,9 +90,9 @@ struct runq { void runq_add(struct runq *, struct thread *, int _flags); void runq_add_idx(struct runq *, struct thread *, int _idx, int _flags); bool runq_not_empty(struct runq *); -struct thread *runq_choose(struct runq *); -struct thread *runq_choose_from(struct runq *, int _idx); -struct thread *runq_choose_fuzz(struct runq *, int _fuzz); +struct thread *runq_choose(struct runq *); +struct thread *runq_choose_from(struct runq *, int _idx); +struct thread *runq_choose_fuzz(struct runq *, int _fuzz); void runq_init(struct runq *); bool runq_remove(struct runq *, struct thread *); #endif /* _KERNEL */ From nobody Mon Jul 28 13:31:13 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 4brKBC5vfkz634vd; Mon, 28 Jul 2025 13:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKB96xbTz3tXb; Mon, 28 Jul 2025 13:31:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709473; 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=nmPZX0vMcAGokn2iOCvHVF2C32+k/FMP+TB8eSARYNs=; b=N6Qyc91D4CBgoyiaHeD23Ie1zQeBc/GO7wAjplMNLLI6UCc/wHS128vfxbcXh23OCgrksS +PnKDw3HvQKsB+BDMxYq+FMQYUInV5sgrNHq1mVd8twLCNwcwXoosxJl0UsBE8Pb8Q9dMb eBHkDi9sv1gjFYj2J3I5/yWtmVX55KuyVWe4B6R/j/tzZ+/JC9WkmgiwkknjxmFw3m7HZc ov71MJBkaoSK99mEQGJGebAH6Xt2DZFK4z+qsnwXCIwC0l973nwZoD4H5qgpSM7aZGr/wo QDNZUwzdeYKccNVtWaCUWzHrZJ8qwbKe3SXMSF3pH+fFsLknAy1S+pXerwnQIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709473; 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=nmPZX0vMcAGokn2iOCvHVF2C32+k/FMP+TB8eSARYNs=; b=KDxRFyoe98WnIB54c91TVLPRUggfNBv7s6e3aeQb2d8RvysdaHjJkV+pYuu3qc5oamq34S cs3xW81ZCSsbcLT2c2Imm9ZE+ohOSqImIKIBUz5qypqppe18rVqSHyIXL5i5b3RTEscOn0 K6YZhnlkXL833sVf+OF5JLvqZ9Zp/+npTSAbZRLw25rR6OOxgFTqcn04z2rVKxN1QKvbU4 tT4ql66Jktxh4Icj6p9fYnXoPgG7nk1hLiu1fxHHrWG5PCzSM/N/WILkWBMMNf5C0lOyP4 PkSAojK68fuL+0xzSKyEIbp9bMyhALj0sq0VdyABVFtPVY+v9UGHKF6hYm5Vbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709473; a=rsa-sha256; cv=none; b=brtx1QDLj+GEl7Ydhh3gJdhDzBIQmfliPbKc89JJmVtJRw4Tzxy+c1VePedLJiStSzVMNI oitBY9CVmVvJ3Hoc1QVdFB7U3zIKbCyuecyfLeepnettmq0Sr37reXbSGkTKB6pVcr9Nlb C1mKIXJzW6x47qEZN8q0RChzucdmgYjeT1mpbY74YlJAveGByMJ2EOQ4/hMcgx4/fZEwz6 eo6NtUymynHwSjxxnRKZGxms8Uk+DbpQkbxv5Xg83dJ970FEXrm7xbazcjZb0MFNDlfCPT /KXoLs1qytF/LXho2/PpmINDvsZluMlcJbUoxK4u6PqTg/bTRtSCgTRE52sLvQ== 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 4brKB95cwjznfn; Mon, 28 Jul 2025 13:31:13 +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 56SDVD9a080057; Mon, 28 Jul 2025 13:31:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVDoI080054; Mon, 28 Jul 2025 13:31:13 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:13 GMT Message-Id: <202507281331.56SDVDoI080054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 000ffb6f24c4 - stable/14 - runq: More macros; Better and more consistent naming 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 000ffb6f24c498bc665b887fafdd1bd4e96f598f Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=000ffb6f24c498bc665b887fafdd1bd4e96f598f commit 000ffb6f24c498bc665b887fafdd1bd4e96f598f Author: Olivier Certner AuthorDate: 2024-04-23 11:33:02 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:06 +0000 runq: More macros; Better and more consistent naming Most existing macros have ambiguous names regarding which index they operate on (queue, word, bit?), so have been renamed to improve clarity. Use the 'RQSW_' prefix for all macros related to status words, and change the status word type name accordingly. Rename RQB_FFS() to RQSW_BSF() to remove confusion about the return value (ffs*() return bit indices starting at 1, or 0 if the input is 0, whereas BSF on x86 returns 0-based indices, which is what the current code assumes). While here, add a check (under INVARIANTS) that RQSW_BSF() isn't called with 0 as an argument. Also, rename 'rqb_bits_t' to the more concise 'rqsw_t', 'struct rqbits' to 'struct rq_status', its 'rqb_bits' field to 'rq_sw' (it designates an array of words, not bits), and the type 'rqhead' to 'rq_queue' Add macros computing a queue index from a status word index and a bit in order to factorize code. If the precise index of the bit is known, callers can use RQSW_TO_QUEUE_IDX() to get the corresponding queue index, whereas if they want the one corresponding to the first (least-significant): set bit in a given status word (corresponding to the non-empty queue with lower index in the status word), they can use RQSW_FIRST_QUEUE_IDX() instead. Add RQSW_BIT_IDX(), which computes the correspond bit's index in the corresponding status word. This allows more code factorization (even if most uses will be eliminated in a later commit) and makes what is computed clearer. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 7e2502e3dec989ea31e5300ade759a721718548d) --- sys/kern/kern_switch.c | 114 ++++++++++++++++++++++++------------------------- sys/kern/sched_4bsd.c | 2 +- sys/kern/sched_ule.c | 56 ++++++++++++------------ sys/sys/runq.h | 40 ++++++++++------- 4 files changed, 111 insertions(+), 101 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 906efca4bb51..9e63709d0acc 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -281,15 +281,15 @@ runq_init(struct runq *rq) static __inline void runq_clrbit(struct runq *rq, int idx) { - struct rqbits *rqb; + struct rq_status *rqs; CHECK_IDX(idx); - rqb = &rq->rq_status; + rqs = &rq->rq_status; CTR4(KTR_RUNQ, "runq_clrbit: bits=%#x %#x bit=%#x word=%d", - rqb->rqb_bits[RQB_WORD(idx)], - rqb->rqb_bits[RQB_WORD(idx)] & ~RQB_BIT(idx), - RQB_BIT(idx), RQB_WORD(idx)); - rqb->rqb_bits[RQB_WORD(idx)] &= ~RQB_BIT(idx); + rqs->rq_sw[RQSW_IDX(idx)], + rqs->rq_sw[RQSW_IDX(idx)] & ~RQSW_BIT(idx), + RQSW_BIT(idx), RQSW_IDX(idx)); + rqs->rq_sw[RQSW_IDX(idx)] &= ~RQSW_BIT(idx); } /* @@ -299,16 +299,16 @@ runq_clrbit(struct runq *rq, int idx) static __inline int runq_findbit(struct runq *rq) { - struct rqbits *rqb; + struct rq_status *rqs; int idx; - rqb = &rq->rq_status; - for (int i = 0; i < RQB_LEN; i++) - if (rqb->rqb_bits[i] != 0) { - idx = RQB_FFS(rqb->rqb_bits[i]) + i * RQB_BPW; + rqs = &rq->rq_status; + for (int i = 0; i < RQSW_NB; i++) + if (rqs->rq_sw[i] != 0) { + idx = RQSW_FIRST_QUEUE_IDX(i, rqs->rq_sw[i]); CHECK_IDX(idx); CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d idx=%d", - rqb->rqb_bits[i], i, idx); + rqs->rq_sw[i], i, idx); return (idx); } @@ -318,20 +318,20 @@ runq_findbit(struct runq *rq) static __inline int runq_findbit_from(struct runq *rq, int idx) { - struct rqbits *rqb; - rqb_word_t mask; + struct rq_status *rqs; + rqsw_t mask; int i; CHECK_IDX(idx); /* Set the mask for the first word so we ignore indices before 'idx'. */ - mask = (rqb_word_t)-1 << (idx & (RQB_BPW - 1)); - rqb = &rq->rq_status; + mask = (rqsw_t)-1 << RQSW_BIT_IDX(idx); + rqs = &rq->rq_status; again: - for (i = RQB_WORD(idx); i < RQB_LEN; mask = -1, i++) { - mask = rqb->rqb_bits[i] & mask; + for (i = RQSW_IDX(idx); i < RQSW_NB; mask = -1, i++) { + mask = rqs->rq_sw[i] & mask; if (mask == 0) continue; - idx = RQB_FFS(mask) + i * RQB_BPW; + idx = RQSW_FIRST_QUEUE_IDX(i, mask); CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d idx=%d", mask, i, idx); return (idx); @@ -353,15 +353,15 @@ again: static __inline void runq_setbit(struct runq *rq, int idx) { - struct rqbits *rqb; + struct rq_status *rqs; CHECK_IDX(idx); - rqb = &rq->rq_status; + rqs = &rq->rq_status; CTR4(KTR_RUNQ, "runq_setbit: bits=%#x %#x bit=%#x word=%d", - rqb->rqb_bits[RQB_WORD(idx)], - rqb->rqb_bits[RQB_WORD(idx)] | RQB_BIT(idx), - RQB_BIT(idx), RQB_WORD(idx)); - rqb->rqb_bits[RQB_WORD(idx)] |= RQB_BIT(idx); + rqs->rq_sw[RQSW_IDX(idx)], + rqs->rq_sw[RQSW_IDX(idx)] | RQSW_BIT(idx), + RQSW_BIT(idx), RQSW_IDX(idx)); + rqs->rq_sw[RQSW_IDX(idx)] |= RQSW_BIT(idx); } /* @@ -372,13 +372,13 @@ void runq_add(struct runq *rq, struct thread *td, int flags) { - runq_add_idx(rq, td, RQ_PRI_TO_IDX(td->td_priority), flags); + runq_add_idx(rq, td, RQ_PRI_TO_QUEUE_IDX(td->td_priority), flags); } void runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) { - struct rqhead *rqh; + struct rq_queue *rqq; /* * runq_setbit() asserts 'idx' is non-negative and below 'RQ_NQS', and @@ -387,13 +387,13 @@ runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) */ td->td_rqindex = idx; runq_setbit(rq, idx); - rqh = &rq->rq_queues[idx]; - CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqh=%p", - td, td->td_priority, idx, rqh); + rqq = &rq->rq_queues[idx]; + CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqq=%p", + td, td->td_priority, idx, rqq); if (flags & SRQ_PREEMPTED) - TAILQ_INSERT_HEAD(rqh, td, td_runq); + TAILQ_INSERT_HEAD(rqq, td, td_runq); else - TAILQ_INSERT_TAIL(rqh, td, td_runq); + TAILQ_INSERT_TAIL(rqq, td, td_runq); } /* @@ -403,13 +403,13 @@ runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) bool runq_not_empty(struct runq *rq) { - struct rqbits *rqb; + struct rq_status *rqs; - rqb = &rq->rq_status; - for (int i = 0; i < RQB_LEN; i++) - if (rqb->rqb_bits[i] != 0) { + rqs = &rq->rq_status; + for (int i = 0; i < RQSW_NB; i++) + if (rqs->rq_sw[i] != 0) { CTR2(KTR_RUNQ, "runq_not_empty: bits=%#x i=%d", - rqb->rqb_bits[i], i); + rqs->rq_sw[i], i); return (true); } CTR0(KTR_RUNQ, "runq_not_empty: empty"); @@ -423,13 +423,13 @@ runq_not_empty(struct runq *rq) struct thread * runq_choose_fuzz(struct runq *rq, int fuzz) { - struct rqhead *rqh; + struct rq_queue *rqq; struct thread *td; int idx; idx = runq_findbit(rq); if (idx != -1) { - rqh = &rq->rq_queues[idx]; + rqq = &rq->rq_queues[idx]; /* fuzz == 1 is normal.. 0 or less are ignored */ if (fuzz > 1) { /* @@ -439,7 +439,7 @@ runq_choose_fuzz(struct runq *rq, int fuzz) int count = fuzz; int cpu = PCPU_GET(cpuid); struct thread *td2; - td2 = td = TAILQ_FIRST(rqh); + td2 = td = TAILQ_FIRST(rqq); while (count-- && td2) { if (td2->td_lastcpu == cpu) { @@ -449,10 +449,10 @@ runq_choose_fuzz(struct runq *rq, int fuzz) td2 = TAILQ_NEXT(td2, td_runq); } } else - td = TAILQ_FIRST(rqh); + td = TAILQ_FIRST(rqq); KASSERT(td != NULL, ("runq_choose_fuzz: no proc on busy queue")); CTR3(KTR_RUNQ, - "runq_choose_fuzz: idx=%d thread=%p rqh=%p", idx, td, rqh); + "runq_choose_fuzz: idx=%d thread=%p rqq=%p", idx, td, rqq); return (td); } CTR1(KTR_RUNQ, "runq_choose_fuzz: idleproc idx=%d", idx); @@ -466,17 +466,17 @@ runq_choose_fuzz(struct runq *rq, int fuzz) struct thread * runq_choose(struct runq *rq) { - struct rqhead *rqh; + struct rq_queue *rqq; struct thread *td; int idx; idx = runq_findbit(rq); if (idx != -1) { - rqh = &rq->rq_queues[idx]; - td = TAILQ_FIRST(rqh); + rqq = &rq->rq_queues[idx]; + td = TAILQ_FIRST(rqq); KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); CTR3(KTR_RUNQ, - "runq_choose: idx=%d thread=%p rqh=%p", idx, td, rqh); + "runq_choose: idx=%d thread=%p rqq=%p", idx, td, rqq); return (td); } CTR1(KTR_RUNQ, "runq_choose: idlethread idx=%d", idx); @@ -487,17 +487,17 @@ runq_choose(struct runq *rq) struct thread * runq_choose_from(struct runq *rq, int from_idx) { - struct rqhead *rqh; + struct rq_queue *rqq; struct thread *td; int idx; if ((idx = runq_findbit_from(rq, from_idx)) != -1) { - rqh = &rq->rq_queues[idx]; - td = TAILQ_FIRST(rqh); + rqq = &rq->rq_queues[idx]; + td = TAILQ_FIRST(rqq); KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); CTR4(KTR_RUNQ, - "runq_choose_from: idx=%d thread=%p idx=%d rqh=%p", - idx, td, td->td_rqindex, rqh); + "runq_choose_from: idx=%d thread=%p idx=%d rqq=%p", + idx, td, td->td_rqindex, rqq); return (td); } CTR1(KTR_RUNQ, "runq_choose_from: idlethread idx=%d", idx); @@ -513,17 +513,17 @@ runq_choose_from(struct runq *rq, int from_idx) bool runq_remove(struct runq *rq, struct thread *td) { - struct rqhead *rqh; + struct rq_queue *rqq; int idx; KASSERT(td->td_flags & TDF_INMEM, ("runq_remove: Thread swapped out")); idx = td->td_rqindex; CHECK_IDX(idx); - rqh = &rq->rq_queues[idx]; - CTR4(KTR_RUNQ, "runq_remove: td=%p pri=%d idx=%d rqh=%p", - td, td->td_priority, idx, rqh); - TAILQ_REMOVE(rqh, td, td_runq); - if (TAILQ_EMPTY(rqh)) { + rqq = &rq->rq_queues[idx]; + CTR4(KTR_RUNQ, "runq_remove: td=%p pri=%d idx=%d rqq=%p", + td, td->td_priority, idx, rqq); + TAILQ_REMOVE(rqq, td, td_runq); + if (TAILQ_EMPTY(rqq)) { runq_clrbit(rq, idx); CTR1(KTR_RUNQ, "runq_remove: queue at idx=%d now empty", idx); return (true); diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index c6b789d060c3..c204e4a5676e 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -873,7 +873,7 @@ sched_priority(struct thread *td, u_char prio) if (td->td_priority == prio) return; td->td_priority = prio; - if (TD_ON_RUNQ(td) && td->td_rqindex != RQ_PRI_TO_IDX(prio)) { + if (TD_ON_RUNQ(td) && td->td_rqindex != RQ_PRI_TO_QUEUE_IDX(prio)) { sched_rem(td); sched_add(td, SRQ_BORING | SRQ_HOLDTD); } diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 13bef8ca9c1c..8fdc71c21e64 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -387,20 +387,20 @@ SDT_PROBE_DEFINE2(sched, , , surrender, "struct thread *", static void runq_print(struct runq *rq) { - struct rqhead *rqh; + struct rq_queue *rqq; struct thread *td; int pri; int j; int i; - for (i = 0; i < RQB_LEN; i++) { + for (i = 0; i < RQSW_NB; i++) { printf("\t\trunq bits %d 0x%zx\n", - i, rq->rq_status.rqb_bits[i]); - for (j = 0; j < RQB_BPW; j++) - if (rq->rq_status.rqb_bits[i] & (1ul << j)) { - pri = j + i * RQB_BPW; - rqh = &rq->rq_queues[pri]; - TAILQ_FOREACH(td, rqh, td_runq) { + i, rq->rq_status.rq_sw[i]); + for (j = 0; j < RQSW_BPW; j++) + if (rq->rq_status.rq_sw[i] & (1ul << j)) { + pri = RQSW_TO_QUEUE_IDX(i, j); + rqq = &rq->rq_queues[pri]; + TAILQ_FOREACH(td, rqq, td_runq) { printf("\t\t\ttd %p(%s) priority %d rqindex %d pri %d\n", td, td->td_name, td->td_priority, td->td_rqindex, pri); @@ -1190,26 +1190,26 @@ tdq_notify(struct tdq *tdq, int lowpri) static struct thread * runq_steal_from(struct runq *rq, int cpu, u_char start) { - struct rqbits *rqb; - struct rqhead *rqh; + struct rq_status *rqs; + struct rq_queue *rqq; struct thread *td, *first; int bit; int i; - rqb = &rq->rq_status; - bit = start & (RQB_BPW -1); + rqs = &rq->rq_status; + bit = RQSW_BIT_IDX(start); first = NULL; again: - for (i = RQB_WORD(start); i < RQB_LEN; bit = 0, i++) { - if (rqb->rqb_bits[i] == 0) + for (i = RQSW_IDX(start); i < RQSW_NB; bit = 0, i++) { + if (rqs->rq_sw[i] == 0) continue; if (bit == 0) - bit = RQB_FFS(rqb->rqb_bits[i]); - for (; bit < RQB_BPW; bit++) { - if ((rqb->rqb_bits[i] & (1ul << bit)) == 0) + bit = RQSW_BSF(rqs->rq_sw[i]); + for (; bit < RQSW_BPW; bit++) { + if ((rqs->rq_sw[i] & (1ul << bit)) == 0) continue; - rqh = &rq->rq_queues[bit + i * RQB_BPW]; - TAILQ_FOREACH(td, rqh, td_runq) { + rqq = &rq->rq_queues[RQSW_TO_QUEUE_IDX(i, bit)]; + TAILQ_FOREACH(td, rqq, td_runq) { if (first) { if (THREAD_CAN_MIGRATE(td) && THREAD_CAN_SCHED(td, cpu)) @@ -1236,21 +1236,21 @@ again: static struct thread * runq_steal(struct runq *rq, int cpu) { - struct rqhead *rqh; - struct rqbits *rqb; + struct rq_queue *rqq; + struct rq_status *rqs; struct thread *td; int word; int bit; - rqb = &rq->rq_status; - for (word = 0; word < RQB_LEN; word++) { - if (rqb->rqb_bits[word] == 0) + rqs = &rq->rq_status; + for (word = 0; word < RQSW_NB; word++) { + if (rqs->rq_sw[word] == 0) continue; - for (bit = 0; bit < RQB_BPW; bit++) { - if ((rqb->rqb_bits[word] & (1ul << bit)) == 0) + for (bit = 0; bit < RQSW_BPW; bit++) { + if ((rqs->rq_sw[word] & (1ul << bit)) == 0) continue; - rqh = &rq->rq_queues[bit + word * RQB_BPW]; - TAILQ_FOREACH(td, rqh, td_runq) + rqq = &rq->rq_queues[RQSW_TO_QUEUE_IDX(word, bit)]; + TAILQ_FOREACH(td, rqq, td_runq) if (THREAD_CAN_MIGRATE(td) && THREAD_CAN_SCHED(td, cpu)) return (td); diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 030b4bb370a8..80a1fad0a089 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -47,16 +47,26 @@ /* * Deduced from the above parameters and machine ones. */ -typedef unsigned long rqb_word_t; /* runq's status words type. */ - #define RQ_NQS (howmany(RQ_MAX_PRIO + 1, RQ_PPQ)) /* Number of run queues. */ -#define RQ_PRI_TO_IDX(pri) ((pri) / RQ_PPQ) /* Priority to queue index. */ - -#define RQB_BPW (sizeof(rqb_word_t) * NBBY) /* Bits per runq word. */ -#define RQB_LEN (howmany(RQ_NQS, RQB_BPW)) /* Words to cover RQ_NQS queues. */ -#define RQB_WORD(idx) ((idx) / RQB_BPW) -#define RQB_BIT(idx) (1ul << ((idx) % RQB_BPW)) -#define RQB_FFS(word) (ffsl((long)(word)) - 1) /* Assumes two-complement. */ +#define RQ_PRI_TO_QUEUE_IDX(pri) ((pri) / RQ_PPQ) /* Priority to queue index. */ + +typedef unsigned long rqsw_t; /* runq's status words type. */ +#define RQSW_BPW (sizeof(rqsw_t) * NBBY) /* Bits per runq word. */ + +/* Number of status words to cover RQ_NQS queues. */ +#define RQSW_NB (howmany(RQ_NQS, RQSW_BPW)) +#define RQSW_IDX(idx) ((idx) / RQSW_BPW) +#define RQSW_BIT_IDX(idx) ((idx) % RQSW_BPW) +#define RQSW_BIT(idx) (1ul << RQSW_BIT_IDX(idx)) +#define RQSW_BSF(word) __extension__ ({ \ + int _res = ffsl((long)(word)); /* Assumes two-complement. */ \ + MPASS(_res > 0); \ + _res - 1; \ +}) +#define RQSW_TO_QUEUE_IDX(word_idx, bit_idx) \ + (((word_idx) * RQSW_BPW) + (bit_idx)) +#define RQSW_FIRST_QUEUE_IDX(word_idx, word) \ + RQSW_TO_QUEUE_IDX(word_idx, RQSW_BSF(word)) #ifdef _KERNEL @@ -66,16 +76,16 @@ typedef unsigned long rqb_word_t; /* runq's status words type. */ struct thread; /* - * Head of run queues. + * The queue for a given index as a list of threads. */ -TAILQ_HEAD(rqhead, thread); +TAILQ_HEAD(rq_queue, thread); /* * Bit array which maintains the status of a run queue. When a queue is * non-empty the bit corresponding to the queue number will be set. */ -struct rqbits { - rqb_word_t rqb_bits[RQB_LEN]; +struct rq_status { + rqsw_t rq_sw[RQSW_NB]; }; /* @@ -83,8 +93,8 @@ struct rqbits { * are placed, and a structure to maintain the status of each queue. */ struct runq { - struct rqbits rq_status; - struct rqhead rq_queues[RQ_NQS]; + struct rq_status rq_status; + struct rq_queue rq_queues[RQ_NQS]; }; void runq_add(struct runq *, struct thread *, int _flags); From nobody Mon Jul 28 13:31:14 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 4brKBC5xvbz634n6; Mon, 28 Jul 2025 13:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBB6zqLz3tbW; Mon, 28 Jul 2025 13:31:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709475; 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=lSRSvDh+GpcCsD53ecBMDmjYQMB9sB31Qil6FQPT1hE=; b=JsohuKHw77q9P6AUO2q+rKejMxEEI2i1tD7Z9CRK3iFUh/70zQkvw1GNfJx+2ULVRIN98+ FHpVbFmv1S9Qz1YwSVB8uPOKxwxL7ogfYxko/fCG45zsy3rriPl8t67RELSkUiLaHwtkCM KDZiki3k6KkEr7lwlJ3DTKTSKVtL6fZ2YgLCwpdau1EShIJYFfhptyf7SACv4nxUSSuj4K KX4aUWGGBNlIXX9ncuBFXUFeR+LNPf2zmqeqGAS73E8oIMMGpE4Kdea2lYtZ5bDJUH2Xvd pnY0irmkOWh+yDQgfJ+Wi9sohynmdz5lRPbmesuRgKojvJY0VsCYzpI8/nF7lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709475; 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=lSRSvDh+GpcCsD53ecBMDmjYQMB9sB31Qil6FQPT1hE=; b=TsATvKcykVnmkjNEv9O/NC2zpneu5r7zIYXly/mgpPg8ARPXz7UW5BUYMmmxH0WJrbH0RW CbNkbJgrNeuQ4kDx2oYfOQGauX6YNpWLaUjcVG5yF390pWhGq4U7MK3q3l91hlzpdfI+fR BFxurS3oQPWf6N1ImQqsjI5zrtZ6GriYy2Jv03f/KEETa4ep9dDjQcLDNjXMbnh9iTx82m cWuttHuCjO840pWdpTqpevXY3zx2dcuoChKEfEf/VEJJ45PdPcPS5HWVTcR3o1mfxvCoz7 WA3Ks/CLqrhGqIZKDgN1JrseTE5RgH4u18uLO6RHEyFPWlkcOLAQQ6bsltlanw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709475; a=rsa-sha256; cv=none; b=fPcEwL6IoTuTWFLhkxBaZNcWso87b9WGyMW/xjDcAgziKhACt8jZj9wJn7JpsDapoDRQcq /0WtgOSlgrTDFP8sZbupuhXWVwtYyttpNuchp5+kW4XyzH8dzpSSiU5hBg1YM4REytX0IM hrbgO4IGexoebxD6iwU4Ra3RCNxAay0n1XzCe6Lj8YpvEQ7BCrcO392LBPaL2oVdb3PIh+ WIPDkm3IWSd8KPbLlV5ioCBjw+0COCjZaRp480Jx+cBRYNcLjFCd42r+Or4Afh6mUO4vIy zOcPhYRUpIONmEahrmw65STPkH9ebS8hr8RxO0ocvLG2AQq5L88ufrgNkxAF4g== 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 4brKBB6YKLznfp; Mon, 28 Jul 2025 13:31:14 +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 56SDVE8U080089; Mon, 28 Jul 2025 13:31:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVEqN080086; Mon, 28 Jul 2025 13:31:14 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:14 GMT Message-Id: <202507281331.56SDVEqN080086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 606087082472 - stable/14 - runq: Re-order functions more logically 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 60608708247207a69d3ec88e4cb05b066d3f3b74 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=60608708247207a69d3ec88e4cb05b066d3f3b74 commit 60608708247207a69d3ec88e4cb05b066d3f3b74 Author: Olivier Certner AuthorDate: 2024-03-01 13:26:39 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:07 +0000 runq: Re-order functions more logically No code change in moved functions. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 200fc93dace76cf251460adc58ca809c36031f3e) --- sys/kern/kern_switch.c | 201 +++++++++++++++++++++++++------------------------ sys/sys/runq.h | 7 +- 2 files changed, 105 insertions(+), 103 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 9e63709d0acc..69e6f4818e40 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -274,6 +274,24 @@ runq_init(struct runq *rq) TAILQ_INIT(&rq->rq_queues[i]); } +/* + * Set the status bit of the queue at index 'idx', indicating that it is + * non-empty. + */ +static __inline void +runq_setbit(struct runq *rq, int idx) +{ + struct rq_status *rqs; + + CHECK_IDX(idx); + rqs = &rq->rq_status; + CTR4(KTR_RUNQ, "runq_setbit: bits=%#x %#x bit=%#x word=%d", + rqs->rq_sw[RQSW_IDX(idx)], + rqs->rq_sw[RQSW_IDX(idx)] | RQSW_BIT(idx), + RQSW_BIT(idx), RQSW_IDX(idx)); + rqs->rq_sw[RQSW_IDX(idx)] |= RQSW_BIT(idx); +} + /* * Clear the status bit of the queue at index 'idx', indicating that it is * empty. @@ -292,6 +310,65 @@ runq_clrbit(struct runq *rq, int idx) rqs->rq_sw[RQSW_IDX(idx)] &= ~RQSW_BIT(idx); } +/* + * Add the thread to the queue specified by its priority, and set the + * corresponding status bit. + */ +void +runq_add(struct runq *rq, struct thread *td, int flags) +{ + + runq_add_idx(rq, td, RQ_PRI_TO_QUEUE_IDX(td->td_priority), flags); +} + +void +runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) +{ + struct rq_queue *rqq; + + /* + * runq_setbit() asserts 'idx' is non-negative and below 'RQ_NQS', and + * a static assert earlier in this file ensures that 'RQ_NQS' is no more + * than 256. + */ + td->td_rqindex = idx; + runq_setbit(rq, idx); + rqq = &rq->rq_queues[idx]; + CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqq=%p", + td, td->td_priority, idx, rqq); + if (flags & SRQ_PREEMPTED) + TAILQ_INSERT_HEAD(rqq, td, td_runq); + else + TAILQ_INSERT_TAIL(rqq, td, td_runq); +} + +/* + * Remove the thread from the queue specified by its priority, and clear the + * corresponding status bit if the queue becomes empty. + * + * Returns whether the corresponding queue is empty after removal. + */ +bool +runq_remove(struct runq *rq, struct thread *td) +{ + struct rq_queue *rqq; + int idx; + + KASSERT(td->td_flags & TDF_INMEM, ("runq_remove: Thread swapped out")); + idx = td->td_rqindex; + CHECK_IDX(idx); + rqq = &rq->rq_queues[idx]; + CTR4(KTR_RUNQ, "runq_remove: td=%p pri=%d idx=%d rqq=%p", + td, td->td_priority, idx, rqq); + TAILQ_REMOVE(rqq, td, td_runq); + if (TAILQ_EMPTY(rqq)) { + runq_clrbit(rq, idx); + CTR1(KTR_RUNQ, "runq_remove: queue at idx=%d now empty", idx); + return (true); + } + return (false); +} + /* * Find the index of the first non-empty run queue. This is done by * scanning the status bits, a set bit indicating a non-empty queue. @@ -346,56 +423,6 @@ again: goto again; } -/* - * Set the status bit of the queue at index 'idx', indicating that it is - * non-empty. - */ -static __inline void -runq_setbit(struct runq *rq, int idx) -{ - struct rq_status *rqs; - - CHECK_IDX(idx); - rqs = &rq->rq_status; - CTR4(KTR_RUNQ, "runq_setbit: bits=%#x %#x bit=%#x word=%d", - rqs->rq_sw[RQSW_IDX(idx)], - rqs->rq_sw[RQSW_IDX(idx)] | RQSW_BIT(idx), - RQSW_BIT(idx), RQSW_IDX(idx)); - rqs->rq_sw[RQSW_IDX(idx)] |= RQSW_BIT(idx); -} - -/* - * Add the thread to the queue specified by its priority, and set the - * corresponding status bit. - */ -void -runq_add(struct runq *rq, struct thread *td, int flags) -{ - - runq_add_idx(rq, td, RQ_PRI_TO_QUEUE_IDX(td->td_priority), flags); -} - -void -runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) -{ - struct rq_queue *rqq; - - /* - * runq_setbit() asserts 'idx' is non-negative and below 'RQ_NQS', and - * a static assert earlier in this file ensures that 'RQ_NQS' is no more - * than 256. - */ - td->td_rqindex = idx; - runq_setbit(rq, idx); - rqq = &rq->rq_queues[idx]; - CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqq=%p", - td, td->td_priority, idx, rqq); - if (flags & SRQ_PREEMPTED) - TAILQ_INSERT_HEAD(rqq, td, td_runq); - else - TAILQ_INSERT_TAIL(rqq, td, td_runq); -} - /* * Return true if there are some processes of any priority on the run queue, * false otherwise. Has no side effects. @@ -417,6 +444,30 @@ runq_not_empty(struct runq *rq) return (false); } +/* + * Find the highest priority process on the run queue. + */ +struct thread * +runq_choose(struct runq *rq) +{ + struct rq_queue *rqq; + struct thread *td; + int idx; + + idx = runq_findbit(rq); + if (idx != -1) { + rqq = &rq->rq_queues[idx]; + td = TAILQ_FIRST(rqq); + KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); + CTR3(KTR_RUNQ, + "runq_choose: idx=%d thread=%p rqq=%p", idx, td, rqq); + return (td); + } + CTR1(KTR_RUNQ, "runq_choose: idlethread idx=%d", idx); + + return (NULL); +} + /* * Find the highest priority process on the run queue. */ @@ -460,30 +511,6 @@ runq_choose_fuzz(struct runq *rq, int fuzz) return (NULL); } -/* - * Find the highest priority process on the run queue. - */ -struct thread * -runq_choose(struct runq *rq) -{ - struct rq_queue *rqq; - struct thread *td; - int idx; - - idx = runq_findbit(rq); - if (idx != -1) { - rqq = &rq->rq_queues[idx]; - td = TAILQ_FIRST(rqq); - KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); - CTR3(KTR_RUNQ, - "runq_choose: idx=%d thread=%p rqq=%p", idx, td, rqq); - return (td); - } - CTR1(KTR_RUNQ, "runq_choose: idlethread idx=%d", idx); - - return (NULL); -} - struct thread * runq_choose_from(struct runq *rq, int from_idx) { @@ -504,29 +531,3 @@ runq_choose_from(struct runq *rq, int from_idx) return (NULL); } -/* - * Remove the thread from the queue specified by its priority, and clear the - * corresponding status bit if the queue becomes empty. - * - * Returns whether the corresponding queue is empty after removal. - */ -bool -runq_remove(struct runq *rq, struct thread *td) -{ - struct rq_queue *rqq; - int idx; - - KASSERT(td->td_flags & TDF_INMEM, ("runq_remove: Thread swapped out")); - idx = td->td_rqindex; - CHECK_IDX(idx); - rqq = &rq->rq_queues[idx]; - CTR4(KTR_RUNQ, "runq_remove: td=%p pri=%d idx=%d rqq=%p", - td, td->td_priority, idx, rqq); - TAILQ_REMOVE(rqq, td, td_runq); - if (TAILQ_EMPTY(rqq)) { - runq_clrbit(rq, idx); - CTR1(KTR_RUNQ, "runq_remove: queue at idx=%d now empty", idx); - return (true); - } - return (false); -} diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 80a1fad0a089..c570dd25503b 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -97,14 +97,15 @@ struct runq { struct rq_queue rq_queues[RQ_NQS]; }; +void runq_init(struct runq *); void runq_add(struct runq *, struct thread *, int _flags); void runq_add_idx(struct runq *, struct thread *, int _idx, int _flags); +bool runq_remove(struct runq *, struct thread *); + bool runq_not_empty(struct runq *); struct thread *runq_choose(struct runq *); -struct thread *runq_choose_from(struct runq *, int _idx); struct thread *runq_choose_fuzz(struct runq *, int _fuzz); -void runq_init(struct runq *); -bool runq_remove(struct runq *, struct thread *); +struct thread *runq_choose_from(struct runq *, int _idx); #endif /* _KERNEL */ #endif From nobody Mon Jul 28 13:31:15 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 4brKBD4Jhgz634WG; Mon, 28 Jul 2025 13:31:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBD21g9z3tby; Mon, 28 Jul 2025 13:31:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709476; 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=dVqaGJu2yTtt945uaBEBZS9vxm/WgNIvqrZRivNKHDY=; b=Gc/1vqnEpUq3rBuVCMxs8XZPh17QicW5NOWFw6WAzHFoHrOoxtoUV+uZnYIOSMYJn6wK/u VK7gNOTFxDLPILELTVnU6oy+nJiSCjeTtthz0QJSz4m/3FCDj2sextYrYhXOjtlA4pGanX 3+5FxyhzMmSIhmCmZ8AkIgRHiIBacV3VDX+qAp0NHLeag1BW/95yu4kZ0k7+b/RCIYwunC 4ZmfZ1/Cf7LBQ0hEl7BCEx+rLqh57IO0qjlIWbeZgsux6HH2kG6J07wESZmojghO0ybiQU Hail8eGRQGirl9vyRyPpsACF+8r4TA86TdCm6luxD4eclr0Q3+it+DxAeN6mMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709476; 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=dVqaGJu2yTtt945uaBEBZS9vxm/WgNIvqrZRivNKHDY=; b=S/iatzdrwi+bM4PrJTDnCDsAJOJJBFBMumOJUmDwCjXLE8JqQWRFFj9dswSJ2IbuhV62VP YbwM2qP3hpc0q7i70oC7tYOttwc5GptuU1uxH0MQwY1KhpEWN/9BXNm9aIoDI6+dT6FZf8 EVlgyOWX+X+EPpnPR7dBCgQFRMDPslnirRPJv2IR1tU+eH6YRSXf9zGPx0r2vjNtVV+hAB IUxuAw+mSxt+ccvPRNtZmO44+bZlD1EHPYMNzuLUGt/ow5AaOV7EIjrTZBC0hKAlTgO8Mw NcRArnlOIbHgzLrXJwPbT85ocxKXiAajEaW7r4/vpNJEkjYN/AckEfqpPjODAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709476; a=rsa-sha256; cv=none; b=ZdPFLH5wSsrFu4oY158bMPgA6mPW1ktj4VEy4QRcEyGaXMHqhJXJtmlePBFUIsrbgYbFRV dkZbPiwVG3BGx+zQjkNPIJBPqFZoW2nJkKoDpD6Eo6ms0Fk0reaNLGbnKSN1YU4MmvVFsA /Wt6eNQ5VQlcLpl6rsxpZLEdIzQQYqQj9SEHsjrMHN4SUADHdtQNfhuRmeL6DcQ0wQPs2g BVrrs3sFszUj+62gGEh3o/oq7/ecTLE1tFA1zLzDXON2vBwEudlLZEPVSg0wQ59zItRkqJ TUXgKvVyldk2cg2gdXmo/FX3aQt3dqn3AcSoVl1mKrxi8LkCAez2t8g2Lsot+w== 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 4brKBD0P7zznG1; Mon, 28 Jul 2025 13:31:16 +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 56SDVFUM080121; Mon, 28 Jul 2025 13:31:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVFAk080118; Mon, 28 Jul 2025 13:31:15 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:15 GMT Message-Id: <202507281331.56SDVFAk080118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: de0e1a3abf8b - stable/14 - runq: Revamp runq_find*(), new runq_find_range() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: de0e1a3abf8b144650173e639337c31a3eaf874f Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=de0e1a3abf8b144650173e639337c31a3eaf874f commit de0e1a3abf8b144650173e639337c31a3eaf874f Author: Olivier Certner AuthorDate: 2024-02-29 08:57:10 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:09 +0000 runq: Revamp runq_find*(), new runq_find_range() Rename existing functions to use the simpler prefix 'runq_findq' instead of 'runq_findbit' (that they work on top of bit runs is an implementation detail). Add runq_findq_range(), which takes a range of indices to operate on (bounds included). This is in preparation for changing ULE to use a single runqueue, since it needs to treat the timesharing range differently. Rename runq_findbit_from() to runq_findq_circular(), which is more descriptive. To reduce code duplication, have runq_findq() and runq_findq_circular() leverage runq_findq_range() internally. For the latter, this also brings a small algorithmic improvement, since previously the second pass (from queue 0) would cover the whole runqueue if it was completely empty, scanning again empty queues after the start index. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 439dc920f2d88e3fe2869a2845f15d8ab44cc051) --- sys/kern/kern_switch.c | 101 ++++++++++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 69e6f4818e40..a321aecc55fb 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -370,57 +370,72 @@ runq_remove(struct runq *rq, struct thread *td) } /* - * Find the index of the first non-empty run queue. This is done by - * scanning the status bits, a set bit indicating a non-empty queue. + * Find the index of the first (i.e., having lower index) non-empty queue in the + * passed range (bounds included). This is done by scanning the status bits, + * a set bit indicating a non-empty queue. Returns -1 if all queues in the range + * are empty. */ -static __inline int -runq_findbit(struct runq *rq) +static int +runq_findq_range(const struct runq *const rq, const int lvl_min, + const int lvl_max) { - struct rq_status *rqs; - int idx; + rqsw_t const (*const rqsw)[RQSW_NB] = &rq->rq_status.rq_sw; + rqsw_t w; + int i, last, idx; + + CHECK_IDX(lvl_min); + CHECK_IDX(lvl_max); + KASSERT(lvl_min <= lvl_max, + ("lvl_min: %d > lvl_max: %d!", lvl_min, lvl_max)); + + i = RQSW_IDX(lvl_min); + last = RQSW_IDX(lvl_max); + /* Clear bits for runqueues below 'lvl_min'. */ + w = (*rqsw)[i] & ~(RQSW_BIT(lvl_min) - 1); + if (i == last) + goto last_mask; + if (w != 0) + goto return_idx; + + for (++i; i < last; ++i) { + w = (*rqsw)[i]; + if (w != 0) + goto return_idx; + } - rqs = &rq->rq_status; - for (int i = 0; i < RQSW_NB; i++) - if (rqs->rq_sw[i] != 0) { - idx = RQSW_FIRST_QUEUE_IDX(i, rqs->rq_sw[i]); - CHECK_IDX(idx); - CTR3(KTR_RUNQ, "runq_findbit: bits=%#x i=%d idx=%d", - rqs->rq_sw[i], i, idx); - return (idx); - } + MPASS(i == last); + w = (*rqsw)[i]; +last_mask: + /* Clear bits for runqueues above 'lvl_max'. */ + w &= (RQSW_BIT(lvl_max) - 1) | RQSW_BIT(lvl_max); + if (w != 0) + goto return_idx; return (-1); +return_idx: + idx = RQSW_FIRST_QUEUE_IDX(i, w); + CTR4(KTR_RUNQ, "runq_findq_range: bits=%#x->%#x i=%d idx=%d", + (*rqsw)[i], w, i, idx); + return (idx); } static __inline int -runq_findbit_from(struct runq *rq, int idx) +runq_findq_circular(struct runq *const rq, int start_idx) { - struct rq_status *rqs; - rqsw_t mask; - int i; + int idx; - CHECK_IDX(idx); - /* Set the mask for the first word so we ignore indices before 'idx'. */ - mask = (rqsw_t)-1 << RQSW_BIT_IDX(idx); - rqs = &rq->rq_status; -again: - for (i = RQSW_IDX(idx); i < RQSW_NB; mask = -1, i++) { - mask = rqs->rq_sw[i] & mask; - if (mask == 0) - continue; - idx = RQSW_FIRST_QUEUE_IDX(i, mask); - CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d idx=%d", - mask, i, idx); + idx = runq_findq_range(rq, start_idx, RQ_NQS - 1); + if (idx != -1 || start_idx == 0) return (idx); - } - if (idx == 0) - return (-1); - /* - * Wrap back around to the beginning of the list just once so we - * scan the whole thing. - */ - idx = 0; - goto again; + + return (runq_findq_range(rq, 0, start_idx - 1)); +} + +static __inline int +runq_findq(struct runq *const rq) +{ + + return (runq_findq_range(rq, 0, RQ_NQS - 1)); } /* @@ -454,7 +469,7 @@ runq_choose(struct runq *rq) struct thread *td; int idx; - idx = runq_findbit(rq); + idx = runq_findq(rq); if (idx != -1) { rqq = &rq->rq_queues[idx]; td = TAILQ_FIRST(rqq); @@ -478,7 +493,7 @@ runq_choose_fuzz(struct runq *rq, int fuzz) struct thread *td; int idx; - idx = runq_findbit(rq); + idx = runq_findq(rq); if (idx != -1) { rqq = &rq->rq_queues[idx]; /* fuzz == 1 is normal.. 0 or less are ignored */ @@ -518,7 +533,7 @@ runq_choose_from(struct runq *rq, int from_idx) struct thread *td; int idx; - if ((idx = runq_findbit_from(rq, from_idx)) != -1) { + if ((idx = runq_findq_circular(rq, from_idx)) != -1) { rqq = &rq->rq_queues[idx]; td = TAILQ_FIRST(rqq); KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); From nobody Mon Jul 28 13:31:17 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 4brKBG1ZXLz634sR; Mon, 28 Jul 2025 13:31:18 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBF1CN6z3tdZ; Mon, 28 Jul 2025 13:31:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709477; 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=2H+EuLVnwdNlNi5xx0CksPZDce1DIyD1UGj8i16Ru2E=; b=uFSEHQRv0ZYkWpfofwzPvg7CpYGj/DXpHQAHGjc1v5aGGrhLEtuXEUzrYJAjWHC4IdCh9k N5Pz0J342KR97eBo21lnK2BLQb9EeW/7mQ72aQHA44ox+ZOxYwJvBOvmyR8y94UoOn9iNf IXnF9TE+w4HHFx1mULwWo89AQaQByX0VUG0czl5c0fdX1Li/DN/uWItoxv6IlxKu6wI9x0 M1JEg9Np3ZUFtajNCPy8RJ5zAzVi2+I5IUQM/YYHqSaHvXQob0vBW7VKEN7C+0y7KO0XLv LLi6mFh214pQPyc7BMbgwfneUMmtPhhwuFcUwDq+GtlV8MH6SICURY9/EJqt+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709477; 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=2H+EuLVnwdNlNi5xx0CksPZDce1DIyD1UGj8i16Ru2E=; b=Lawk7gYAMQs2BiVODbJpNrWN8SsaTV2E/lZO9ZnmKey1pMuhIQ8wvJ7Q+ON7znskOtyp5w Zu6e+7fVDi3JNNgXYcbKCzWOXcJanbEtgfWztB3xGL2xzXSTxI0CqMcsECnJ1PjhvvJgTr CJN06JmhrVmIApltvc0vZ4C/VXJ4+mPR/bFZL9RDZ2UJUYY6FA4ZypB6n7/4WUzDlpYckb YRGVKQyuAb3oZEIksRDi8cO/1dlRBHQ1CAKi5V79cxTU6XaOI97cokXizX5VnaQWyHbwFY nnpfteLvENdIrdgQGQ16F5udSWOWnh5KJ6FVcVAdPYX7G4eV/68EJriK/Pa/Rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709477; a=rsa-sha256; cv=none; b=CPsDjFfhsCtJLUbtK/uyOBeX+AltBtkj3TNWRrAoVhHCHqzssfBhpaCfW2JlTQ3RhWnrMK 52gDkxG8hFO4DMxJt8uYM26Ij4f2QXN6VsflU8Pz85+iqP1U87Lx48JC32Yg20AQQnr/FK vMgrb4ZgZNThUf1z6qlb3+ZMlidI58Oyh9oq78SpJS4t8v7cxf2a3bhHqrmFTohBoKazQw ARzgoZkwCWrKjSI27iGFShtodN6QdNbtvhrK0PL0+s4LcgcKufFQn/m5TBJnIzOKkG0/EI wu+S5GlB2rH6YZp9O5IzEHktBWL+d6bBb5BeicJ7cOyrjvPFXlCVMZbioHSc8w== 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 4brKBF0g1ZznCK; Mon, 28 Jul 2025 13:31:17 +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 56SDVHm8080163; Mon, 28 Jul 2025 13:31:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVH3U080159; Mon, 28 Jul 2025 13:31:17 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:17 GMT Message-Id: <202507281331.56SDVH3U080159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: bfd59136bece - stable/14 - runq: runq_check(): Re-implement on top of runq_findq() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bfd59136bece048f2c4646d6e7a1ba48a3ce7a36 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd59136bece048f2c4646d6e7a1ba48a3ce7a36 commit bfd59136bece048f2c4646d6e7a1ba48a3ce7a36 Author: Olivier Certner AuthorDate: 2024-02-29 18:10:58 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:10 +0000 runq: runq_check(): Re-implement on top of runq_findq() Remove one more loop and duplicated code, with the benefit of less instruction cache pollution at the expense of a few cycles more for the function calls and computing 'idx' (however, this gives a better diagnostic message). Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit de78657a3aef3c2efbcbdf9ea73a95283c91fab0) --- sys/kern/kern_switch.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index a321aecc55fb..59925c10c30d 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -445,17 +445,15 @@ runq_findq(struct runq *const rq) bool runq_not_empty(struct runq *rq) { - struct rq_status *rqs; + int idx; - rqs = &rq->rq_status; - for (int i = 0; i < RQSW_NB; i++) - if (rqs->rq_sw[i] != 0) { - CTR2(KTR_RUNQ, "runq_not_empty: bits=%#x i=%d", - rqs->rq_sw[i], i); - return (true); - } - CTR0(KTR_RUNQ, "runq_not_empty: empty"); + idx = runq_findq(rq); + if (idx != -1) { + CTR1(KTR_RUNQ, "runq_not_empty: idx=%d", idx); + return (true); + } + CTR0(KTR_RUNQ, "runq_not_empty: empty"); return (false); } From nobody Mon Jul 28 13:31:18 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 4brKBG6Zhkz634sS; Mon, 28 Jul 2025 13:31:18 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBG2jXgz3tTS; Mon, 28 Jul 2025 13:31:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709478; 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=GfMA9t5m0OBzdrShjxP/rT6fh674H5mLq7q9S0r7Py4=; b=Udc/bbvjPXCcpGT4g1Gos7sK5jkTXHT5oKpzneshotY6piwyDvxdpXQfpK5OJM7ydlguY5 Re4H975Vyj6FKEpvojZzE7HQl9nf5KlpWnehLxLCfzXMpM4uRSTZnsgICqA3+tG3oze0an FurJies2CFrNezmBajBneXwG0PTBhLSLCj/5NvFfQXiP5Wh1Fc+2cyHJSCnErSLJHaN90n nL+2ZqaZGIlJ0p1L/Xf3J/qpsjJR9L0O+2b6850GcGUoSTJo6PUyCfUKgcdWUvb6I1Cq/m zpOYtiQ7ckLaqgBZEuV8O+sZffc4aQ3y9QHwl0T4n+onvRs0dBJae4F137Ce8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709478; 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=GfMA9t5m0OBzdrShjxP/rT6fh674H5mLq7q9S0r7Py4=; b=fRd2CotlYabmm2O+pAjeRcVf6ZG1u0Q/3nU95/Fkbw3mY53n41u8d5dEHUsQNKRoSGKcCS TGSVeAO9+o6WHOnY7mC+CRaNdshJLeuVUkW20d1kgCuaZdH3HMSyejQVfZuKKBOJFGENoa Hy99bSd4ZLwjQaXA+JZg2xu2G+EDcxC2YMM2DdQqHE2EizFyY30waohbWe20IzlbwFvVFO ST4ocdm9vc/e/8059Qi0L1ixPOedChKn3NwJZpsrSV6u8uMQ2KDN8SC9wEt19GGwNMkWJz XhNynm+ogLOwKJQ2dPS5UAjivVb1WXtdxQMEuC7gv0MT4+M47WKA8+A/yiK3yg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709478; a=rsa-sha256; cv=none; b=RDtuuKnRYBFKvTD72Vl3oVbQ7sF4XlT7/5xpHnpnIjmiLxUXQGz+aPT7wsEqFqtqpO20if DW1XqJVbZ03Nk7T7z+hMUbmF8VzM4yjwsOull1hWxp0xm0EXopV7+zKE5t4Lf9gORuaGgz 9ztMB7TkZc0DF8SIKE+oqNxT58JVm14ywaNcdaF5Pd3jTjczsXOCQhStgMId6GtTfiiM7c OzkEGbrYBemPd85Z7CTcMzqRUngC0uxe4j8CAfd/EAvXiiDsRugSO683YSDHcb4RVUn6R2 j8BjnDmZTs5wTM0F/1x+Ju7L6w7NLNjpj3KDMfYiSM6aVR/V6MbbPExyvEzYaw== 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 4brKBG1wXlznRH; Mon, 28 Jul 2025 13:31:18 +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 56SDVIuO080195; Mon, 28 Jul 2025 13:31:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVIJB080192; Mon, 28 Jul 2025 13:31:18 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:18 GMT Message-Id: <202507281331.56SDVIJB080192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: bd97078d704b - stable/14 - runq: Tidy up and rename runq_setbit() and runq_clrbit() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bd97078d704b59341bc05674e89e4d0c9eb2351e Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=bd97078d704b59341bc05674e89e4d0c9eb2351e commit bd97078d704b59341bc05674e89e4d0c9eb2351e Author: Olivier Certner AuthorDate: 2024-03-01 20:41:23 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:12 +0000 runq: Tidy up and rename runq_setbit() and runq_clrbit() Factorize common sub-expressions in a separate helper (runq_sw_apply()) for better readability. Rename these functions so that the names refer to the use cases rather than the implementations. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 757bab06fb59abca8b7fda38e8f546ff7c2d3280) --- sys/kern/kern_switch.c | 104 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 28 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 59925c10c30d..eb39ca88992c 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -261,6 +261,21 @@ _Static_assert(RQ_NQS <= 256, ("%s: %s out of range: %d", __func__, __STRING(idx), _idx)); \ }) +/* Status words' individual bit manipulators' internals. */ +typedef uintptr_t runq_sw_op(int idx, int sw_idx, rqsw_t sw_bit, + rqsw_t *swp); +static inline uintptr_t runq_sw_apply(struct runq *rq, int idx, + runq_sw_op *op); + +static inline uintptr_t runq_sw_set_not_empty_op(int idx, int sw_idx, + rqsw_t sw_bit, rqsw_t *swp); +static inline uintptr_t runq_sw_set_empty_op(int idx, int sw_idx, + rqsw_t sw_bit, rqsw_t *swp); + +/* Status words' individual bit manipulators. */ +static inline void runq_sw_set_not_empty(struct runq *rq, int idx); +static inline void runq_sw_set_empty(struct runq *rq, int idx); + /* * Initialize a run structure. */ @@ -275,39 +290,72 @@ runq_init(struct runq *rq) } /* - * Set the status bit of the queue at index 'idx', indicating that it is - * non-empty. + * Helper to implement functions operating on a particular status word bit. + * + * The operator is passed the initial 'idx', the corresponding status word index + * in 'rq_status' in 'sw_idx', a status word with only that bit set in 'sw_bit' + * and a pointer to the corresponding status word in 'swp'. */ -static __inline void -runq_setbit(struct runq *rq, int idx) +static inline uintptr_t +runq_sw_apply(struct runq *rq, int idx, runq_sw_op *op) { - struct rq_status *rqs; + rqsw_t *swp; + rqsw_t sw_bit; + int sw_idx; CHECK_IDX(idx); - rqs = &rq->rq_status; - CTR4(KTR_RUNQ, "runq_setbit: bits=%#x %#x bit=%#x word=%d", - rqs->rq_sw[RQSW_IDX(idx)], - rqs->rq_sw[RQSW_IDX(idx)] | RQSW_BIT(idx), - RQSW_BIT(idx), RQSW_IDX(idx)); - rqs->rq_sw[RQSW_IDX(idx)] |= RQSW_BIT(idx); + + sw_idx = RQSW_IDX(idx); + sw_bit = RQSW_BIT(idx); + swp = &rq->rq_status.rq_sw[sw_idx]; + + return (op(idx, sw_idx, sw_bit, swp)); +} + +static inline uintptr_t +runq_sw_set_not_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp) +{ + rqsw_t old_sw __unused = *swp; + + *swp |= sw_bit; + CTR4(KTR_RUNQ, "runq_sw_set_not_empty: idx=%d sw_idx=%d bits=%#x->%#x", + idx, sw_idx, old_sw, *swp); + return (0); } /* - * Clear the status bit of the queue at index 'idx', indicating that it is - * empty. + * Modify the status words to indicate that some queue is not empty. + * + * Sets the status bit corresponding to the queue at index 'idx'. */ -static __inline void -runq_clrbit(struct runq *rq, int idx) +static inline void +runq_sw_set_not_empty(struct runq *rq, int idx) { - struct rq_status *rqs; - CHECK_IDX(idx); - rqs = &rq->rq_status; - CTR4(KTR_RUNQ, "runq_clrbit: bits=%#x %#x bit=%#x word=%d", - rqs->rq_sw[RQSW_IDX(idx)], - rqs->rq_sw[RQSW_IDX(idx)] & ~RQSW_BIT(idx), - RQSW_BIT(idx), RQSW_IDX(idx)); - rqs->rq_sw[RQSW_IDX(idx)] &= ~RQSW_BIT(idx); + (void)runq_sw_apply(rq, idx, &runq_sw_set_not_empty_op); +} + +static inline uintptr_t +runq_sw_set_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp) +{ + rqsw_t old_sw __unused = *swp; + + *swp &= ~sw_bit; + CTR4(KTR_RUNQ, "runq_sw_set_empty: idx=%d sw_idx=%d bits=%#x->%#x", + idx, sw_idx, old_sw, *swp); + return (0); +} + +/* + * Modify the status words to indicate that some queue is empty. + * + * Clears the status bit corresponding to the queue at index 'idx'. + */ +static inline void +runq_sw_set_empty(struct runq *rq, int idx) +{ + + (void)runq_sw_apply(rq, idx, &runq_sw_set_empty_op); } /* @@ -327,12 +375,12 @@ runq_add_idx(struct runq *rq, struct thread *td, int idx, int flags) struct rq_queue *rqq; /* - * runq_setbit() asserts 'idx' is non-negative and below 'RQ_NQS', and - * a static assert earlier in this file ensures that 'RQ_NQS' is no more - * than 256. + * runq_sw_*() functions assert that 'idx' is non-negative and below + * 'RQ_NQS', and a static assert earlier in this file ensures that + * 'RQ_NQS' is no more than 256. */ td->td_rqindex = idx; - runq_setbit(rq, idx); + runq_sw_set_not_empty(rq, idx); rqq = &rq->rq_queues[idx]; CTR4(KTR_RUNQ, "runq_add_idx: td=%p pri=%d idx=%d rqq=%p", td, td->td_priority, idx, rqq); @@ -362,7 +410,7 @@ runq_remove(struct runq *rq, struct thread *td) td, td->td_priority, idx, rqq); TAILQ_REMOVE(rqq, td, td_runq); if (TAILQ_EMPTY(rqq)) { - runq_clrbit(rq, idx); + runq_sw_set_empty(rq, idx); CTR1(KTR_RUNQ, "runq_remove: queue at idx=%d now empty", idx); return (true); } From nobody Mon Jul 28 13:31:19 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 4brKBJ1j9Yz634sV; Mon, 28 Jul 2025 13:31:20 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBH4RYBz3tmx; Mon, 28 Jul 2025 13:31:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709479; 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=iMwz7AJEjRolvaojgcbyDyCdhvplfO6SCv8X+Eoi4No=; b=tJP/UhJOAqTAsjvruefOBhAPbFPRI8wNMpoSkaslJLKAld/9Kztef2YLYO37qcuomB5erz Ipdl13wq4KcuEQ1YPc5k1AKg4cUSfGMf0UGlaRw9/YZjW91IAc2d04H16KS6+GyujOamxx BEjKcQhop+PVeNEf/CFSxP0Q2RM/PxTca8x90eTqH/11WIr6VlL3ALTT48lRg6CVS4VNh1 s7YjCqxU3UBga0zdMz/in6slCgwMNqGUxuiI2MUjiQ4NDlE+slZnZKO+fgDgbuO2h6jY6e vI1M4ZwtEUkJ4cybCqQe4Bs0R81Lg/EkGOUDUk3NCnXW3G0tRPgXqgva/yppmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709479; 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=iMwz7AJEjRolvaojgcbyDyCdhvplfO6SCv8X+Eoi4No=; b=ZbJalYlzKHu/S+FhD035LNkO+000y4L1A0QJqgIijr6SIdtgZM9qJWwHEwfKhIuaPJWoo6 9oluuj6urzYLgllGfLH2CYbjyeqUy1gpwSKuawU+SvW8Pj4Kqxp5kjC6exLf+Afao1XxOa wFBsmey5dhdCxWcrYevhMrD74y+BcYBHTlqtwrPFvsPdD5oRKua/Jrhy6WVncGySVCCfqg 5flqJLPUgetVGqy8ZxaRnFQakSe2JeyoNTSi+R2NH0shgTbnttFmEnbvggaBSsw+O7YDs1 T0PCLh7XbH71rTS3FsA73m1BCVHOvw21mpbuGnk89SvhRspXRjVFeDl9NG4PMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709479; a=rsa-sha256; cv=none; b=M3POzX+yGQYZB+b1f2EDSohlHaw7KCUHY3OSH/wBP5mZiMzTwcp4dnUjaTuQ+dVLyrOgrc kUuagAbbPanPPpL37Bg5bSajWYgmMykn9anaCiJYAchWru2B4rEl4kIi+h6nepq/w0UYsn XpWiYeOh+oXt8SrwVIcllwlq8dRBi2pzkd7BWJROH0O9J0d0+bVnVAFDhi59fvCagZnhZx mFvGd+7fmwy8DOEvEJW/PJTQNmQJn3f0gbFYcLSDZcSPZ9X6ROsYqxZyBqu5WxbFKxhyaJ 1DuV7hZYr1ucIPiCphc4+U+sLIy49WhWJKdVel2/P7Jh9+5krTOjYMO6n4/gNw== 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 4brKBH2sXtznCL; Mon, 28 Jul 2025 13:31:19 +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 56SDVJfB080228; Mon, 28 Jul 2025 13:31:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVJbB080225; Mon, 28 Jul 2025 13:31:19 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:19 GMT Message-Id: <202507281331.56SDVJbB080225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 9eba574a6761 - stable/14 - runq: New function runq_is_queue_empty(); Use it in ULE 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9eba574a676191e2f2aaaa0401dcd887e25fb961 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9eba574a676191e2f2aaaa0401dcd887e25fb961 commit 9eba574a676191e2f2aaaa0401dcd887e25fb961 Author: Olivier Certner AuthorDate: 2024-05-23 15:31:06 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:13 +0000 runq: New function runq_is_queue_empty(); Use it in ULE Indicates if some particular queue of the runqueue is empty. Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit a31193172cb98bd1fb242555ca8e122efff74258) --- sys/kern/kern_switch.c | 28 ++++++++++++++++++++++++++++ sys/kern/sched_ule.c | 2 +- sys/sys/runq.h | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index eb39ca88992c..b23dfa162c4f 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -271,10 +271,13 @@ static inline uintptr_t runq_sw_set_not_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp); static inline uintptr_t runq_sw_set_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp); +static inline uintptr_t runq_sw_is_empty_op(int idx, int sw_idx, + rqsw_t sw_bit, rqsw_t *swp); /* Status words' individual bit manipulators. */ static inline void runq_sw_set_not_empty(struct runq *rq, int idx); static inline void runq_sw_set_empty(struct runq *rq, int idx); +static inline bool runq_sw_is_empty(struct runq *rq, int idx); /* * Initialize a run structure. @@ -358,6 +361,31 @@ runq_sw_set_empty(struct runq *rq, int idx) (void)runq_sw_apply(rq, idx, &runq_sw_set_empty_op); } +static inline uintptr_t +runq_sw_is_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp) +{ + return ((*swp & sw_bit) == 0); +} + +/* + * Returns whether the status words indicate that some queue is empty. + */ +static inline bool +runq_sw_is_empty(struct runq *rq, int idx) +{ + return (runq_sw_apply(rq, idx, &runq_sw_is_empty_op)); +} + +/* + * Returns whether a particular queue is empty. + */ +bool +runq_is_queue_empty(struct runq *rq, int idx) +{ + + return (runq_sw_is_empty(rq, idx)); +} + /* * Add the thread to the queue specified by its priority, and set the * corresponding status bit. diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 8fdc71c21e64..d8abb911a887 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2605,7 +2605,7 @@ sched_clock(struct thread *td, int cnt) */ if (tdq->tdq_idx == tdq->tdq_ridx) { tdq->tdq_idx = (tdq->tdq_idx + 1) % RQ_NQS; - if (TAILQ_EMPTY(&tdq->tdq_timeshare.rq_queues[tdq->tdq_ridx])) + if (runq_is_queue_empty(&tdq->tdq_timeshare, tdq->tdq_ridx)) tdq->tdq_ridx = tdq->tdq_idx; } ts = td_get_sched(td); diff --git a/sys/sys/runq.h b/sys/sys/runq.h index c570dd25503b..5156a7d8c307 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -98,6 +98,7 @@ struct runq { }; void runq_init(struct runq *); +bool runq_is_queue_empty(struct runq *, int _idx); void runq_add(struct runq *, struct thread *, int _flags); void runq_add_idx(struct runq *, struct thread *, int _idx, int _flags); bool runq_remove(struct runq *, struct thread *); From nobody Mon Jul 28 13:31:20 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 4brKBK04GKz6351T; Mon, 28 Jul 2025 13:31:21 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBJ4s78z3tqS; Mon, 28 Jul 2025 13:31:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709480; 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=AAKNE20Nh9JdMHx3xVenyTjm8JLUykTyP+2jFaw9cAI=; b=iBx3IEzOwnUnuNZZxwDztoO2xoF4ZPWUxBcY0F0uWl5/c7SHFJUeFA4lfGX0A7E72G9elw x/coBcXvA4jSNQr0PBo3ZHoIcoRxnhOVGTkjOTUcZY8dRtOIvZwrDM32wnxdrT0HWGQjYs WpmNDJBqUJQe52Zux9ptBuMHPiB4BIi0BpPZAdNnwCPpQ0GNgW1ZUpCbtdwWI0wMmxyEwy 8jvoIxmFFvhdcY5nesEGK3WHPgMfD33fBqamPdr1gAU3WARaROpYj4aqYsWW5ZGi6Mc86A eOv4KM5W/KI72vBHVHHq8jNWesOo0RAypySk2P4MOhDFdr6CPVpdxZFgKKmj4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709480; 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=AAKNE20Nh9JdMHx3xVenyTjm8JLUykTyP+2jFaw9cAI=; b=OIkqBFdljQtjD0Q4NIMtRcdXAsNP+hiV3g6LOdVyo0ydAAM6VQConOwpsX/6TkSoCKh5O7 eZCDML5eDGuiz/En9vhel6Mza0twpsugSS0QgnAkZ4Md5J++LF7+NvHoa2rbbT7xrZ6MjB ijU7+XX3FcahIDbtHKlCpNvlCOyBh+/STaA7/O0pUoIb7CWQFqejlO1Nn+uUhb64CVIdRD HWtHeV8hDyQkAc9BylU3vczLneAHoYbi7youAOYOqD45Ea5HxJd022NROI5CHW/wMvkmlK qs022jdddHYXrTlOpRa5Wz27XurXHzX6Z0aOnGwSUt4ulXbIVCYr1ykpbu+okg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709480; a=rsa-sha256; cv=none; b=hc3OOiq4ne7scYOvvSqkNhy10QTYHTPZM/+AtCIfpPxuPJkx2SGX26O6gGjz2Pna6l3tYI hRQtNna7PlPsfzpGO1z+a3pPeS72GfOKmxR+cN5ptldcN/GEywRl+ebTyr9UtAbVxZDKH1 Kfvvcmro4XhlRmDZqoCvBoeM+LJl5eimBVBgkEF8y51MWL43c40zOQtTNe/rqo2iTceftB 5AcM/sKEX435kW1iFjusz8orp7k3fBGIXS/WgTtEhuicAe6kspbBDRnY+JguVX1WmyE2IF buhTDIm5TYZzN72IR3AcUeuAX6AkdIuhb1BMy7BOQiyZYnjXaV6U7EB0lIBZIQ== 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 4brKBJ3ngMznG3; Mon, 28 Jul 2025 13:31:20 +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 56SDVK1S080261; Mon, 28 Jul 2025 13:31:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVKBE080258; Mon, 28 Jul 2025 13:31:20 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:20 GMT Message-Id: <202507281331.56SDVKBE080258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 16cfdebb8b34 - stable/14 - runq: New runq_findq(), common low-level search implementation 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 16cfdebb8b3466c27a7c4a42589c252353ccdad1 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=16cfdebb8b3466c27a7c4a42589c252353ccdad1 commit 16cfdebb8b3466c27a7c4a42589c252353ccdad1 Author: Olivier Certner AuthorDate: 2024-04-26 01:57:25 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:15 +0000 runq: New runq_findq(), common low-level search implementation That new runq_findq(), based on the implementation of the former runq_findq_range(), is intended to become the foundation and unique low-level implementation for all searches in a runqueue. In addition to a range of queues' indices, it takes a predicate function, allowing to: - Possibly skip a non-empty queue with higher priority (numerically lower index) on some criteria. This is not yet used but will be in a subsequent commit revising ULE's stealing machinery. - Choose a specific thread in the queue, not necessarily the first. - Return whatever information is deemed necessary. It helps to remove duplicated boilerplate code, including redundant assertions, and generally makes things much clearer. These effects will be even greater in a subsequent commit modifying ULE to use it. runq_first_thread_range() replaces the old runq_findq_range() (returns the first thread of the highest priority queue in the requested range), and runq_first_thread() the old runq_findq() (same, but considering all queues). Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit 9c3f4682bb90eeb85b0bbe8728a493e7d2ffece3) --- sys/kern/kern_switch.c | 203 ++++++++++++++++++++++++++++++------------------- sys/sys/runq.h | 13 +++- 2 files changed, 135 insertions(+), 81 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index b23dfa162c4f..9a05f3c90a80 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -445,15 +445,44 @@ runq_remove(struct runq *rq, struct thread *td) return (false); } +static inline int +runq_findq_status_word(struct runq *const rq, const int w_idx, + const rqsw_t w, runq_pred_t *const pred, void *const pred_data) +{ + struct rq_queue *q; + rqsw_t tw = w; + int idx, b_idx; + + while (tw != 0) { + b_idx = RQSW_BSF(tw); + idx = RQSW_TO_QUEUE_IDX(w_idx, b_idx); + q = &rq->rq_queues[idx]; + KASSERT(!TAILQ_EMPTY(q), + ("runq_findq(): No thread on non-empty queue with idx=%d", + idx)); + if (pred(idx, q, pred_data)) + return (idx); + tw &= ~RQSW_BIT(idx); + } + + return (-1); +} + /* - * Find the index of the first (i.e., having lower index) non-empty queue in the - * passed range (bounds included). This is done by scanning the status bits, - * a set bit indicating a non-empty queue. Returns -1 if all queues in the range - * are empty. + * Find in the passed range (bounds included) the index of the first (i.e., + * having lower index) non-empty queue that passes pred(). + * + * Considered queues are those with index 'lvl_min' up to 'lvl_max' (bounds + * included). If no queue matches, returns -1. + * + * This is done by scanning the status words (a set bit indicates a non-empty + * queue) and calling pred() with corresponding queue indices. pred() must + * return whether the corresponding queue is accepted. It is passed private + * data through 'pred_data', which can be used both for extra input and output. */ -static int -runq_findq_range(const struct runq *const rq, const int lvl_min, - const int lvl_max) +int +runq_findq(struct runq *const rq, const int lvl_min, const int lvl_max, + runq_pred_t *const pred, void *const pred_data) { rqsw_t const (*const rqsw)[RQSW_NB] = &rq->rq_status.rq_sw; rqsw_t w; @@ -470,12 +499,14 @@ runq_findq_range(const struct runq *const rq, const int lvl_min, w = (*rqsw)[i] & ~(RQSW_BIT(lvl_min) - 1); if (i == last) goto last_mask; - if (w != 0) + idx = runq_findq_status_word(rq, i, w, pred, pred_data); + if (idx != -1) goto return_idx; for (++i; i < last; ++i) { w = (*rqsw)[i]; - if (w != 0) + idx = runq_findq_status_word(rq, i, w, pred, pred_data); + if (idx != -1) goto return_idx; } @@ -484,34 +515,45 @@ runq_findq_range(const struct runq *const rq, const int lvl_min, last_mask: /* Clear bits for runqueues above 'lvl_max'. */ w &= (RQSW_BIT(lvl_max) - 1) | RQSW_BIT(lvl_max); - if (w != 0) + idx = runq_findq_status_word(rq, i, w, pred, pred_data); + if (idx != -1) goto return_idx; - return (-1); return_idx: - idx = RQSW_FIRST_QUEUE_IDX(i, w); - CTR4(KTR_RUNQ, "runq_findq_range: bits=%#x->%#x i=%d idx=%d", + CTR4(KTR_RUNQ, "runq_findq: bits=%#x->%#x i=%d idx=%d", (*rqsw)[i], w, i, idx); return (idx); } -static __inline int -runq_findq_circular(struct runq *const rq, int start_idx) +static bool +runq_first_thread_pred(const int idx, struct rq_queue *const q, void *const data) { - int idx; + struct thread **const tdp = data; + struct thread *const td = TAILQ_FIRST(q); - idx = runq_findq_range(rq, start_idx, RQ_NQS - 1); - if (idx != -1 || start_idx == 0) - return (idx); + *tdp = td; + return (true); +} - return (runq_findq_range(rq, 0, start_idx - 1)); +/* + * Inline this function for the benefit of this file's internal uses, but make + * sure it has an external definition as it is exported. + */ +extern inline struct thread * +runq_first_thread_range(struct runq *const rq, const int lvl_min, + const int lvl_max) +{ + struct thread *td = NULL; + + (void)runq_findq(rq, lvl_min, lvl_max, runq_first_thread_pred, &td); + return (td); } -static __inline int -runq_findq(struct runq *const rq) +static inline struct thread * +runq_first_thread(struct runq *const rq) { - return (runq_findq_range(rq, 0, RQ_NQS - 1)); + return (runq_first_thread_range(rq, 0, RQ_NQS - 1)); } /* @@ -521,11 +563,11 @@ runq_findq(struct runq *const rq) bool runq_not_empty(struct runq *rq) { - int idx; + struct thread *const td = runq_first_thread(rq); - idx = runq_findq(rq); - if (idx != -1) { - CTR1(KTR_RUNQ, "runq_not_empty: idx=%d", idx); + if (td != NULL) { + CTR2(KTR_RUNQ, "runq_not_empty: idx=%d, td=%p", + td->td_rqindex, td); return (true); } @@ -539,84 +581,85 @@ runq_not_empty(struct runq *rq) struct thread * runq_choose(struct runq *rq) { - struct rq_queue *rqq; struct thread *td; - int idx; - idx = runq_findq(rq); - if (idx != -1) { - rqq = &rq->rq_queues[idx]; - td = TAILQ_FIRST(rqq); - KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); - CTR3(KTR_RUNQ, - "runq_choose: idx=%d thread=%p rqq=%p", idx, td, rqq); + td = runq_first_thread(rq); + if (td != NULL) { + CTR2(KTR_RUNQ, "runq_choose: idx=%d td=%p", td->td_rqindex, td); return (td); } - CTR1(KTR_RUNQ, "runq_choose: idlethread idx=%d", idx); + CTR0(KTR_RUNQ, "runq_choose: idlethread"); return (NULL); } +struct runq_fuzz_pred_data { + int fuzz; + struct thread *td; +}; + +static bool +runq_fuzz_pred(const int idx, struct rq_queue *const q, void *const data) +{ + struct runq_fuzz_pred_data *const d = data; + const int fuzz = d->fuzz; + struct thread *td; + + td = TAILQ_FIRST(q); + + if (fuzz > 1) { + /* + * In the first couple of entries, check if + * there is one for our CPU as a preference. + */ + struct thread *td2 = td; + int count = fuzz; + int cpu = PCPU_GET(cpuid); + + while (count-- != 0 && td2 != NULL) { + if (td2->td_lastcpu == cpu) { + td = td2; + break; + } + td2 = TAILQ_NEXT(td2, td_runq); + } + } + + d->td = td; + return (true); +} + /* * Find the highest priority process on the run queue. */ struct thread * runq_choose_fuzz(struct runq *rq, int fuzz) { - struct rq_queue *rqq; - struct thread *td; + struct runq_fuzz_pred_data data = { + .fuzz = fuzz, + .td = NULL + }; int idx; - idx = runq_findq(rq); + idx = runq_findq(rq, 0, RQ_NQS - 1, runq_fuzz_pred, &data); if (idx != -1) { - rqq = &rq->rq_queues[idx]; - /* fuzz == 1 is normal.. 0 or less are ignored */ - if (fuzz > 1) { - /* - * In the first couple of entries, check if - * there is one for our CPU as a preference. - */ - int count = fuzz; - int cpu = PCPU_GET(cpuid); - struct thread *td2; - td2 = td = TAILQ_FIRST(rqq); - - while (count-- && td2) { - if (td2->td_lastcpu == cpu) { - td = td2; - break; - } - td2 = TAILQ_NEXT(td2, td_runq); - } - } else - td = TAILQ_FIRST(rqq); - KASSERT(td != NULL, ("runq_choose_fuzz: no proc on busy queue")); - CTR3(KTR_RUNQ, - "runq_choose_fuzz: idx=%d thread=%p rqq=%p", idx, td, rqq); - return (td); + MPASS(data.td != NULL); + CTR2(KTR_RUNQ, "runq_choose_fuzz: idx=%d td=%p", idx, data.td); + return (data.td); } - CTR1(KTR_RUNQ, "runq_choose_fuzz: idleproc idx=%d", idx); + MPASS(data.td == NULL); + CTR0(KTR_RUNQ, "runq_choose_fuzz: idlethread"); return (NULL); } struct thread * -runq_choose_from(struct runq *rq, int from_idx) +runq_choose_from(struct runq *const rq, int from_idx) { - struct rq_queue *rqq; struct thread *td; - int idx; - if ((idx = runq_findq_circular(rq, from_idx)) != -1) { - rqq = &rq->rq_queues[idx]; - td = TAILQ_FIRST(rqq); - KASSERT(td != NULL, ("runq_choose: no thread on busy queue")); - CTR4(KTR_RUNQ, - "runq_choose_from: idx=%d thread=%p idx=%d rqq=%p", - idx, td, td->td_rqindex, rqq); + td = runq_first_thread_range(rq, from_idx, RQ_NQS - 1); + if (td != NULL || from_idx == 0) return (td); - } - CTR1(KTR_RUNQ, "runq_choose_from: idlethread idx=%d", idx); - - return (NULL); + return (runq_first_thread_range(rq, 0, from_idx - 1)); } diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 5156a7d8c307..0a7f70fcfa16 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -103,7 +103,18 @@ void runq_add(struct runq *, struct thread *, int _flags); void runq_add_idx(struct runq *, struct thread *, int _idx, int _flags); bool runq_remove(struct runq *, struct thread *); -bool runq_not_empty(struct runq *); +/* + * Implementation helpers for common and scheduler-specific runq_choose*() + * functions. + */ +typedef bool runq_pred_t(int _idx, struct rq_queue *, void *_data); +int runq_findq(struct runq *const rq, const int lvl_min, + const int lvl_max, + runq_pred_t *const pred, void *const pred_data); +struct thread *runq_first_thread_range(struct runq *const rq, + const int lvl_min, const int lvl_max); + +bool runq_not_empty(struct runq *); struct thread *runq_choose(struct runq *); struct thread *runq_choose_fuzz(struct runq *, int _fuzz); struct thread *runq_choose_from(struct runq *, int _idx); From nobody Mon Jul 28 13:31:21 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 4brKBL1lWWz634qb; Mon, 28 Jul 2025 13:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBK54hZz3tnX; Mon, 28 Jul 2025 13:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709481; 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=mCzAcl5Q4kw+TEPeKwZWW65fYBnqtQX3NuF6DwxCC9c=; b=lM9ZDuNVXQGNR0/rWdVDqHAq2nq9AxWY5ApQqJgSarA6awtaYc0NlRxMkkxvxWygMcqgwT EiecPLKXmdWrAwHb2h2Af/civep94UgX11f4hjr5FOTSpMGi0pixycdyzEQ+g3CLCa6vPM bGUrC+kasbT2z7F25Ii+kH6GSU9MLbvAFdDLQh0RV+wbpjD0EMA9xWKxQIcCaWEoKm9Vth L9a0BFep6pkYdienaGQYkuFjzmrMfLAL9o+7lbWOl7uzEGECLOcIbmwEHVYibf/E3NkXWZ Cg7UFMHDdzqiTQi7BoytAEU67LKL3P0sfSE8AycQ57p60WO/tVbML4zb9B3Slw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709481; 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=mCzAcl5Q4kw+TEPeKwZWW65fYBnqtQX3NuF6DwxCC9c=; b=fn8Djj/SUbAMiZzCpiwpjIaqUbRqScemaEazEjNvZSHOUTisam6t5PPN0TZaQVOoa1MkDd VzzD4JVdZ2Nz1thsGIWP5rDxfaeUcIoud2baFZrbtoYYNaXDiJX9JDKiQOLrnjD+YUsaor bdGR8lFnZi5dSDcYnik6WSPvGkKQoSfmsgkjpKrADLDWSXZdhanc8ULv4ouJg3bzaYj4lW R8uNUDnlRRKAsRuudUvRRMFUfnuAvTUugLrqoqT+P6Q4Fd2TBuyMYC70qoFVfe1e8sLTap U99m74Xh8kSyXEe9fkvuP924YcSei4PXA/75ZL5Jl4kbcFP5+2KvgYrTZ+UD+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709481; a=rsa-sha256; cv=none; b=G/lT8m8gpE0EIOlqLQdJEp9RwhvcTb4VY+J5nBk+I1foQ7ejbgtjmzvcdqraes9n2TYKgz qQY+u0BBwU3upfvFlYTqhnAfNP/RiRDWLvZvLU+Lag0Dt40bPX60T+QE/kD4ejbsmE3Qu2 xZBwZ21jHFIPobkf9uDNai6ssclCPv1nxRr4g8XOzp+Ncza5VJUXlncGbFTVPweSFRAxPW Mj0U8m48RsTmYmVy8NArTB5oE8BFsry3cm+SOGoa7wvI97TGL9W/KM7rK/g4CkKHFq1Wsk AbzRxtOTPEzJAOdePlZsciTJZOJc2CK2sKwcYPl3nZaYpwLU7yVI+fhbZoZ6EA== 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 4brKBK4P1pznNs; Mon, 28 Jul 2025 13:31:21 +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 56SDVLRQ080294; Mon, 28 Jul 2025 13:31:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVLg3080291; Mon, 28 Jul 2025 13:31:21 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:21 GMT Message-Id: <202507281331.56SDVLg3080291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 952ccda22e27 - stable/14 - sched_ule: Re-implement stealing on top of runq common-code 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 952ccda22e27a7321d07814bd19d2c407c366cd4 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=952ccda22e27a7321d07814bd19d2c407c366cd4 commit 952ccda22e27a7321d07814bd19d2c407c366cd4 Author: Olivier Certner AuthorDate: 2024-04-29 00:55:40 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:17 +0000 sched_ule: Re-implement stealing on top of runq common-code Stop using internal knowledge of runqueues. Remove duplicate boilerplate parts. Concretely, runq_steal() and runq_steal_from() are now implemented on top of runq_findq(). Besides considerably simplifying the code, this change also brings an algorithmic improvement since, previously, set bits in the runqueue's status words were found by testing each bit individually in a loop instead of using ffsl()/bsfl() (except for the first set bit per status word). This change also makes it more apparent that runq_steal_from() treats the first thread with highest priority specifically (which runq_steal() does not). MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45388 (cherry picked from commit f4be333bc56759d33dca49ab4d19eaf22134e844) --- sys/kern/sched_ule.c | 124 ++++++++++++++++++++++++++++----------------------- 1 file changed, 68 insertions(+), 56 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index d8abb911a887..2e01cf6c2484 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1183,51 +1183,68 @@ tdq_notify(struct tdq *tdq, int lowpri) ipi_cpu(cpu, IPI_PREEMPT); } -/* - * Steals load from a timeshare queue. Honors the rotating queue head - * index. - */ -static struct thread * -runq_steal_from(struct runq *rq, int cpu, u_char start) +struct runq_steal_pred_data { + struct thread *td; + struct thread *first; + int cpu; + bool use_first_last; +}; + +static bool +runq_steal_pred(const int idx, struct rq_queue *const q, void *const data) { - struct rq_status *rqs; - struct rq_queue *rqq; - struct thread *td, *first; - int bit; - int i; + struct runq_steal_pred_data *const d = data; + struct thread *td; - rqs = &rq->rq_status; - bit = RQSW_BIT_IDX(start); - first = NULL; -again: - for (i = RQSW_IDX(start); i < RQSW_NB; bit = 0, i++) { - if (rqs->rq_sw[i] == 0) + TAILQ_FOREACH(td, q, td_runq) { + if (d->use_first_last && d->first == NULL) { + d->first = td; continue; - if (bit == 0) - bit = RQSW_BSF(rqs->rq_sw[i]); - for (; bit < RQSW_BPW; bit++) { - if ((rqs->rq_sw[i] & (1ul << bit)) == 0) - continue; - rqq = &rq->rq_queues[RQSW_TO_QUEUE_IDX(i, bit)]; - TAILQ_FOREACH(td, rqq, td_runq) { - if (first) { - if (THREAD_CAN_MIGRATE(td) && - THREAD_CAN_SCHED(td, cpu)) - return (td); - } else - first = td; - } + } + + if (THREAD_CAN_MIGRATE(td) && THREAD_CAN_SCHED(td, d->cpu)) { + d->td = td; + return (true); } } - if (start != 0) { - start = 0; - goto again; + + return (false); +} + +/* + * Steals load from a timeshare queue. Honors the rotating queue head + * index. + */ +static inline struct thread * +runq_steal_from(struct runq *const rq, int cpu, int start_idx) +{ + struct runq_steal_pred_data data = { + .td = NULL, + .first = NULL, + .cpu = cpu, + .use_first_last = true + }; + int idx; + + idx = runq_findq(rq, start_idx, RQ_NQS - 1, &runq_steal_pred, &data); + if (idx != -1) + goto found; + + MPASS(data.td == NULL); + if (start_idx != 0) { + idx = runq_findq(rq, 0, start_idx - 1, &runq_steal_pred, &data); + if (idx != -1) + goto found; } - if (first && THREAD_CAN_MIGRATE(first) && - THREAD_CAN_SCHED(first, cpu)) - return (first); + MPASS(idx == -1 && data.td == NULL); + if (data.first != NULL && THREAD_CAN_MIGRATE(data.first) && + THREAD_CAN_SCHED(data.first, cpu)) + return (data.first); return (NULL); +found: + MPASS(data.td != NULL); + return (data.td); } /* @@ -1236,26 +1253,21 @@ again: static struct thread * runq_steal(struct runq *rq, int cpu) { - struct rq_queue *rqq; - struct rq_status *rqs; - struct thread *td; - int word; - int bit; - - rqs = &rq->rq_status; - for (word = 0; word < RQSW_NB; word++) { - if (rqs->rq_sw[word] == 0) - continue; - for (bit = 0; bit < RQSW_BPW; bit++) { - if ((rqs->rq_sw[word] & (1ul << bit)) == 0) - continue; - rqq = &rq->rq_queues[RQSW_TO_QUEUE_IDX(word, bit)]; - TAILQ_FOREACH(td, rqq, td_runq) - if (THREAD_CAN_MIGRATE(td) && - THREAD_CAN_SCHED(td, cpu)) - return (td); - } + struct runq_steal_pred_data data = { + .td = NULL, + .first = NULL, + .cpu = cpu, + .use_first_last = false + }; + int idx; + + idx = runq_findq(rq, 0, RQ_NQS - 1, &runq_steal_pred, &data); + if (idx != -1) { + MPASS(data.td != NULL); + return (data.td); } + + MPASS(data.td == NULL); return (NULL); } From nobody Mon Jul 28 13:31:22 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 4brKBM3t6jz6351Z; Mon, 28 Jul 2025 13:31:23 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBL5fxpz3tYk; Mon, 28 Jul 2025 13:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709482; 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=fw2CmIAn2UIawjnwHwD86F/xl3qGAqJ+/kWi7VrnYgA=; b=ML1YGkIhk8C4lFzj7hq0P5eTZq5qtIcjXDCDgmUjYtGEFI/A0uDnBgipgA8lfQqDCVkKgB AN+cquWkuKCk3tcF5mJvkR+7wQ0rNIVe79D4qctUoHghRCgZpBMMz4r62HKvzWCgIVOWNy jbCBMTIII/4BHpAU+/RUpO9XRy5FXb+/Nc8f8rIPsXCz+WN7U35mivJDkNnow1J54YS0z3 34bqLOUDSW+T9Po68cPefekIEI5AIb03wbICqURlT06Zv7bp3JO5x3Yi1t60GtvT7q61en 3WGuRxzwfjZ339HbAp1cJ9y6jmQKbLON0ig2faqZP0yh2fLuT7pbUQBN1HOZWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709482; 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=fw2CmIAn2UIawjnwHwD86F/xl3qGAqJ+/kWi7VrnYgA=; b=oyH+/3m6CU+ugeo1Sa0b9qvcV2y5LDjRDOKu+LMv01QvIP7Wz1igImYDYrinEaBg/TX0Zu 8/FY4jUF+VYryikS65WtAW9Mh3GCDZCeQBB77DKNdMxNJjWcMEC3T+pYDGebs0byih9wm6 mCyulId2gJhuYzQhuRvAFGrc8WSjVtWEXhzeN9CB9wOhQ5uoMpfjlQGDEeLnIeVTIPxnOE 2BTOilGu19rmxkA2Cm3uAUpMHtX7u6wT6v4JohJhhqGZa6XVNCuN55pWR6WXcXdJ/vzFDM ziUSJNhJ30DSiLXXipPu+4WwwzytXdCVEKDNELi2OSuwk5k97CVn2e2Btx2u+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709482; a=rsa-sha256; cv=none; b=hOI6moF08nTK/T5oMeioUQQWHBcTw2PQ1+TP1VtGU9uiv8ga+5wmmQZVEGZqU6MpP0sIqI IdGDYGBOT6pdKlC/083LgUHb+0MzIHS6nYyp66nlCc7CDgttak/zOqzydTdAvE3dWTanl3 gvT6TPf6nYsc41BxX3oyk2ggQsJtXZODt1AhaTuuFAmtxddi5PO5ecOEoIoiXAiB79G9cP GCMdEMrZfDyX5/5YvpXjnqWLkJjOevFdOEvJXDFuj7VdLnPWv7b8sW/hhKR1akD235c1Rt 2XTy3U1qBfQV4VFQd1NF728wM/x+Gk6yVB54bScVSli/DBs/ibZO/ocdhVBdnw== 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 4brKBL5Cc1znfM; Mon, 28 Jul 2025 13:31: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 56SDVMxC080333; Mon, 28 Jul 2025 13:31:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVM1u080330; Mon, 28 Jul 2025 13:31:22 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:22 GMT Message-Id: <202507281331.56SDVM1u080330@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 0566e750c46c - stable/14 - sched_ule: runq_steal_from(): Suppress first thread special case 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0566e750c46cea02b4fbdda5b31e83dafaeaeb15 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=0566e750c46cea02b4fbdda5b31e83dafaeaeb15 commit 0566e750c46cea02b4fbdda5b31e83dafaeaeb15 Author: Olivier Certner AuthorDate: 2024-04-29 06:54:43 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:18 +0000 sched_ule: runq_steal_from(): Suppress first thread special case This special case was introduced as soon as commit "ULE 3.0" (ae7a6b38d53f, r171482, from July 2007). It caused runq_steal_from() to ignore the highest-priority thread while stealing. Its functionality was changed in commit "Rework CPU load balancing in SCHED_ULE" (36acfc6507aa, r232207, from February 2012), where the intent was to keep track of that first thread and return it if no other one was stealable, instead of returning NULL (no steal). Some bug prevented it from working in loaded cases (more than one thread, and all threads but the first one not stealable), which was subsequently fixed in commit "sched_ule(4): Fix interactive threads stealing." (bd84094a51c4, from September 2021). All the reasons for this mechanism we could second-guess were dubious at best. Jeff Roberson, ULE's main author, says in the differential revision that "The point was to move threads that are least likely to benefit from affinity because they are unlikely to run soon enough to take advantage of it.", to which we responded: "(snip) This may improve affinity in some cases, but at the same time we don't really know when the next thread on the queue is to run. Not stealing in this case also amounts to slightly violating the expected execution ordering and fairness.". As this twist doesn't seem to bring any performance improvement in general, let's just remove it. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45388 (cherry picked from commit fdf31d27476968456a8a389d8152370582756ef1) --- sys/kern/sched_ule.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 2e01cf6c2484..01eaabac3450 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1185,9 +1185,7 @@ tdq_notify(struct tdq *tdq, int lowpri) struct runq_steal_pred_data { struct thread *td; - struct thread *first; int cpu; - bool use_first_last; }; static bool @@ -1197,11 +1195,6 @@ runq_steal_pred(const int idx, struct rq_queue *const q, void *const data) struct thread *td; TAILQ_FOREACH(td, q, td_runq) { - if (d->use_first_last && d->first == NULL) { - d->first = td; - continue; - } - if (THREAD_CAN_MIGRATE(td) && THREAD_CAN_SCHED(td, d->cpu)) { d->td = td; return (true); @@ -1220,9 +1213,7 @@ runq_steal_from(struct runq *const rq, int cpu, int start_idx) { struct runq_steal_pred_data data = { .td = NULL, - .first = NULL, .cpu = cpu, - .use_first_last = true }; int idx; @@ -1238,9 +1229,6 @@ runq_steal_from(struct runq *const rq, int cpu, int start_idx) } MPASS(idx == -1 && data.td == NULL); - if (data.first != NULL && THREAD_CAN_MIGRATE(data.first) && - THREAD_CAN_SCHED(data.first, cpu)) - return (data.first); return (NULL); found: MPASS(data.td != NULL); @@ -1255,9 +1243,7 @@ runq_steal(struct runq *rq, int cpu) { struct runq_steal_pred_data data = { .td = NULL, - .first = NULL, .cpu = cpu, - .use_first_last = false }; int idx; From nobody Mon Jul 28 13:31:23 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 4brKBN6Vgxz634sj; Mon, 28 Jul 2025 13:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBM6TFbz3tYn; Mon, 28 Jul 2025 13:31:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709484; 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=JmpgBSvNvIXotvqR4sTfWwt/4bkXtAF3cG/CoONCBZ8=; b=Y2/kX0Il+/hbNEPXvtwwuN/EdzrQXsE0SUdXEGXugn7NAc263I0+8XczdkrTtsECn/CR1L WGfHg9HiqE0UWRtgGbQFaal1RTPzYe+WGsk6S6oG5XTYsD1mhUzyAFpDApDf8pi3CNrydT 1j0NccR8LgeiRP1KZOxQuaPEnXrmMRVNIJ3y6EBw91L6BTP/t8jYyozBo3KJT5vlOHiwvX YdfmpQa5hdf7rQrDgdTP6lNyKUMGE1oHj97K22wMJ2Gi2GFL/E4vst6KEP4wXwM0AxNoh9 mQg0AlRPw3xioMsRD87a39/YBI1WSQ7YVCXj/YyiTdkTu0mAb7KEMVAXE/Ik8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709484; 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=JmpgBSvNvIXotvqR4sTfWwt/4bkXtAF3cG/CoONCBZ8=; b=qlPg5ivP9UgmA2+HNYDWlrFFa9Euh7fadba14Pteo5vap+/BYeWdhWrrnmvBB+vr87vHcB KLxVhABeQzS0xHYx4hNyd9mnSUtEKL3Cn0vHl8OxJZRLitYua4UlTSbuaN220l1rPNB9Km rqFcVEqxc3C2nbHg9nDmgbD/gHRBTT3nptBaO4GSH8L3xKIZa+r/kR7OgWxeZMabcYM7f3 22wn01ux4D1w1hiGrztTG8QMtMFufV++eOBds3JHZHQGYQc077zVVx/cOaV6PLlW8uGITz f7xm7o0DxjCPGNzx7E3xiezk5FrrToF5lrAEIEXZLrkR34kvMjq5cRiQxhyQRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709484; a=rsa-sha256; cv=none; b=edKmQbdLdXYy0h5ibNBGWFuuaCesrqFBokrQ+QmNtqH9J+82LMITAYM8+kUxl5S0m5Jwqg KKQEsRrn09qat3ujuZ++2oQfpV3p43ye+0zshaV88xFnhKmqZSu3XSCfWHOaApqa4gMGC1 ONS3oK1qBMKIHlar1CZFTFrnA8I393b4BEyWdVP1k/2CJtz6rPR3W7eod7VkOOACQoGGkJ 3sD1w0qFZ0pqhiHuNPV8If8bfYpvXCVUuSsGrOpZ505qJa1p2P/3FP/+bMY36dJqf6hzKF /u4qvUwB+rPTUMbKzIrujBWw/46jhtanKZ3PjsbkPRMnuvpGh4idEr0R8hSEOA== 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 4brKBM5xKDznfq; Mon, 28 Jul 2025 13:31:23 +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 56SDVNNG080366; Mon, 28 Jul 2025 13:31:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVNtn080363; Mon, 28 Jul 2025 13:31:23 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:23 GMT Message-Id: <202507281331.56SDVNtn080363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: faa0b715592d - stable/14 - sched_ule: Use a single runqueue per CPU 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: faa0b715592ddc470fdaacb84f5efc3bbf2b1e69 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=faa0b715592ddc470fdaacb84f5efc3bbf2b1e69 commit faa0b715592ddc470fdaacb84f5efc3bbf2b1e69 Author: Olivier Certner AuthorDate: 2024-05-14 10:45:20 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:19 +0000 sched_ule: Use a single runqueue per CPU Previously, ULE would use 3 separate runqueues per CPU to store threads, one for each of its selection policies, which are realtime, timesharing and idle. They would be examined in this order, and the first thread found would be the one selected. This choice indeed appears as the easiest evolution from the single runqueue used by sched_4bsd (4BSD): It allows sharing most of the same runqueue code, which currently defines 64 levels per runqueue, while multiplying the number of levels (by 3). However, it has several important drawbacks: 1. The number of levels is the same for each selection policy. 64 is unnecessarily large for the idle policy (only 32 distinct levels would be necessary, given the 32 levels of our RTP_PRIO_IDLE and their future aliases in the to-be-introduced SCHED_IDLE POSIX scheduling policy) and unnecessary restrictive both for the realtime policy (which should include 32 distinct levels for PRI_REALTIME, given our implementation of SCHED_RR/SCHED_FIFO, leaving at most 32 levels for ULE's interactive processes where the current implementation provisions 48 (perhaps taking into account the spreading problem, see next point)) and the timesharing one (88 distinct levels currently provisioned). 2. A runqueue has only 64 distinct levels, and maps priorities in the range [0;255] to a queue index by just performing a division by 4. Priorities mapped to the same level are treated exactly the same from a scheduling perspective, which is generally both unexpected and incorrect. ULE's code tries to compensate for this aliasing in the timesharing selection policy, by spreading the 88 levels into 256, knowing the latter amount in the end to only 64 distinct ones. This scaling is unfortunately not performed for the other policies, breaking the expectations mentioned in the previous point about distinct priority levels. With this change, only a single runqueue is now used to store all threads, regardless of the scheduling policy ULE applies to them (going back to what 4BSD has always been doing). ULE's 3 selection policies are assigned non-overlapping ranges of levels, and helper functions have been created to select or steal a thread in these distinct ranges, preserving the "circular" queue mechanism for the timesharing selection policy that (tries to) prevent starvation in the face of permanent dynamic priority adjustments. This change allows to choose any arbitrary repartition of runqueue levels between selection policies. It is a prerequisite to the increase to 256 levels per runqueue, which will allow to dispense with all the drawbacks listed above. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45389 (cherry picked from commit baecdea10eb50ac20c2ed1fcd4171d3a609e90b5) --- sys/kern/kern_switch.c | 11 -- sys/kern/sched_ule.c | 305 ++++++++++++++++++++++++++++++------------------- sys/sys/runq.h | 1 - 3 files changed, 187 insertions(+), 130 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 9a05f3c90a80..264925ab954a 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -652,14 +652,3 @@ runq_choose_fuzz(struct runq *rq, int fuzz) CTR0(KTR_RUNQ, "runq_choose_fuzz: idlethread"); return (NULL); } - -struct thread * -runq_choose_from(struct runq *const rq, int from_idx) -{ - struct thread *td; - - td = runq_first_thread_range(rq, from_idx, RQ_NQS - 1); - if (td != NULL || from_idx == 0) - return (td); - return (runq_first_thread_range(rq, 0, from_idx - 1)); -} diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 01eaabac3450..29a4bfef3ea2 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -88,10 +88,9 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; * Thread scheduler specific section. All fields are protected * by the thread lock. */ -struct td_sched { - struct runq *ts_runq; /* Run-queue we're queued on. */ +struct td_sched { short ts_flags; /* TSF_* flags. */ - int ts_cpu; /* CPU that we have affinity for. */ + int ts_cpu; /* CPU we are on, or were last on. */ int ts_rltick; /* Real last tick, for affinity. */ int ts_slice; /* Ticks of slice remaining. */ u_int ts_slptime; /* Number of ticks we vol. slept */ @@ -131,23 +130,6 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= #define PRI_MIN_BATCH (PRI_MIN_TIMESHARE + PRI_INTERACT_RANGE) #define PRI_MAX_BATCH PRI_MAX_TIMESHARE -/* - * Cpu percentage computation macros and defines. - * - * SCHED_TICK_SECS: Number of seconds to average the cpu usage across. - * SCHED_TICK_TARG: Number of hz ticks to average the cpu usage across. - * SCHED_TICK_MAX: Maximum number of ticks before scaling back. - * SCHED_TICK_SHIFT: Shift factor to avoid rounding away results. - * SCHED_TICK_HZ: Compute the number of hz ticks for a given ticks count. - * SCHED_TICK_TOTAL: Gives the amount of time we've been recording ticks. - */ -#define SCHED_TICK_SECS 10 -#define SCHED_TICK_TARG (hz * SCHED_TICK_SECS) -#define SCHED_TICK_MAX (SCHED_TICK_TARG + hz) -#define SCHED_TICK_SHIFT 10 -#define SCHED_TICK_HZ(ts) ((ts)->ts_ticks >> SCHED_TICK_SHIFT) -#define SCHED_TICK_TOTAL(ts) (max((ts)->ts_ltick - (ts)->ts_ftick, hz)) - /* * These macros determine priorities for non-interactive threads. They are * assigned a priority based on their recent cpu utilization as expressed @@ -170,6 +152,48 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= (roundup(SCHED_TICK_TOTAL((ts)), SCHED_PRI_RANGE) / SCHED_PRI_RANGE)) #define SCHED_PRI_NICE(nice) (nice) +/* + * Runqueue indices for the implemented scheduling policies' priority bounds. + * + * In ULE's implementation, realtime policy covers the ITHD, REALTIME and + * INTERACT (see above) ranges, timesharing the BATCH range (see above), and + * idle policy the IDLE range. + * + * Priorities from these ranges must not be assigned to the same runqueue's + * queue. + */ +#define RQ_RT_POL_MIN (RQ_PRI_TO_QUEUE_IDX(PRI_MIN_ITHD)) +#define RQ_RT_POL_MAX (RQ_PRI_TO_QUEUE_IDX(PRI_MAX_INTERACT)) +#define RQ_TS_POL_MIN (RQ_PRI_TO_QUEUE_IDX(PRI_MIN_BATCH)) +#define RQ_TS_POL_MAX (RQ_PRI_TO_QUEUE_IDX(PRI_MAX_BATCH)) +#define RQ_ID_POL_MIN (RQ_PRI_TO_QUEUE_IDX(PRI_MIN_IDLE)) +#define RQ_ID_POL_MAX (RQ_PRI_TO_QUEUE_IDX(PRI_MAX_IDLE)) + +_Static_assert(RQ_RT_POL_MAX != RQ_TS_POL_MIN, + "ULE's realtime and timeshare policies' runqueue ranges overlap"); +_Static_assert(RQ_TS_POL_MAX != RQ_ID_POL_MIN, + "ULE's timeshare and idle policies' runqueue ranges overlap"); + +/* Helper to treat the timeshare range as a circular group of queues. */ +#define RQ_TS_POL_MODULO (RQ_TS_POL_MAX - RQ_TS_POL_MIN + 1) + +/* + * Cpu percentage computation macros and defines. + * + * SCHED_TICK_SECS: Number of seconds to average the cpu usage across. + * SCHED_TICK_TARG: Number of hz ticks to average the cpu usage across. + * SCHED_TICK_MAX: Maximum number of ticks before scaling back. + * SCHED_TICK_SHIFT: Shift factor to avoid rounding away results. + * SCHED_TICK_HZ: Compute the number of hz ticks for a given ticks count. + * SCHED_TICK_TOTAL: Gives the amount of time we've been recording ticks. + */ +#define SCHED_TICK_SECS 10 +#define SCHED_TICK_TARG (hz * SCHED_TICK_SECS) +#define SCHED_TICK_MAX (SCHED_TICK_TARG + hz) +#define SCHED_TICK_SHIFT 10 +#define SCHED_TICK_HZ(ts) ((ts)->ts_ticks >> SCHED_TICK_SHIFT) +#define SCHED_TICK_TOTAL(ts) (max((ts)->ts_ltick - (ts)->ts_ftick, hz)) + /* * These determine the interactivity of a process. Interactivity differs from * cpu utilization in that it expresses the voluntary time slept vs time ran @@ -253,12 +277,10 @@ struct tdq { short tdq_oldswitchcnt; /* (l) Switches last tick. */ u_char tdq_lowpri; /* (ts) Lowest priority thread. */ u_char tdq_owepreempt; /* (f) Remote preemption pending. */ - u_char tdq_idx; /* (t) Current insert index. */ - u_char tdq_ridx; /* (t) Current removal index. */ + u_char tdq_ts_off; /* (t) TS insertion offset. */ + u_char tdq_ts_deq_off; /* (t) TS dequeue offset. */ int tdq_id; /* (c) cpuid. */ - struct runq tdq_realtime; /* (t) real-time run queue. */ - struct runq tdq_timeshare; /* (t) timeshare run queue. */ - struct runq tdq_idle; /* (t) Queue of IDLE threads. */ + struct runq tdq_runq; /* (t) Run queue. */ char tdq_name[TDQ_NAME_LEN]; #ifdef KTR char tdq_loadname[TDQ_LOADNAME_LEN]; @@ -330,12 +352,17 @@ static void sched_interact_fork(struct thread *); static void sched_pctcpu_update(struct td_sched *, int); /* Operations on per processor queues */ +static inline struct thread *runq_choose_realtime(struct runq *const rq); +static inline struct thread *runq_choose_timeshare(struct runq *const rq, + int off); +static inline struct thread *runq_choose_idle(struct runq *const rq); static struct thread *tdq_choose(struct tdq *); + static void tdq_setup(struct tdq *, int i); static void tdq_load_add(struct tdq *, struct thread *); static void tdq_load_rem(struct tdq *, struct thread *); -static __inline void tdq_runq_add(struct tdq *, struct thread *, int); -static __inline void tdq_runq_rem(struct tdq *, struct thread *); +static inline void tdq_runq_add(struct tdq *, struct thread *, int); +static inline void tdq_runq_rem(struct tdq *, struct thread *); static inline int sched_shouldpreempt(int, int, int); static void tdq_print(int cpu); static void runq_print(struct runq *rq); @@ -344,8 +371,19 @@ static int tdq_add(struct tdq *, struct thread *, int); static int tdq_move(struct tdq *, struct tdq *); static int tdq_idled(struct tdq *); static void tdq_notify(struct tdq *, int lowpri); + +static bool runq_steal_pred(const int idx, struct rq_queue *const q, + void *const data); +static inline struct thread *runq_steal_range(struct runq *const rq, + const int lvl_min, const int lvl_max, int cpu); +static inline struct thread *runq_steal_realtime(struct runq *const rq, + int cpu); +static inline struct thread *runq_steal_timeshare(struct runq *const rq, + int cpu, int off); +static inline struct thread *runq_steal_idle(struct runq *const rq, + int cpu); static struct thread *tdq_steal(struct tdq *, int); -static struct thread *runq_steal(struct runq *, int); + static int sched_pickcpu(struct thread *, int); static void sched_balance(void); static bool sched_balance_pair(struct tdq *, struct tdq *); @@ -420,21 +458,17 @@ tdq_print(int cpu) tdq = TDQ_CPU(cpu); printf("tdq %d:\n", TDQ_ID(tdq)); - printf("\tlock %p\n", TDQ_LOCKPTR(tdq)); - printf("\tLock name: %s\n", tdq->tdq_name); - printf("\tload: %d\n", tdq->tdq_load); - printf("\tswitch cnt: %d\n", tdq->tdq_switchcnt); - printf("\told switch cnt: %d\n", tdq->tdq_oldswitchcnt); - printf("\ttimeshare idx: %d\n", tdq->tdq_idx); - printf("\ttimeshare ridx: %d\n", tdq->tdq_ridx); + printf("\tlock %p\n", TDQ_LOCKPTR(tdq)); + printf("\tLock name: %s\n", tdq->tdq_name); + printf("\tload: %d\n", tdq->tdq_load); + printf("\tswitch cnt: %d\n", tdq->tdq_switchcnt); + printf("\told switch cnt: %d\n", tdq->tdq_oldswitchcnt); + printf("\tTS insert offset: %d\n", tdq->tdq_ts_off); + printf("\tTS dequeue offset: %d\n", tdq->tdq_ts_deq_off); printf("\tload transferable: %d\n", tdq->tdq_transferable); printf("\tlowest priority: %d\n", tdq->tdq_lowpri); - printf("\trealtime runq:\n"); - runq_print(&tdq->tdq_realtime); - printf("\ttimeshare runq:\n"); - runq_print(&tdq->tdq_timeshare); - printf("\tidle runq:\n"); - runq_print(&tdq->tdq_idle); + printf("\trunq:\n"); + runq_print(&tdq->tdq_runq); } static inline int @@ -475,11 +509,11 @@ sched_shouldpreempt(int pri, int cpri, int remote) * date with what is actually on the run-queue. Selects the correct * queue position for timeshare threads. */ -static __inline void +static inline void tdq_runq_add(struct tdq *tdq, struct thread *td, int flags) { struct td_sched *ts; - u_char pri; + u_char pri, idx; TDQ_LOCK_ASSERT(tdq, MA_OWNED); THREAD_LOCK_BLOCKED_ASSERT(td, MA_OWNED); @@ -491,34 +525,36 @@ tdq_runq_add(struct tdq *tdq, struct thread *td, int flags) tdq->tdq_transferable++; ts->ts_flags |= TSF_XFERABLE; } - if (pri < PRI_MIN_BATCH) { - ts->ts_runq = &tdq->tdq_realtime; - } else if (pri <= PRI_MAX_BATCH) { - ts->ts_runq = &tdq->tdq_timeshare; - KASSERT(pri <= PRI_MAX_BATCH && pri >= PRI_MIN_BATCH, - ("Invalid priority %d on timeshare runq", pri)); + if (PRI_MIN_BATCH <= pri && pri <= PRI_MAX_BATCH) { /* - * This queue contains only priorities between MIN and MAX - * batch. Use the whole queue to represent these values. + * The queues allocated to the batch range are not used as + * a simple array but as a "circular" one where the insertion + * index (derived from 'pri') is offset by 'tdq_ts_off'. 'idx' + * is first set to the offset of the wanted queue in the TS' + * selection policy range. */ - if ((flags & (SRQ_BORROWING|SRQ_PREEMPTED)) == 0) { - pri = RQ_NQS * (pri - PRI_MIN_BATCH) / PRI_BATCH_RANGE; - pri = (pri + tdq->tdq_idx) % RQ_NQS; + if ((flags & (SRQ_BORROWING|SRQ_PREEMPTED)) != 0) + /* Current queue from which processes are being run. */ + idx = tdq->tdq_ts_deq_off; + else { + idx = (RQ_PRI_TO_QUEUE_IDX(pri) - RQ_TS_POL_MIN + + tdq->tdq_ts_off) % RQ_TS_POL_MODULO; /* - * This effectively shortens the queue by one so we - * can have a one slot difference between idx and - * ridx while we wait for threads to drain. + * We avoid enqueuing low priority threads in the queue + * that we are still draining, effectively shortening + * the runqueue by one queue. */ - if (tdq->tdq_ridx != tdq->tdq_idx && - pri == tdq->tdq_ridx) - pri = (unsigned char)(pri - 1) % RQ_NQS; - } else - pri = tdq->tdq_ridx; - runq_add_idx(ts->ts_runq, td, pri, flags); - return; + if (tdq->tdq_ts_deq_off != tdq->tdq_ts_off && + idx == tdq->tdq_ts_deq_off) + /* Ensure the dividend is positive. */ + idx = (idx - 1 + RQ_TS_POL_MODULO) % + RQ_TS_POL_MODULO; + } + /* Absolute queue index. */ + idx += RQ_TS_POL_MIN; + runq_add_idx(&tdq->tdq_runq, td, idx, flags); } else - ts->ts_runq = &tdq->tdq_idle; - runq_add(ts->ts_runq, td, flags); + runq_add(&tdq->tdq_runq, td, flags); } /* @@ -526,7 +562,7 @@ tdq_runq_add(struct tdq *tdq, struct thread *td, int flags) * is selected to run. Running threads are not on the queue and the * transferable count does not reflect them. */ -static __inline void +static inline void tdq_runq_rem(struct tdq *tdq, struct thread *td) { struct td_sched *ts; @@ -535,13 +571,11 @@ tdq_runq_rem(struct tdq *tdq, struct thread *td) ts = td_get_sched(td); TDQ_LOCK_ASSERT(tdq, MA_OWNED); THREAD_LOCK_BLOCKED_ASSERT(td, MA_OWNED); - KASSERT(ts->ts_runq != NULL, - ("tdq_runq_remove: thread %p null ts_runq", td)); if (ts->ts_flags & TSF_XFERABLE) { tdq->tdq_transferable--; ts->ts_flags &= ~TSF_XFERABLE; } - queue_empty = runq_remove(ts->ts_runq, td); + queue_empty = runq_remove(&tdq->tdq_runq, td); /* * If thread has a batch priority and the queue from which it was * removed is now empty, advance the batch's queue removal index if it @@ -549,8 +583,10 @@ tdq_runq_rem(struct tdq *tdq, struct thread *td) */ if (queue_empty && PRI_MIN_BATCH <= td->td_priority && td->td_priority <= PRI_MAX_BATCH && - tdq->tdq_idx != tdq->tdq_ridx && tdq->tdq_ridx == td->td_rqindex) - tdq->tdq_ridx = (tdq->tdq_ridx + 1) % RQ_NQS; + tdq->tdq_ts_off != tdq->tdq_ts_deq_off && + tdq->tdq_ts_deq_off + RQ_TS_POL_MIN == td->td_rqindex) + tdq->tdq_ts_deq_off = (tdq->tdq_ts_deq_off + 1) % + RQ_TS_POL_MODULO; } /* @@ -1205,11 +1241,11 @@ runq_steal_pred(const int idx, struct rq_queue *const q, void *const data) } /* - * Steals load from a timeshare queue. Honors the rotating queue head - * index. + * Steals load contained in queues with indices in the specified range. */ static inline struct thread * -runq_steal_from(struct runq *const rq, int cpu, int start_idx) +runq_steal_range(struct runq *const rq, const int lvl_min, const int lvl_max, + int cpu) { struct runq_steal_pred_data data = { .td = NULL, @@ -1217,46 +1253,50 @@ runq_steal_from(struct runq *const rq, int cpu, int start_idx) }; int idx; - idx = runq_findq(rq, start_idx, RQ_NQS - 1, &runq_steal_pred, &data); - if (idx != -1) - goto found; - - MPASS(data.td == NULL); - if (start_idx != 0) { - idx = runq_findq(rq, 0, start_idx - 1, &runq_steal_pred, &data); - if (idx != -1) - goto found; + idx = runq_findq(rq, lvl_min, lvl_max, &runq_steal_pred, &data); + if (idx != -1) { + MPASS(data.td != NULL); + return (data.td); } - MPASS(idx == -1 && data.td == NULL); + MPASS(data.td == NULL); return (NULL); -found: - MPASS(data.td != NULL); - return (data.td); +} + +static inline struct thread * +runq_steal_realtime(struct runq *const rq, int cpu) +{ + + return (runq_steal_range(rq, RQ_RT_POL_MIN, RQ_RT_POL_MAX, cpu)); } /* - * Steals load from a standard linear queue. + * Steals load from a timeshare queue. Honors the rotating queue head + * index. */ -static struct thread * -runq_steal(struct runq *rq, int cpu) +static inline struct thread * +runq_steal_timeshare(struct runq *const rq, int cpu, int off) { - struct runq_steal_pred_data data = { - .td = NULL, - .cpu = cpu, - }; - int idx; + struct thread *td; - idx = runq_findq(rq, 0, RQ_NQS - 1, &runq_steal_pred, &data); - if (idx != -1) { - MPASS(data.td != NULL); - return (data.td); - } + MPASS(0 <= off && off < RQ_TS_POL_MODULO); - MPASS(data.td == NULL); - return (NULL); + td = runq_steal_range(rq, RQ_TS_POL_MIN + off, RQ_TS_POL_MAX, cpu); + if (td != NULL || off == 0) + return (td); + + td = runq_steal_range(rq, RQ_TS_POL_MIN, RQ_TS_POL_MIN + off - 1, cpu); + return (td); +} + +static inline struct thread * +runq_steal_idle(struct runq *const rq, int cpu) +{ + + return (runq_steal_range(rq, RQ_ID_POL_MIN, RQ_ID_POL_MAX, cpu)); } + /* * Attempt to steal a thread in priority order from a thread queue. */ @@ -1266,12 +1306,13 @@ tdq_steal(struct tdq *tdq, int cpu) struct thread *td; TDQ_LOCK_ASSERT(tdq, MA_OWNED); - if ((td = runq_steal(&tdq->tdq_realtime, cpu)) != NULL) + td = runq_steal_realtime(&tdq->tdq_runq, cpu); + if (td != NULL) return (td); - if ((td = runq_steal_from(&tdq->tdq_timeshare, - cpu, tdq->tdq_ridx)) != NULL) + td = runq_steal_timeshare(&tdq->tdq_runq, cpu, tdq->tdq_ts_deq_off); + if (td != NULL) return (td); - return (runq_steal(&tdq->tdq_idle, cpu)); + return (runq_steal_idle(&tdq->tdq_runq, cpu)); } /* @@ -1453,6 +1494,35 @@ llc: } #endif +static inline struct thread * +runq_choose_realtime(struct runq *const rq) +{ + + return (runq_first_thread_range(rq, RQ_RT_POL_MIN, RQ_RT_POL_MAX)); +} + +static struct thread * +runq_choose_timeshare(struct runq *const rq, int off) +{ + struct thread *td; + + MPASS(0 <= off && off < RQ_TS_POL_MODULO); + + td = runq_first_thread_range(rq, RQ_TS_POL_MIN + off, RQ_TS_POL_MAX); + if (td != NULL || off == 0) + return (td); + + td = runq_first_thread_range(rq, RQ_TS_POL_MIN, RQ_TS_POL_MIN + off - 1); + return (td); +} + +static inline struct thread * +runq_choose_idle(struct runq *const rq) +{ + + return (runq_first_thread_range(rq, RQ_ID_POL_MIN, RQ_ID_POL_MAX)); +} + /* * Pick the highest priority task we have and return it. */ @@ -1462,17 +1532,17 @@ tdq_choose(struct tdq *tdq) struct thread *td; TDQ_LOCK_ASSERT(tdq, MA_OWNED); - td = runq_choose(&tdq->tdq_realtime); + td = runq_choose_realtime(&tdq->tdq_runq); if (td != NULL) return (td); - td = runq_choose_from(&tdq->tdq_timeshare, tdq->tdq_ridx); + td = runq_choose_timeshare(&tdq->tdq_runq, tdq->tdq_ts_deq_off); if (td != NULL) { KASSERT(td->td_priority >= PRI_MIN_BATCH, ("tdq_choose: Invalid priority on timeshare queue %d", td->td_priority)); return (td); } - td = runq_choose(&tdq->tdq_idle); + td = runq_choose_idle(&tdq->tdq_runq); if (td != NULL) { KASSERT(td->td_priority >= PRI_MIN_IDLE, ("tdq_choose: Invalid priority on idle queue %d", @@ -1492,9 +1562,7 @@ tdq_setup(struct tdq *tdq, int id) if (bootverbose) printf("ULE: setup cpu %d\n", id); - runq_init(&tdq->tdq_realtime); - runq_init(&tdq->tdq_timeshare); - runq_init(&tdq->tdq_idle); + runq_init(&tdq->tdq_runq); tdq->tdq_id = id; snprintf(tdq->tdq_name, sizeof(tdq->tdq_name), "sched lock %d", (int)TDQ_ID(tdq)); @@ -2598,13 +2666,14 @@ sched_clock(struct thread *td, int cnt) tdq->tdq_switchcnt = tdq->tdq_load; /* - * Advance the insert index once for each tick to ensure that all + * Advance the insert offset once for each tick to ensure that all * threads get a chance to run. */ - if (tdq->tdq_idx == tdq->tdq_ridx) { - tdq->tdq_idx = (tdq->tdq_idx + 1) % RQ_NQS; - if (runq_is_queue_empty(&tdq->tdq_timeshare, tdq->tdq_ridx)) - tdq->tdq_ridx = tdq->tdq_idx; + if (tdq->tdq_ts_off == tdq->tdq_ts_deq_off) { + tdq->tdq_ts_off = (tdq->tdq_ts_off + 1) % RQ_TS_POL_MODULO; + if (runq_is_queue_empty(&tdq->tdq_runq, + tdq->tdq_ts_deq_off + RQ_TS_POL_MIN)) + tdq->tdq_ts_deq_off = tdq->tdq_ts_off; } ts = td_get_sched(td); sched_pctcpu_update(ts, 1); diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 0a7f70fcfa16..5f415740099f 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -117,7 +117,6 @@ struct thread *runq_first_thread_range(struct runq *const rq, bool runq_not_empty(struct runq *); struct thread *runq_choose(struct runq *); struct thread *runq_choose_fuzz(struct runq *, int _fuzz); -struct thread *runq_choose_from(struct runq *, int _idx); #endif /* _KERNEL */ #endif From nobody Mon Jul 28 13:31: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 4brKBP2kvQz634lT; Mon, 28 Jul 2025 13:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBP0F72z3tjP; Mon, 28 Jul 2025 13:31:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709485; 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=KOfWXwI+L3efhmIcegIqV5Ifh8a7CYhgqCqvUdN35Nc=; b=yS3LcTtH9jWrrTB0eMr4MlwcoBZeN2aDe8eGgXk4pZn2cSKNG/aVcEFaNr8+AxJi0F+xhK trHz3RpnkE7hBmpvmc4iS16GQ8fuiy75RtbRAHBdgNVJ2TpUTzlwo42EOnyoQXXUICFufW HD7w2KrtVSTiaA1lURyWl3CfM3gHfAnEaO8wHTrzhNdFiLI5P1/rlFwy3YO5T4Z12iAbPG qeaqvJB4TKonpQz9ZzEYu/kFpxVEKkC+CFrj/C6zVeaDZDXTSXamlDawQuIHtrd2Z8eJMU es+tfldY+KfIPgN7/nY8NjRFy8XWqSmxvaiL5OJDGI+DS0OII+0GmcD7vqH0lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709485; 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=KOfWXwI+L3efhmIcegIqV5Ifh8a7CYhgqCqvUdN35Nc=; b=sU6xstUgoUqRkaH3FU9Rtye5SxqC1zH4/vdC4SviTabZh9t36w2IDOZB0ErlBPhqEP0AuB MT6hijM0/fpnkswL5ybSn+30ftTHkVLMS/xEAT1vgybSfwOMYsMAQraDo6O2lvSj4K42IE aZ73uO2eurgItOHh/n9inS5Lqwtrl/mdOCIuprB5eoJW2yFPBPIu1AiTxUQ0yTZCeFhp9r owUeoCP2S3EEGRUsEkolIF7rn0rXJdL+2+v/no2f5q2bjDVbxt88VO09mpnWkuIabx0iuZ iwU/aXt8v3FaBUJTysIIv0goO4Z8wTynVnPlaGOE8o7MTR0yPArEMa+SuPFyCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709485; a=rsa-sha256; cv=none; b=JoFjYCOprzrjPiqSw/eOQhupGWBYsfS+n693zKNWWgU7PU/V4tDtY4HohOGpvH/00qf10X YITHn5FrqsnUPQmLlen6rzNYFp1SwloHjouRQrT4xi3OvYEhxFP8NFaeXV3rlNP3WVYzum zlwqC5jwnr+e6maIL88UAyr5EAExNcDSJOPzgDFGZhjZTJ9WfM++C063t+G+8ioO7kZ3uZ EnJcRxIQca3JVYq43Xzg5kbrpqeV/0JplqMiOBFiLAAbgO/NP01fk3FDp+I2NaxqNK+j8H EPyk38RqfUSMw7mVLvzDx1ky0lgNq0qMAtKN5MR8Y7ANERLOJH0Ta+9GMFUscA== 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 4brKBN6xNkznJV; Mon, 28 Jul 2025 13:31: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 56SDVOU3080399; Mon, 28 Jul 2025 13:31:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVOqd080396; Mon, 28 Jul 2025 13:31:24 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:24 GMT Message-Id: <202507281331.56SDVOqd080396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 79dcda3d5df6 - stable/14 - Internal scheduling priorities: Always use symbolic ones 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 79dcda3d5df6ede0bb4a0afcaa7180af703a785d Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=79dcda3d5df6ede0bb4a0afcaa7180af703a785d commit 79dcda3d5df6ede0bb4a0afcaa7180af703a785d Author: Olivier Certner AuthorDate: 2024-05-22 15:29:22 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:20 +0000 Internal scheduling priorities: Always use symbolic ones Replace priorities specified by a base priority and some hardcoded offset value by symbolic constants. Hardcoded offsets prevent changing the difference between priorities without changing their relative ordering, and is generally a dangerous practice since the resulting priority may inadvertently belong to a different selection policy's range. Since RQ_PPQ is 4, differences of less than 4 are insignificant, so just remove them. These small differences have not been changed for years, so it is likely they have no real meaning (besides having no practical effect). One can still consult the changes history to recover them if ever needed. No functional change (intended). MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390 (cherry picked from commit 8ecc41918066422d6788a67251b22d11a6efeddf) --- sys/cam/ctl/ctl.c | 4 ++-- sys/dev/firewire/firewirereg.h | 2 +- sys/dev/iicbus/iiconf.h | 2 +- sys/dev/ppbus/lpt.c | 2 +- sys/dev/ppbus/ppbconf.h | 2 +- sys/dev/smbus/smbconf.h | 2 +- sys/dev/syscons/syscons.c | 2 +- sys/dev/vkbd/vkbd.c | 14 +++++++------- sys/fs/fuse/fuse_device.c | 2 +- sys/fs/fuse/fuse_io.c | 2 +- sys/fs/fuse/fuse_ipc.c | 4 ++-- sys/fs/nfs/nfs_commonsubs.c | 2 +- sys/fs/nfsserver/nfs_nfsdcache.c | 6 +++--- sys/fs/nfsserver/nfs_nfsdstate.c | 4 ++-- sys/fs/smbfs/smbfs_io.c | 2 +- sys/kern/kern_rmlock.c | 7 ++++--- sys/kern/subr_log.c | 2 +- sys/kern/sysv_msg.c | 4 ++-- sys/kern/sysv_sem.c | 2 +- sys/kern/vfs_bio.c | 7 +++---- sys/kern/vfs_vnops.c | 12 ++++++------ sys/net/if_tuntap.c | 8 ++++---- sys/netgraph/ng_device.c | 2 +- sys/sys/buf.h | 4 ++-- sys/ufs/ffs/ffs_softdep.c | 6 +++--- sys/ufs/ffs/ffs_vnops.c | 3 +-- sys/ufs/ufs/ufs_quota.c | 22 +++++++++++----------- 27 files changed, 65 insertions(+), 66 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index f22b6ae924bc..0c2c21ba42fa 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -13424,7 +13424,7 @@ ctl_work_thread(void *arg) CTL_DEBUG_PRINT(("ctl_work_thread starting\n")); thread_lock(curthread); - sched_prio(curthread, PUSER - 1); + sched_prio(curthread, PRI_MAX_KERN); thread_unlock(curthread); while (!softc->shutdown) { @@ -13494,7 +13494,7 @@ ctl_thresh_thread(void *arg) CTL_DEBUG_PRINT(("ctl_thresh_thread starting\n")); thread_lock(curthread); - sched_prio(curthread, PUSER - 1); + sched_prio(curthread, PRI_MAX_KERN); thread_unlock(curthread); while (!softc->shutdown) { diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 4d2d282dd22d..d17f7a15785a 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -293,7 +293,7 @@ extern int firewire_debug; extern devclass_t firewire_devclass; extern int firewire_phydma_enable; -#define FWPRI ((PZERO + 8) | PCATCH) +#define FWPRI (PWAIT | PCATCH) #define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */) diff --git a/sys/dev/iicbus/iiconf.h b/sys/dev/iicbus/iiconf.h index ccf1661bba7f..2fe95c0e9f6d 100644 --- a/sys/dev/iicbus/iiconf.h +++ b/sys/dev/iicbus/iiconf.h @@ -32,7 +32,7 @@ #include -#define IICPRI (PZERO+8) /* XXX sleep/wakeup queue priority */ +#define IICPRI (PWAIT) /* XXX sleep/wakeup queue priority */ #define LSB 0x1 diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 644e0f08008b..27cc7bb28f85 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -100,7 +100,7 @@ static int volatile lptflag = 1; #define LPINITRDY 4 /* wait up to 4 seconds for a ready */ #define LPTOUTINITIAL 10 /* initial timeout to wait for ready 1/10 s */ #define LPTOUTMAX 1 /* maximal timeout 1 s */ -#define LPPRI (PZERO+8) +#define LPPRI (PWAIT) #define BUFSIZE 1024 #define BUFSTATSIZE 32 diff --git a/sys/dev/ppbus/ppbconf.h b/sys/dev/ppbus/ppbconf.h index 0f6395121fba..66f45634ea6d 100644 --- a/sys/dev/ppbus/ppbconf.h +++ b/sys/dev/ppbus/ppbconf.h @@ -63,7 +63,7 @@ /* * Parallel Port Bus sleep/wakeup queue. */ -#define PPBPRI (PZERO+8) +#define PPBPRI (PWAIT) /* * Parallel Port Chipset mode masks. diff --git a/sys/dev/smbus/smbconf.h b/sys/dev/smbus/smbconf.h index 4c646df20a30..a6c320594064 100644 --- a/sys/dev/smbus/smbconf.h +++ b/sys/dev/smbus/smbconf.h @@ -30,7 +30,7 @@ #include -#define SMBPRI (PZERO+8) /* XXX sleep/wakeup queue priority */ +#define SMBPRI (PWAIT) /* XXX sleep/wakeup queue priority */ #define n(flags) (~(flags) & (flags)) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index fd204491f8fc..c53b2b582663 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -1310,7 +1310,7 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) if (i == sc->cur_scp->index) return 0; error = - tsleep(VTY_WCHAN(sc, i), (PZERO + 1) | PCATCH, "waitvt", 0); + tsleep(VTY_WCHAN(sc, i), PZERO | PCATCH, "waitvt", 0); return error; case VT_GETACTIVE: /* get active vty # */ diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c index 3dbf64063e33..27a7e626fa64 100644 --- a/sys/dev/vkbd/vkbd.c +++ b/sys/dev/vkbd/vkbd.c @@ -82,7 +82,7 @@ MALLOC_DEFINE(M_VKBD, KEYBOARD_NAME, "Virtual AT keyboard"); #define VKBD_UNLOCK(s) mtx_unlock(&(s)->ks_lock) #define VKBD_LOCK_ASSERT(s, w) mtx_assert(&(s)->ks_lock, w) #define VKBD_SLEEP(s, f, d, t) \ - msleep(&(s)->f, &(s)->ks_lock, PCATCH | (PZERO + 1), d, t) + msleep(&(s)->f, &(s)->ks_lock, PCATCH | PZERO, d, t) #else #define VKBD_LOCK_DECL #define VKBD_LOCK_INIT(s) @@ -90,7 +90,7 @@ MALLOC_DEFINE(M_VKBD, KEYBOARD_NAME, "Virtual AT keyboard"); #define VKBD_LOCK(s) #define VKBD_UNLOCK(s) #define VKBD_LOCK_ASSERT(s, w) -#define VKBD_SLEEP(s, f, d, t) tsleep(&(s)->f, PCATCH | (PZERO + 1), d, t) +#define VKBD_SLEEP(s, f, d, t) tsleep(&(s)->f, PCATCH | PZERO, d, t) #endif #define VKBD_KEYBOARD(d) \ @@ -268,8 +268,8 @@ vkbd_dev_close(struct cdev *dev, int foo, int bar, struct thread *td) VKBD_SLEEP(state, ks_task, "vkbdc", 0); /* wakeup poll()ers */ - selwakeuppri(&state->ks_rsel, PZERO + 1); - selwakeuppri(&state->ks_wsel, PZERO + 1); + selwakeuppri(&state->ks_rsel, PZERO); + selwakeuppri(&state->ks_wsel, PZERO); state->ks_flags &= ~OPEN; state->ks_dev = NULL; @@ -498,7 +498,7 @@ vkbd_status_changed(vkbd_state_t *state) if (!(state->ks_flags & STATUS)) { state->ks_flags |= STATUS; - selwakeuppri(&state->ks_rsel, PZERO + 1); + selwakeuppri(&state->ks_rsel, PZERO); wakeup(&state->ks_flags); } } @@ -531,7 +531,7 @@ vkbd_data_read(vkbd_state_t *state, int wait) q->head = 0; /* wakeup ks_inq writers/poll()ers */ - selwakeuppri(&state->ks_wsel, PZERO + 1); + selwakeuppri(&state->ks_wsel, PZERO); wakeup(q); return (c); @@ -1246,7 +1246,7 @@ vkbd_clear_state_locked(vkbd_state_t *state) /* flush ks_inq and wakeup writers/poll()ers */ state->ks_inq.head = state->ks_inq.tail = state->ks_inq.cc = 0; - selwakeuppri(&state->ks_wsel, PZERO + 1); + selwakeuppri(&state->ks_wsel, PZERO); wakeup(&state->ks_inq); } diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 2fd43bc742dc..26f764f1939c 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -153,7 +153,7 @@ fdata_dtor(void *arg) FUSE_LOCK(); fuse_lck_mtx_lock(fdata->aw_mtx); /* wakup poll()ers */ - selwakeuppri(&fdata->ks_rsel, PZERO + 1); + selwakeuppri(&fdata->ks_rsel, PZERO); /* Don't let syscall handlers wait in vain */ while ((tick = fuse_aw_pop(fdata))) { fuse_lck_mtx_lock(tick->tk_aw_mtx); diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index 877da90b580b..f64344b64679 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -933,7 +933,7 @@ fuse_io_invalbuf(struct vnode *vp, struct thread *td) if (vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF) return EIO; fvdat->flag |= FN_FLUSHWANT; - tsleep(&fvdat->flag, PRIBIO + 2, "fusevinv", 2 * hz); + tsleep(&fvdat->flag, PRIBIO, "fusevinv", 2 * hz); error = 0; if (p != NULL) { PROC_LOCK(p); diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 379306f8ef2e..164b7abdaa53 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -589,7 +589,7 @@ fdata_set_dead(struct fuse_data *data) fuse_lck_mtx_lock(data->ms_mtx); data->dataflags |= FSESS_DEAD; wakeup_one(data); - selwakeuppri(&data->ks_rsel, PZERO + 1); + selwakeuppri(&data->ks_rsel, PZERO); wakeup(&data->ticketer); fuse_lck_mtx_unlock(data->ms_mtx); FUSE_UNLOCK(); @@ -665,7 +665,7 @@ fuse_insert_message(struct fuse_ticket *ftick, bool urgent) else fuse_ms_push(ftick); wakeup_one(ftick->tk_data); - selwakeuppri(&ftick->tk_data->ks_rsel, PZERO + 1); + selwakeuppri(&ftick->tk_data->ks_rsel, PZERO); KNOTE_LOCKED(&ftick->tk_data->ks_rsel.si_note, 0); fuse_lck_mtx_unlock(ftick->tk_data->ms_mtx); } diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index c593264ef63e..cb9e32376170 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4670,7 +4670,7 @@ newnfs_sndlock(int *flagp) ts.tv_sec = 0; ts.tv_nsec = 0; (void) nfsmsleep((caddr_t)flagp, NFSSOCKMUTEXPTR, - PZERO - 1, "nfsndlck", &ts); + PVFS, "nfsndlck", &ts); } *flagp |= NFSR_SNDLOCK; NFSUNLOCKSOCK(); diff --git a/sys/fs/nfsserver/nfs_nfsdcache.c b/sys/fs/nfsserver/nfs_nfsdcache.c index bf0ff4e84d98..de72187bbb91 100644 --- a/sys/fs/nfsserver/nfs_nfsdcache.c +++ b/sys/fs/nfsserver/nfs_nfsdcache.c @@ -392,7 +392,7 @@ loop: nfsaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) { if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP, + (void)mtx_sleep(rp, mutex, PVFS | PDROP, "nfsrc", 10 * hz); goto loop; } @@ -678,7 +678,7 @@ tryagain: rp = hitrp; if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP, + (void)mtx_sleep(rp, mutex, PVFS | PDROP, "nfsrc", 10 * hz); goto tryagain; } @@ -750,7 +750,7 @@ nfsrc_lock(struct nfsrvcache *rp) mtx_assert(mutex, MA_OWNED); while ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, mutex, PZERO - 1, "nfsrc", 0); + (void)mtx_sleep(rp, mutex, PVFS, "nfsrc", 0); } rp->rc_flag |= RC_LOCKED; } diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 6cd8c1c861ec..0f556adb697b 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -552,7 +552,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp, */ while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PVFS, "nfsd clp", 10 * hz); } NFSUNLOCKSTATE(); @@ -629,7 +629,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp, NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PVFS, "nfsdclp", 10 * hz); } NFSUNLOCKSTATE(); diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 324f38abd10e..35454998fc8e 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -629,7 +629,7 @@ smbfs_vinvalbuf(struct vnode *vp, struct thread *td) while (np->n_flag & NFLUSHINPROG) { np->n_flag |= NFLUSHWANT; - error = tsleep(&np->n_flag, PRIBIO + 2, "smfsvinv", 2 * hz); + error = tsleep(&np->n_flag, PRIBIO, "smfsvinv", 2 * hz); error = smb_td_intr(td); if (error == EINTR) return EINTR; diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 0867e9e14fee..c1633dd19de2 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -1010,7 +1010,8 @@ rms_rlock_fallback(struct rmslock *rms) mtx_lock(&rms->mtx); while (rms->writers > 0) - msleep(&rms->readers, &rms->mtx, PUSER - 1, mtx_name(&rms->mtx), 0); + msleep(&rms->readers, &rms->mtx, PRI_MAX_KERN, + mtx_name(&rms->mtx), 0); critical_enter(); rms_int_readers_inc(rms, rms_int_pcpu(rms)); mtx_unlock(&rms->mtx); @@ -1197,7 +1198,7 @@ rms_wlock(struct rmslock *rms) mtx_lock(&rms->mtx); rms->writers++; if (rms->writers > 1) { - msleep(&rms->owner, &rms->mtx, (PUSER - 1), + msleep(&rms->owner, &rms->mtx, PRI_MAX_KERN, mtx_name(&rms->mtx), 0); MPASS(rms->readers == 0); KASSERT(rms->owner == RMS_TRANSIENT, @@ -1213,7 +1214,7 @@ rms_wlock(struct rmslock *rms) rms_assert_no_pcpu_readers(rms); if (rms->readers > 0) { - msleep(&rms->writers, &rms->mtx, (PUSER - 1), + msleep(&rms->writers, &rms->mtx, PRI_MAX_KERN, mtx_name(&rms->mtx), 0); } diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 5a6ebacb780c..993c71b68940 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -50,7 +50,7 @@ #include #include -#define LOG_RDPRI (PZERO + 1) +#define LOG_RDPRI PZERO #define LOG_ASYNC 0x04 diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 354a01fa7e3f..a545a0a54c25 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -893,7 +893,7 @@ kern_msgsnd(struct thread *td, int msqid, const void *msgp, we_own_it = 1; } DPRINTF(("msgsnd: goodnight\n")); - error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH, + error = msleep(msqkptr, &msq_mtx, PVFS | PCATCH, "msgsnd", hz); DPRINTF(("msgsnd: good morning, error=%d\n", error)); if (we_own_it) @@ -1302,7 +1302,7 @@ kern_msgrcv(struct thread *td, int msqid, void *msgp, size_t msgsz, long msgtyp, */ DPRINTF(("msgrcv: goodnight\n")); - error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH, + error = msleep(msqkptr, &msq_mtx, PVFS | PCATCH, "msgrcv", 0); DPRINTF(("msgrcv: good morning (error=%d)\n", error)); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 076851235ffa..a99e1a4de14e 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1308,7 +1308,7 @@ kern_semop(struct thread *td, int usemid, struct sembuf *usops, semptr->semncnt++; DPRINTF(("semop: good night!\n")); - error = msleep_sbt(semakptr, sema_mtxp, (PZERO - 4) | PCATCH, + error = msleep_sbt(semakptr, sema_mtxp, PVFS | PCATCH, "semwait", sbt, precision, C_ABSOLUTE); DPRINTF(("semop: good morning (error=%d)!\n", error)); /* return code is checked below, after sem[nz]cnt-- */ diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 4ae80e7e078d..92d850381e06 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -754,7 +754,7 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, int gbflags, break; } error = msleep(&bd->bd_wanted, BD_LOCKPTR(bd), - (PRIBIO + 4) | slpflag, "newbuf", slptimeo); + PVFS | slpflag, "newbuf", slptimeo); if (error != 0) break; } @@ -2653,8 +2653,7 @@ bwillwrite(void) mtx_lock(&bdirtylock); while (buf_dirty_count_severe()) { bdirtywait = 1; - msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4), - "flswai", 0); + msleep(&bdirtywait, &bdirtylock, PVFS, "flswai", 0); } mtx_unlock(&bdirtylock); } @@ -5214,7 +5213,7 @@ bufobj_wwait(struct bufobj *bo, int slpflag, int timeo) while (bo->bo_numoutput) { bo->bo_flag |= BO_WWAIT; error = msleep(&bo->bo_numoutput, BO_LOCKPTR(bo), - slpflag | (PRIBIO + 1), "bo_wwait", timeo); + slpflag | PRIBIO, "bo_wwait", timeo); if (error) break; } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index c3666ca99c26..79fee79295fb 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -795,7 +795,7 @@ foffset_lock(struct file *fp, int flags) } DROP_GIANT(); sleepq_add(&fp->f_vnread_flags, NULL, "vofflock", 0, 0); - sleepq_wait(&fp->f_vnread_flags, PUSER -1); + sleepq_wait(&fp->f_vnread_flags, PRI_MAX_KERN); PICKUP_GIANT(); sleepq_lock(&fp->f_vnread_flags); state = atomic_load_16(flagsp); @@ -857,7 +857,7 @@ foffset_lock(struct file *fp, int flags) if ((flags & FOF_NOLOCK) == 0) { while (fp->f_vnread_flags & FOFFSET_LOCKED) { fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + msleep(&fp->f_vnread_flags, mtxp, PRI_MAX_KERN, "vofflock", 0); } fp->f_vnread_flags |= FOFFSET_LOCKED; @@ -1925,7 +1925,7 @@ vn_start_write_refed(struct mount *mp, int flags, bool mplocked) if (flags & V_PCATCH) mflags |= PCATCH; } - mflags |= (PUSER - 1); + mflags |= PRI_MAX_KERN; while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { if ((flags & V_NOWAIT) != 0) { error = EWOULDBLOCK; @@ -2050,7 +2050,7 @@ vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags) if ((flags & V_PCATCH) != 0) mflags |= PCATCH; } - mflags |= (PUSER - 1) | PDROP; + mflags |= PRI_MAX_KERN | PDROP; error = msleep(&mp->mnt_flag, MNT_MTX(mp), mflags, "suspfs", 0); vfs_rel(mp); if (error == 0) @@ -2135,7 +2135,7 @@ vfs_write_suspend(struct mount *mp, int flags) return (EALREADY); } while (mp->mnt_kern_flag & MNTK_SUSPEND) - msleep(&mp->mnt_flag, MNT_MTX(mp), PUSER - 1, "wsuspfs", 0); + msleep(&mp->mnt_flag, MNT_MTX(mp), PRI_MAX_KERN, "wsuspfs", 0); /* * Unmount holds a write reference on the mount point. If we @@ -2156,7 +2156,7 @@ vfs_write_suspend(struct mount *mp, int flags) mp->mnt_susp_owner = curthread; if (mp->mnt_writeopcount > 0) (void) msleep(&mp->mnt_writeopcount, - MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0); + MNT_MTX(mp), PRI_MAX_KERN | PDROP, "suspwt", 0); else MNT_IUNLOCK(mp); if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) { diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index a0275a7471e5..45d981de9fdb 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -866,7 +866,7 @@ tunstart(struct ifnet *ifp) tp->tun_flags &= ~TUN_RWAIT; wakeup(tp); } - selwakeuppri(&tp->tun_rsel, PZERO + 1); + selwakeuppri(&tp->tun_rsel, PZERO); KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) { TUN_UNLOCK(tp); @@ -927,7 +927,7 @@ tunstart_l2(struct ifnet *ifp) TUN_LOCK(tp); } - selwakeuppri(&tp->tun_rsel, PZERO+1); + selwakeuppri(&tp->tun_rsel, PZERO); KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* obytes are counted in ether_output */ } @@ -1201,7 +1201,7 @@ out: CURVNET_RESTORE(); funsetown(&tp->tun_sigio); - selwakeuppri(&tp->tun_rsel, PZERO + 1); + selwakeuppri(&tp->tun_rsel, PZERO); KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); TUNDEBUG (ifp, "closed\n"); tp->tun_flags &= ~TUN_OPEN; @@ -1735,7 +1735,7 @@ tunread(struct cdev *dev, struct uio *uio, int flag) return (EWOULDBLOCK); } tp->tun_flags |= TUN_RWAIT; - error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1), + error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | PZERO, "tunread", 0); if (error != 0) { TUN_UNLOCK(tp); diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index 9269b3d16467..e4fcdfc635cb 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -462,7 +462,7 @@ ngdread(struct cdev *dev, struct uio *uio, int flag) mtx_lock(&priv->ngd_mtx); priv->flags |= NGDF_RWAIT; if ((error = msleep(priv, &priv->ngd_mtx, - PDROP | PCATCH | (PZERO + 1), + PDROP | PCATCH | PZERO, "ngdread", 0)) != 0) return (error); } diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 7c0ea9605e28..dd05d5a1df7d 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -298,7 +298,7 @@ struct buf { * Initialize a lock. */ #define BUF_LOCKINIT(bp, wmesg) \ - lockinit(&(bp)->b_lock, PRIBIO + 4, wmesg, 0, LK_NEW) + lockinit(&(bp)->b_lock, PVFS, wmesg, 0, LK_NEW) /* * * Get a lock sleeping non-interruptably until it becomes available. @@ -313,7 +313,7 @@ struct buf { */ #define BUF_TIMELOCK(bp, locktype, interlock, wmesg, catch, timo) \ _lockmgr_args_rw(&(bp)->b_lock, (locktype) | LK_TIMELOCK, \ - (interlock), (wmesg), (PRIBIO + 4) | (catch), (timo), \ + (interlock), (wmesg), PVFS | (catch), (timo), \ LOCK_FILE, LOCK_LINE) /* diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 316c978e1bdf..edf064549d85 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -499,7 +499,7 @@ softdep_check_suspend(struct mount *mp, while (mp->mnt_secondary_writes != 0) { BO_UNLOCK(bo); msleep(&mp->mnt_secondary_writes, MNT_MTX(mp), - (PUSER - 1) | PDROP, "secwr", 0); + PRI_MAX_KERN | PDROP, "secwr", 0); BO_LOCK(bo); MNT_ILOCK(mp); } @@ -14578,7 +14578,7 @@ softdep_check_suspend(struct mount *mp, while (mp->mnt_secondary_writes != 0) { BO_UNLOCK(bo); msleep(&mp->mnt_secondary_writes, MNT_MTX(mp), - (PUSER - 1) | PDROP, "secwr", 0); + PRI_MAX_KERN | PDROP, "secwr", 0); BO_LOCK(bo); MNT_ILOCK(mp); } @@ -14618,7 +14618,7 @@ softdep_check_suspend(struct mount *mp, BO_UNLOCK(bo); msleep(&mp->mnt_secondary_writes, MNT_MTX(mp), - (PUSER - 1) | PDROP, "secwr", 0); + PRI_MAX_KERN | PDROP, "secwr", 0); BO_LOCK(bo); continue; } diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 0f60f8061043..03dcb27ff6f7 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1402,8 +1402,7 @@ ffs_lock_ea(struct vnode *vp) VI_LOCK(vp); while (ip->i_flag & IN_EA_LOCKED) { UFS_INODE_SET_FLAG(ip, IN_EA_LOCKWAIT); - msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD + 2, "ufs_ea", - 0); + msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD, "ufs_ea", 0); } UFS_INODE_SET_FLAG(ip, IN_EA_LOCKED); VI_UNLOCK(vp); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 78f539bcabd2..52fc6c08fdf9 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -181,7 +181,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags) if ((dq = ip->i_dquot[i]) == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkdq1"); + DQI_WAIT(dq, PINOD, "chkdq1"); ncurblocks = dq->dq_curblocks + change; if (ncurblocks >= 0) dq->dq_curblocks = ncurblocks; @@ -203,7 +203,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags) continue; warn = 0; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkdq2"); + DQI_WAIT(dq, PINOD, "chkdq2"); if (do_check) { error = chkdqchg(ip, change, cred, i, &warn); if (error) { @@ -217,7 +217,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags) if (dq == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkdq3"); + DQI_WAIT(dq, PINOD, "chkdq3"); ncurblocks = dq->dq_curblocks - change; if (ncurblocks >= 0) dq->dq_curblocks = ncurblocks; @@ -322,7 +322,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags) if ((dq = ip->i_dquot[i]) == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkiq1"); + DQI_WAIT(dq, PINOD, "chkiq1"); if (dq->dq_curinodes >= -change) dq->dq_curinodes += change; else @@ -343,7 +343,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags) continue; warn = 0; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkiq2"); + DQI_WAIT(dq, PINOD, "chkiq2"); if (do_check) { error = chkiqchg(ip, change, cred, i, &warn); if (error) { @@ -357,7 +357,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags) if (dq == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "chkiq3"); + DQI_WAIT(dq, PINOD, "chkiq3"); if (dq->dq_curinodes >= change) dq->dq_curinodes -= change; else @@ -857,7 +857,7 @@ _setquota(struct thread *td, struct mount *mp, uint64_t id, int type, return (error); dq = ndq; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "setqta"); + DQI_WAIT(dq, PINOD, "setqta"); /* * Copy all but the current values. * Reset time limit if previously had no soft limit or were @@ -920,7 +920,7 @@ _setuse(struct thread *td, struct mount *mp, uint64_t id, int type, return (error); dq = ndq; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "setuse"); + DQI_WAIT(dq, PINOD, "setuse"); /* * Reset time limit if have a soft limit and were * previously under it, but are now over it. @@ -1316,7 +1316,7 @@ dqget(struct vnode *vp, uint64_t id, struct ufsmount *ump, int type, if (dq != NULL) { DQH_UNLOCK(); hfound: DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "dqget"); + DQI_WAIT(dq, PINOD, "dqget"); DQI_UNLOCK(dq); if (dq->dq_ump == NULL) { dqrele(vp, dq); @@ -1590,7 +1590,7 @@ dqsync(struct vnode *vp, struct dquot *dq) vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY); DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+2, "dqsync"); + DQI_WAIT(dq, PINOD, "dqsync"); if ((dq->dq_flags & DQ_MOD) == 0) goto out; dq->dq_flags |= DQ_LOCK; @@ -1744,7 +1744,7 @@ quotaadj(struct dquot **qrp, struct ufsmount *ump, int64_t blkcount) if ((dq = qrp[i]) == NODQUOT) continue; DQI_LOCK(dq); - DQI_WAIT(dq, PINOD+1, "adjqta"); + DQI_WAIT(dq, PINOD, "adjqta"); ncurblocks = dq->dq_curblocks + blkcount; if (ncurblocks >= 0) dq->dq_curblocks = ncurblocks; From nobody Mon Jul 28 13:31:27 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 4brKBS0d6Cz6351j; Mon, 28 Jul 2025 13:31:28 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBR4V2dz3tx4; Mon, 28 Jul 2025 13:31:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709487; 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=xVRUzmyOguvbVIwLe/h6SJkcLCFlylXnkuBqQze8Id4=; b=VZUOe1h6RfvJ/SWIen296mdE95Jtnk/IRdXrCGzKR0lVuwD/dRHU+qkvm70UuJVXhAdnAg Y+Obdi5lMXE6/rcqI50kzLMh4nEINtl7vM8dmTW7DCPcxGVCdBLqHUlpxQaNCtxa1Iw9LW rndnw08Nu3KFqDQbQNWuMXdwUCqspn21UaJLLEf08mea52sR5MwPEdMpjI8SIYRpt9QoU+ V5DhwG9kX1izaiJ0QzRooLMH02Uv4arUqUURvnHmb7o9xZVT0y+tNX3Ac3bw8887uhEFxo yegMVRWkBHKsoAWyTQQiP/huUOe1mqr4b1zy05/Ez0d2bsUbrUQw4StoObcfwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709487; 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=xVRUzmyOguvbVIwLe/h6SJkcLCFlylXnkuBqQze8Id4=; b=ZjGtsstxnVbgXVlp5P57QljxRayYslAzPiX+k1tGAA68TJJ7dt5b+sEapF3nGV5pMlH+/p xvCO7AFIuaRbAt7z0LgVaK81TWzjqYvxdyobDnTQMMt4JbR+keaSo68YGBnEmEj7sSmOPB Mm1kq3uDsPy3LItObY3d0i3QcpNFtDmZ3KTZh2NNs+a45dmPEt2pRqOTHd3OeT7mtHtvn6 iKigRUk6M5muNQPoXMXiP505ZGKtLhphTiqHia2kfVvnco60c05eHzwB1xmcT1dImxFhV7 H6Gb8LeEBjkWkTwvQfRPG/LM8k522RGFkaTDZ6Q9zr7aUOpxPN1K19sq2AMPRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709487; a=rsa-sha256; cv=none; b=aQQQQXgjPu2GlDriX5KxysM/VRYV6sXOTi8WpMorb20AkepvW4zX9fBcZ+aEtZhGj95/tK vQ5ZzMSsrh9dVK8FOGAu8U7QlDiNc5z03w0V4UiH08Mlv9eV55TEgBU04a2YdIzCuxQTIO LpjMn/E2cQACg3y42YVhr4xuXgOJlJ0V6BSMNQqY790mD9EBUkBkuqTokMzuA72AlhjeC+ 0qa/os8JiHFZjT/JBuy2STHZ8E7pQypCo8sEPgVtsaCRjkp/3rHbc75Mq+bkRDcIcSbyQu T5gGN4uNGsdzfFvXSjV9xfg6z89FubcacTC60cOS9nSteAo9FgDn4G5uhHHdog== 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 4brKBR1fv0znft; Mon, 28 Jul 2025 13:31:27 +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 56SDVRg7080465; Mon, 28 Jul 2025 13:31:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVRGi080462; Mon, 28 Jul 2025 13:31:27 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:27 GMT Message-Id: <202507281331.56SDVRGi080462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 0f54758cbe91 - stable/14 - runq: Switch to 256 levels 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0f54758cbe917bd8ba4160a97b9bf93b05922257 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=0f54758cbe917bd8ba4160a97b9bf93b05922257 commit 0f54758cbe917bd8ba4160a97b9bf93b05922257 Author: Olivier Certner AuthorDate: 2024-05-14 12:36:33 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:23 +0000 runq: Switch to 256 levels This increases the number of levels from 64 to 256, which coincides with the distinct internal priority values (priority is currently encoded in a 'u_char', whose range is entirely used). With this change, we become POSIX-compliant for SCHED_FIFO/SCHED_RR in that we really provide 32 distinct priority levels for these policies. Previously, threads in the same "priority group", with priority groups defined as the threads in consecutive spans of 4 priority levels starting with level 0 up to 31 (so there are 8 groups), could not preempt or be preempted by each other even if they were assigned different priority levels. See also commit "sched_ule: Use a single runqueue per CPU" for all the drawbacks that this change also removes. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390 (cherry picked from commit af8de65ef23e7e447916370851f39aea3f74e16a) --- sys/sys/runq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 5f415740099f..590463af192c 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -42,7 +42,7 @@ */ #define RQ_MAX_PRIO (255) /* Maximum priority (minimum is 0). */ -#define RQ_PPQ (4) /* Priorities per queue. */ +#define RQ_PPQ (1) /* Priorities per queue. */ /* * Deduced from the above parameters and machine ones. From nobody Mon Jul 28 13:31:25 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 4brKBQ5pSdz634qd; Mon, 28 Jul 2025 13:31:26 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBQ1qgBz3tpb; Mon, 28 Jul 2025 13:31:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709486; 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=kVOrFPA9YLW5GSRmu+awRkVKRiR/tQfv1OO+TM301dw=; b=WjNJCL4fSWXYD43UbVJ01ijPU6Iwuv7dBP6nBUG2q4ErPIoellyK306CDWgdKHtrUt/Fr4 HJALtmXOMuCh2UmTTss42r4q8RCK+CRfS1zo+2rC3sQXRhut83+GMjSDUxR4Rm7KHTqin6 M30B9mmU5NtQ2R/5+AUpR/PKkJWD8agyrYjqy9dP2ljUdxEXJa/DRRdTv2EFLd9bqHCxZ5 0K0fmM6YbbC1WFqMpdOB1lNH+/G+gfv0FTPZuTC62Tpi58OfjXA8rfw8SuoVh0G7e0vyUB abQAVwwtIL70BQrlJ0LGxVHNE2cGKsGr7c4EsKqjy4lS/mNRjSrqol9wA3FI5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709486; 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=kVOrFPA9YLW5GSRmu+awRkVKRiR/tQfv1OO+TM301dw=; b=v1/tliLJKlvnKXqCeeILWG7idbzg9eoYVsYvy2belIP9g9g8J2qkYYKJX0a49NzNQYmA2a /5WPbbzIx6HdSMM9mFuiRzShXbZ1Lcut5+tT/gLmYRtGT2rK7Kpz/671akaK0ifc5upp6Q Xv3AbiQDYphOfcJcmQav/Ca7WQoiSi6NKBPrc+qDyaVQQWDuG2Pis6Sx88yzZWg3oAwLEg 6dF8rp/argoSMljE50V8bGlVGlhiestuNMbkcjIFV1/3eq2mJ8zaQTSyQ6MCbwbdzvdPJo jszfm8VH5/WSXHNU53ZFW+WmilSiEWEt+qcb27mcGIAWr8PJGSLN9AWre7DHFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709486; a=rsa-sha256; cv=none; b=SpPC1UQ3QP88VZsGG69J9blMgKHVeyZMPieU5R4Ez2e6FNgr71oWGBLesFsrqNsOdCJvsx l3eBDz/rHPbZzuQkmU/7LjohStO7gl3e08L98fPN2XSGG231OCCkBYm2Xvv+NHp02oSK47 WuRs+ugr83KmrMO2odJHzxlWz/U9Kjrfx5VqDWpw+LD7YNMSn0od9OJMI+3BtYVNNrXGjm leDrm5soBZBJ2Vry3NHWtD8aKA/FV0fFGSSfxSB7Noo3Zi1OEXm/kmQjzczwTaE3girQYF U/KIqo8fL+HXqGRc61nyO5UPDEqV8Y/NaNjQLWuf+Ti90MNBC+/APlssh/Y0aQ== 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 4brKBQ0kfXznJW; Mon, 28 Jul 2025 13:31:26 +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 56SDVQxK080432; Mon, 28 Jul 2025 13:31:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVPhw080429; Mon, 28 Jul 2025 13:31:25 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:25 GMT Message-Id: <202507281331.56SDVPhw080429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c6a65bbee695 - stable/14 - zfs: spa: ZIO_TASKQ_ISSUE: Use symbolic priority 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c6a65bbee6959f50fa9313c63f31ff6e815b48d4 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c6a65bbee6959f50fa9313c63f31ff6e815b48d4 commit c6a65bbee6959f50fa9313c63f31ff6e815b48d4 Author: Olivier Certner AuthorDate: 2024-05-21 14:23:32 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:21 +0000 zfs: spa: ZIO_TASKQ_ISSUE: Use symbolic priority This allows to change the meaning of priority differences in FreeBSD without requiring code changes in ZFS. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390 (cherry picked from commit fd141584cf89d7d24543ef5be83c6927a5d67ffa) --- .../openzfs/include/os/freebsd/spl/sys/proc.h | 4 +++- .../openzfs/include/os/linux/spl/sys/sysmacros.h | 4 +++- sys/contrib/openzfs/include/sys/zfs_context.h | 4 +++- sys/contrib/openzfs/module/zfs/spa.c | 21 +++------------------ 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h index 96ba10e5679e..0d02a826870c 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/proc.h @@ -44,7 +44,9 @@ #ifdef _KERNEL #define CPU curcpu #define minclsyspri PRIBIO -#define defclsyspri minclsyspri +#define defclsyspri minclsyspri +/* Write issue taskq priority. */ +#define wtqclsyspri ((PVM + PRIBIO) / 2) #define maxclsyspri PVM #define max_ncpus (mp_maxid + 1) #define boot_max_ncpus (mp_maxid + 1) diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h index 0e8390736309..96bb01e81541 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/sysmacros.h @@ -91,8 +91,10 @@ * Treat shim tasks as SCHED_NORMAL tasks */ #define minclsyspri (MAX_PRIO-1) -#define maxclsyspri (MAX_RT_PRIO) #define defclsyspri (DEFAULT_PRIO) +/* Write issue taskq priority. */ +#define wtqclsyspri (MAX_RT_PRIO + 1) +#define maxclsyspri (MAX_RT_PRIO) #ifndef NICE_TO_PRIO #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) diff --git a/sys/contrib/openzfs/include/sys/zfs_context.h b/sys/contrib/openzfs/include/sys/zfs_context.h index 5dedb14c7fb5..accfa3d9da9f 100644 --- a/sys/contrib/openzfs/include/sys/zfs_context.h +++ b/sys/contrib/openzfs/include/sys/zfs_context.h @@ -620,8 +620,10 @@ extern void delay(clock_t ticks); * Process priorities as defined by setpriority(2) and getpriority(2). */ #define minclsyspri 19 -#define maxclsyspri -20 #define defclsyspri 0 +/* Write issue taskq priority. */ +#define wtqclsyspri -19 +#define maxclsyspri -20 #define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1)) #define CPU_SEQID_UNSTABLE CPU_SEQID diff --git a/sys/contrib/openzfs/module/zfs/spa.c b/sys/contrib/openzfs/module/zfs/spa.c index 886867b739f0..b140f55af973 100644 --- a/sys/contrib/openzfs/module/zfs/spa.c +++ b/sys/contrib/openzfs/module/zfs/spa.c @@ -1114,29 +1114,14 @@ spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q) tq = taskq_create_sysdc(name, value, 50, INT_MAX, spa->spa_proc, zio_taskq_basedc, flags); } else { - pri_t pri = maxclsyspri; /* * The write issue taskq can be extremely CPU * intensive. Run it at slightly less important * priority than the other taskqs. - * - * Under Linux and FreeBSD this means incrementing - * the priority value as opposed to platforms like - * illumos where it should be decremented. - * - * On FreeBSD, if priorities divided by four (RQ_PPQ) - * are equal then a difference between them is - * insignificant. */ - if (t == ZIO_TYPE_WRITE && q == ZIO_TASKQ_ISSUE) { -#if defined(__linux__) - pri++; -#elif defined(__FreeBSD__) - pri += 4; -#else -#error "unknown OS" -#endif - } + const pri_t pri = (t == ZIO_TYPE_WRITE && + q == ZIO_TASKQ_ISSUE) ? + wtqclsyspri : maxclsyspri; tq = taskq_create_proc(name, value, pri, 50, INT_MAX, spa->spa_proc, flags); } From nobody Mon Jul 28 13:31:28 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 4brKBS5M5Fz634lZ; Mon, 28 Jul 2025 13:31:28 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBS3SdDz3txK; Mon, 28 Jul 2025 13:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709488; 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=I0/v8+3sXf7ZwmH4ktEO0bu6LB4b71ir5w3Jy33EGGQ=; b=Z3x1KnyqG4rZl1MIwln3ZnrMbEQzjitbiXCSTPXX5TpmBbxSjwm/rX0wiDqS+EvZOiL2i5 vJmt2ol1nFrk3uNb+dVwM+BO23rjBJVStRqbeozvPUMMUgPFCiXXBGtCdasD8qHHMIe21e 9VXtQzfS989aR3bFxum8I8+48nyJ5bwR7RNn1wrTU1Q/wzCCElEsB3+k6OPkEVQu+Q995x zfjgpHrAeyfczaK2MHTKZ4IE5O6VgtAeQaX9xy0dcZzzu8bKxqW36hwWFDBQ8o2Bg4akzM Dsp+XsoD3P2LeUkhW4WEx+Y0vts15bqRHbbWlqNreY3vD1rSXguXAOvrLwBs+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709488; 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=I0/v8+3sXf7ZwmH4ktEO0bu6LB4b71ir5w3Jy33EGGQ=; b=GBq0O48yVF4tH4VrNOnY0K11Tk3cTNmZEzKeqCvzN2i3iIdcVJUjATVuYXoo+PAb7YDqwU LaJNY61fzxguN79PwT6NiuvNtsFBfXv6nlFXZzuZagfm1+6kfVwrUg4gLz2mmpQUyp5qWj N6zSRfMtAN+FtjE/5I+HnXR9rH5J3s0xl3PUe2qZ1UN//UycUnpRh8TF1k9xa4QWzrsD6c xjbrxwavyQUxAXh/sEOpZkPd1AceAPrFNA3fbtNyRFGwQwKj6mt3gdmjmvortUUbHextkr KU9qtAIivtMYsCdJGohDVf5WadcEBXYSisu8fb3Ydcr4j29lBH7JK24caaGjzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709488; a=rsa-sha256; cv=none; b=bs0hy/TyBQvVi0xtQoVP8VMqNM83fYtTQZxNYYQQgJqex76JhGyMUI02kLubH1ZrAjAIra bzOICfC3eSNo8cp/+Cn0Bqx5+NTqj7iIcQyzeNDCkXSun9sgx9Cyg6s3Wf8WZf+aWnzxbt tyctHbqdhe1z/xFfBT6I9xxoq5FaH720jhUUAUDKo0mVSlwcABWRLLbx5Cien9Jcci4L6q tRcVHKe+7midiGGKaRow32VCWoEgJcdAwcNU1lE4ntylxXlyLDGBLKv1EcUKQ9SfyYMM9d R1M7yyMa7fYFZ/qv/JtWHpuq/stZNsptA+2fg8oNfz58rZK7c817Lia6g0WG0g== 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 4brKBS2N3xznNt; Mon, 28 Jul 2025 13:31:28 +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 56SDVShw080504; Mon, 28 Jul 2025 13:31:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVSJn080501; Mon, 28 Jul 2025 13:31:28 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:28 GMT Message-Id: <202507281331.56SDVSJn080501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 590d12774f8f - stable/14 - runq: Bump __FreeBSD_version after switching to 256 levels 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 590d12774f8f921a3181dc0b893612925b041394 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=590d12774f8f921a3181dc0b893612925b041394 commit 590d12774f8f921a3181dc0b893612925b041394 Author: Olivier Certner AuthorDate: 2024-05-21 13:21:51 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:25 +0000 runq: Bump __FreeBSD_version after switching to 256 levels Corresponding to changing RQ_PPQ to 1. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390 (cherry picked from commit e3a4b989d7f7d82f7ab8cefe0d665dbe6b74d316) --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 74490f5e6e0e..3c3f4093ee1f 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1403503 +#define __FreeBSD_version 1403504 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Mon Jul 28 13:31:29 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 4brKBV50Zrz634ql; Mon, 28 Jul 2025 13:31:30 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBT4R9Sz3ts0; Mon, 28 Jul 2025 13:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709489; 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=AE93Bxiq+dTBX/bZFo324OFNDiHNCw3adipXsyvXxoM=; b=BH4eJcJsXuczJm84A11dbfws6Y5SPqnRV056EHuzfmuRg8AdjC5yzXNBe5QyZiUUJSYzRd d1RRHh0VDpxla1tM8yIGOVmvWO8FE4ah7VIyns8XXsiJpnln3vKcC3UG0npC0iH1Vke6JM M/rpIZCmyb++YKzgo16x2wN6/35dkxIL3ciQzTYXmq4e9ifKq/vBcz2XchE93Kjc4zaJcX hNTR95Xw8IqQKkZxKch4+pdj9PFYoA+MB5iK+n1B0PUKJCn/rxHuJ1/p/yTqzwe9Qk1MsZ gXZ4U7WhRd9ckOxkyYTD3FEDO2vGNOaNCuoCieTCKOY176AJPlP0Yhvk+KKEoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709489; 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=AE93Bxiq+dTBX/bZFo324OFNDiHNCw3adipXsyvXxoM=; b=myDAgQQjifuvROGxNDsqPzJJYckqYPpIN7M5nO7ZXsI5w7egoWxjtJiJAH2vwk8LiZUu50 oTVJkgrw8XimH+IwwRZ2kZxoHP+yo6OQ/9pgPxBDkLa6DKq9FK/udHU0ON3OVKWrY4Ea4L U5tnDg5MUfBtXWBBx9yY7d6FrdqFzBnACG9g/ZUcBORAT2Hlf7GnZ52tVHlNqLgnmpTfnN gRkKSA+R7zXrAX8i9HjVKVAwXZzatM3HM7z1vN7kYDYxjbmDl56nB9ch9af6ZnI0AQwufD H46BQph4Q3EQKBxjDJP0NBT8isgi4DGO1SgDMHzRlC9R6cK0J1Rkml28uLCbHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709489; a=rsa-sha256; cv=none; b=sUENPscjqCadXnKb397msepAWDe6IB+vHIkkf6iU9iBHnaB8lLm8gjxR3f/8GWzeg3oluW 3ydw9QL8TgnyvMlPO0ngO2n2kNhX3vJ63CMn9oPoT3u89n4L0eq4pRDUSVWYNbFURFd3FY QF1QrkRuEgsDkVt8Sf/guXim5wWXRTIBUeRyOorRJghB2obnuwqXo6AZlzsy6TKatYQtJ4 81kty83cTU13Y2Run0iaFRirOpzOtk7NaWTSMGYUhgOtlANbl2S26nWv/382TU17+DhWcG gjvoj0CZ4jCwziI5r6c+3vY8agoz9D4IgJf+EQBVmrLOAmbvFRdNx5D/u6uo2A== 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 4brKBT3W15znfR; Mon, 28 Jul 2025 13:31:29 +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 56SDVTDH080540; Mon, 28 Jul 2025 13:31:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVTwE080536; Mon, 28 Jul 2025 13:31:29 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:29 GMT Message-Id: <202507281331.56SDVTwE080536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: dcf352d69d91 - stable/14 - runq: Remove userland references to RQ_PPQ in rtprio contexts 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: dcf352d69d912823b7eb2fb0ed5a33ac4ce9b5c9 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=dcf352d69d912823b7eb2fb0ed5a33ac4ce9b5c9 commit dcf352d69d912823b7eb2fb0ed5a33ac4ce9b5c9 Author: Olivier Certner AuthorDate: 2024-05-21 13:00:23 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:26 +0000 runq: Remove userland references to RQ_PPQ in rtprio contexts Concerns only a single test (ptrace_test.c). MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390 (cherry picked from commit b2a9ee2a72eabcfe7942cfbc2a576b5603ef218c) --- tests/sys/kern/ptrace_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 8831d298d554..b96e7d126b03 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -2029,7 +2028,7 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_signal, tc) sched_get_priority_min(SCHED_FIFO)) / 2; CHILD_REQUIRE(pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched_param) == 0); - sched_param.sched_priority -= RQ_PPQ; + sched_param.sched_priority -= 1; CHILD_REQUIRE(pthread_setschedparam(t, SCHED_FIFO, &sched_param) == 0); @@ -2132,7 +2131,7 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc) sched_get_priority_min(SCHED_FIFO)) / 2; CHILD_REQUIRE(pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched_param) == 0); - sched_param.sched_priority -= RQ_PPQ; + sched_param.sched_priority -= 1; CHILD_REQUIRE(pthread_setschedparam(t, SCHED_FIFO, &sched_param) == 0); From nobody Mon Jul 28 13:31:30 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 4brKBW1V2dz634sp; Mon, 28 Jul 2025 13:31:31 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBV3vDjz3v02; Mon, 28 Jul 2025 13:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709490; 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=E+LfwrT078+41FrSWY7iEaxzRxHmsvmCQTnuFeeCQv4=; b=Ew7UQLLqXAoP463NYmGNe2a0QDCA1ki04NQQ/WPIEqCDbnYptpyaq0r2aY5f/8SezmShXs GPx0js5nxR0nlfAfg5d4oY26JoAs14CvCOlWJ7MBWtRVm3kOA9iJKwR4ECYlSLg1jzk/Bs x9Z96rJ/WFdI93+tyRkRRjmZM/vLEebmiojc26PL/pUOdNV4cWkD1at9NPLpx977mLFidb 2+C2OANEDA+8eMpGlMiJKmSVDDslLKKwIpIkRKk1mmznvxGpli+EMSFbUaVPt1M9PWLgzO 66CzRnIIcdfmwZdUS5AzDRKfEuBBKfIP94Ovb7wjT8pdVF12OMXs7xtw4Vhriw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709490; 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=E+LfwrT078+41FrSWY7iEaxzRxHmsvmCQTnuFeeCQv4=; b=KG8MG4ak57/EMVxYgDbCoJvpOBJKZoFINcyckFPNMibuVb4ZQ0fG5z2aPzlj+zi3EZrxnV NQ++Ky7maVrEwEHF0p581DKpYwNAdcAkBT+PiFvrypGRyUnWr5H/xeDbnzt0ApExb5P0ZP 41Vzhvj/HBbnfxenKKsX4hQgoJzJrHYif318MZhaRCrQ6Mfh1eqn7umpcB9COB3/GUHDPv iWoPwty4lLdE/f+KLxRfKICAG6D04ekgerlkR5WBSYcZgYYzRjWtU3Yh59AGc9aVYzEYoQ xHDGafY/HOYdbqdDAgI2g1Zto8Xq/LRjeY91v8qxiGWFq0hXQFipj7W2GQfrBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709490; a=rsa-sha256; cv=none; b=YnysQlu6ztOiJNyAyV5P/SswFU4b2uoRLIQpbvIzyMIqk0XRAcSB6u0s7ZwUY6pu0Vrj/C PvNTNFjKa+OsUnRe8kPR0OcPrzCJ3EV/Avq4cVSQq2YiCD9lXsanf1WlHEj9F5rPp9yuE+ 3fSAY9RJ61BD9I8y9hByZTCJlxmug+k0vN2uwvq4s8HJVjrlkA4e6XF8CNUrz1WMqjCexu cqUbgaI/5U7ez4lkSJIRg7ZPbwq2dGCYOqM372L614YyPQ9ozP45IBIOdrVPpUF4Vqgk8R DlGz07r0CbRhQ6HYyg/8WZPma8lcqqSSlX0HMhII6V1nxskxzt10MjiyeZXPog== 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 4brKBV3VtrznJb; Mon, 28 Jul 2025 13:31:30 +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 56SDVUXK080655; Mon, 28 Jul 2025 13:31:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVU4w080641; Mon, 28 Jul 2025 13:31:30 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:30 GMT Message-Id: <202507281331.56SDVU4w080641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c6838df83578 - stable/14 - epoch_test: Assign different priorities using offset 1 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c6838df8357825d2f49c138b8a7d9d0bfdcc4760 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c6838df8357825d2f49c138b8a7d9d0bfdcc4760 commit c6838df8357825d2f49c138b8a7d9d0bfdcc4760 Author: Olivier Certner AuthorDate: 2025-03-13 09:31:45 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:28 +0000 epoch_test: Assign different priorities using offset 1 Replace the hardcoded 4 (old RQ_PPQ) by 1 (new RQ_PPQ), as all priority levels are now treated differently. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit a2d1c3bc2bb44a824a8d1f688aa1fd3b66fa759b) --- sys/tests/epoch/epoch_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/tests/epoch/epoch_test.c b/sys/tests/epoch/epoch_test.c index e34b5de1c422..f25e03344b36 100644 --- a/sys/tests/epoch/epoch_test.c +++ b/sys/tests/epoch/epoch_test.c @@ -148,7 +148,7 @@ test_modinit(void) printf("%s: kthread_add(epoch_test): error %d", __func__, error); } else { - pri_off = (i*4)%pri_range; + pri_off = i%pri_range; td = testthreads[i]; thread_lock(td); sched_prio(td, PRI_MIN_REALTIME + pri_off); From nobody Mon Jul 28 13:31:31 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 4brKBX0b4Lz634lh; Mon, 28 Jul 2025 13:31:32 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBW5S8Xz3vBH; Mon, 28 Jul 2025 13:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709491; 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=FoLDJhHREjb+0TxgGUeXwb2V0CNSS2vQPMIZT2KLwaQ=; b=Ig4YCUxt1/AXakokOTjQNLSnVayuVM08qCBbY6DBRDoH4LSgIlhfBrKouw5AFNT4kE+D8V CgXsrJQxRahaDQsqjCFMoPwjA9Y3jKqczA5P17i6dcR2ZcOY2c/0ipef3+wjz4RlyAGlXa bCBdoEV6J3ZhOp7vjYEdKPxTD38Lbtzxh/GYbmvDA2RRQ3XENZbbcEQWNlFbH8aXCBUlfb n5SPA7SVYSjLggREVipb4yGwpd94OCjdZxnbjZk89q9NxzvwuBzVvJquH1h14wKYkXARh3 KIk9EpdJvQNhdjTZWwPS3QS+7zAFHboQYhFo4PYmCKezj1CPTf+KObfzXBXJMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709491; 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=FoLDJhHREjb+0TxgGUeXwb2V0CNSS2vQPMIZT2KLwaQ=; b=s67Fer9KvkBPRTUBawM0yr35CNe25HLvy/XTv+5oAx4kflX8vAppoHdTCd5zy4Ymg8qaLO 1fG3Qiq97A91IF0d0F31jQViY4HSVnz1sn9XJR1ZIryL+DbH9I4AVP6JgWeLqawEj/AV6y 28gGzSTqjf5t47Dc2SxYGTSZvORlzQijVC43ccb/LEz7D3XPzp/C4vlOTYG3lfLjAKjzUY JO0HooBztlBMK1IPOOHWGOZHE9GI32cCA2uYjKj1X1zL8rDXV0+XSIpkRsWa8+1FhyQXFA 4gYDGQWsEdw791No8h28fnVdt8DULV7M7n4xVCrII2ntrGZLp2coBUnccsPeXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709491; a=rsa-sha256; cv=none; b=Iq8y8g8KtcHfDVdhjZ8E0XGi+x2uIkXoWS95Q4sPLo2AgrkfF8/DuVYEeCBYb7TmCqQuqz 3huFDpTQsOSNiQzwzDwM9iL/iOV1rSQvlq2XXaiRUpw0NjwWmw/z2P0F+rlOc5cezCsHH6 YDrTmXHbRVbh4+HKvgfCpItpyskS+X7ZjORh7HPld/fuErMo/CBsHtq9+lhUVUBfGlFtOj Yw0v4Kq5cXMe8++Y1U4NKCagNACBVoNSDKeB7t1UsPOtJ4kbkYYG387JEDnX7IkO0I6oOz d4RwHZBHwCmAIoX0e2A9cle5zCm0uTke8MmyxFNzj5qYJ+a3TO/E1YTqaisy1A== 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 4brKBW4kjwznfw; Mon, 28 Jul 2025 13:31:31 +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 56SDVVeo081832; Mon, 28 Jul 2025 13:31:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVVHe081829; Mon, 28 Jul 2025 13:31:31 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:31 GMT Message-Id: <202507281331.56SDVVHe081829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 2a9e7fd346f6 - stable/14 - runq: Restrict to kernel only 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2a9e7fd346f669338a23b438a723f5d604957173 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=2a9e7fd346f669338a23b438a723f5d604957173 commit 2a9e7fd346f669338a23b438a723f5d604957173 Author: Olivier Certner AuthorDate: 2024-05-21 13:05:54 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:29 +0000 runq: Restrict to kernel only MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390 (cherry picked from commit 055b5b5f850da9d8355740b7a0698fa790c4f97d) --- sys/sys/runq.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 590463af192c..9e209538d9c2 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -29,13 +29,16 @@ #ifndef _RUNQ_H_ #define _RUNQ_H_ -#include +#ifndef _KERNEL +#error "no user-serviceable parts inside" +#endif -#ifdef _KERNEL +#include /* For bool. */ +#include #include -#else -#include -#endif +#include + +struct thread; /* * Run queue parameters. @@ -69,12 +72,6 @@ typedef unsigned long rqsw_t; /* runq's status words type. */ RQSW_TO_QUEUE_IDX(word_idx, RQSW_BSF(word)) -#ifdef _KERNEL -#include /* For bool. */ -#include - -struct thread; - /* * The queue for a given index as a list of threads. */ @@ -117,6 +114,5 @@ struct thread *runq_first_thread_range(struct runq *const rq, bool runq_not_empty(struct runq *); struct thread *runq_choose(struct runq *); struct thread *runq_choose_fuzz(struct runq *, int _fuzz); -#endif /* _KERNEL */ #endif From nobody Mon Jul 28 13:31:32 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 4brKBY0g6pz634nZ; Mon, 28 Jul 2025 13:31:33 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBX631lz3vBj; Mon, 28 Jul 2025 13:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709492; 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=V7r9JnKmNcR0Egvwmws14AYb9BkwCXVrr/4pPFKgLlc=; b=DMPJqqiWPovxWD/6rzAjg62Cr3qvT19BKgl8w3Ru3f2nBA8unYdlwawa3QNDWERPv2OW9M 2ctQWiSC1FfU59BCLvxDcr31gzIHRCHpWECwPxL2K3OwoJ6pQYBIBzub4d79EvRAO7CBMu TcONZ/yd91EN27ksz5K4FvYxxTxy2ToC8LdHySijB8KwMH7xYlfK/PyN4s7QzOgaeSfcZ1 ZksonKjzo6oXiEX8858PsN8jurzs5/boPoeIpcDxFYifudbyn2cGIW1gFSkGuxLAWBXUVP hevRfbBYbHuCaC+TF1hpDXVYZj7JmvPPFuOMbX5NAsjxIl0QMDclRnhx2arC4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709492; 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=V7r9JnKmNcR0Egvwmws14AYb9BkwCXVrr/4pPFKgLlc=; b=iBv51MIgOJirmBGd0VsYYml4gvQvTN3SfR9vV4qUHiPNyicHcz4ZxY6ziYrgY3o515jpCe vIP2UD7aoqlCHmk3nJDTy8oIewTbM28c7Xz/CIMHwA3MVz+KDG+x5ilvgtBEjP/xy0rInX pj7p6U1McHaZ/Vu+ohyZ96Z7c9hBi4MN8FgJ6iHd0Q3I379JCyvsFWOtQUg2374GEZf0nO MV/hGqE/Kqw0ycipgUneXvA9t9V1WCUo60MJaw0uAnW7WyXZJiKQjkFL3qoGhvXJr5MnQv aBjrtyj/mj6DH5J3kEDPywerqb3OZRIl8J+hyWzfAMP+2dhFsei8JNJLGbnxNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709492; a=rsa-sha256; cv=none; b=gdXfT/Px+7tUgaI300c2sKEhX9GvNWopHn/AIsjXbqMYSXFWfX1J6u2W+LxhqS57ORUzE1 ni9Ow9qWiaJ+twbGmDChEmn5UQ6zU1a3Hu15tf9RcuzwvZD7rvH3DAMjkiOQg+KjlOz1OW SC3IhvhS1FWf7QSi9ORI4vceuR8FS5fCrMQ5sWHcIM3kHZh/dRKxsPr2ZynJJEnMc1gs/Y /y0t8l3u9fgkECpLxc6Sdoq5Y/omwHBvWX+hFRJzUOfZWuJsILJLp6bFsoAl4mZ3Tux3w0 wx+/d7mif91P23wkwwf15wtcqcsD03Ine6G6rQADoSrR96BY7bgg2T602aRbZw== 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 4brKBX5QrMznJc; Mon, 28 Jul 2025 13:31:32 +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 56SDVWsr081939; Mon, 28 Jul 2025 13:31:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVWWt081936; Mon, 28 Jul 2025 13:31:32 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:32 GMT Message-Id: <202507281331.56SDVWWt081936@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c42d06da488a - stable/14 - runq: Add copyright 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c42d06da488a12c110a7476a6b313e1fce890402 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c42d06da488a12c110a7476a6b313e1fce890402 commit c42d06da488a12c110a7476a6b313e1fce890402 Author: Olivier Certner AuthorDate: 2024-05-21 13:12:27 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:38 +0000 runq: Add copyright MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit d710acecc00f59dbcc1006ca330f0eeb1a133695) --- sys/kern/kern_switch.c | 5 +++++ sys/sys/runq.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 264925ab954a..bd0d987594ea 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -3,6 +3,11 @@ * * Copyright (c) 2001 Jake Burkholder * All rights reserved. + * Copyright (c) 2024 The FreeBSD Foundation + * + * Portions of this software were developed by Olivier Certner + * at Kumacom SARL under sponsorship from the FreeBSD + * Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/sys/runq.h b/sys/sys/runq.h index 9e209538d9c2..fb9b9908fe57 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -3,6 +3,11 @@ * * Copyright (c) 2001 Jake Burkholder * All rights reserved. + * Copyright (c) 2024 The FreeBSD Foundation + * + * Portions of this software were developed by Olivier Certner + * at Kumacom SARL under sponsorship from the FreeBSD + * Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From nobody Mon Jul 28 13:31:33 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 4brKBb4FD5z634Y1; Mon, 28 Jul 2025 13:31:35 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBY75pkz3v8F; Mon, 28 Jul 2025 13:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709494; 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=KQIu/wePMU3/VBIVBIw7ILszwtPn0f9yDpes47Stbx8=; b=nsu9ArgeWuNW1kZeGuyCHYLbiGzTuF6lN+lOp8ykJwuOB7ELfS1prq+QRRaBv2lrGwjEma JESgggDapLDjUDdkS7iXNjVhdCQZkFczykbPIQSG1FwNfYiaiEskn70GZar/0frEXrt1+i MGL6gLmUd9RZKTHR49pckBF0F+jnl7y3PzDawZa3XQfKWEZvcpqtZMOfPBJ+xDlGpZNWzF LbclfMjdRBITFAbytXHIXqZdQRLffGBTo+AFWkYqO1ItNJFGgYR5jgWyLu+8lThzbID8hO 6qJ9OkLNCJMHG/YKsHGaoOuakUL4nyQC8UEdse8m342IFxfwJb+G1trDgBXHnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709494; 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=KQIu/wePMU3/VBIVBIw7ILszwtPn0f9yDpes47Stbx8=; b=Ww3PtNLc0ynjccoVYgWsE3iHP1DwYg86sGZukXsEIkZH9yh/KPoZ8Y3/iZXBQAPXuUpyxP c8sJBsq/wvzYtcQ18rnPzmSolvYjzyVH7HXbV62U9SnT1UNxF0e2njDheq+rrreWvF0F0q QIRIgR/Cw+fE/giGIeYnX+dZ/sZfhIsHIqSi6Tq/XfirZPqQiY7meL5Rl226GkkQhS1DpP DkCUCJb/e05vea02df7OWOgbgJTjuxcDCMCrhuv8MeM8mU9Xg7g1EOpKPBoYR2UtNjAkJZ tz5hD0wPhx6o9LJ7jrkLlemmFWIdC85v8lJzQPWCCMqnj+bA4GljcoK2B6/GSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709494; a=rsa-sha256; cv=none; b=MB/rwloxkaKJIwtl6cl4NBDJ4WN8/UL6MuTTY8C5ykzRnDRA8031t/8hC5UNATHwGKQe2a MqvfhSiHHYoQUm7ShgimZwmwg6iRXR0MyZMf6Hrj7SjTB6FmiofK6wMvaSLuSbjJlSVsGt zDOgtEBYi/jP64FscbSMvVZWlHYVt8Ka7cQeBdlwIzLiaxrbKWlxJTPGyi15WU0+0J9X1P XhIVdLq6kNEMUIb9cECyMG1HjYZ9NXkBaITB97U1wLODCmtupVZ9zdrWpAZgGtP37VANfj NpL/p+GJmBYAGPvquCpsnZ9OGUm+KcVRsWUCRXREtgbThH6ui7Mku50TM2ymbQ== 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 4brKBY6cKrznJd; Mon, 28 Jul 2025 13:31:33 +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 56SDVXTC081977; Mon, 28 Jul 2025 13:31:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVXax081973; Mon, 28 Jul 2025 13:31:33 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:33 GMT Message-Id: <202507281331.56SDVXax081973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: d83f27fe7378 - stable/14 - sched: Internal priority ranges: Reduce kernel, increase timeshare 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d83f27fe73787a3625aae3f36fd50bd4662db483 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d83f27fe73787a3625aae3f36fd50bd4662db483 commit d83f27fe73787a3625aae3f36fd50bd4662db483 Author: Olivier Certner AuthorDate: 2024-05-22 20:32:18 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:39 +0000 sched: Internal priority ranges: Reduce kernel, increase timeshare Now that a difference of 1 in priority level is significant, we can shrink the priority range reserved for kernel threads. Only four distinct levels are necessary for the bottom half (3 base levels and arguably an additional one for demoted interrupt threads that run for full time slices so that they finally don't compete with other ones). To leave room for other possible uses, we settle on 8 levels. Given the symbolic constants for the top half, 10 levels are currently necessary. We settle on 16 levels. This allows to enlarge the timesharing range, which covers ULE's both interactive and batch range, to 168 distinct levels from less than 64 ones for ULE (as of before the changes to make it use a single runqueue and have 256 distinct levels per runqueue) and 34 ones for 4BSD. While here, note that the realtime range is required to have at least 32 priority levels since: - POSIX mandates at least 32 distinct levels for the SCHED_RR/SCHED_FIFO scheduling policies. - We directly map contiguous priority levels ('sched_priority') of these scheduling policies to distinct, contiguous internal priority levels. Conversely, having at least 32 priority levels is enough to guarantee compliance to the POSIX requirement mentioned above because different internal priority levels are treated differently since commit "runq: Switch to 256 levels". While here, list explicit change restrictions for the realtime and idle range. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45391 (cherry picked from commit dee257c28d936bb7b459d3eda207531b3cf1bd4e) --- sys/sys/priority.h | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/sys/sys/priority.h b/sys/sys/priority.h index 4428a85c0987..93dd5aa90d95 100644 --- a/sys/sys/priority.h +++ b/sys/sys/priority.h @@ -64,17 +64,23 @@ */ /* - * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ) - * are insignificant. Ranges are as follows: + * Priorities range from 0 to 255. Ranges are as follows: * - * Interrupt threads: 0 - 15 - * Realtime user threads: 16 - 47 - * Top half kernel threads: 48 - 87 - * Time sharing user threads: 88 - 223 + * Interrupt threads: 0 - 7 + * Realtime user threads: 8 - 39 + * Top half kernel threads: 40 - 55 + * Time sharing user threads: 56 - 223 * Idle user threads: 224 - 255 * - * XXX If/When the specific interrupt thread and top half thread ranges - * disappear, a larger range can be used for user processes. + * Priority levels of rtprio(2)'s RTP_PRIO_FIFO and RTP_PRIO_REALTIME and + * POSIX's SCHED_FIFO and SCHED_RR are directly mapped to the internal realtime + * range mentioned above by a simple translation. This range's length + * consequently cannot be changed without impacts on the scheduling priority + * code, and in any case must never be smaller than 32 for POSIX compliance and + * rtprio(2) backwards compatibility. Similarly, priority levels of rtprio(2)'s + * RTP_PRIO_IDLE are directly mapped to the internal idle range above (and, + * soon, those of the to-be-introduced SCHED_IDLE policy as well), so changing + * that range is subject to the same caveats and restrictions. */ #define PRI_MIN (0) /* Highest priority. */ @@ -88,34 +94,34 @@ * decay to lower priorities if they run for full time slices. */ #define PI_REALTIME (PRI_MIN_ITHD + 0) -#define PI_INTR (PRI_MIN_ITHD + 4) +#define PI_INTR (PRI_MIN_ITHD + 1) #define PI_AV PI_INTR #define PI_NET PI_INTR #define PI_DISK PI_INTR #define PI_TTY PI_INTR #define PI_DULL PI_INTR -#define PI_SOFT (PRI_MIN_ITHD + 8) +#define PI_SOFT (PRI_MIN_ITHD + 2) #define PI_SOFTCLOCK PI_SOFT #define PI_SWI(x) PI_SOFT -#define PRI_MIN_REALTIME (16) +#define PRI_MIN_REALTIME (8) #define PRI_MAX_REALTIME (PRI_MIN_KERN - 1) -#define PRI_MIN_KERN (48) +#define PRI_MIN_KERN (40) #define PRI_MAX_KERN (PRI_MIN_TIMESHARE - 1) #define PSWP (PRI_MIN_KERN + 0) -#define PVM (PRI_MIN_KERN + 4) -#define PINOD (PRI_MIN_KERN + 8) -#define PRIBIO (PRI_MIN_KERN + 12) -#define PVFS (PRI_MIN_KERN + 16) -#define PZERO (PRI_MIN_KERN + 20) -#define PSOCK (PRI_MIN_KERN + 24) -#define PWAIT (PRI_MIN_KERN + 28) -#define PLOCK (PRI_MIN_KERN + 32) -#define PPAUSE (PRI_MIN_KERN + 36) - -#define PRI_MIN_TIMESHARE (88) +#define PVM (PRI_MIN_KERN + 1) +#define PINOD (PRI_MIN_KERN + 2) +#define PRIBIO (PRI_MIN_KERN + 3) +#define PVFS (PRI_MIN_KERN + 4) +#define PZERO (PRI_MIN_KERN + 5) +#define PSOCK (PRI_MIN_KERN + 6) +#define PWAIT (PRI_MIN_KERN + 7) +#define PLOCK (PRI_MIN_KERN + 8) +#define PPAUSE (PRI_MIN_KERN + 9) + +#define PRI_MIN_TIMESHARE (56) #define PRI_MAX_TIMESHARE (PRI_MIN_IDLE - 1) #define PUSER (PRI_MIN_TIMESHARE) From nobody Mon Jul 28 13:31:36 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 4brKBc3WF5z634tV; Mon, 28 Jul 2025 13:31:36 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBc1VyKz3tyX; Mon, 28 Jul 2025 13:31:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709496; 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=FzLu+dIPTM1ccOzVTvvMAr3jBuYxK8FXA/DjiykS34s=; b=NyI+eJb7DX+/yuOM1P8MgxJeu9GoiQr2eVSFzafrbb6Vd4HiLMSxJNhKynTe7pXylmQb6f vuf6J7meD1p+iN1nocjPrxyK7xWH1tmxKjsZII8M2p2vYHY2faBcuvXuX7x8GTn+WySkXY S04Kv41DE7Lz/dLFPjxNcwVtn7FE1ZtTZiEiDmxnKvGrvCaHXZ4mEWzQ2XguiQSCe1vPxz Qph97eZnM3/dsWHgs8VfvPZAT4RPBhof3VShwtpu1lYBFkztzGbtCR6nY2Vc76aT7tt61W zFuWYdkmDCbzaxy/IIuGlZr0RPsMx+rLX/cgkTaSfxn1bGGxkV5vPCiyTefOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709496; 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=FzLu+dIPTM1ccOzVTvvMAr3jBuYxK8FXA/DjiykS34s=; b=aQKJGrIcxnHK6ObNeCC1WDhPCvZl1DJTLb3N8aPvb+0x4BACbp8RA9cwm0kUhkn8qHEu8w JsjBsmswakbrOlgTZRt45z0asXeMzTmDUA/Cco0I3sROb1h9r2aZ6qyiYu8mjPTCrMp1rA L8b7zaDeCSC1V4eSu4O67KhMUXa0WkUlAP2FbzWAkIX3QYSNBKpFV3ZJauRoSZ6pgiVpVU OjVIpjofzW7oaoLxu4Kd3HufzRilz2oCMbE9XeR4Mmi3UUYYlwxtxy0FlZ8MwcMAYF13eZ cOXViFIcIJkwa8pyjQUfcOptjh8gCLQXxnqdCkq4j76LJZOWDRd1O+AeUYwyHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709496; a=rsa-sha256; cv=none; b=Dnn5np6m04dNZrWhujGbGHj4mkPVwVLWPFhIkl4kGay14zkZRqJk1NqDgcNJCZhYG+BulV RJN+DbJUbym9PB7KdbQqH2rnSwQA3OKQS2gOlGSgo6FIyUHAc5B3sE3wShnqoCRgpEqrZB +NFfSPr0v/asENXPxmsK3ypDZlLSfKxOWhPgojH2shS3STg2j0ZULnOfK8hJbSdMP/pgqa CvF1yqQgaBlid2yrLl1UkPLd5cF6xaa/cWO9W/sPzkyG7q3bZ+nE/Ly5tTzt3y7zw1i7Ea W2d4JG+72CcDvdeFszgqp2D8y3bft2ntU4VpI9O5ezyE6Mtt1hoNd1vxoEWfVQ== 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 4brKBc15xCznfy; Mon, 28 Jul 2025 13:31:36 +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 56SDVai5082050; Mon, 28 Jul 2025 13:31:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVaQQ082047; Mon, 28 Jul 2025 13:31:36 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:36 GMT Message-Id: <202507281331.56SDVaQQ082047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 15056c43e87f - stable/14 - sched_ule: Sanitize CPU's use and priority computations, and ticks storage 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 15056c43e87f2fc451057b1812e23a8270ebcc1f Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=15056c43e87f2fc451057b1812e23a8270ebcc1f commit 15056c43e87f2fc451057b1812e23a8270ebcc1f Author: Olivier Certner AuthorDate: 2024-06-25 16:12:24 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:40 +0000 sched_ule: Sanitize CPU's use and priority computations, and ticks storage Computation of %CPU in sched_pctcpu() was overly complicated, wrong in the case of a non-maximal window (10 seconds span; this is always the case in practice as the window would oscillate between 10 and 11 seconds for continuously running processes) and performed unshifted for the first part, essentially losing precision (up to 9% for SCHED_TICK_SECS being 10), and with some uneffective shift for the second part. Conserve maximum precision by only shifting by the require amount to attain FSHIFT before dividing. Apply classical rounding to nearest instead of rounding down. To generally avoid wraparound problems with tick fields in 'struct td_sched' (as already happened once in sched_pctcpu_update()), make then all unsigned, and ensure 'ticks' is always converted to some 'u_int'. While here, fix SCHED_AFFINITY(). Rewrite sched_pctcpu_update() while keeping the existing formulas: - Fix the hole in the cliff case that in theory 'ts_ticks' can become greater than the window size if a running thread has not been accounted for too long (today cannot happen because of sched_clock()). - Make the decay ratio explicit and configurable (SCHED_CPU_DECAY_NUMER, SCHED_CPU_DECAY_DENOM). Set it to the current value (10/11), currently producing a 95% attenuation after about ~32s. This eases experimenting with changing it. Apply the ratio on shifted ticks for better precision, independently of the chosen value for SCHED_TICK_MAX/SCHED_TICK_SECS. - Remove redundant SCHED_TICK_TARG. Compute SCHED_TICK_MAX from SCHED_TICK_SECS, the latter now really specifying the maximum size of the %CPU estimation window. - Ensure it is immune to varying 'hz' (which today can't happen), so that after computation SCHED_TICK_RUN(ts) is mathematically guaranteed lower than SCHED_TICK_LENGTH(ts). - Thoroughly explain the current formula, and mention its main drawback (it is completely dependent on the frequency of calls to sched_pctcpu_update(), which currently manifests itself for sleeping threads). Rework sched_priority(): - Ensure 'p_nice' is read only once, to be immune to a concurrent change. - Clearly show that the computed priority is the sum of 3 components. Make them all positive by shifting the starting priority and shifting the nice value in SCHED_PRI_NICE(). - Compute the priority offset deriving from the %CPU with rounding to nearest. - Much more informative KASSERT() output with details regarding the priority computation. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46567 (cherry picked from commit a33225efb4bc2598e4caa1c1f7f715653e8b1fda) --- sys/kern/sched_ule.c | 192 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 76 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 8cd58cd32605..b09d6dfc0f54 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -91,13 +91,14 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; struct td_sched { short ts_flags; /* TSF_* flags. */ int ts_cpu; /* CPU we are on, or were last on. */ - int ts_rltick; /* Real last tick, for affinity. */ - int ts_slice; /* Ticks of slice remaining. */ + u_int ts_rltick; /* Real last tick, for affinity. */ + u_int ts_slice; /* Ticks of slice remaining. */ + u_int ts_ftick; /* %CPU window's first tick */ + u_int ts_ltick; /* %CPU window's last tick */ + /* All ticks count below are stored shifted by SCHED_TICK_SHIFT. */ u_int ts_slptime; /* Number of ticks we vol. slept */ u_int ts_runtime; /* Number of ticks we were running */ - int ts_ltick; /* Last tick that we were running on */ - int ts_ftick; /* First tick that we were running on */ - int ts_ticks; /* Tick count */ + u_int ts_ticks; /* pctcpu window's running tick count */ #ifdef KTR char ts_name[TS_NAME_LEN]; #endif @@ -137,20 +138,14 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= * and end of the MIN to MAX timeshare range are only reachable with negative * or positive nice respectively. * - * PRI_NRESV: Number of priority levels reserved to account for nice values. + * CPU_RANGE: Length of range for priorities computed from CPU use. + * NICE: Priority offset due to the nice value. * 5/4 is to preserve historical nice effect on computation ratios. - * PRI_RANGE: Length of range for priorities computed from CPU use. - * PRI_TICKS: Compute a priority in PRI_RANGE from the ticks count and total. - * PRI_NICE: Determines the part of the priority inherited from nice. + * NRESV: Number of priority levels reserved to account for nice values. */ -#define SCHED_PRI_NRESV ((PRIO_MAX - PRIO_MIN) * 5 / 4) -#define SCHED_PRI_MIN (PRI_MIN_BATCH + (SCHED_PRI_NRESV / 2)) -#define SCHED_PRI_MAX (PRI_MAX_BATCH - (SCHED_PRI_NRESV / 2)) -#define SCHED_PRI_RANGE (SCHED_PRI_MAX - SCHED_PRI_MIN + 1) -#define SCHED_PRI_TICKS(ts) \ - (SCHED_TICK_HZ((ts)) / \ - (roundup(SCHED_TICK_TOTAL((ts)), SCHED_PRI_RANGE) / SCHED_PRI_RANGE)) -#define SCHED_PRI_NICE(nice) ((nice) * 5 / 4) +#define SCHED_PRI_CPU_RANGE (PRI_BATCH_RANGE - SCHED_PRI_NRESV) +#define SCHED_PRI_NICE(nice) (((nice) - PRIO_MIN) * 5 / 4) +#define SCHED_PRI_NRESV SCHED_PRI_NICE(PRIO_MAX) /* * Runqueue indices for the implemented scheduling policies' priority bounds. @@ -180,19 +175,26 @@ _Static_assert(RQ_TS_POL_MAX != RQ_ID_POL_MIN, /* * Cpu percentage computation macros and defines. * - * SCHED_TICK_SECS: Number of seconds to average the cpu usage across. - * SCHED_TICK_TARG: Number of hz ticks to average the cpu usage across. - * SCHED_TICK_MAX: Maximum number of ticks before scaling back. + * SCHED_TICK_SECS: Max number of seconds to average the cpu usage across. + * Must be at most 20 to avoid overflow in sched_pctcpu()'s current formula. + * SCHED_TICK_MAX: Max number of hz ticks matching SCHED_TICK_SECS. * SCHED_TICK_SHIFT: Shift factor to avoid rounding away results. - * SCHED_TICK_HZ: Compute the number of hz ticks for a given ticks count. - * SCHED_TICK_TOTAL: Gives the amount of time we've been recording ticks. - */ -#define SCHED_TICK_SECS 10 -#define SCHED_TICK_TARG (hz * SCHED_TICK_SECS) -#define SCHED_TICK_MAX (SCHED_TICK_TARG + hz) -#define SCHED_TICK_SHIFT 10 -#define SCHED_TICK_HZ(ts) ((ts)->ts_ticks >> SCHED_TICK_SHIFT) -#define SCHED_TICK_TOTAL(ts) (max((ts)->ts_ltick - (ts)->ts_ftick, hz)) + * SCHED_TICK_RUN_SHIFTED: Number of shifted ticks running in last window. + * SCHED_TICK_LENGTH: Length of last window in shifted ticks or 1 if empty. + * SCHED_CPU_DECAY_NUMER: Numerator of %CPU decay factor. + * SCHED_CPU_DECAY_DENOM: Denominator of %CPU decay factor. + */ +#define SCHED_TICK_SECS 11 +#define SCHED_TICK_MAX(hz) ((hz) * SCHED_TICK_SECS) +#define SCHED_TICK_SHIFT 10 +#define SCHED_TICK_RUN_SHIFTED(ts) ((ts)->ts_ticks) +#define SCHED_TICK_LENGTH(ts) (max((ts)->ts_ltick - (ts)->ts_ftick, 1)) +#define SCHED_CPU_DECAY_NUMER 10 +#define SCHED_CPU_DECAY_DENOM 11 +_Static_assert(SCHED_CPU_DECAY_NUMER >= 0 && SCHED_CPU_DECAY_DENOM > 0 && + SCHED_CPU_DECAY_NUMER <= SCHED_CPU_DECAY_DENOM, + "Inconsistent values for SCHED_CPU_DECAY_NUMER and/or " + "SCHED_CPU_DECAY_DENOM"); /* * These determine the interactivity of a process. Interactivity differs from @@ -308,7 +310,11 @@ struct tdq { struct cpu_group __read_mostly *cpu_top; /* CPU topology */ #define SCHED_AFFINITY_DEFAULT (max(1, hz / 1000)) -#define SCHED_AFFINITY(ts, t) ((ts)->ts_rltick > ticks - ((t) * affinity)) +/* + * This inequality has to be written with a positive difference of ticks to + * correctly handle wraparound. + */ +#define SCHED_AFFINITY(ts, t) ((u_int)ticks - (ts)->ts_rltick < (t) * affinity) /* * Run-time tunables. @@ -665,7 +671,7 @@ tdq_load_rem(struct tdq *tdq, struct thread *td) * aside from curthread and target no more than sched_slice latency but * no less than sched_slice_min runtime. */ -static inline int +static inline u_int tdq_slice(struct tdq *tdq) { int load; @@ -1757,9 +1763,12 @@ static void sched_priority(struct thread *td) { u_int pri, score; + int nice; if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE) return; + + nice = td->td_proc->p_nice; /* * If the score is interactive we place the thread in the realtime * queue with a priority that is less than kernel and interrupt @@ -1773,7 +1782,7 @@ sched_priority(struct thread *td) * score. Negative nice values make it easier for a thread to be * considered interactive. */ - score = imax(0, sched_interact_score(td) + td->td_proc->p_nice); + score = imax(0, sched_interact_score(td) + nice); if (score < sched_interact) { pri = PRI_MIN_INTERACT; pri += (PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) * score / @@ -1782,17 +1791,26 @@ sched_priority(struct thread *td) ("sched_priority: invalid interactive priority %u score %u", pri, score)); } else { - pri = SCHED_PRI_MIN; - if (td_get_sched(td)->ts_ticks) - pri += min(SCHED_PRI_TICKS(td_get_sched(td)), - SCHED_PRI_RANGE - 1); - pri += SCHED_PRI_NICE(td->td_proc->p_nice); + const struct td_sched *const ts = td_get_sched(td); + const u_int run = SCHED_TICK_RUN_SHIFTED(ts); + const u_int run_unshifted __unused = (run + + (1 << SCHED_TICK_SHIFT) / 2) >> SCHED_TICK_SHIFT; + const u_int len = SCHED_TICK_LENGTH(ts); + const u_int nice_pri_off = SCHED_PRI_NICE(nice); + const u_int cpu_pri_off = (((SCHED_PRI_CPU_RANGE - 1) * + run + len / 2) / len + (1 << SCHED_TICK_SHIFT) / 2) >> + SCHED_TICK_SHIFT; + + MPASS(cpu_pri_off < SCHED_PRI_CPU_RANGE); + pri = PRI_MIN_BATCH + cpu_pri_off + nice_pri_off; KASSERT(pri >= PRI_MIN_BATCH && pri <= PRI_MAX_BATCH, - ("sched_priority: invalid priority %u: nice %d, " - "ticks %d ftick %d ltick %d tick pri %d", - pri, td->td_proc->p_nice, td_get_sched(td)->ts_ticks, - td_get_sched(td)->ts_ftick, td_get_sched(td)->ts_ltick, - SCHED_PRI_TICKS(td_get_sched(td)))); + ("sched_priority: Invalid computed priority %u: " + "Should be between %u and %u (PRI_MIN_BATCH: %u; " + "Window size (ticks): %u, runtime (shifted ticks): %u," + "(unshifted ticks): %u => CPU pri off: %u; " + "Nice: %d => nice pri off: %u)", + pri, PRI_MIN_BATCH, PRI_MAX_BATCH, PRI_MIN_BATCH, + len, run, run_unshifted, cpu_pri_off, nice, nice_pri_off)); } sched_user_prio(td, pri); @@ -1877,8 +1895,8 @@ schedinit(void) * Set up the scheduler specific parts of thread0. */ ts0 = td_get_sched(&thread0); - ts0->ts_ltick = ticks; - ts0->ts_ftick = ticks; + ts0->ts_ftick = (u_int)ticks; + ts0->ts_ltick = ts0->ts_ftick; ts0->ts_slice = 0; ts0->ts_cpu = curcpu; /* set valid CPU number */ } @@ -1917,30 +1935,56 @@ sched_rr_interval(void) } /* - * Update the percent cpu tracking information when it is requested or - * the total history exceeds the maximum. We keep a sliding history of - * tick counts that slowly decays. This is less precise than the 4BSD - * mechanism since it happens with less regular and frequent events. + * Update the percent cpu tracking information when it is requested or the total + * history exceeds the maximum. We keep a sliding history of tick counts that + * slowly decays, for running threads (see comments below for more details). + * This is less precise than the 4BSD mechanism since it happens with less + * regular and frequent events. */ static void sched_pctcpu_update(struct td_sched *ts, int run) { - int t = ticks; + const u_int t = (u_int)ticks; + u_int t_max = SCHED_TICK_MAX((u_int)hz); + u_int t_tgt = ((t_max << SCHED_TICK_SHIFT) * SCHED_CPU_DECAY_NUMER / + SCHED_CPU_DECAY_DENOM) >> SCHED_TICK_SHIFT; + const u_int lu_span = t - ts->ts_ltick; - /* - * The signed difference may be negative if the thread hasn't run for - * over half of the ticks rollover period. - */ - if ((u_int)(t - ts->ts_ltick) >= SCHED_TICK_TARG) { - ts->ts_ticks = 0; - ts->ts_ftick = t - SCHED_TICK_TARG; - } else if (t - ts->ts_ftick >= SCHED_TICK_MAX) { - ts->ts_ticks = (ts->ts_ticks / (ts->ts_ltick - ts->ts_ftick)) * - (ts->ts_ltick - (t - SCHED_TICK_TARG)); - ts->ts_ftick = t - SCHED_TICK_TARG; + if (lu_span >= t_tgt) { + /* + * Forget all previous ticks if we are more than t_tgt + * (currently, 10s) apart from the last update. Don't account + * for more than 't_tgt' ticks when running. + */ + ts->ts_ticks = run ? (t_tgt << SCHED_TICK_SHIFT) : 0; + ts->ts_ftick = t - t_tgt; + ts->ts_ltick = t; + return; + } + + if (t - ts->ts_ftick >= t_max) { + /* + * First reduce the existing ticks to proportionally occupy only + * what's left of the target window given 'lu_span' will occupy + * the rest. Since sched_clock() is called frequently on + * running threads, these threads have a small 'lu_span', and + * the next formula basically becomes an exponential decay with + * ratio r = SCHED_CPU_DECAY_NUMER / SCHED_CPU_DECAY_DENOM + * (currently, 10/11) and period 1s. However, a sleeping thread + * will see its accounted ticks drop linearly with a high slope + * with respect to 'lu_span', approaching 0 as 'lu_span' + * approaches 't_tgt' (so, continuously with respect to the + * previous case). This rescaling is completely dependent on + * the frequency of calls and the span since last update passed + * at each call. + */ + ts->ts_ticks = SCHED_TICK_RUN_SHIFTED(ts) / + SCHED_TICK_LENGTH(ts) * (t_tgt - lu_span); + ts->ts_ftick = t - t_tgt; } + if (run) - ts->ts_ticks += (t - ts->ts_ltick) << SCHED_TICK_SHIFT; + ts->ts_ticks += lu_span << SCHED_TICK_SHIFT; ts->ts_ltick = t; } @@ -2300,9 +2344,9 @@ sched_switch(struct thread *td, int flags) #ifdef SMP pickcpu = (td->td_flags & TDF_PICKCPU) != 0; if (pickcpu) - ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; + ts->ts_rltick = (u_int)ticks - affinity * MAX_CACHE_LEVELS; else - ts->ts_rltick = ticks; + ts->ts_rltick = (u_int)ticks; #endif td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && @@ -2658,7 +2702,7 @@ SCHED_STAT_DEFINE(ithread_preemptions, * Return time slice for a given thread. For ithreads this is * sched_slice. For other threads it is tdq_slice(tdq). */ -static inline int +static inline u_int td_slice(struct thread *td, struct tdq *tdq) { if (PRI_BASE(td->td_pri_class) == PRI_ITHD) @@ -2943,22 +2987,18 @@ sched_rem(struct thread *td) fixpt_t sched_pctcpu(struct thread *td) { - fixpt_t pctcpu; struct td_sched *ts; - - pctcpu = 0; - ts = td_get_sched(td); + u_int len; + fixpt_t pctcpu; THREAD_LOCK_ASSERT(td, MA_OWNED); + ts = td_get_sched(td); sched_pctcpu_update(ts, TD_IS_RUNNING(td)); - if (ts->ts_ticks) { - int rtick; - - /* How many rtick per second ? */ - rtick = min(SCHED_TICK_HZ(ts) / SCHED_TICK_SECS, hz); - pctcpu = (FSCALE * ((FSCALE * rtick)/hz)) >> FSHIFT; - } - + len = SCHED_TICK_LENGTH(ts); + pctcpu = ((FSHIFT >= SCHED_TICK_SHIFT ? /* Resolved at compile-time. */ + (SCHED_TICK_RUN_SHIFTED(ts) << (FSHIFT - SCHED_TICK_SHIFT)) : + (SCHED_TICK_RUN_SHIFTED(ts) >> (SCHED_TICK_SHIFT - FSHIFT))) + + len / 2) / len; return (pctcpu); } From nobody Mon Jul 28 13:31:34 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 4brKBb6ZF4z634tT; Mon, 28 Jul 2025 13:31:35 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBb15x3z3v3N; Mon, 28 Jul 2025 13:31:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709495; 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=qOXScGu6IAeyx8YYvli+1mCWKu3MNoBCH/AdyUof4bA=; b=rjNDqUFHw9iJumtTj0mRCBNmqz7siTpG2N4ltQ8zNvoD3SZkZkolSHmItxN7O8voic9SeY EXZo0GZNQqRYZL3pbPvgz0iHfMNLKGIzhboNsO0KxzzMplQ1b8Qfna2o6Lh4TyqvknadS4 +aWfhXmQ78NrEiyHZxR2pBzMARU8nDrVLorw9U9zWlo1lZz/ob9TkVT2yQZwRiS1hmp6JG XXuRvZkdPdUbdjOLdALzRriWa1t6jQOnPgUIjmUcXzvBC5iZ3Vq5Z86YXlOWGcZQ49EB/o L4Q1CnOIMvPsHXt3kTNxynpknhRkNlfUC6NyYT/ngWEEppov4FoB9SkgkOgkyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709495; 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=qOXScGu6IAeyx8YYvli+1mCWKu3MNoBCH/AdyUof4bA=; b=JyPQ3Ar9BfLuD5cNTsbEcOCIQNAOZnDdHGCuWUqwjQVRsggtLYr2eMuGSEtUoPGkIFM4Hf 6V2JG1DEnGgUFfEL0kFBXNMnob/Kr9dLRWvQ8f8c5OGVHVGiL3lQhM3I/4cclCtvFVKh0Q PFJflRNpZ9LC49JW0ox7rovh9gnOtZ30A/uwGmMhaJp/xY3L5paBrsuKz2ODPK7gjjgvHX OPjx0D+CEg9XWaaDXpBkH4tLW+6oIh4KXHrUV8WLjKcRfkj3AYhECkI9p7uJWppgbWDhmF Mng5Jn7OeTUTgx+GYUmIj6OJN9j3gKbXURFAaue1tmvz5Kh1CIZSymXiq5QeQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709495; a=rsa-sha256; cv=none; b=gm1Jj5nYb8WvlQ1vUcxh/mHTk0wmUtY/gvqCCKkBdw8+ALg9nb27xxOaWjbflhCNMATE5j yfIcwYFjZRFBPEia9XDVcBpwvaR0VxBllYDgjUc+iaGnNcjGTKcwBH+nSppYaNubyFj2jj 6TdJZcVx/9c69+YjaAvdp5KSKFQdCLr2nnSCc58GkHC9oQlM3ONTPw2emmsj4Segz9cEq+ RwEmVm6je/HK/YMguI1JQEVLXZE9jz8zzffkK4A4cO99tuE3YgHYQ/jd2bRJj92erJOtVV QKRFCM1ZXnybVoQrr/Q1Pcf6fDqF4LRI+xFQOhCtwXbM0i9CuzXCgin6S3SctQ== 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 4brKBb0RK7znfV; Mon, 28 Jul 2025 13:31:35 +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 56SDVYlH082013; Mon, 28 Jul 2025 13:31:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVY1Z082010; Mon, 28 Jul 2025 13:31:34 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:34 GMT Message-Id: <202507281331.56SDVY1Z082010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c1ca55eb93fd - stable/14 - sched_ule: Recover previous nice and anti-starvation behaviors 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c1ca55eb93fd3ce9624258ce73d2ecec06d2d9c3 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c1ca55eb93fd3ce9624258ce73d2ecec06d2d9c3 commit c1ca55eb93fd3ce9624258ce73d2ecec06d2d9c3 Author: Olivier Certner AuthorDate: 2024-06-17 19:34:14 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:39 +0000 sched_ule: Recover previous nice and anti-starvation behaviors Justification for this change is to avoid disturbing ULE's behavior too much at this time. We however acknowledge that the effect of "nice" values is extremely weak and will most probably change it going forward. Tuning allows to mostly recover ULE's behavior prior to the switch to a single 256-queue runqueue and the increase of the timesharing priority levels' range. After this change, in a series of test involving two long-running processes with varying nice values competing for the same CPU, we observe that used CPU time ratios of the highest priority process to change by at most 1.15% and on average by 0.46% (absolute differences). In relative differences, they change by at most 2% and on average by 0.78%. In order to preserve these ratios, as the number of priority levels alloted to timesharing have been raised from 136 to 168 (and the subsets of them dedicated to either interactive or batch threads scaled accordingly), we keep the ratio of levels reserved to handle nice values to those reserved for CPU usage by applying a factor of 5/4 (which is close to 168/136). Time-based advance of the timesharing circular queue's head is ULE's main fairness and anti-starvation mechanism. The higher number of queues subject to the timesharing scheduling policy is now compensated by allowing a greater increment of the head offset per tick. Because there are now 109 queue levels dedicated to the timesharing scheduling policy (in contrast with the 168 levels alloted to timesharing levels, which include the former but also those dedicated to threads considered interactive) whereas there previously were 64 ones (priorities spread into a single, separate runqueue), we advance the circular queue's head 7/4 faster (a ratio close to 109/64). While here, take into account 'cnt' as the number of ticks when advancing the circular queue's head. This fix depends on the other code changes enabling incrementation by more than one. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46566 (cherry picked from commit 6792f3411f6d99e1698589835adbf6b7b51c7c74) --- sys/kern/sched_ule.c | 76 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 29a4bfef3ea2..8cd58cd32605 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -137,20 +137,20 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= * and end of the MIN to MAX timeshare range are only reachable with negative * or positive nice respectively. * - * PRI_RANGE: Priority range for utilization dependent priorities. - * PRI_NRESV: Number of nice values. + * PRI_NRESV: Number of priority levels reserved to account for nice values. + * 5/4 is to preserve historical nice effect on computation ratios. + * PRI_RANGE: Length of range for priorities computed from CPU use. * PRI_TICKS: Compute a priority in PRI_RANGE from the ticks count and total. * PRI_NICE: Determines the part of the priority inherited from nice. */ -#define SCHED_PRI_NRESV (PRIO_MAX - PRIO_MIN) -#define SCHED_PRI_NHALF (SCHED_PRI_NRESV / 2) -#define SCHED_PRI_MIN (PRI_MIN_BATCH + SCHED_PRI_NHALF) -#define SCHED_PRI_MAX (PRI_MAX_BATCH - SCHED_PRI_NHALF) +#define SCHED_PRI_NRESV ((PRIO_MAX - PRIO_MIN) * 5 / 4) +#define SCHED_PRI_MIN (PRI_MIN_BATCH + (SCHED_PRI_NRESV / 2)) +#define SCHED_PRI_MAX (PRI_MAX_BATCH - (SCHED_PRI_NRESV / 2)) #define SCHED_PRI_RANGE (SCHED_PRI_MAX - SCHED_PRI_MIN + 1) #define SCHED_PRI_TICKS(ts) \ (SCHED_TICK_HZ((ts)) / \ (roundup(SCHED_TICK_TOTAL((ts)), SCHED_PRI_RANGE) / SCHED_PRI_RANGE)) -#define SCHED_PRI_NICE(nice) (nice) +#define SCHED_PRI_NICE(nice) ((nice) * 5 / 4) /* * Runqueue indices for the implemented scheduling policies' priority bounds. @@ -279,6 +279,11 @@ struct tdq { u_char tdq_owepreempt; /* (f) Remote preemption pending. */ u_char tdq_ts_off; /* (t) TS insertion offset. */ u_char tdq_ts_deq_off; /* (t) TS dequeue offset. */ + /* + * (t) Number of (stathz) ticks since last offset incrementation + * correction. + */ + u_char tdq_ts_ticks; int tdq_id; /* (c) cpuid. */ struct runq tdq_runq; /* (t) Run queue. */ char tdq_name[TDQ_NAME_LEN]; @@ -362,6 +367,7 @@ static void tdq_setup(struct tdq *, int i); static void tdq_load_add(struct tdq *, struct thread *); static void tdq_load_rem(struct tdq *, struct thread *); static inline void tdq_runq_add(struct tdq *, struct thread *, int); +static inline void tdq_advance_ts_deq_off(struct tdq *, bool); static inline void tdq_runq_rem(struct tdq *, struct thread *); static inline int sched_shouldpreempt(int, int, int); static void tdq_print(int cpu); @@ -557,6 +563,33 @@ tdq_runq_add(struct tdq *tdq, struct thread *td, int flags) runq_add(&tdq->tdq_runq, td, flags); } +/* + * Advance the timesharing dequeue offset to the next non-empty queue or the + * insertion offset, whichever is closer. + * + * If 'deq_queue_known_empty' is true, then the queue where timesharing threads + * are currently removed for execution (pointed to by 'tdq_ts_deq_off') is + * assumed empty. Otherwise, this condition is checked for. + */ +static inline void +tdq_advance_ts_deq_off(struct tdq *tdq, bool deq_queue_known_empty) +{ + /* + * We chose a simple iterative algorithm since the difference between + * offsets is small in practice (see sched_clock()). + */ + while (tdq->tdq_ts_deq_off != tdq->tdq_ts_off) { + if (deq_queue_known_empty) + deq_queue_known_empty = false; + else if (!runq_is_queue_empty(&tdq->tdq_runq, + tdq->tdq_ts_deq_off + RQ_TS_POL_MIN)) + break; + + tdq->tdq_ts_deq_off = (tdq->tdq_ts_deq_off + 1) % + RQ_TS_POL_MODULO; + } +} + /* * Remove a thread from a run-queue. This typically happens when a thread * is selected to run. Running threads are not on the queue and the @@ -579,14 +612,13 @@ tdq_runq_rem(struct tdq *tdq, struct thread *td) /* * If thread has a batch priority and the queue from which it was * removed is now empty, advance the batch's queue removal index if it - * lags with respect to the batch's queue insertion index. + * lags with respect to the batch's queue insertion index, so that we + * may eventually be able to advance the latter in sched_clock(). */ - if (queue_empty && PRI_MIN_BATCH <= td->td_priority && - td->td_priority <= PRI_MAX_BATCH && - tdq->tdq_ts_off != tdq->tdq_ts_deq_off && + if (PRI_MIN_BATCH <= td->td_priority && + td->td_priority <= PRI_MAX_BATCH && queue_empty && tdq->tdq_ts_deq_off + RQ_TS_POL_MIN == td->td_rqindex) - tdq->tdq_ts_deq_off = (tdq->tdq_ts_deq_off + 1) % - RQ_TS_POL_MODULO; + tdq_advance_ts_deq_off(tdq, true); } /* @@ -2667,13 +2699,21 @@ sched_clock(struct thread *td, int cnt) /* * Advance the insert offset once for each tick to ensure that all - * threads get a chance to run. + * threads get a chance to run. In order not to change too much ULE's + * anti-starvation and "nice" behaviors after the switch to a single + * 256-queue runqueue, since the queue insert offset is incremented by + * 1 at every tick (provided the system is not too loaded) and there are + * now 109 distinct levels for the timesharing selection policy instead + * of 64 before (separate runqueue), we apply a factor 7/4 when + * increasing the insert offset, by incrementing it by 2 instead of + * 1 except for one in four ticks. */ if (tdq->tdq_ts_off == tdq->tdq_ts_deq_off) { - tdq->tdq_ts_off = (tdq->tdq_ts_off + 1) % RQ_TS_POL_MODULO; - if (runq_is_queue_empty(&tdq->tdq_runq, - tdq->tdq_ts_deq_off + RQ_TS_POL_MIN)) - tdq->tdq_ts_deq_off = tdq->tdq_ts_off; + tdq->tdq_ts_ticks += cnt; + tdq->tdq_ts_off = (tdq->tdq_ts_off + 2 * cnt - + tdq-> tdq_ts_ticks / 4) % RQ_TS_POL_MODULO; + tdq->tdq_ts_ticks %= 4; + tdq_advance_ts_deq_off(tdq, false); } ts = td_get_sched(td); sched_pctcpu_update(ts, 1); From nobody Mon Jul 28 13:31:37 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 4brKBd54jmz634tW; Mon, 28 Jul 2025 13:31:37 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBd2T3Xz3vCZ; Mon, 28 Jul 2025 13:31:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709497; 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=5gqMLXgc6/ZYYe1kva//6WBrQ3a7Oq/CSgNgn5Eu4AE=; b=alc2upukvwzINyhlxnd++4qHc4WG20y9kQCu38ERWGQSZjHjDM6biWL2TYmwiUQhIPmY3i 2JS3pRcd11MEdx49FftFkMlU4e3XvzUhzZzBmwSON2fvDaKD9RBZgtwJSd+SEbGfPREGZH rixF8AeDOW/pOH/J3p//pupNz913Gsv5x4OAnE/MOZJGb43VmWmseOJYeTpOy1sY2D2EaP IhRQnLnFxyi0IvKeers8zJQisECZm0eubGRZNdGMvTiqIuELkwCkb1V7lz4zT3+Fmh8PVU kW7LWkKbS23FdcbRFVADyCi7LnPxRIJXRENBtqZIGqTsJM99NEMb6zfd5hJmng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709497; 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=5gqMLXgc6/ZYYe1kva//6WBrQ3a7Oq/CSgNgn5Eu4AE=; b=d2nKZa4I810ywOYXRXG78V8yq/crEpjVKvQ7xoc/5VFjQjy+oOMVzkjxUbae+KqUOPDDUo R4gOB8VPyRun/fxK4MmQf3GxgB/7X/ByfiiglfncS5UjQL0L7PBknymEqSHS04Dca3Skvf j/qC66I77HpjEk1SYcvUghwLSEHVKnfqDqdXDkQWiKZUpSN8MKF88IKdhrxEK/QN6URdWK wUHOTwWuSH12xwmlFRTCNGq8EuekQ7PWSRoRC2itlg3XsnavV21CpY3nqfvJ+vXEfPJPft zO7jM2hE39kUl6WXFx9IaBddwLfKu0HUG88+5CKToM9dRCf4JQbuLFii2siX0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709497; a=rsa-sha256; cv=none; b=DtAMpMa5j9K6F6IVuP8aBCBvcMeVyqRHqxoC7hxYDEZYgNtgOuEdE8dMA1aEbTY8tZiWo1 0wKQvd5LTBM7QOdSn2QtA8iTHpK03ivKWgaIRgA3W+/cjXzsoWvCyse+ia51Qptb5xHMmF ZWlB7kVQzJK94zlLRHocbyGOZokPPSylG0boHFszJJxDpCHCxv4REeJ7Ac5XWKinWYv3fo WGEoF3aLR5MzmQEz9F2RKEdnoLpcAW9h7GDVr6ev4DFFI3SXA0n5rBPFlBjOvqnB3Id79q byQMp8HG4lK3Gv/cPNTEukpzef81hzhN5PlOpP5JYWb4UucXgrpFzyp0dx59hg== 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 4brKBd241mzns0; Mon, 28 Jul 2025 13:31:37 +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 56SDVbSc082084; Mon, 28 Jul 2025 13:31:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVb9j082081; Mon, 28 Jul 2025 13:31:37 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:37 GMT Message-Id: <202507281331.56SDVb9j082081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 32766dde5bc3 - stable/14 - sched_4bsd: Move ESTCPULIM() after its macro dependencies 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 32766dde5bc35b4fd47550fb6cdf2ff745528773 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=32766dde5bc35b4fd47550fb6cdf2ff745528773 commit 32766dde5bc35b4fd47550fb6cdf2ff745528773 Author: Olivier Certner AuthorDate: 2024-05-21 11:59:40 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:41 +0000 sched_4bsd: Move ESTCPULIM() after its macro dependencies No functional change (intended). Also makes the comment about INVERSE_ESTCPU_WEIGHT() adjacent to its definition. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45392 (cherry picked from commit a454ff6b0440ec1a8e6b5c8154ad22c32df13c51) --- sys/kern/sched_4bsd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index c204e4a5676e..4cf5ec054d1c 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -73,15 +73,15 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in * the range 100-256 Hz (approximately). */ -#define ESTCPULIM(e) \ - min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \ - RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1) #ifdef SMP #define INVERSE_ESTCPU_WEIGHT (8 * smp_cpus) #else #define INVERSE_ESTCPU_WEIGHT 8 /* 1 / (priorities per estcpu level). */ #endif #define NICE_WEIGHT 1 /* Priorities per nice level. */ +#define ESTCPULIM(e) \ + min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \ + RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1) #define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX))) From nobody Mon Jul 28 13:31:39 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 4brKBh12Ksz634YN; Mon, 28 Jul 2025 13:31:40 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBg4SJtz3v9C; Mon, 28 Jul 2025 13:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709499; 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=+pCPf7vwCdUicqC9sqp1uNqpNNgWKMuVCYo89bHZHtk=; b=L5eKWi/DPhAeFnp3aPPM6FIDcVoB1jjtmi7s5bHvGJX9KaaB0j3r9Xy8yTe85QOqTU/dga JSzwhahiuTyndYheHKQue9M9kSpVMe+tnASpX0eDBKLAJnCuJYVG2rhoG9tfXJtlD05uSg 30WR9+goP5bPYAtp6bmpVP84JdOkglzGJeJ2ZQWJj9qC8o/f5Qa0NQTGaUtnbG542cxQU1 FcCVZMH7rj7Z1yd1JrhuhlUbZa5Pg4jd9+m+osGuxyWQ1QzOym/d6/7F9mNZlaqdwf6X/H lVVZ2M2qjuH/eP2oefiyWffhESHWoBnA8zcpW12x3841WsbALHhGupgxPV+Cow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709499; 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=+pCPf7vwCdUicqC9sqp1uNqpNNgWKMuVCYo89bHZHtk=; b=oELLIFOE1SVr8GJc3JPROvkVRneNygI2ja/MUezdCXLlYtZT4mJl5i1g2dkM+gyDXisGIr b4cIbHJXjOHp6KLYgfZT1qTemG4T7RGRanZqHsX+NO+0Lowq81YpTqUBFh0QPf5zJn0wHP LZgSr7NcBe+u8N+hp7tNXN+5SUkPVF2DbSqa7wtTHWUW2hmeClw3fgf69mlKqm5iG9vcuU ShkICoA6QsGyUqj/IVyzO1oGckgrQx7hHn3c5ERX0++u+3QcOZgoAZyoNHPUazFdDRZvMF w2lGsEh32ROeL0pqWm0kUSM2oNLby9EU6SxO3D1OB0xMBklEvbFx9Jc1r+D6gQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709499; a=rsa-sha256; cv=none; b=CaGu2QdMFetXTfWVgz7yt95iXWUdzXQlqISXsiGUdqSaa9Lf6waFt+crJi0ZGODHRGudnC ExkAvJTSrc1jdCoNNFr4CAucEdnQ0KncUhljyuCJwKOT14SPmsvd+A5SQDxtis8gphPqE8 0/FndzrmCg+u1B1ozGsKKxLvWokObLno9YrVIgCkzhwKnSOIBFBf+DRCFmIbgSKzdMj6mJ 471VzGe6YPVR9xXKbzyjqe0ZK9YR8IXEVkMObYak5ON+klV0HSJ570N+goIdC4agewbpL7 HmZNHQLiaZ5xMKHvNyuE85U/1azJq4DQ8UI3adXAPxvxdR+TszOLYQDaK3RhKw== 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 4brKBg3xkBznCZ; Mon, 28 Jul 2025 13:31:39 +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 56SDVdjY082155; Mon, 28 Jul 2025 13:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVdpS082151; Mon, 28 Jul 2025 13:31:39 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:39 GMT Message-Id: <202507281331.56SDVdpS082151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: cc604213b597 - stable/14 - sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cc604213b59777b33c413e2d2c70f63d4c3665bf Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=cc604213b59777b33c413e2d2c70f63d4c3665bf commit cc604213b59777b33c413e2d2c70f63d4c3665bf Author: Olivier Certner AuthorDate: 2024-05-21 12:55:43 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:42 +0000 sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range The current formula wastes queues and degrades usage estimation precision, since any increase of ticks that goes over 40 priorities (so, 8 * 40) is clamped to the last of these 40 levels (the nice value is subsequently added to that number to get the final priority level). Allow 'ts_estcpu' to grow up to a value corresponding to the greatest (i.e., lowest) priority of the timeshare range. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45392 (cherry picked from commit eebc148f25c3012b943083b48fbfc13494e9c77f) --- sys/kern/sched_4bsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index e9d180fde303..0e7ac9feb686 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -80,7 +80,9 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif #define NICE_WEIGHT 1 /* Priorities per nice level. */ #define ESTCPULIM(e) \ - min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN)) \ + min((e), INVERSE_ESTCPU_WEIGHT * \ + (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) + \ + PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) \ + INVERSE_ESTCPU_WEIGHT - 1) #define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX))) From nobody Mon Jul 28 13:31:38 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 4brKBf6McDz63541; Mon, 28 Jul 2025 13:31:38 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBf3cZVz3v75; Mon, 28 Jul 2025 13:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709498; 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=6BkqmxBofOA+kEOA4TF5UwQhMQFV2W+WCGDSo9aNPuQ=; b=uaVM4t7HQIVgC9UQIQTThvuwY59jokwqfODkfapKjPkCVU9NIh8DoR2EUedD6EduJbMHpz hOa9x9C5tbRKdyiqzOywNA6wdBk2LB/L28rcfhjViBmjOJR0y5PWCbNZaDnGn6Y+GJULci 0FUGNWlICjYMHvFMwckar5hqL9ykm/CEkvP/CW9VtsuVH+z2qLgQ9U17BC2IkMoXtdLON8 NfjZGZjXxst5SSQx7tuBM+AkuoS76BPRcsHr3PDjaO75k8oVUtvQalsmZeu9p+SHZWNutG J1h99ECsQdO4+3fumwDjonvV+E3m9suBGCu3MnfllHmc58Nhf/LMX2M/XeZDtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709498; 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=6BkqmxBofOA+kEOA4TF5UwQhMQFV2W+WCGDSo9aNPuQ=; b=J8qbVLrVQk8CWaJ2tu1JIZfMpDT/ocJnddIMaGGxrfcJWGaLf5hByqQY+HQXngo3VP6fvT BaoLk4vKOo6azhHuvobOSSGOCXbMhVTrCxQCwzlgWbymKPmRD+7ajnie/vuAdD257qvdtR ku81mG7SsLRjdm60n0pXCRZfebG1fh67GRxkfRYge+yCLxepSaOVOm7mqi7kqyeZTFiKec oNYfZ51t2OFPSTMbL//o0DBequYXz8osawFOAeq3FCIAa6auQEFaWQhTMd7kcPq62+FApU 5nA9HB8DPyKTvJl3PIWp7qecX9dzOLVWpcdpE3C657piFUmPA7LC6evpX7DeFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709498; a=rsa-sha256; cv=none; b=wBqWhE2OyNnxrpNMpJUT0yOC3y6Cw2MrPPASDUA5qhegA5caWu7S0nSsctsAWQIUyp2L8+ 2u9xIXqMZotoRF5tuRc6xxlLMNAyR63TAnmcva1jSMXLcVQpOvsnGMKEZifKd64xyE/MAV A3GE++KpP0IEvAY0wKMYzbfZ8fgQHyiV22hocvYXI4zNwb1KgQSWtivicgdoJKWz7s5dzX Oahlq3bFX5aZIpuwRW4craTW49nrCFBG6haDL/+Cidl5S7e3xqCO1OFl3TT+yuMlHX0mR4 pNMNzgBCq26L5LOVpGI+VHDXBJUEg0RjwVH1TmXTLmYoaKJhpG5Y7zulg96ySw== 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 4brKBf303Rzng3; Mon, 28 Jul 2025 13:31:38 +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 56SDVcGI082118; Mon, 28 Jul 2025 13:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVcLj082115; Mon, 28 Jul 2025 13:31:38 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:38 GMT Message-Id: <202507281331.56SDVcLj082115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 00c1b4fac2ab - stable/14 - sched_4bsd: Remove RQ_PPQ from ESTCPULIM()'s formula 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 00c1b4fac2ab709b0e0c77007d47c85e0bf36095 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=00c1b4fac2ab709b0e0c77007d47c85e0bf36095 commit 00c1b4fac2ab709b0e0c77007d47c85e0bf36095 Author: Olivier Certner AuthorDate: 2024-05-21 12:26:25 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:42 +0000 sched_4bsd: Remove RQ_PPQ from ESTCPULIM()'s formula Substracting RQ_PPQ to the maximum number of allowed priority values (the factor to INVERSE_ESTCPU_WEIGHT) has the effect of pessimizing the number of processes assigned to the last priority bucket. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45392 (cherry picked from commit 51a4ae05abe6e170de0ff82641d8fce19043eea9) --- sys/kern/sched_4bsd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 4cf5ec054d1c..e9d180fde303 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -79,9 +79,9 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #define INVERSE_ESTCPU_WEIGHT 8 /* 1 / (priorities per estcpu level). */ #endif #define NICE_WEIGHT 1 /* Priorities per nice level. */ -#define ESTCPULIM(e) \ - min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \ - RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1) +#define ESTCPULIM(e) \ + min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN)) \ + + INVERSE_ESTCPU_WEIGHT - 1) #define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX))) From nobody Mon Jul 28 13:31:42 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 4brKBm1nq1z63545; Mon, 28 Jul 2025 13:31:44 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBk6mDQz3vgD; Mon, 28 Jul 2025 13:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709502; 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=/8brrLhrjlEyCwsigEwrTiLBUlYOiqnHq2LPsz1+OtQ=; b=TTSVX8ZZMY9mHsUQmmvusaBKcuZMPesMotTKeUEP1HMkl2B9PR6rSHwwYbt1tzVha2ppex Z7PKD5JfSrRP0r5vsIglrZ0z+VA9/gwSsO9gGwmZZnITbX4XAliXsOlwUiESzu26345jnJ hMm4IpTEHrlcwIp7L0X3p8vaS9Lc844N0AvYg+Qd89j4ykYb/qOdUcdwUEtNaQwBz5TqIK rQdCNEb0JObqb0cmxNqj2eY3g9wYM2jlYX6NkPAZt02vqwXiFcX6JHKY27Md1Oom+6eQPM zRgsDLT/Zx5uAE21foGok4xbDnWCYjMLJXU2V32U+kg0SfJWTMq1v+eUPJRJfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709502; 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=/8brrLhrjlEyCwsigEwrTiLBUlYOiqnHq2LPsz1+OtQ=; b=aoPlj2qvCN3Xqa+giTK4a5naxyfyDhSMwcFXfFhvFVangjZW58VOFfzdWl7KltStjvQuoD R2m60XumbLlTbQABFcHHnxl3usgVwYaculctNyw2WtjtQ/x8Q1wBSWc88pEqAJZUtZidhR f6ZzJ7HRTUFiCfgy7dAyRYh8+ynryPAwHhuyfADMeQtcxaPd/TXZmOJQLs2BjveOUt7UZP 75y5H8xOgo5l2fxcEzs95VzRbXAj5vL9qzpbyNH/MigyNANGIp3ivGjs1ePARE102clIwV 5y9JMe9vEAhJYmT9LY4In1R7b4b5UdwZzHkWYULOBmv6Aahn4bdCzNDEsnmtrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709502; a=rsa-sha256; cv=none; b=MSMRsRXHxWqVpLntPSIhud7ONpL7YB89xC6O8qAXpcIzpTHhi/9aE44U4wVWwYFejJZSBd ypV1vTd5mg10z/wcOu44pg2v9yK/xWcmyVd6qylF3Jf+kkWwVNB7Ie55cLvsYDdgWLYBoI RleNKEXeHBocVniv8umQwsb9zgoMBZF8WtnUEH63lPdvfDMsLqxh/4IevS8bRY/u/YY+Qb 1BQG5eQQoXVcNtaxgokfZLev9LPOHP9LKDLTdpvegq3AzZakAFfJpiHZDzCtrXt7IJLgc7 w3HXFFWrGfGCIDtRZR/DQnCKx65dvsdDt61XjDDKzsNLvk86n1r6l3KVfhMTQg== 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 4brKBk69zZznRY; Mon, 28 Jul 2025 13:31:42 +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 56SDVgAt082263; Mon, 28 Jul 2025 13:31:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVgXX082260; Mon, 28 Jul 2025 13:31:42 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:42 GMT Message-Id: <202507281331.56SDVgXX082260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 8a59ea47d92c - stable/14 - sched_ule: 32-bit platforms: Fix runq_print() after runq changes 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8a59ea47d92c3c4b6dca61a3c21346ae34b30b61 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8a59ea47d92c3c4b6dca61a3c21346ae34b30b61 commit 8a59ea47d92c3c4b6dca61a3c21346ae34b30b61 Author: Olivier Certner AuthorDate: 2025-06-18 15:15:18 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:44 +0000 sched_ule: 32-bit platforms: Fix runq_print() after runq changes The compiler would report a mismatch between the format and the actual type of the runqueue status word because the latter is now unconditionally defined as an 'unsigned long' (which has the "natural" platform size) and the format expects a 'size_t', which expands to an 'unsigned int' on 32-bit platforms (although they are both of the same actual size). This worked before as the C type used depended on the architecture and was set to 'uint32_t' aka 'unsigned int' on these 32-bit platforms. Just fix the format (use 'l'). While here, remove outputting '0x' by hand, instead relying on '#' (only difference is for 0, and is fine). runq_print() should be moved out of 'sched_ule.c' in a subsequent commit. Reported by: Jenkins Fixes: 79d8a99ee583 ("runq: Deduce most parameters, remove machine headers") MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit 013c58ced6aef26bad7ca5c6eb829b9d586f6edb) --- sys/kern/sched_ule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index b09d6dfc0f54..f59b7195f754 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -444,7 +444,7 @@ runq_print(struct runq *rq) int i; for (i = 0; i < RQSW_NB; i++) { - printf("\t\trunq bits %d 0x%zx\n", + printf("\t\trunq bits %d %#lx\n", i, rq->rq_status.rq_sw[i]); for (j = 0; j < RQSW_BPW; j++) if (rq->rq_status.rq_sw[i] & (1ul << j)) { From nobody Mon Jul 28 13:31:41 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 4brKBk6KPpz634r8; Mon, 28 Jul 2025 13:31:42 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBj6fvxz3vg3; Mon, 28 Jul 2025 13:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709501; 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=9n12SPK85hdxLnZXNdRTLsM9bltvG2YJKx171AARQec=; b=LcUtZZ0fX02B5i9XwgyLVRaI5zHLfiS34EhvprlpNiWux+FwLspjqg5l+18c3uu4s5p0dK 1+C4ohO2ocPTzfP1p5O+CF6/+Us4Ri836tKc32D8Ri+PSzPfo16QaBrFrXfpri4FROcstG 6E+Tt1Zm11LDmbCxiZYC9ByDgnKDSYAGWXpAN7n3Jq3/L15R0qXJI8PS7dIcB5orT+PDCa gFScunns4WeoGsQn3jVTne5f+152rgcubFW2/TqgQheRrn2SABujK5J97QnMOtNYKNDzan M9+oKsx2oLzoM8dr106o36Ultj75Ho36rbSEiaBZ6j8gh2LV3tteJGQoZbYmIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709501; 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=9n12SPK85hdxLnZXNdRTLsM9bltvG2YJKx171AARQec=; b=GIIec1ZFUG/V8PARPjQHVemXEhIZHxeGNWezRr2sRz+u812Ec83KjB644kGDserRaljbvg reTegdyDDhvI8OqjHPYjUnYN0YqzYjuZa11ufFhTZ2AjsWLFI0uVvzsrRU1MkcqSwkREP1 jArKLnBB6dvOsVICv9xgjfar+8sLN2eWSGEVunoCQBDjRZumPZlNEegP+SQv3JJPzxF8ti bUjzY6pulIg09HBxWZqLEsxGeTB7LGslCzJPaJ+gkei/sT1Rrl4Q2Xdg71AjxQ4uq1qi4D r2cKCU69g5qjdmYNS8JDlhxn1PTNhM9oUawdgbJwDg0uXOuvAYunDON9V3MGqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709501; a=rsa-sha256; cv=none; b=X3WaQuOhZyfbQAoS1nXd1BlDPUHR92T2EPBebEi2pLkRubReXrH0o/CztiZvhTXGunivwC O13TGXNl493PQ9GLs/11S8z8vrCg/XbQyITa3x5yO4VUbp5aoMyvc4GwU1JDam9VtcjlzY /6CZ9DHqFjvBYt74PmrVRJbqyVmkgoIVsZd2R0jC4c5JU05Q8bJKdpZb5napZetZILSx3d uiT/XyQue3poKUHRspZEgjzvuaFPDBuaihDkB/bs9C/N46D7lAUpuh3WPZ11xyqlSFYwNJ /7AjCMTtxcPV0p/ITndqd28MGb1WYpw4bzOE7cPu3bvmlbErOMwo5BO05Pyu5w== 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 4brKBj5Nn9zng5; Mon, 28 Jul 2025 13:31:41 +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 56SDVf1t082227; Mon, 28 Jul 2025 13:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVfSW082223; Mon, 28 Jul 2025 13:31:41 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:41 GMT Message-Id: <202507281331.56SDVfSW082223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 2b76d028605b - stable/14 - arm64: lib32: Don't try to install removed 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2b76d028605bf1f08ab9630f775fa29368737715 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=2b76d028605bf1f08ab9630f775fa29368737715 commit 2b76d028605bf1f08ab9630f775fa29368737715 Author: Olivier Certner AuthorDate: 2025-06-18 14:31:59 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:44 +0000 arm64: lib32: Don't try to install removed Reported by: Herbert J. Skuhra (herbert gojira.at) Fixes: 79d8a99ee583 ("runq: Deduce most parameters, remove machine headers") MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit 63c9b018069b58bacb2875c83c676cc8c4f40d69) --- include/arm/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/include/arm/Makefile b/include/arm/Makefile index 1f596763df77..27fa8dfb9de3 100644 --- a/include/arm/Makefile +++ b/include/arm/Makefile @@ -32,7 +32,6 @@ INCS= _align.h \ reg.h \ reloc.h \ resource.h \ - runq.h \ setjmp.h \ signal.h \ sysarch.h \ From nobody Mon Jul 28 13:31:40 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 4brKBj3NvHz634tc; Mon, 28 Jul 2025 13:31:41 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBh54MXz3vZ5; Mon, 28 Jul 2025 13:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709500; 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=/VB/DyxRJyRjSObxtuLseKFPwC7waoVmj27Z7IsTqFY=; b=ltdwZ3CCnlVWFrl8WUdRXOtm/UrkwPxoPfUU/4W1S4D1QqVB/PGKOK2uT4sV6jzouf942x aYVXjVp+i0dxNmigWLZIFo7daDJBK6nvkADZnVmCGzlSkBDhgAOoXdmfjNQ52omT5UJmCr vYB4yqWDjWdqZBeznSWOQX1Hm+UWCfem8fKyfJjR1JPO+Y0PdIvWowkZh3YF1nXF7WKJxW qnTxZ+yFhP0uBw+7a8OpYk0ix8WrTQJ+O9989MciJa7Cj36sea9BBf1DqQrkMu/Yrgxrwh X5HIZXijoD8hRset5pSW1LStGPAkVcyF2NmWi29EcV3+WAYqrVEME/zjaVLLIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709500; 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=/VB/DyxRJyRjSObxtuLseKFPwC7waoVmj27Z7IsTqFY=; b=JzrjU8q3itpZszZMe+dASbacrxa1ZFDSTO2DWI9qeBKhVMnCt9f+eB80ZnyQYc8S+3VRnH i4/DCmF0dXY+ZqZYjc50lBQx3raJLGpqonRQuHflcZazBOCumDko5BVguKqni33KjoujeS RfDLLz6n/uESq2QVervOWhK2PyeJXZfEIEHbjOSYI9JrczGhIs7rtBGw1VXx9rvsz0fyR8 GYgwO1pHBjOh30Bz0C53XZUT9tFngvldPOGWCR5RxeOZotzvfznk41PZr3yZDDDbZeuly2 SwDeBpaLQJXE5o4/L6uDh1adN2843NxgmxdLXRfqnzdT3R02wACzdKHOfAmWXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709500; a=rsa-sha256; cv=none; b=f64LSdDleeBCIndYk8WMxNT9VFp8Hx0N4VarMLL0pFQhU+6SqIR1Pa/AtRlTtDGJ1Du6nU CNAIDd75LXRS5o8JCUB5Zpk/6+CXcUTkipyoc4/p/c/yYccSLIN8bl7/NypHp4/u/TYrHO DbNGSjBXr8FVME0AUel/xCqVLKE8e1ITbdtD6MsjzsVYxHfI4TboM8cmHOeBuFMSU3Cva1 au/6cNcByTsva8e1ANd+kgzSNqiuPfU4jFPaFyD6AqXaFgDF+A2ekSEznV1+fc0sjrpJgl LzBskCcqRpWhhQwW7/AGypfZ+08eJWvnnf+RuHIRRR6jk+CyQtao6pRh2aMoxg== 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 4brKBh4b62znfZ; Mon, 28 Jul 2025 13:31:40 +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 56SDVe1w082192; Mon, 28 Jul 2025 13:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVeVc082189; Mon, 28 Jul 2025 13:31:40 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:40 GMT Message-Id: <202507281331.56SDVeVc082189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 193c695d7b07 - stable/14 - ps(1), top(1): Priority: Let 0 be the first timesharing level 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 193c695d7b071f901a60c971736b22c96565bd70 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=193c695d7b071f901a60c971736b22c96565bd70 commit 193c695d7b071f901a60c971736b22c96565bd70 Author: Olivier Certner AuthorDate: 2024-09-09 19:35:16 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:43 +0000 ps(1), top(1): Priority: Let 0 be the first timesharing level Change the origin from PZERO to PUSER. Doing so allows users to immediately detect if some thread is running under a high priority (kernel or realtime) or under a low one (timesharing or idle). MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit 1d8f8f3e36fafdb50613d042f5fa75d8cbcf2b8f) --- bin/ps/print.c | 2 +- usr.bin/top/machine.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ps/print.c b/bin/ps/print.c index c12a8dd8fbe1..5f5f7b23eaec 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -286,7 +286,7 @@ state(KINFO *k, VARENT *ve __unused) return (buf); } -#define scalepri(x) ((x) - PZERO) +#define scalepri(x) ((x) - PUSER) char * pri(KINFO *k, VARENT *ve __unused) diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 07a7119ad0c2..8c035b5df383 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1134,7 +1134,7 @@ format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags sbuf_printf(procbuf, " "); } - sbuf_printf(procbuf, "%3d ", pp->ki_pri.pri_level - PZERO); + sbuf_printf(procbuf, "%3d ", pp->ki_pri.pri_level - PUSER); sbuf_printf(procbuf, "%4s", format_nice(pp)); sbuf_printf(procbuf, "%7s ", format_k(PROCSIZE(pp))); sbuf_printf(procbuf, "%6s ", format_k(pagetok(pp->ki_rssize))); From nobody Mon Jul 28 13:31:43 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 4brKBn49hFz634r9; Mon, 28 Jul 2025 13:31:45 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBm0XTKz3v2G; Mon, 28 Jul 2025 13:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709504; 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=GyeObK8ROMRbm4cF7YBX45jFqguqqE9z3RYCEV2rwtU=; b=VEyHv7UFOA+JKbReiz5wX4q8b5Bm9H2z5qaxtgNux4xsHOtqzreHzywS0Z+IQ/6RukHVFw Ox+gDdkHxe3CwR5qXYQ4j+guj6XnoLZWy1EsILIg0rHsHJCcGDMnW7fsgATOuF+4FrcJYj 3k0karZCEeBtJ/Y3PDJNKK7e6uUjhFwiuZLaCUAYse+ykUnOC7GLBxFFDXMf1um7uXXGHo Fd6z7ec9R0B6J+JyCts8twOAH7Up5xz/9ZpRb5OZE2jUKHPPZ543JvkRXW2uM8v/U73mNp kalupfJpkHiuPwuQWSSYGB2cL+RZcAQ6NHbZYunbd0eEz7mh6Rwsa3SBDocDVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709504; 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=GyeObK8ROMRbm4cF7YBX45jFqguqqE9z3RYCEV2rwtU=; b=HRptAn7WqQplfUhq/B0UlMlIwsppiV8AcJnikZ7YdLhiTlp88z91gr6w5av81rjFgeachZ o0p1EfH1E8yLHZgxUs3kHjH+C1/e/obke8TN8nPB6lgJ/OWvRNnNlR5lIVHikljr0ducNG HSM8f6ZkE8WXpVH7rWZvCE4JYOIZ0rAi7XsIHza8x/r/2yY4kRB75p9Q2wflUkBVyI3nAS vaGO11lf9sw1tmyVxIdF/Aji29oqAfV3KCEURTE+5K8xGWIIqKrU6150rO3nfQb6/x27JZ uCwFg6MPAcu/vvMEnFseuoqaDwU6dd9Y/J8/oVarwdR/O+sfmDiHvNXTguaezg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709504; a=rsa-sha256; cv=none; b=EjHLkW6lZ2FFeg35rUeAEjzlvy48yuJAPpm/RsB7tEbEXUHFtlOSZ+DUuetfiEySkaleWe ET7G38VDQvi3iUcP47vzCIWexLqjgJXJ+ob30KEoROtJu81p+NxMYNWpDoUKBQDR6Dqy2L XmOGucMRubb3wTAfVuXuBL8edLBayhLN0rsQNFOKi5h72p/v9MlGwySBf/+wwMrk0oD3l4 WUD/JGgo0OenGaIbf1z4KV6X6F6cwiKrmFpoes4MdLH3eTJ+HF8pW6bPkgL1DRWMceDYIr snsn5x8lRIlAy4LqMBiSRZ7J4/iAwyZhBO0a0IamdmRdk8IpNy9doAlUhhFo1A== 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 4brKBl6hRkznRb; Mon, 28 Jul 2025 13:31:43 +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 56SDVhiJ082296; Mon, 28 Jul 2025 13:31:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVhDL082293; Mon, 28 Jul 2025 13:31:43 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:43 GMT Message-Id: <202507281331.56SDVhDL082293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c7bb3ca85e5a - stable/14 - runq: Fix printing status word bits 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c7bb3ca85e5a8d7916fc2828aa2a47aebddb0294 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c7bb3ca85e5a8d7916fc2828aa2a47aebddb0294 commit c7bb3ca85e5a8d7916fc2828aa2a47aebddb0294 Author: Olivier Certner AuthorDate: 2025-06-20 02:26:28 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:46 +0000 runq: Fix printing status word bits 'rqsw_t' is 'unsigned long', strictly longer than integers on 64-bit platforms. While here, factor out the print format for a status word. Fixes: d2ac231616f0 ("Make the run queue parameters machine dependent...") MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit 3e5aeb20645fa0a67ce50d96c5136de14067a944) --- sys/kern/kern_switch.c | 11 ++++++++--- sys/sys/runq.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index bd0d987594ea..917f73682564 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -326,7 +326,9 @@ runq_sw_set_not_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp) rqsw_t old_sw __unused = *swp; *swp |= sw_bit; - CTR4(KTR_RUNQ, "runq_sw_set_not_empty: idx=%d sw_idx=%d bits=%#x->%#x", + CTR4(KTR_RUNQ, + "runq_sw_set_not_empty: idx=%d sw_idx=%d " + "bits=" RQSW_PRI "->" RQSW_PRI, idx, sw_idx, old_sw, *swp); return (0); } @@ -349,7 +351,9 @@ runq_sw_set_empty_op(int idx, int sw_idx, rqsw_t sw_bit, rqsw_t *swp) rqsw_t old_sw __unused = *swp; *swp &= ~sw_bit; - CTR4(KTR_RUNQ, "runq_sw_set_empty: idx=%d sw_idx=%d bits=%#x->%#x", + CTR4(KTR_RUNQ, + "runq_sw_set_empty: idx=%d sw_idx=%d " + "bits=" RQSW_PRI "->" RQSW_PRI, idx, sw_idx, old_sw, *swp); return (0); } @@ -525,7 +529,8 @@ last_mask: goto return_idx; return (-1); return_idx: - CTR4(KTR_RUNQ, "runq_findq: bits=%#x->%#x i=%d idx=%d", + CTR4(KTR_RUNQ, + "runq_findq: bits=" RQSW_PRI "->" RQSW_PRI " i=%d idx=%d", (*rqsw)[i], w, i, idx); return (idx); } diff --git a/sys/sys/runq.h b/sys/sys/runq.h index fb9b9908fe57..997c131b24b1 100644 --- a/sys/sys/runq.h +++ b/sys/sys/runq.h @@ -60,6 +60,7 @@ struct thread; typedef unsigned long rqsw_t; /* runq's status words type. */ #define RQSW_BPW (sizeof(rqsw_t) * NBBY) /* Bits per runq word. */ +#define RQSW_PRI "%#lx" /* printf() directive. */ /* Number of status words to cover RQ_NQS queues. */ #define RQSW_NB (howmany(RQ_NQS, RQSW_BPW)) From nobody Mon Jul 28 13:31:45 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 4brKBn74NMz63547; Mon, 28 Jul 2025 13:31:45 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBn1YVMz3vV9; Mon, 28 Jul 2025 13:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709505; 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=EY9Md8ZW/1aantgWMIe62+L+p1Do3u44r0neqYwedQU=; b=MLPBYBOntNtktAhW0pa3q0TxTPLIb/hNP9wdSJ9Ob+iL+JB6Cb+7wQKQyUpErxqy4FkMqi 3fT6uleLqCwXMc5X52OPjGOH78aaqpxQvNSv+Zwpls+1TCqJ7uJNrdTaV5AFZh3wLEphyC SCp+B7ZjVWMIddOr/YZlwpq132gGWm9gCR0ojC3G5ibdT6HZCJn6zZ39PGtmcjfiKFzjS9 F3Fl5B8I+WgV4r2v+aLoPp2PAUHYrRWeIFC/QAeJi8KImmUOcVX4rLMLGguDY0xDeixX28 hK8Hw6ry/jqNEpcqi+lRFE0eQ+jHOD/HoFuU7k57WRZLOdBbVc5jNj9aSC27ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709505; 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=EY9Md8ZW/1aantgWMIe62+L+p1Do3u44r0neqYwedQU=; b=XDQt/pDhnAqOqckFkkhesJvK6D7cYU5f9IHhRFa6mOf4Vo/RytT0BHNQjCV1BmvvjdY7dT wr4PkzuhkurS8Oq3HwEvAoFxuNXlKEdjxhEjgKylPAT1SxCLlMYUT9yB/Q9+P/VAP050Xv LUQCaSOeP6F/JR5biGVPKDbUmrhkPqTevUh+S9/pss9xDPr0RPQ1ObT1vRUKTD+ilpFAc4 AzCybYShyWpF939hLTvhGMZ4QYRL+s/9x4oELuXWnGmMzUIJKd/RqUs8KWTLPRTkNbyuJ8 nedIRBef6VZvfdVv1Uox4iK4UpNO5AxzW9DF+yvfEOKssxNZX5H7gpoJvw/fzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709505; a=rsa-sha256; cv=none; b=Mh/uAEvJT257VpNllWmQ+bqND3UxF2mdkdUQQ+0bPwMpZvo5uunuSekaLQ0Gi77EAifsvp Zpz+7wERF1LvluqYfORK2IHdP8HeJELOl8JlWgisttvl+UuqqX6i8s7UVE/iHUo0qV7ZHm 5h1vb7My3Lj1Cp9q98eywRljDIgjWWJx7ixmUDQiQBrVZicucESEumcpUkl2Zh4vdJX+GI 2F3ASxQ/2eBcvulFmyYmLrOVDWvgui5Bnf9ZyDGOq2OAmg6NNQAmbKTpeIuylqykPfR1Nc zEhLNY9EYbTy4GBA0+6ClFG0oDdlHng6fx7gVUd9NopK4IKEUQp9lNGTVRtp2A== 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 4brKBn0XGfznvN; Mon, 28 Jul 2025 13:31:45 +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 56SDVjfl082330; Mon, 28 Jul 2025 13:31:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVj5j082327; Mon, 28 Jul 2025 13:31:45 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:45 GMT Message-Id: <202507281331.56SDVj5j082327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 2d2e8ea9f286 - stable/14 - runq: runq_not_empty() to support racy lookups again 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2d2e8ea9f2866182ad1524b5b99564a46f92649f Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=2d2e8ea9f2866182ad1524b5b99564a46f92649f commit 2d2e8ea9f2866182ad1524b5b99564a46f92649f Author: Olivier Certner AuthorDate: 2025-06-20 02:36:09 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:47 +0000 runq: runq_not_empty() to support racy lookups again The 4BSD assumes that its sched_runnable(), which then calls runq_not_empty(), can be called racily (another CPU may be grabbing a thread from the global queue at the same time). This makes runq_not_empty() trip on an assertion in runq_find() detecting a mismatch between some bit in the status word and the state of the corresponding queue (empty/not empty). Re-implement runq_not_empty() in an independent and simpler way as an alternative to removing the assertion, which remains useful to detect races when removing or adding a thread in some runqueue. Fixes: 79f68322c892 ("runq: runq_check(): Re-implement on top of runq_findq()") MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit be8e84c2e9240110ce99bb8d14259073340e4ef6) --- sys/kern/kern_switch.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 917f73682564..42fee61a99a0 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -493,7 +493,7 @@ int runq_findq(struct runq *const rq, const int lvl_min, const int lvl_max, runq_pred_t *const pred, void *const pred_data) { - rqsw_t const (*const rqsw)[RQSW_NB] = &rq->rq_status.rq_sw; + const rqsw_t (*const rqsw)[RQSW_NB] = &rq->rq_status.rq_sw; rqsw_t w; int i, last, idx; @@ -568,20 +568,27 @@ runq_first_thread(struct runq *const rq) /* * Return true if there are some processes of any priority on the run queue, - * false otherwise. Has no side effects. + * false otherwise. Has no side effects. Supports racy lookups (required by + * 4BSD). */ bool runq_not_empty(struct runq *rq) { - struct thread *const td = runq_first_thread(rq); + const rqsw_t (*const rqsw)[RQSW_NB] = &rq->rq_status.rq_sw; + int sw_idx; - if (td != NULL) { - CTR2(KTR_RUNQ, "runq_not_empty: idx=%d, td=%p", - td->td_rqindex, td); - return (true); + for (sw_idx = 0; sw_idx < RQSW_NB; ++sw_idx) { + const rqsw_t w = (*rqsw)[sw_idx]; + + if (w != 0) { + CTR3(KTR_RUNQ, "runq_not_empty: not empty; " + "rq=%p, sw_idx=%d, bits=" RQSW_PRI, + rq, sw_idx, w); + return (true); + } } - CTR0(KTR_RUNQ, "runq_not_empty: empty"); + CTR1(KTR_RUNQ, "runq_not_empty: empty; rq=%p", rq); return (false); } From nobody Mon Jul 28 13:31:46 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 4brKBq2gVQz63549; Mon, 28 Jul 2025 13:31:47 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBp2Wsxz3vjk; Mon, 28 Jul 2025 13:31:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709506; 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=TrNLGMECsF5AuIgsBYAYy1YKndNpLbkyvnmpsBulIqE=; b=EsYHNWlRLdnFmgg2W8A0bV0OuYdAUdxz0dmK1aKnqmue2HoSar+ZJ9oRC4h5sRvgtZpueK Mt3TGkz3BpeZWvYl1l++NW3MAj4GrRugENv/EiEHNOmZG1oSxb2JT4f1AM0T+n5PcbVe9r K+8V7sBdv2L9Ks7KBFGOYKVwL6Bk4dHAQcg56xUapUSMd2BBtHQSIgtj+BoqrHcwdOat75 ioFnVr/8QPocjiEZOLnF+DzEG04ewjk6xMasAaVkFEDAcaBYh4VCNUxaLLYxnikjyjhK63 iMSMr30z5JMI+UAd7EIuJLplyehSObgH6lhcCZt+kprZJvcjTi3Gofw2za5ZPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709506; 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=TrNLGMECsF5AuIgsBYAYy1YKndNpLbkyvnmpsBulIqE=; b=QJ1qSKeU2czARPoPDoNAiEVfDIGPixxv2yuOuzG1WeR65lGZTVxuFYHggsC1D8lnae0clK 7V1fXOTOFAxHEgRrsEGXVn4YDmlj85B6BdVaeoEIE/lzdIm1QMqaPb9fq9ulDUD9K9TX7S GuHAXfoHaiZmmpzcJYteeZ2D8WRM8VM1cmHxpc5Jj/+6sfOiJ1PS/FQWuJC8ckqiZSlZeR EGo//ym0rsbl0ljAjnVaEYuUwkjCtQqjgkTT1dk6fWG0+A7D2lcAnGYNY+lw5NoOCRNZ7P mTClBn0P9qoSSuygOiyxj9bryDGkugLP1wOwYz6xh14tnCEPFOMWL2B7A96cNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709506; a=rsa-sha256; cv=none; b=K/JdtBWEI5lsNJPvVFyRrdy7fhZX4CQ2F1POGugsyXWy3D5sNnGCkwqvZiAPgVwAHIY+84 61B/nBgsuYON8fWCYcJMo2CJ9gTjv4vigF33sFsbSR3d2IWtAJVMQlsCBlp9BuOQ0thOW5 taN/l+DElasqOvlvYQ7frc6WtlCjnC9D5prpUbFU3Q99TFYsGhYwYjYyYEfaCb9b+wRdE+ nSvA9w1A1ygYDzYfFe7EKVVKp/lfHzl/hyUe3TarUsDmLQhf8rpMMqZHK6DVixUAgYcMj0 WWYVZ30PXtrkwclBRnX7QPdNYUYCNRNtAJda1WsMftHRNdzcFtIcyRvHa8vf5A== 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 4brKBp1sLrzngC; Mon, 28 Jul 2025 13:31:46 +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 56SDVk7V082369; Mon, 28 Jul 2025 13:31:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVkbe082366; Mon, 28 Jul 2025 13:31:46 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:46 GMT Message-Id: <202507281331.56SDVkbe082366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 38cf4580a449 - stable/14 - Obsoletefiles.inc: Add architecture-specific 'runq.h' headers 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 38cf4580a449a81805f2d45cc5b5f3a08685a36c Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=38cf4580a449a81805f2d45cc5b5f3a08685a36c commit 38cf4580a449a81805f2d45cc5b5f3a08685a36c Author: Olivier Certner AuthorDate: 2025-07-28 03:10:26 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:48 +0000 Obsoletefiles.inc: Add architecture-specific 'runq.h' headers These were removed in commit 2fefe2c88b31 ("runq: Deduce most parameters, remove machine headers"). MFC with: 2fefe2c88b31 ("runq: Deduce most parameters, remove machine headers") Sponsored by: The FreeBSD Foundation (cherry picked from commit 8a69eb88fa00bb0ce85439d91cfdbd71426ffd0e) --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index cecfc8c47a75..8edc2a281ae9 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20250728: Machine versions of 'runq.h' do not exist anymore +OLD_FILES+=usr/include/machine/runq.h + # 20250708: replace yaml.lua with lyaml OLD_FILES+=usr/share/flua/yaml.lua From nobody Mon Jul 28 13:31:47 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 4brKBs1vqxz635Km; Mon, 28 Jul 2025 13:31:49 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBq354Kz3vk0; Mon, 28 Jul 2025 13:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709507; 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=PTQymAJJdBI7PyNBp2RyCEhTDl4NMdBeCr6fiC3tXt4=; b=BsgA1dENkfh1ZT4O2PnZNp8+riNBgTBRQk4yirqKJOeCbXWulCIzi3EJH+nJB8iEucOxPw LKK61pgqkfgW/qn89p7u/OofywhFhSpzS2AqSLNIBrN4RqPAaUuTH10oJvGp9KnZ7bUK2D /QEGWkPXfREe7aM0uLyqYgqDxwkli1zOky5ENyHRWIe2HFWw6CXsHSy4Mwyj8vNZRu+f8g dQAr4p3pYjca6TqqffnfRLEunOXyVljL2giXnu3py0iPspOS7xjQE2+SrbaC9Ql0MXiBg6 /g9IQTRdVqMUlID47C4BYg5u0cCrFgK0p1bqn9gikhj6/LkFnS31X7W/YPLD4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709507; 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=PTQymAJJdBI7PyNBp2RyCEhTDl4NMdBeCr6fiC3tXt4=; b=pmF4RtsjM15xP1Aqfjhqs64yrEUMT7Z5XILHFNdEkHqUw1uIOUPmeSNA8af8q4qV/Lhmcg j2luPbXg3qeC/CYkc6l47v/UJWXEK2avMLFG3/BkPkaJ04dnIixRtJjiAV0Cb3cbOX4JoI FTf7vqbxN/gduyG7QvrEjMrpQzjlOIJguZMmEvPX8+wrsG80Onh7so5heYFuobD3kSAwaY 1Uyn+iHCtinSoo23pcCFm3EXWbumPPXq6Iq3dIC5eVApp6LlBrfytf/faNkr1QiI6jeMhI 55j1vWDbXVC2p/OGsbwalD6IRhSbBb0gWQLKvNX0kQgsQuZftDZzwlLWKuoRYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709507; a=rsa-sha256; cv=none; b=rJXW23KtQ5hbk5jnPX3rVX81jGwS+BW5iWAnCGJ1cg0AwFnYqK6yugga+DSorGbx5j/Lgd 6LvOcNZF+p9zYSzt/7doRggZx8eEDBzuuxayY7cEug3Ktedy+cutSUGv/LlvLp+vcTd1Ds mr+DW3D+AJlDDqGtge1xBgHxSytocoJfuNGYPxL6s/gR9SLUT8AMEXGOY6Ll74lSg9QgDO G4lyKXK/na3JL32s9Lbg5gMrWCkFfQwfz4d8mq+G3tAtsZnFhMgA9PgQANOCgeES3p6Rqt wRROi3Vl69wAscnVeXX75fJuojXueuCo8Nz3pKTLoHoJVfX17mDwcUQwE+hwWw== 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 4brKBq2TRzzngD; Mon, 28 Jul 2025 13:31:47 +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 56SDVlcS082402; Mon, 28 Jul 2025 13:31:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVlXn082399; Mon, 28 Jul 2025 13:31:47 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:47 GMT Message-Id: <202507281331.56SDVlXn082399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: d738ed04dbff - stable/14 - LinuxKPI: alloc_pages(): Don't reclaim on __GFP_NORETRY 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d738ed04dbff78243617ac341486b86486e9c8be Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d738ed04dbff78243617ac341486b86486e9c8be commit d738ed04dbff78243617ac341486b86486e9c8be Author: Olivier Certner AuthorDate: 2025-07-07 12:27:48 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:49 +0000 LinuxKPI: alloc_pages(): Don't reclaim on __GFP_NORETRY Pass VM_ALLOC_NORECLAIM to vm_page_alloc_noobj_contig() so that it avoids reclaiming (currently, calling vm_reserv_reclaim_contig()). According to Linux's documentation, __GFP_NORETRY should not cause any "disruptive reclaim". alloc_pages() is called a lot from the amdgpu DRM driver via ttm_pool_alloc(), which tries to allocate pages of the highest order first and fallback to lower order pages (as allocating contiguous physical pages is in fact not a requirement). This process relies on failing fast, as requested by __GFP_NORETRY. See also related commit 718d1928f874 ("LinuxKPI: make linux_alloc_pages() honor __GFP_NORETRY"). Reviewed by: jeffpc_josefsipek.net, bz MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51246 (cherry picked from commit 4ca9190251bbd00c928a3cba54712c3ec25e9e26) Forgotten on commit to main/-CURRENT: PR: 277476 --- sys/compat/linuxkpi/common/src/linux_page.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 99b63e8d5680..bb5a1411eeec 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -107,6 +107,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; + if (order == 0 && (flags & GFP_DMA32) == 0) { page = vm_page_alloc_noobj(req); if (page == NULL) @@ -114,6 +115,10 @@ linux_alloc_pages(gfp_t flags, unsigned int order) } else { vm_paddr_t pmax = (flags & GFP_DMA32) ? BUS_SPACE_MAXADDR_32BIT : BUS_SPACE_MAXADDR; + + if ((flags & __GFP_NORETRY) != 0) + req |= VM_ALLOC_NORECLAIM; + retry: page = vm_page_alloc_noobj_contig(req, npages, 0, pmax, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); From nobody Mon Jul 28 13:31:48 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 4brKBt3vWDz6354h; Mon, 28 Jul 2025 13:31:50 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBr4bz7z3vbY; Mon, 28 Jul 2025 13:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709508; 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=eylbEbibNj3kW0gbdm4uxcdzgSQredJPEOqSllJdyA8=; b=S6jgzQKKNCfSnBZ178EYyoTk4Oegz+7gV63VxuLrGTmEOxlPNoDY6nr/X+TVTn7Nas8jIH 3uF5dlfsdw0jJyvaRcfc+UVSI3+EpfzmwhMc7N/+cDFpygPQcCxZE3CxigZpGtxB0C5Ifw rERA3Q5/Cfiw81uFdGS3rDYkU1J5XRCgatqCzymYM4crhSAl11go2a1U3ch3WRSPeH6Wbu qGAMKV7rkE1UxzOV8Vw2rvHpp80Vp62P/Q1s+e/uTmKoWnZ09oNoL+DMiJnSOAF6DzKx3H CPnqwIVS0iGfOkdc/EBd8ciOmapSUaQaewj5mlnqBt0OzTjvIHqUw4d1utHE6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709508; 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=eylbEbibNj3kW0gbdm4uxcdzgSQredJPEOqSllJdyA8=; b=guJE6lr3Rkcz6YbVphiTqJyLLPsdkb4yRFnYuoiWuxabikl3VW6SSbY+XJZzxOIksRAx+f 7ubTxWP2Ra2B/PWthSRVS32yxn9YaNI8hL6qj25s4EIK9+/A++21qLyRL7dOKNFepcWVfG Gl2siuprvtOChhpsjUQW4sYtTCekfG2lDLyEH6f2qpF3krzNsacwbPqg8DxSzG9KSsXh7Z HRrY2iU/ZlJUd7EpA1ggunQ9MaZ3JxhxRec0ZjWaSfaAr4s3B5y2L/c5UobgGTaxbz4Q/b HyJfbdIxz20XfxzVZdTOZJtvjdB3IWmYozlfEtEXfURPoq/bU5bgy53h8Si6eA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709508; a=rsa-sha256; cv=none; b=KOpOEw/bLIagh/Af5xxAAA83spQIBpkCgaUlQ4nvdPY5NGMBd7xPRcNIvYCmloRp+KTdHA o+mH86AJaKtkML+feFJEgi6Tze4Bqn/7Gdygyat525S2ieu99NqUeB15zHl4Bpn0bh1OKz rfAOxniapAtK+VBnF2ZeQUvjFZGY3JkeA125672BxHHagDHh4BvEjXb8VNH/bnCgE6abeZ IYCSs1BVXhv9Y+xTmzhUugYxlQLDJaLEd/SVanKzWku5TkRforzqh6qu3lbZK6dnWxVuE0 6QXbY8AIzbWe7ZWUSEYHrQmN/IO1y76dOE6Bb0ERkR9F1O0tzYq/eL4MK49nPw== 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 4brKBr3l9QznsF; Mon, 28 Jul 2025 13:31:48 +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 56SDVmbG082435; Mon, 28 Jul 2025 13:31:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVmBA082432; Mon, 28 Jul 2025 13:31:48 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:48 GMT Message-Id: <202507281331.56SDVmBA082432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 8e1b8ae7298f - stable/14 - LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8e1b8ae7298fc8ec91f6d7dc040341343c894e57 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8e1b8ae7298fc8ec91f6d7dc040341343c894e57 commit 8e1b8ae7298fc8ec91f6d7dc040341343c894e57 Author: Olivier Certner AuthorDate: 2025-07-07 13:28:21 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:50 +0000 LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() Since commit 19df0c5abcb9d4e9 ("LinuxKPI: make __kmalloc() play by the rules"), kmalloc() systematically allocates contiguous physical memory, as it should. However, kvzalloc() was left defined in terms of kmalloc(), which makes it allocate contiguous physical memory too. This is a too stringent restriction, as kvzalloc() is supposed to be a simple page-zeroing wrapper around kvmalloc(). According to Linux's documentation ("memory-allocation.rst"), kvmalloc() first tries to allocate contiguous memory, falling back to non-contiguous one if that fails. Thus, callers are already supposed to deal with the possibility of non-contiguous memory being returned. Reviewed by: bz Fixes: 19df0c5abcb9 ("LinuxKPI: make __kmalloc() play by the rules") MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51247 (cherry picked from commit 986edb19a49c7d7d3050c759d9b0826283492ebf) Forgotten on commit to main/-CURRENT: PR: 277476 --- sys/compat/linuxkpi/common/include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index f3a840d9bf4b..efa5c8cb67b3 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -45,7 +45,7 @@ MALLOC_DECLARE(M_KMALLOC); -#define kvzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) +#define kvzalloc(size, flags) kvmalloc(size, (flags) | __GFP_ZERO) #define kvcalloc(n, size, flags) kvmalloc_array(n, size, (flags) | __GFP_ZERO) #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) #define kzalloc_node(size, flags, node) kmalloc_node(size, (flags) | __GFP_ZERO, node) From nobody Mon Jul 28 13:31:50 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 4brKBv4zHrz635DX; Mon, 28 Jul 2025 13:31:51 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBt6X7Mz3vsM; Mon, 28 Jul 2025 13:31:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709510; 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=COCplM74Kjva2FG320guNp4IGin5ZzHQ0vsTSyj8xYY=; b=N0zuGUppkQ7aAYh9cWmoKim1myyUQor2LmtnDl4H1N7b+7LIRRgzi4sWjuIlAULpkSPvD/ paNbpmGIsNEV0HdhnKLU0J5FtMSOmeBjM7d68hO6apX8c65tSZEY5Fjg/VUYWdy7jRmmQG lDZlYvUHvsFtzJspnqCUYgC+cLHUDJITK/RQUdKX2VIVZDfM2cUSQ6IaOgsOnjRXl3VNZc /AlBvk7UPko7jBnqP52nEnMgkw20NGBruomQfVLxCMQcpfxBa6jBkRNQZNg2t5vZ4Zzwpk JmjLEWP9TdrKtuiqO7SajCgel0O+a0I0UKc8D7SsmHUciMMEc6q301Aa5WsJnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709510; 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=COCplM74Kjva2FG320guNp4IGin5ZzHQ0vsTSyj8xYY=; b=pSzuweJYIhavWtbep9JLzWqjnjxXWM4/gGiUqKoh10/NFSCkfqYnePE9U79AedfSpzHj5Q 49MyEV4z/jwuNs9aUoMApDQVWbemxMPOMUMpidm+TIQPboLPyKH3iOYGuPqPn0xJYaqZUR /Uqrg09yHmBhl1PcoMICMalZS8oujlcfj8iamlF7VGff/yPH5lx9vEd1VndSuvRBiv4+5K gYvUwHhNG1vG2L8h59MfMSXhgWigs1OdjyMJCT9hAm6xsko345DBM1qnC7VOFSUiqm+WB/ hTspFhih2HJw8G5aOhLkiJL0r0ft895x9qdg/h0nx3Tqxm1k9ujI0pmVx5I6Tw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709510; a=rsa-sha256; cv=none; b=LQZPeuBJGA4+0TzZ4i+6BPFBRm8gYjB7HVH+aXla5M9cqH9fmf6fEP0z4zk+K6fYEcL/Kc 4np6QKoJE+eWtWYYw6CjqmjJ6WLl1MvJRaH8a5GEkOXFd750s6uMc3gC0ll8Li85VG6ql/ 6LQDD/+eeiBLj3569Q06JmEh0oa3btxEInD91RI41SQJx1M9vnc39nR3/1ZfwY5HTMItcA T/qszrL3F22WMjAwF6yF0aCD0gc70GkkQ+r8Klm7f9jBf1uopcgtzNOFRPHXLkrAo0R5Hb xI45+5n/RY1eT84AvlDhfHJQCe38rOU3KqVkkpFDb/DJ3y9ANQ/UFrtcwgxryg== 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 4brKBt5YjGzngG; Mon, 28 Jul 2025 13:31:50 +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 56SDVosg082506; Mon, 28 Jul 2025 13:31:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVopN082503; Mon, 28 Jul 2025 13:31:50 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:50 GMT Message-Id: <202507281331.56SDVopN082503@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 880e131d9d31 - stable/14 - vm_domainset: Print correct function in KASSERT()/panic() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 880e131d9d310c98f3b3c035d2daecb757198a77 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=880e131d9d310c98f3b3c035d2daecb757198a77 commit 880e131d9d310c98f3b3c035d2daecb757198a77 Author: Olivier Certner AuthorDate: 2025-07-07 14:14:16 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:52 +0000 vm_domainset: Print correct function in KASSERT()/panic() Some messages in vm_domainset_iter_next() would wrongly refer to vm_domainset_iter_first(). While here, ensure that all assertion/panic messages use '__func__' to avoid this discrepancy in the future if code is moved/copy-pasted again. Reviewed by: markj, alc, kib MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51248 (cherry picked from commit 1e78a6a6d85702b84f679712aac71f91e481e8f9) --- sys/vm/vm_domainset.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/vm/vm_domainset.c b/sys/vm/vm_domainset.c index 9bc0df865154..b666324db494 100644 --- a/sys/vm/vm_domainset.c +++ b/sys/vm/vm_domainset.c @@ -126,8 +126,7 @@ static void vm_domainset_iter_next(struct vm_domainset_iter *di, int *domain) { - KASSERT(di->di_n > 0, - ("vm_domainset_iter_first: Invalid n %d", di->di_n)); + KASSERT(di->di_n > 0, ("%s: Invalid n %d", __func__, di->di_n)); switch (di->di_policy) { case DOMAINSET_POLICY_FIRSTTOUCH: /* @@ -144,11 +143,10 @@ vm_domainset_iter_next(struct vm_domainset_iter *di, int *domain) vm_domainset_iter_prefer(di, domain); break; default: - panic("vm_domainset_iter_first: Unknown policy %d", - di->di_policy); + panic("%s: Unknown policy %d", __func__, di->di_policy); } KASSERT(*domain < vm_ndomains, - ("vm_domainset_iter_next: Invalid domain %d", *domain)); + ("%s: Invalid domain %d", __func__, *domain)); } static void @@ -184,13 +182,11 @@ vm_domainset_iter_first(struct vm_domainset_iter *di, int *domain) di->di_n = di->di_domain->ds_cnt; break; default: - panic("vm_domainset_iter_first: Unknown policy %d", - di->di_policy); + panic("%s: Unknown policy %d", __func__, di->di_policy); } - KASSERT(di->di_n > 0, - ("vm_domainset_iter_first: Invalid n %d", di->di_n)); + KASSERT(di->di_n > 0, ("%s: Invalid n %d", __func__, di->di_n)); KASSERT(*domain < vm_ndomains, - ("vm_domainset_iter_first: Invalid domain %d", *domain)); + ("%s: Invalid domain %d", __func__, *domain)); } void From nobody Mon Jul 28 13:31:49 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 4brKBv0yc1z6354k; Mon, 28 Jul 2025 13:31:51 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBs54X4z3vbk; Mon, 28 Jul 2025 13:31:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709509; 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=Syy5H0plAKdAjjDxabUOCZ9WQ8SuRxhsC8gN4LPSHJo=; b=NKhrOyQhb5AhgP8akVIzl7E/ctU8C/lz+pza7pTVVfgMg3SSMGimHhEtIz5ALcoZCuiXVN 44MBW8UFSdAYOCPCX+tlC/dfvsx+8zqPX1GxpO7wbBoxW42T1wK/FhjCbP2M07YdMyieae N39sp2g9sa43lUjDEqTKGBmbAw6/Gztp6pl/jf2CP6eS8m4irl0As6pdvN37I4tCJtr1u9 gX4jI5b7JSOt7JZ2D34qRwMBHTXEq/OVgnigw5R9UPXkvvH0nMfbe2tvYZ6rCirnZ0hWtd Mpmye3EaPnGE6xx2/g6A/RA8u+2AMFLhLRWT5v69LumiWa7E5UtHpMA4cv/NfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709509; 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=Syy5H0plAKdAjjDxabUOCZ9WQ8SuRxhsC8gN4LPSHJo=; b=M/P4ZzJhMM/t54JpsuvhVNuB3VvZ6/uMJnBsO745Bu+r8qCrSA4zk7TYz9ycJVHTMzkAn1 ygk0rY8hISAMGPb4KB6HNaVUCwxPywGRFWhIkrvRfUOgQ3cdGp25OCseDqahzGwc190cld Apv+w76jt4cb7VhUbLxn1ZgEg/9wq9BUxF0Eq34avA9J+SeQt7S3xEgAkekP0vOKAYyo0G 4T3deIhK1IZ/Z25eaQS9Q8OG+WKHJ0lboB4isVedgLFtkHVCn9QbcXKNVVZEsA0lQAikmd s7bDvU+G+s8cNOPaBZFZclPoqLPdyroVULnBREqUFKdU9sOJDxiyRwXq0vAOVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709509; a=rsa-sha256; cv=none; b=CIbt+bnZ8iw4lrUnWaXHei7Sd8E+znbfxy35a7+jozxsvwCLahLR2C/rnAqU/EJIkdVrGu FYSOqc3d0moEA63aFHfdlRoIOKwQ2NtxE9M8KJiHEgUYXTm0+MLOqIzXt15DHVTzbmE1UC YO0yBifgs7YK70uCgMUvpoMymoFgvmrxjdcqv8IR7C7Pcg8SMDuiczU3H5iVjKYLiidx8+ ozt3Sfva1+RSRr3riul/9Phmqj06yDcoPLmJw0fTmoKTRZ9TVFqeCvchx+pez3fmRuIO3j 7altol9+RDYax6G2GiWp0VT+GmMNa9sKhDD+U27EJGLWup7vsMTRo7HBb6MUVQ== 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 4brKBs4ZyNzngF; Mon, 28 Jul 2025 13:31:49 +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 56SDVn1r082472; Mon, 28 Jul 2025 13:31:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVnKZ082469; Mon, 28 Jul 2025 13:31:49 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:49 GMT Message-Id: <202507281331.56SDVnKZ082469@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 0e9a3bdeb737 - stable/14 - pmap: Degrade pmap_page_set_attr*() into a no-op on same attribute 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0e9a3bdeb7376bf04cf21830c4e33aa7efe13961 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=0e9a3bdeb7376bf04cf21830c4e33aa7efe13961 commit 0e9a3bdeb7376bf04cf21830c4e33aa7efe13961 Author: Olivier Certner AuthorDate: 2025-07-08 16:17:30 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:51 +0000 pmap: Degrade pmap_page_set_attr*() into a no-op on same attribute For 32-bit arm, move the no-op test that was already in place at start of the function so that it stays first even if the '#if 0' block around the call to sf_buf_invalidate_cache() is uncommented at some point (if ever). Reviewed by: jeffpc_josefsipek.net, kib MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51253 (cherry picked from commit 9d1f3ce79d85855399663e3977766ec46f28cadd) Forgotten on commit to main/-CURRENT: PR: 277476 --- sys/amd64/amd64/pmap.c | 5 +++++ sys/arm/arm/pmap-v6.c | 32 +++++++++++++++----------------- sys/arm64/arm64/pmap.c | 2 ++ sys/i386/i386/pmap.c | 2 ++ sys/powerpc/aim/mmu_oea.c | 3 +++ sys/powerpc/aim/mmu_oea64.c | 3 +++ sys/powerpc/aim/mmu_radix.c | 4 ++++ sys/riscv/riscv/pmap.c | 2 ++ 8 files changed, 36 insertions(+), 17 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 34c7c1c94737..b9681da13d3a 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -9620,6 +9620,8 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va, vm_page_t m) void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { + if (m->md.pat_mode == ma) + return; m->md.pat_mode = ma; @@ -9639,6 +9641,9 @@ pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma) { int error; + if (m->md.pat_mode == ma) + return; + m->md.pat_mode = ma; if ((m->flags & PG_FICTITIOUS) != 0) diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index 95aeba201e4a..737e215b44b6 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -5749,7 +5749,7 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) CTR5(KTR_PMAP, "%s: page %p - 0x%08X oma: %d, ma: %d", __func__, m, VM_PAGE_TO_PHYS(m), oma, ma); - if ((m->flags & PG_FICTITIOUS) != 0) + if (ma == oma || (m->flags & PG_FICTITIOUS) != 0) return; #if 0 /* @@ -5766,22 +5766,20 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) * If page is not mapped by sf buffer, map the page * transient and do invalidation. */ - if (ma != oma) { - pa = VM_PAGE_TO_PHYS(m); - sched_pin(); - pc = get_pcpu(); - cmap2_pte2p = pc->pc_cmap2_pte2p; - mtx_lock(&pc->pc_cmap_lock); - if (pte2_load(cmap2_pte2p) != 0) - panic("%s: CMAP2 busy", __func__); - pte2_store(cmap2_pte2p, PTE2_KERN_NG(pa, PTE2_AP_KRW, - vm_memattr_to_pte2(ma))); - dcache_wbinv_poc((vm_offset_t)pc->pc_cmap2_addr, pa, PAGE_SIZE); - pte2_clear(cmap2_pte2p); - tlb_flush((vm_offset_t)pc->pc_cmap2_addr); - sched_unpin(); - mtx_unlock(&pc->pc_cmap_lock); - } + pa = VM_PAGE_TO_PHYS(m); + sched_pin(); + pc = get_pcpu(); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) + panic("%s: CMAP2 busy", __func__); + pte2_store(cmap2_pte2p, PTE2_KERN_NG(pa, PTE2_AP_KRW, + vm_memattr_to_pte2(ma))); + dcache_wbinv_poc((vm_offset_t)pc->pc_cmap2_addr, pa, PAGE_SIZE); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); + sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index ef33a7339b9e..8e3161736467 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -6678,6 +6678,8 @@ pmap_unmapbios(void *p, vm_size_t size) void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { + if (m->md.pv_memattr == ma) + return; m->md.pv_memattr = ma; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 90ea6e3459cf..d9eeeed69bd5 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -5516,6 +5516,8 @@ __CONCAT(PMTYPE, unmapdev)(void *p, vm_size_t size) static void __CONCAT(PMTYPE, page_set_memattr)(vm_page_t m, vm_memattr_t ma) { + if (m->md.pat_mode == ma) + return; m->md.pat_mode = ma; if ((m->flags & PG_FICTITIOUS) != 0) diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 363eb0c4c9a7..662204ec8b33 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1465,6 +1465,9 @@ moea_page_set_memattr(vm_page_t m, vm_memattr_t ma) pmap_t pmap; u_int lo; + if (m->md.mdpg_cache_attrs == ma) + return; + if ((m->oflags & VPO_UNMANAGED) != 0) { m->md.mdpg_cache_attrs = ma; return; diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 4266047ee3e2..2ded3b6b5195 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -2121,6 +2121,9 @@ moea64_page_set_memattr(vm_page_t m, vm_memattr_t ma) CTR3(KTR_PMAP, "%s: pa=%#jx, ma=%#x", __func__, (uintmax_t)VM_PAGE_TO_PHYS(m), ma); + if (m->md.mdpg_cache_attrs == ma) + return; + if ((m->oflags & VPO_UNMANAGED) != 0) { m->md.mdpg_cache_attrs = ma; return; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index a15f686d88fe..78c57badee55 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -5888,6 +5888,10 @@ mmu_radix_page_set_memattr(vm_page_t m, vm_memattr_t ma) { CTR3(KTR_PMAP, "%s(%p, %#x)", __func__, m, ma); + + if (m->md.mdpg_cache_attrs == ma) + return; + m->md.mdpg_cache_attrs = ma; /* diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 4812f3274e69..74bbddd7b065 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -4589,6 +4589,8 @@ pmap_unmapbios(void *p, vm_size_t size) void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { + if (m->md.pv_memattr == ma) + return; m->md.pv_memattr = ma; From nobody Tue Jul 29 03:41:16 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 4brh3074P3z5yMJr; Tue, 29 Jul 2025 03:41:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brh306GRrz3Pp9; Tue, 29 Jul 2025 03:41:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753760476; 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=wRVuFvVhXq8eU1ZR4qEEJv19Fbty7vbYT4CVT3aSV54=; b=QPRRbbWXUhS8zBIsZWIOZbyXuPlJwKN7RNdIyR9tG1PtaWXl3VHXAKgMYIZW+3iaVSIw3f AE4TznxiFGubnQoaHRw6RtCgnW534kqUsOsuTe7EkU8Rq96rxtZWT+M+6l/cD85E5+G/pT 945B8mkrdzf7f+2PdIb99rD51m7nImuJXA04nn1Zh+IBXKDg0og5fwnhiFiSIwoFXxZ26T WTLFRryQz63Ge3ZS+Mhc7Ob1j9IUyDy/H+K1dwDYgYYjXnleLURdU1MSXvz3qH5g8vuqAg x+jMHRM9xkCcGPlgOoiUDl+uauBGUTQrF0Ewx3PemU1Pv9jHwcjU9REjkXr0Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753760476; 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=wRVuFvVhXq8eU1ZR4qEEJv19Fbty7vbYT4CVT3aSV54=; b=gRFOvR4cSDC6iBPP+UnTd1PFy/8v3YVC5sVadZEpbW8BylfoeRP7Wp+rwq6gl/R0yELo68 SYK8COXweCKX3UaKMegtalFCYa+xVcm0ysPL6/o6dnI1aoeTXDgjyaHchXz1zzkjs5jBYe YREqNjGCAFiYrtj2Po5lEfJFJE7Tv2miZF06xrYgB2Wa1pAT3tsLg5Lv+2kdEcl+93q+td UIkW5rmLA6Nzih4WBMTzF47pWKO96UN2hIeMz1DgLld6jjY/8udwXvQJBf8gUF253pKWdj n6+3LfRZCuGX6fwLO77AK2g+GrQb1/oFv0PK4MbN3XzM1KFztCxaAkpnx6Z5oA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753760476; a=rsa-sha256; cv=none; b=tw8bag+kbyNjvg7PLW8+22mko+nW0iq4sznvl/k6hsRYMhVdIxfvuKxe2h01SV5Jz5w0i9 z1O1zkpwoBWNJfg/fBdD4SwsNE/eolvjhRIsD/AoEED06rL8TrWapPYQKe1FpDILoH6xk3 jaBsrFRXi2iZbQDzRVsQLqpZxOeIzo9n/Ngo6OEnZOCTl+sJgGtJPMMweesJK4jjVmJoOv EuwqftbW9w+b4QQ68DUkPcEZzWWQ3gxBQGON95Vae/SbHK9SdJVI64LI1si5CgmiVh3a8Z Qgi9BTtHA9eT/SlIsIseEzeqdsEc1ZwimqMCgb1u6Ebe4GkjsKT9rvYtc6McCg== 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 4brh305mDRz1CcK; Tue, 29 Jul 2025 03:41:16 +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 56T3fGNj084855; Tue, 29 Jul 2025 03:41:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56T3fG8B084852; Tue, 29 Jul 2025 03:41:16 GMT (envelope-from git) Date: Tue, 29 Jul 2025 03:41:16 GMT Message-Id: <202507290341.56T3fG8B084852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 99979f0eeb93 - stable/14 - setsockopt.2: Clarify SO_SPLICE action 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: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 99979f0eeb9381685c8b4601623a109235341016 Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=99979f0eeb9381685c8b4601623a109235341016 commit 99979f0eeb9381685c8b4601623a109235341016 Author: Kevin Bowling AuthorDate: 2024-11-25 18:32:35 +0000 Commit: Kevin Bowling CommitDate: 2025-07-29 03:39:47 +0000 setsockopt.2: Clarify SO_SPLICE action Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D47720 Co-authored-by: Mark Johnston (cherry picked from commit c1e304c60c46a26af57f9638c53417dd6cffa9fe) --- lib/libc/sys/getsockopt.2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2 index c738a152d859..f36a9fe7baf8 100644 --- a/lib/libc/sys/getsockopt.2 +++ b/lib/libc/sys/getsockopt.2 @@ -570,9 +570,14 @@ struct so_splice { .Pp Data received on .Fa s -will automatically be transmitted from the socket specified in +will automatically be transmitted via the socket specified in .Fa sp_fd without any intervention by userspace. +That is, the data will be transmitted via +.Fa sp_fd +as if userspace had called +.Xr send 2 +directly. Splicing is a one-way operation; a given pair of sockets may be spliced in one or both directions. Currently only connected From nobody Tue Jul 29 03:41:17 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 4brh320nxCz5yLhh; Tue, 29 Jul 2025 03:41:18 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brh3175c2z3PpB; Tue, 29 Jul 2025 03:41:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753760478; 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=cLj4Q/gOHAEq3DYd2/0X1ZM828dloiyHPvnl4lKXzmc=; b=Dp8fCEtc7K/+1Nw9jv+w8YQNgrjCLP7qeJosKNG7QzOdhhJ+HogmgRbayPnSfzeS2pKSa3 G4e6Os8vxpXiE0sT5D2L6EeFlUo7b12pO2Ipes4WIdodfSd/nFOGA8t04fQ9tdPY4eu77y 5ml+tfNwlDqKnTzLA3R3j736X+KCRXTovDoDyrwDWJOEOcmZEsaRD3X42XjhSRKxc2bdkh fXhFeczjQT9+D6GR/ewwAFH7b6GcI8+Mi5jPH6crjlK20wmSNd5xqpm86/nQdBO9JnyoHT mjv/wMfH9fpgTVnyLX/GX/3l9hURCEEClfCwvQu9xlo7NXCRrJMbZ28Ufn17wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753760478; 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=cLj4Q/gOHAEq3DYd2/0X1ZM828dloiyHPvnl4lKXzmc=; b=mFVjXrErvaTWt5RBeZsZDwyoejXKhXKooxDl84w9/KM3dblxGC03RdqdHIWXvzoEc7Z8vS pOUfdqVBeYsWFI3pmORTKKugidL0EsxpQXlQ+Pzl60IMVnW89wBEPG8FX5v6Qpz4eQVei3 jlCw/+C5f3az3Qib08TdZ8FWqUmTZguFjonaxfrVqISeRReJp2H7elPkt/MSHzlmO4833a yAx9AVTVK5MHChrftoEoMDF/6Itjk/BWfA1CCXPGxni5RUeQSvuQXl9XG20u0HkDeFxvlU zsL0iVm/FJUjUHZVhvHekyzBzqi9GMsbw2KNqgOH75g9ua2g3EabDY/f1adhMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753760478; a=rsa-sha256; cv=none; b=ic7Df5VnuFlKjKcQhapeEO19EyMlhzRBd5gCW29/g3mQP/E266Zs4zTkRV/jp4pVUE8yqE QdQTwJUEw1v632vxjmOoDKfhkGRxFp/MRwxtyfG/dmiZh69uM8anCrwrtsaF++jLUM0Cyj d1IY+Q3eeH14nR6HNF4qDo3y6vedh8dnVX5VHnDuiZa9WlT8Xg1n2MSPhgTb2b3Gilq45T ovrrfo6w+QysumMsqwAg1+OLN3eUtr6ztaMhBJWECqlnUfN1A+dEyGwAJ1w2G2jySBss1+ Oc1uOok27S78E7lOJWws5fI05j2An1as8l00J4vp0B/rXufcgsNzOy6gllPWuA== 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 4brh316hTzz1CsV; Tue, 29 Jul 2025 03:41:17 +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 56T3fHXj084887; Tue, 29 Jul 2025 03:41:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56T3fHsc084884; Tue, 29 Jul 2025 03:41:17 GMT (envelope-from git) Date: Tue, 29 Jul 2025 03:41:17 GMT Message-Id: <202507290341.56T3fHsc084884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 677465720ad1 - stable/14 - getsockopt.2: Add SO_SPLICE source socket read and socket close behavior 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: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 677465720ad10f24de178c8bba0285cb3f3c23fe Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=677465720ad10f24de178c8bba0285cb3f3c23fe commit 677465720ad10f24de178c8bba0285cb3f3c23fe Author: Kevin Bowling AuthorDate: 2025-07-26 21:18:47 +0000 Commit: Kevin Bowling CommitDate: 2025-07-29 03:40:26 +0000 getsockopt.2: Add SO_SPLICE source socket read and socket close behavior Add select(2), poll(2), or kqueue(2) source socket semantics and close behavior. Reported by: Udip Pant Reviewed by: manpages (ziaee), markj Obtained from: OpenBSD Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D51547 (cherry picked from commit 122b2a3530f8baab56d196b51724cc3ddd38abd2) --- lib/libc/sys/getsockopt.2 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2 index f36a9fe7baf8..b9c6589d07ac 100644 --- a/lib/libc/sys/getsockopt.2 +++ b/lib/libc/sys/getsockopt.2 @@ -595,6 +595,15 @@ specified amount of time has elapsed since the initial call to If .Fa sp_fd is -1, the socket will be unspliced immediately. +A successful +.Xr select 2 , +.Xr poll 2 , +or +.Xr kqueue 2 +operation testing the ability to read from the source socket indicates +that the splicing has terminated and at least one byte is available for +reading. +When one of the sockets gets closed, splicing ends. .Pp When passed to .Fn getsockopt , From nobody Tue Jul 29 07:49:25 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 4brnYK73hcz61tbN; Tue, 29 Jul 2025 07:49: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brnYK65TXz3H3Q; Tue, 29 Jul 2025 07:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753775365; 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=vZ8ozSA3Fc0QWoCwPJhg/isleSsEWjwWGBmjC8k+RWM=; b=V7s0+8BOPBFRRuk6KKRpXtY9ov9F77BpDQAFKkwfjmfHiJFwr3+AOmEzScIA3rJ2Ko+Ilx XatFuz8ONnO9YUVWGOlgJecIS1OoE5ZmI/nJ1P8MypvCCgnKjePJsMJHG76zerpJY7WtSg 6Bh0S/TGDNbtO9uRkTl0LxKZkb4E5VPzhl6zyD9vZeX2GYXfR3Or8GMQa9VH4qDiEP5XX3 azQgVnQnhzyHPGBaV2qro1Ry+SEcLj+yn/p0fFMwc1ghpnEFmakpFRgM1f6wX3N8K3Ty5n XtnhziwYAHhdLPYV9swPIAZfhpJhT4xM/oWrR46EGNGqfgqYE4i/H8j1TyNUjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753775365; 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=vZ8ozSA3Fc0QWoCwPJhg/isleSsEWjwWGBmjC8k+RWM=; b=hz2RwCTXdyNC5CQpex9F+Tjg/gfabPeyTe6jhgvkxtfpp5WD04MOG3HFLf0oWwCaEjUH9a 0MOx7wxAREk6k4lTLBsd3DGp6bXlHMsYbVwRiDV2JYK5ey520n5iNfLo36+MvoNnhV/GJP 1cOkoA821pJyMNoG8YCH5Rz0GaF0D0x8BlRsZNm88znz3UgTVWbUbTF2N2C3tmRaJKPO+i QZibQSJrATdqpibnqkwMA269LuAgpIXrazv4LLjJGsxKrJD/9l2KaqKuEzW+ckfrKo2OiS op6FxuTP6w4QF/mt6jJNny5BaD9qy6D/dYo/3RLLbZs+fffeRHVmidh3C6Mb5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753775365; a=rsa-sha256; cv=none; b=pWw1FhpZV6HRpKNxokKEnYygppj1TW4B350X0o1LXdL+72bRtCN2hs2YmVoi9HMb0bUqbq t2jIwi9Szp7oiGaZvbar49NmleDQE3nu6q11Fjg9tPMu6M6MeWFkEKMIsOyGUzMkgI7xNH ba2pOYse/XQYkyzp0TC8JH5vgi16JwD6GsieZB+108JwHa6Ph7h87TjADBVGDXBa9VzPvS PDbbRHZ9L8hkwrqpp8emZ4QnAQtxA9OqVXBEscWa5CMwAbqnnV8A+qbQ1bZ48Cinj+XtiJ 0UvIk5pRmaMjr/aSDXLZxZo7jKpZr7p4k7nTsy7L33l+255Z0I23u6xhY8pCEg== 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 4brnYK5Y9bz6bH; Tue, 29 Jul 2025 07:49:25 +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 56T7nPUd065631; Tue, 29 Jul 2025 07:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56T7nPd8065628; Tue, 29 Jul 2025 07:49:25 GMT (envelope-from git) Date: Tue, 29 Jul 2025 07:49:25 GMT Message-Id: <202507290749.56T7nPd8065628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b731570eca60 - stable/14 - /etc/rc.d/pf: Fix for multi-line pf_fallback_rules 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b731570eca60c421f9c42208d542b49073e33a6d Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b731570eca60c421f9c42208d542b49073e33a6d commit b731570eca60c421f9c42208d542b49073e33a6d Author: Michael Proto AuthorDate: 2025-07-13 21:30:28 +0000 Commit: Kristof Provost CommitDate: 2025-07-29 07:48:39 +0000 /etc/rc.d/pf: Fix for multi-line pf_fallback_rules Setting multiple pf_fallback_rules in /etc/rc.conf as per the documentation produces invalid pf syntax due to the lack of echo quoting $pf_fallback_rules in /etc/rc.d/pf. Adding quotes around the $pf_fallback_rules echo maintains newlines needed for valid pfctl syntax. Provided patch resolves the issue Also updating rc.conf(5) to reflect that multi-line pf_fallback_rules should not include a trailing backslash (\) as line breaks are needed when passing rules to pfctl via stdin. PR: 288197 Reviewed by: kp MFC after: 2 weeks (cherry picked from commit 9e8c1f9576e75fcd34007c6e8a4a6da0b1b2f1e2) --- libexec/rc/rc.d/pf | 2 +- share/man/man5/rc.conf.5 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf index f227782e640c..f5871c367c6a 100755 --- a/libexec/rc/rc.d/pf +++ b/libexec/rc/rc.d/pf @@ -35,7 +35,7 @@ pf_fallback() $pf_program -f "$pf_fallback_rules_file" $pf_flags else warn "Loading fallback rules: $pf_fallback_rules" - echo $pf_fallback_rules | $pf_program -f - $pf_flags + echo "$pf_fallback_rules" | $pf_program -f - $pf_flags fi } diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 51e9ff7d9f86..a023d04a1bb6 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 7, 2025 +.Dd July 15, 2025 .Dt RC.CONF 5 .Os .Sh NAME @@ -1140,8 +1140,8 @@ and is not found. Multiple rules can be set as follows: .Bd -literal -pf_fallback_rules="\\ - block drop log all\\ +pf_fallback_rules=" + block drop log all pass in quick on em0" .Pp .Ed From nobody Tue Jul 29 07:49:26 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 4brnYM38WXz61tDR; Tue, 29 Jul 2025 07:49:27 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brnYM0vFyz3H8J; Tue, 29 Jul 2025 07:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753775367; 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=s9//ny0HBfwdvMZnyTsOw62o/HsghTEPH7U/RWOK2K0=; b=XWxBzSXm/ZJugNDOxmdXZrReeTtBBI6BQpB4UggMq5RHcX/sribakUQzfJ8EACIkP/i1/R goVjXxqE/LWmRXuL54Hqejb02q35pGfawKfOx0mhDygrK+VB8anIwjYzUt6ZqDV3YtBtVm jgblNfjP1kihPE+BC/ZnCAQzNlaiQBQZAOWu0Ly4Hi6NG7RO0lfmBhkijzL8QzsDt7yA2D 6nptLe/Eo3uihzaQc4bADba+WmxA7kLP2/iuFqLHnydez6mnO6J4P/P1nQtJ6o/efx8z84 +prOCaOhyZVurE0+2CFIkYU7BYjCkpBl5MX5xQeQez+4mMa7hUSHj+gMU2ntVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753775367; 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=s9//ny0HBfwdvMZnyTsOw62o/HsghTEPH7U/RWOK2K0=; b=mpLej0u2qjS73cmeiFSj4wE3ASxs/a7/VZWEOUWl8ww0V9Tni5vOQk8nfGLxeHzA8h726u ARg0GKwu+ZaBcnMO5eSUUwQCxEyN20ITrjcQ65jv3wIxk9d1xUPZpmeBNOsYYnFCYJ9TZM VZqbke6krBooblUoeEh91t8utUuBHqdHtkyaW0TrM/5Ma8zQCfEjICOUsUfBAjJT5RyxtD msBkxmUEGePqml2BIo/ERQ2Hdb5nrWGOPJjIotd55/7ou9+TXIkZx4PMEK1kvZBXglvjzJ D/Gtrl3Yrsh/qKicBgF11BQ+kFeWtIduBMRpd/iIo59+EEqWOZTpIVJjgiVPYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753775367; a=rsa-sha256; cv=none; b=TZbvtdrLX9TVojJRkfC7/C669trUYfK6UgYdMzIXOuAWNLuJeb8TKd1bfEAi1ZBpV93+xb M8QntgwGHgaVYYaO5ppy0R2NciqUMKqJUkyeoa1v3al26ehMI/Scv5uh9tA6Z91rCMVu9d qL9fj6FH4B0mFUeo41zPpY6XgBdX9Fzy1BKeEmkQ2Ul6oU4NrbdkWgsdIBV2SGnJwN5ZTa Mux+jSbEONF7RMedV9MIDtEYSR1TMDRZDbtGnD+gaRY6349DD0tTvnSoAALx6neg4yhpqW 2oZQZW05szznVHZbd72SaHC4AjGEG/9yjp5VKq5YUCxd+O+JRqsQbDsthG6Kqg== 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 4brnYM0Qjgz6W3; Tue, 29 Jul 2025 07:49:27 +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 56T7nQfp065756; Tue, 29 Jul 2025 07:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56T7nQQR065753; Tue, 29 Jul 2025 07:49:26 GMT (envelope-from git) Date: Tue, 29 Jul 2025 07:49:26 GMT Message-Id: <202507290749.56T7nQQR065753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 0bb490bdbff4 - stable/13 - /etc/rc.d/pf: Fix for multi-line pf_fallback_rules 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0bb490bdbff4bb39e7a3429ee2176bd123b627ca Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0bb490bdbff4bb39e7a3429ee2176bd123b627ca commit 0bb490bdbff4bb39e7a3429ee2176bd123b627ca Author: Michael Proto AuthorDate: 2025-07-13 21:30:28 +0000 Commit: Kristof Provost CommitDate: 2025-07-29 07:48:51 +0000 /etc/rc.d/pf: Fix for multi-line pf_fallback_rules Setting multiple pf_fallback_rules in /etc/rc.conf as per the documentation produces invalid pf syntax due to the lack of echo quoting $pf_fallback_rules in /etc/rc.d/pf. Adding quotes around the $pf_fallback_rules echo maintains newlines needed for valid pfctl syntax. Provided patch resolves the issue Also updating rc.conf(5) to reflect that multi-line pf_fallback_rules should not include a trailing backslash (\) as line breaks are needed when passing rules to pfctl via stdin. PR: 288197 Reviewed by: kp MFC after: 2 weeks (cherry picked from commit 9e8c1f9576e75fcd34007c6e8a4a6da0b1b2f1e2) --- libexec/rc/rc.d/pf | 2 +- share/man/man5/rc.conf.5 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf index f227782e640c..f5871c367c6a 100755 --- a/libexec/rc/rc.d/pf +++ b/libexec/rc/rc.d/pf @@ -35,7 +35,7 @@ pf_fallback() $pf_program -f "$pf_fallback_rules_file" $pf_flags else warn "Loading fallback rules: $pf_fallback_rules" - echo $pf_fallback_rules | $pf_program -f - $pf_flags + echo "$pf_fallback_rules" | $pf_program -f - $pf_flags fi } diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index f588f12eee59..8dd871d7c779 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 7, 2025 +.Dd July 15, 2025 .Dt RC.CONF 5 .Os .Sh NAME @@ -1101,8 +1101,8 @@ and is not found. Multiple rules can be set as follows: .Bd -literal -pf_fallback_rules="\\ - block drop log all\\ +pf_fallback_rules=" + block drop log all pass in quick on em0" .Pp .Ed From nobody Tue Jul 29 12:49:02 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 4brwC312VMz62xSk; Tue, 29 Jul 2025 12:49:03 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC30f0Bz3lQX; Tue, 29 Jul 2025 12:49:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793343; 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=Y78qBz+SWSFFuXKbpEu8YaRlrzUpecJRD5FU+bWDsYY=; b=L/AqhsG13hx6ZnRuh3Lk7Jd/rzHplvGjyLsTymyM2l3Vx/7x6P90nqPQSLJ3mlTHKElkvm ubF1kg+S3XgPqhrVgkZzZlQxTTZsJ7efRoRhA9elxHntBo5g4DpGfu+2iSk7+MPexi2QQO VieNiCDOH3abZv/VVfjCXxOC02nacyLknk5t7Z7gJ/WHrA5IIWQM4dc2KiyG+MnEFql+Dh U05ZKter5rtAvQ30sGYRFVLQ8EFGfVNqvSz78gwIe+/ihB8PUNNIci2eJfJk7UER+x5YC/ wQAmrCYfynzm81c0i+tkE/BJKAswYCgqeDfkRgl5YAz8MoGBUfj6ycPV+XXYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793343; 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=Y78qBz+SWSFFuXKbpEu8YaRlrzUpecJRD5FU+bWDsYY=; b=w2k6YOgNs82u3RpjxCQYbsSb0agW9mlOtEehV/xg5cQIkosn9PU6YRFn/CBaHIiGiZCa/x avrPHkKtDFF1brIbqFXUT3s0VOIZUv1F4yVoxiH5H8TI9TCL981kZWOrvp8Al8MsQ1MSeR wHGbR0YZu46QQRKJqEXW3bAN0TIuNyNbimwZ8AhlwWigENplayxZF8BHKL3FvUE/7cK/6Q hHFbcR/OnUcjf4NQYtIVxe3gSPQHUAMZXPt1Tl5s48En/I9c2M/iPkr9szdGunKTHnRBmE 7vFYFP51w9b5uPp5/dtdMK6eHeYOvxqtYAgG2AU4i/eX0LryB6YOXYA9bryktw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793343; a=rsa-sha256; cv=none; b=hHY2napPpdo6JF6B3fDpLFxrlKIvsyBqfKCL5bZbDliJTDPKEBUlMrkkrIN5kztXdFFn6h dvf00Ri+YvHe8urbqG1oQ0rLu1s1IQKiABdbOOz5ghK10ecg8eVvJ/8MytaJilCzZiXOeD Poc11IdU3jP48GF2LyKAiOSnzOKqug9+NXtx+ly8vCJGdEHsRacHa2ZNL81YbdQ5u1blod Gvxs5X3BgTrIdxtnCxvi60MqLAF7Rxr8MkniDD10iPQPBuklALnzY9q/rXYwfp9yP+odoa RKjR1gRt09m56c7vUmOHuBQ4HSaZylpwF+TQone1tLXcaBuRuSh9UhjmXO8dFw== 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 4brwC26pbSzY1h; Tue, 29 Jul 2025 12:49:02 +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 56TCn2N7033321; Tue, 29 Jul 2025 12:49:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn25R033313; Tue, 29 Jul 2025 12:49:02 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:02 GMT Message-Id: <202507291249.56TCn25R033313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 10b3f2138573 - stable/14 - file: Add a fd flag with O_RESOLVE_BENEATH semantics 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 10b3f2138573da952b4db29f88f6d67cfc3300cd Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=10b3f2138573da952b4db29f88f6d67cfc3300cd commit 10b3f2138573da952b4db29f88f6d67cfc3300cd Author: Mark Johnston AuthorDate: 2025-06-24 20:17:07 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 file: Add a fd flag with O_RESOLVE_BENEATH semantics The O_RESOLVE_BENEATH openat(2) flag restricts name lookups such that they remain under the directory referenced by the dirfd. This commit introduces an implicit version of the flag, FD_RESOLVE_BENEATH, stored in the file descriptor entry. When the flag is set, any lookup relative to that fd automatically has O_RESOLVE_BENEATH semantics. Furthermore, the flag is sticky, meaning that it cannot be cleared, and it is copied by dup() and openat(). File descriptors with FD_RESOLVE_BENEATH set may not be passed to fchdir(2) or fchroot(2). Various fd lookup routines are modified to return fd flags to the caller. This flag will be used to address a case where jails with different root directories and the ability to pass SCM_RIGHTS messages across the jail boundary can transfer directory fds in such as way as to allow a filesystem escape. PR: 262180 Reviewed by: kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D50371 (cherry picked from commit f35525ff2053e026a423e852136d73ed93c95803) --- lib/libc/sys/fcntl.2 | 63 +++++++++++++++++++---------- sys/fs/fdescfs/fdesc_vnops.c | 4 +- sys/kern/kern_descrip.c | 95 ++++++++++++++++++++++++++++++++------------ sys/kern/uipc_syscalls.c | 2 +- sys/kern/vfs_acl.c | 4 +- sys/kern/vfs_cache.c | 14 +++++-- sys/kern/vfs_extattr.c | 8 ++-- sys/kern/vfs_syscalls.c | 21 +++++++--- sys/sys/fcntl.h | 2 + sys/sys/file.h | 2 +- sys/sys/filedesc.h | 8 +++- sys/sys/namei.h | 1 + 12 files changed, 156 insertions(+), 68 deletions(-) diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2 index 5de41f4c0476..fdd29c9f5d78 100644 --- a/lib/libc/sys/fcntl.2 +++ b/lib/libc/sys/fcntl.2 @@ -27,7 +27,7 @@ .\" .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" -.Dd December 7, 2021 +.Dd June 5, 2025 .Dt FCNTL 2 .Os .Sh NAME @@ -82,6 +82,11 @@ associated with the new file descriptor is cleared, so the file descriptor is to remain open across .Xr execve 2 system calls. +.It +The +.Dv FD_RESOLVE_BENEATH +flag, described below, will be set if it was set on the original +descriptor. .El .It Dv F_DUPFD_CLOEXEC Like @@ -115,29 +120,47 @@ Use instead of .Dv F_DUP2FD . .It Dv F_GETFD -Get the close-on-exec flag associated with the file descriptor -.Fa fd -as -.Dv FD_CLOEXEC . -If the returned value ANDed with -.Dv FD_CLOEXEC -is 0, -the file will remain open across -.Fn exec , -otherwise the file will be closed upon execution of +Get the flags associated with the file descriptor +.Fa fd . +The following flags are defined: +.Bl -tag -width FD_RESOLVE_BENEATH +.It Dv FD_CLOEXEC +The file will be closed upon execution of .Fn exec .Fa ( arg is ignored). +Otherwise, the file descriptor will remain open. +.It Dv FD_RESOLVE_BENEATH +All path name lookups relative to that file descriptor +will behave as if the lookup had +.Dv O_RESOLVE_BENEATH +or +.Dv AT_RESOLVE_BENEATH +semantics. +It is not permitted to call +.Xr fchdir 2 +or +.Xr fchroot 2 +on such a file descriptor. +The +.Dv FD_RESOLVE_BENEATH +flag is sticky, meaning that it is preserved by +.Xr dup 2 +and similar operations, and opening a directory with +.Xr openat 2 +where the directory descriptor has the flag set causes the new directory +descriptor to also have the flag set. +.El .It Dv F_SETFD -Set the close-on-exec flag associated with -.Fa fd -to -.Fa arg , -where -.Fa arg -is either 0 or -.Dv FD_CLOEXEC , -as described above. +Set flags associated with +.Fa fd . +The available flags are +.Dv FD_CLOEXEC +and +.Dv FD_RESOLVE_BENEATH . +The +.Dv FD_RESOLVE_BENEATH +flag cannot be cleared once set. .It Dv F_GETFL Get descriptor status flags, as described below .Fa ( arg diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 9c451aa9247a..47fb387a007e 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -504,7 +504,7 @@ fdesc_setattr(struct vop_setattr_args *ap) cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); } else { error = getvnode_path(td, fd, - cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); + cap_rights_init_one(&rights, CAP_EXTATTR_SET), NULL, &fp); } if (error) { /* @@ -641,7 +641,7 @@ fdesc_readlink(struct vop_readlink_args *va) VOP_UNLOCK(vn); td = curthread; - error = fget_cap(td, fd_fd, &cap_no_rights, &fp, NULL); + error = fget_cap(td, fd_fd, &cap_no_rights, NULL, &fp, NULL); if (error != 0) goto out; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 30be63d8e5d5..d84c97669320 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -111,8 +111,8 @@ static void fdgrowtable_exp(struct filedesc *fdp, int nfd); static void fdunused(struct filedesc *fdp, int fd); static void fdused(struct filedesc *fdp, int fd); static int fget_unlocked_seq(struct thread *td, int fd, - const cap_rights_t *needrightsp, struct file **fpp, - seqc_t *seqp); + const cap_rights_t *needrightsp, uint8_t *flagsp, + struct file **fpp, seqc_t *seqp); static int getmaxfd(struct thread *td); static u_long *filecaps_copy_prep(const struct filecaps *src); static void filecaps_copy_finish(const struct filecaps *src, @@ -529,7 +529,9 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) fde = fdeget_noref(fdp, fd); if (fde != NULL) { td->td_retval[0] = - (fde->fde_flags & UF_EXCLOSE) ? FD_CLOEXEC : 0; + ((fde->fde_flags & UF_EXCLOSE) ? FD_CLOEXEC : 0) | + ((fde->fde_flags & UF_RESOLVE_BENEATH) ? + FD_RESOLVE_BENEATH : 0); error = 0; } FILEDESC_SUNLOCK(fdp); @@ -540,8 +542,13 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) FILEDESC_XLOCK(fdp); fde = fdeget_noref(fdp, fd); if (fde != NULL) { + /* + * UF_RESOLVE_BENEATH is sticky and cannot be cleared. + */ fde->fde_flags = (fde->fde_flags & ~UF_EXCLOSE) | - (arg & FD_CLOEXEC ? UF_EXCLOSE : 0); + ((arg & FD_CLOEXEC) != 0 ? UF_EXCLOSE : 0) | + ((arg & FD_RESOLVE_BENEATH) != 0 ? + UF_RESOLVE_BENEATH : 0); error = 0; } FILEDESC_XUNLOCK(fdp); @@ -2166,7 +2173,8 @@ _finstall(struct filedesc *fdp, struct file *fp, int fd, int flags, seqc_write_begin(&fde->fde_seqc); #endif fde->fde_file = fp; - fde->fde_flags = (flags & O_CLOEXEC) != 0 ? UF_EXCLOSE : 0; + fde->fde_flags = ((flags & O_CLOEXEC) != 0 ? UF_EXCLOSE : 0) | + ((flags & O_RESOLVE_BENEATH) != 0 ? UF_RESOLVE_BENEATH : 0); if (fcaps != NULL) filecaps_move(fcaps, &fde->fde_caps); else @@ -2914,7 +2922,7 @@ out: #ifdef CAPABILITIES int fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, - struct file **fpp, struct filecaps *havecapsp) + uint8_t *flagsp, struct file **fpp, struct filecaps *havecapsp) { struct filedesc *fdp = td->td_proc->p_fd; int error; @@ -2923,7 +2931,8 @@ fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, *fpp = NULL; for (;;) { - error = fget_unlocked_seq(td, fd, needrightsp, &fp, &seq); + error = fget_unlocked_seq(td, fd, needrightsp, flagsp, &fp, + &seq); if (error != 0) return (error); @@ -2954,10 +2963,10 @@ get_locked: #else int fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, - struct file **fpp, struct filecaps *havecapsp) + uint8_t *flagsp, struct file **fpp, struct filecaps *havecapsp) { int error; - error = fget_unlocked(td, fd, needrightsp, fpp); + error = fget_unlocked(td, fd, needrightsp, flagsp, fpp); if (havecapsp != NULL && error == 0) filecaps_fill(havecapsp); @@ -3040,7 +3049,7 @@ out: #ifdef CAPABILITIES int -fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) +fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, int *flagsp) { const struct filedescent *fde; const struct fdescenttbl *fdt; @@ -3050,7 +3059,7 @@ fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) const cap_rights_t *haverights; cap_rights_t rights; seqc_t seq; - int fd; + int fd, flags; VFS_SMR_ASSERT_ENTERED(); @@ -3070,7 +3079,9 @@ fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) return (EAGAIN); if (__predict_false(cap_check_inline_transient(haverights, &rights))) return (EAGAIN); - *fsearch = ((fp->f_flag & FSEARCH) != 0); + flags = fp->f_flag & FSEARCH; + flags |= (fde->fde_flags & UF_RESOLVE_BENEATH) != 0 ? + O_RESOLVE_BENEATH : 0; vp = fp->f_vnode; if (__predict_false(vp == NULL)) { return (EAGAIN); @@ -3104,17 +3115,19 @@ fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) #endif } *vpp = vp; + *flagsp = flags; return (0); } #else int -fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) +fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, int *flagsp) { + const struct filedescent *fde; const struct fdescenttbl *fdt; struct filedesc *fdp; struct file *fp; struct vnode *vp; - int fd; + int fd, flags; VFS_SMR_ASSERT_ENTERED(); @@ -3123,9 +3136,13 @@ fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) fdt = fdp->fd_files; if (__predict_false((u_int)fd >= fdt->fdt_nfiles)) return (EBADF); - fp = fdt->fdt_ofiles[fd].fde_file; + fde = &fdt->fdt_ofiles[fd]; + fp = fde->fde_file; if (__predict_false(fp == NULL)) return (EAGAIN); + flags = fp->f_flag & FSEARCH; + flags |= (fde->fde_flags & UF_RESOLVE_BENEATH) != 0 ? + O_RESOLVE_BENEATH : 0; *fsearch = ((fp->f_flag & FSEARCH) != 0); vp = fp->f_vnode; if (__predict_false(vp == NULL || vp->v_type != VDIR)) { @@ -3141,6 +3158,7 @@ fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch) return (EAGAIN); filecaps_fill(&ndp->ni_filecaps); *vpp = vp; + *flagsp = flags; return (0); } #endif @@ -3154,13 +3172,15 @@ fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp) struct componentname *cnp; cap_rights_t rights; int error; + uint8_t flags; td = curthread; rights = *ndp->ni_rightsneeded; cap_rights_set_one(&rights, CAP_LOOKUP); cnp = &ndp->ni_cnd; - error = fget_cap(td, ndp->ni_dirfd, &rights, &fp, &ndp->ni_filecaps); + error = fget_cap(td, ndp->ni_dirfd, &rights, &flags, &fp, + &ndp->ni_filecaps); if (__predict_false(error != 0)) return (error); if (__predict_false(fp->f_ops == &badfileops)) { @@ -3178,6 +3198,10 @@ fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp) */ if ((fp->f_flag & FSEARCH) != 0) cnp->cn_flags |= NOEXECCHECK; + if ((flags & UF_RESOLVE_BENEATH) != 0) { + cnp->cn_flags |= RBENEATH; + ndp->ni_resflags |= NIRES_BENEATH; + } fdrop(fp, td); #ifdef CAPABILITIES @@ -3225,7 +3249,7 @@ out_free: #ifdef CAPABILITIES static int fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, - struct file **fpp, seqc_t *seqp) + uint8_t *flagsp, struct file **fpp, seqc_t *seqp) { struct filedesc *fdp; const struct filedescent *fde; @@ -3234,6 +3258,7 @@ fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, seqc_t seq; cap_rights_t haverights; int error; + uint8_t flags; fdp = td->td_proc->p_fd; fdt = fdp->fd_files; @@ -3245,6 +3270,7 @@ fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, fde = &fdt->fdt_ofiles[fd]; haverights = *cap_rights_fde_inline(fde); fp = fde->fde_file; + flags = fde->fde_flags; if (__predict_false(fp == NULL)) { if (seqc_consistent(fd_seqc(fdt, fd), seq)) return (EBADF); @@ -3273,19 +3299,21 @@ fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, fdrop(fp, td); } *fpp = fp; - if (seqp != NULL) { + if (flagsp != NULL) + *flagsp = flags; + if (seqp != NULL) *seqp = seq; - } return (0); } #else static int fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, - struct file **fpp, seqc_t *seqp __unused) + uint8_t *flagsp, struct file **fpp, seqc_t *seqp __unused) { struct filedesc *fdp; const struct fdescenttbl *fdt; struct file *fp; + uint8_t flags; fdp = td->td_proc->p_fd; fdt = fdp->fd_files; @@ -3294,6 +3322,7 @@ fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, for (;;) { fp = fdt->fdt_ofiles[fd].fde_file; + flags = fdt->fdt_ofiles[fd].fde_flags; if (__predict_false(fp == NULL)) return (EBADF); if (__predict_false(!refcount_acquire_if_not_zero(&fp->f_count))) { @@ -3310,6 +3339,8 @@ fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, break; fdrop(fp, td); } + if (flagsp != NULL) + *flagsp = flags; *fpp = fp; return (0); } @@ -3323,8 +3354,8 @@ fget_unlocked_seq(struct thread *td, int fd, const cap_rights_t *needrightsp, * racing with itself. */ int -fget_unlocked(struct thread *td, int fd, const cap_rights_t *needrightsp, - struct file **fpp) +fget_unlocked_flags(struct thread *td, int fd, const cap_rights_t *needrightsp, + uint8_t *flagsp, struct file **fpp) { struct filedesc *fdp; #ifdef CAPABILITIES @@ -3336,6 +3367,7 @@ fget_unlocked(struct thread *td, int fd, const cap_rights_t *needrightsp, seqc_t seq; const cap_rights_t *haverights; #endif + uint8_t flags; fdp = td->td_proc->p_fd; fdt = fdp->fd_files; @@ -3348,8 +3380,10 @@ fget_unlocked(struct thread *td, int fd, const cap_rights_t *needrightsp, fde = &fdt->fdt_ofiles[fd]; haverights = cap_rights_fde_inline(fde); fp = fde->fde_file; + flags = fde->fde_flags; #else fp = fdt->fdt_ofiles[fd].fde_file; + flags = fdt->fdt_ofiles[fd].fde_flags; #endif if (__predict_false(fp == NULL)) goto out_fallback; @@ -3373,12 +3407,21 @@ fget_unlocked(struct thread *td, int fd, const cap_rights_t *needrightsp, #endif goto out_fdrop; *fpp = fp; + if (flagsp != NULL) + *flagsp = flags; return (0); out_fdrop: fdrop(fp, td); out_fallback: *fpp = NULL; - return (fget_unlocked_seq(td, fd, needrightsp, fpp, NULL)); + return (fget_unlocked_seq(td, fd, needrightsp, flagsp, fpp, NULL)); +} + +int +fget_unlocked(struct thread *td, int fd, const cap_rights_t *needrightsp, + struct file **fpp) +{ + return (fget_unlocked_flags(td, fd, needrightsp, NULL, fpp)); } /* @@ -3530,7 +3573,7 @@ fget_mmap(struct thread *td, int fd, const cap_rights_t *rightsp, fdp = td->td_proc->p_fd; MPASS(cap_rights_is_set(rightsp, CAP_MMAP)); for (;;) { - error = fget_unlocked_seq(td, fd, rightsp, &fp, &seq); + error = fget_unlocked_seq(td, fd, rightsp, NULL, &fp, &seq); if (__predict_false(error != 0)) return (error); if (__predict_false(fp->f_ops == &badfileops)) { @@ -3585,7 +3628,7 @@ fget_fcntl(struct thread *td, int fd, const cap_rights_t *rightsp, *fpp = NULL; MPASS(cap_rights_is_set(rightsp, CAP_FCNTL)); for (;;) { - error = fget_unlocked_seq(td, fd, rightsp, &fp, &seq); + error = fget_unlocked_seq(td, fd, rightsp, NULL, &fp, &seq); if (error != 0) return (error); error = cap_fcntl_check(fdp, fd, needfcntl); @@ -3647,7 +3690,7 @@ fgetvp_rights(struct thread *td, int fd, const cap_rights_t *needrightsp, struct file *fp; int error; - error = fget_cap(td, fd, needrightsp, &fp, &caps); + error = fget_cap(td, fd, needrightsp, NULL, &fp, &caps); if (error != 0) return (error); if (fp->f_ops == &badfileops) { diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 4dca0522f707..86b3731468fa 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -93,7 +93,7 @@ getsock_cap(struct thread *td, int fd, const cap_rights_t *rightsp, struct file *fp; int error; - error = fget_cap(td, fd, rightsp, &fp, havecapsp); + error = fget_cap(td, fd, rightsp, NULL, &fp, havecapsp); if (__predict_false(error != 0)) return (error); if (__predict_false(fp->f_type != DTYPE_SOCKET)) { diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c index 58b950a04cd1..b4b1285400d3 100644 --- a/sys/kern/vfs_acl.c +++ b/sys/kern/vfs_acl.c @@ -435,7 +435,7 @@ sys___acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap) AUDIT_ARG_FD(uap->filedes); error = getvnode_path(td, uap->filedes, - cap_rights_init_one(&rights, CAP_ACL_GET), &fp); + cap_rights_init_one(&rights, CAP_ACL_GET), NULL, &fp); if (error == 0) { error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp); fdrop(fp, td); @@ -570,7 +570,7 @@ sys___acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap) AUDIT_ARG_FD(uap->filedes); error = getvnode_path(td, uap->filedes, - cap_rights_init_one(&rights, CAP_ACL_CHECK), &fp); + cap_rights_init_one(&rights, CAP_ACL_CHECK), NULL, &fp); if (error == 0) { error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp); fdrop(fp, td); diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 3942371c0962..bb9c68e05afc 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4441,17 +4441,23 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) { struct nameidata *ndp; struct componentname *cnp; - int error; - bool fsearch; + int error, flags; ndp = fpl->ndp; cnp = fpl->cnp; - error = fgetvp_lookup_smr(ndp, vpp, &fsearch); + error = fgetvp_lookup_smr(ndp, vpp, &flags); if (__predict_false(error != 0)) { return (cache_fpl_aborted(fpl)); } - fpl->fsearch = fsearch; + if (__predict_false((flags & O_RESOLVE_BENEATH) != 0)) { + _Static_assert((CACHE_FPL_SUPPORTED_CN_FLAGS & RBENEATH) == 0, + "RBENEATH supported by fplookup"); + cache_fpl_smr_exit(fpl); + cache_fpl_aborted(fpl); + return (EOPNOTSUPP); + } + fpl->fsearch = (flags & FSEARCH) != 0; if ((*vpp)->v_type != VDIR) { if (!((cnp->cn_flags & EMPTYPATH) != 0 && cnp->cn_pnbuf[0] == '\0')) { cache_fpl_smr_exit(fpl); diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index dc1bbb58644b..831090f02f90 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -254,7 +254,7 @@ kern_extattr_set_fd(struct thread *td, int fd, int attrnamespace, AUDIT_ARG_TEXT(attrname); error = getvnode_path(td, fd, - cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); + cap_rights_init_one(&rights, CAP_EXTATTR_SET), NULL, &fp); if (error) return (error); @@ -442,7 +442,7 @@ kern_extattr_get_fd(struct thread *td, int fd, int attrnamespace, AUDIT_ARG_TEXT(attrname); error = getvnode_path(td, fd, - cap_rights_init_one(&rights, CAP_EXTATTR_GET), &fp); + cap_rights_init_one(&rights, CAP_EXTATTR_GET), NULL, &fp); if (error) return (error); @@ -598,7 +598,7 @@ kern_extattr_delete_fd(struct thread *td, int fd, int attrnamespace, AUDIT_ARG_TEXT(attrname); error = getvnode_path(td, fd, - cap_rights_init_one(&rights, CAP_EXTATTR_DELETE), &fp); + cap_rights_init_one(&rights, CAP_EXTATTR_DELETE), NULL, &fp); if (error) return (error); @@ -765,7 +765,7 @@ kern_extattr_list_fd(struct thread *td, int fd, int attrnamespace, AUDIT_ARG_FD(fd); AUDIT_ARG_VALUE(attrnamespace); error = getvnode_path(td, fd, - cap_rights_init_one(&rights, CAP_EXTATTR_LIST), &fp); + cap_rights_init_one(&rights, CAP_EXTATTR_LIST), NULL, &fp); if (error) return (error); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index d2a7b4d9d364..37dc48c6a297 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -375,7 +375,7 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf) int error; AUDIT_ARG_FD(fd); - error = getvnode_path(td, fd, &cap_fstatfs_rights, &fp); + error = getvnode_path(td, fd, &cap_fstatfs_rights, NULL, &fp); if (error != 0) return (error); vp = fp->f_vnode; @@ -898,12 +898,17 @@ sys_fchdir(struct thread *td, struct fchdir_args *uap) struct mount *mp; struct file *fp; int error; + uint8_t fdflags; AUDIT_ARG_FD(uap->fd); - error = getvnode_path(td, uap->fd, &cap_fchdir_rights, + error = getvnode_path(td, uap->fd, &cap_fchdir_rights, &fdflags, &fp); if (error != 0) return (error); + if ((fdflags & UF_RESOLVE_BENEATH) != 0) { + fdrop(fp, td); + return (ENOTCAPABLE); + } vp = fp->f_vnode; vrefact(vp); fdrop(fp, td); @@ -1252,6 +1257,10 @@ success: else #endif fcaps = NULL; + if ((nd.ni_resflags & NIRES_BENEATH) != 0) + flags |= O_RESOLVE_BENEATH; + else + flags &= ~O_RESOLVE_BENEATH; error = finstall_refed(td, fp, &indx, flags, fcaps); /* On success finstall_refed() consumes fcaps. */ if (error != 0) { @@ -1939,7 +1948,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, fp = NULL; if (fd != FD_NONE) { - error = getvnode_path(td, fd, &cap_no_rights, &fp); + error = getvnode_path(td, fd, &cap_no_rights, NULL, &fp); if (error != 0) return (error); } @@ -4326,12 +4335,12 @@ out: */ int getvnode_path(struct thread *td, int fd, const cap_rights_t *rightsp, - struct file **fpp) + uint8_t *flagsp, struct file **fpp) { struct file *fp; int error; - error = fget_unlocked(td, fd, rightsp, &fp); + error = fget_unlocked_flags(td, fd, rightsp, flagsp, &fp); if (error != 0) return (error); @@ -4368,7 +4377,7 @@ getvnode(struct thread *td, int fd, const cap_rights_t *rightsp, { int error; - error = getvnode_path(td, fd, rightsp, fpp); + error = getvnode_path(td, fd, rightsp, NULL, fpp); if (__predict_false(error != 0)) return (error); diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index c4c4207af4ff..7f8645e9eedf 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -290,6 +290,8 @@ typedef __pid_t pid_t; /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ +#define FD_RESOLVE_BENEATH 2 /* all lookups relative to fd have + O_RESOLVE_BENEATH semantics */ /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ #define F_RDLCK 1 /* shared or read lock */ diff --git a/sys/sys/file.h b/sys/sys/file.h index bad161d5d46b..7d1a191b4374 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -300,7 +300,7 @@ int fgetvp_read(struct thread *td, int fd, const cap_rights_t *rightsp, struct vnode **vpp); int fgetvp_write(struct thread *td, int fd, const cap_rights_t *rightsp, struct vnode **vpp); -int fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch); +int fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, int *flagsp); int fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp); static __inline __result_use_check bool diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index ecb8c58e5d29..440c5d3d15f9 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -150,6 +150,7 @@ struct filedesc_to_leader { * Per-process open flags. */ #define UF_EXCLOSE 0x01 /* auto-close on exec */ +#define UF_RESOLVE_BENEATH 0x02 /* lookups must be beneath this dir */ #ifdef _KERNEL @@ -280,17 +281,20 @@ struct filedesc_to_leader * int getvnode(struct thread *td, int fd, const cap_rights_t *rightsp, struct file **fpp); int getvnode_path(struct thread *td, int fd, const cap_rights_t *rightsp, - struct file **fpp); + uint8_t *flagsp, struct file **fpp); void mountcheckdirs(struct vnode *olddp, struct vnode *newdp); int fget_cap_noref(struct filedesc *fdp, int fd, const cap_rights_t *needrightsp, struct file **fpp, struct filecaps *havecapsp); int fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, - struct file **fpp, struct filecaps *havecapsp); + uint8_t *flagsp, struct file **fpp, struct filecaps *havecapsp); /* Return a referenced file from an unlocked descriptor. */ int fget_unlocked(struct thread *td, int fd, const cap_rights_t *needrightsp, struct file **fpp); +int fget_unlocked_flags(struct thread *td, int fd, + const cap_rights_t *needrightsp, uint8_t *flagsp, + struct file **fpp); /* Return a file pointer without a ref. FILEDESC_IS_ONLY_USER must be true. */ int fget_only_user(struct filedesc *fdp, int fd, const cap_rights_t *needrightsp, struct file **fpp); diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 7033e5469240..dae714f97aef 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -195,6 +195,7 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, #define NIRES_ABS 0x00000001 /* Path was absolute */ #define NIRES_STRICTREL 0x00000002 /* Restricted lookup result */ #define NIRES_EMPTYPATH 0x00000004 /* EMPTYPATH used */ +#define NIRES_BENEATH 0x00000008 /* O_RESOLVE_BENEATH is to be inherited */ /* * Flags in ni_lcf, valid for the duration of the namei call. From nobody Tue Jul 29 12:49:03 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 4brwC43030z62xQk; Tue, 29 Jul 2025 12:49:04 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC4247Xz3lHb; Tue, 29 Jul 2025 12:49:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793344; 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=ckW9zw0MdTH3wfoLbkjlXtPIvjbxKSsU+mUI/xktN/U=; b=J8CzOP9zyqAbtTWsvDTXYBLWDasxBtWGT//dEdPDFeHnu5Acck6H2us3GcZJt+jzexy+K5 J3Ltpm6f12/Sz4seuTtBGcdapH71XRWqLZgML+cxVQg632EhHgFg4OQ+9JNCpYQfliNlQ3 JS8FBtTO9eMVkzjXNZFlAO6JAEJQSqr7tfjuwxUDYytfOx1w3CkDjrYB9M4Nw8kXQkcDr6 nq+QMFTXzo0rtP1bgxzw9udHXTmD1gLUKFmWf9wFKyPbHEujS7X2wUFkS2e27EuatY/Vt5 bFGU7cLunLW2MYGydtaEm0RgrjILindeGCGZWUkQWgyvpPRNw5qTneFLIZgRDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793344; 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=ckW9zw0MdTH3wfoLbkjlXtPIvjbxKSsU+mUI/xktN/U=; b=lCUZf1SGfg7sEAzySvJKGN0WQ4qmJeEyB/W/cz044FkOotOAayO/TZzNEIRY1rQDKOlEv+ hnN7lJRyMiZyTsuLWNF8StecEAL+YmhjMpingckfvTgtqxNqbU2QpGS/4qvCIaAH+E8OCa M8MhVRuca3tuWr6/ibBw9fe696eFuajZoOTHtcaLCQobFktSUjVtFoLE0pBRThcvcGmOgD yfIDb1JT9jb0X7xcnLWw07wdRZ2AZ+jt06mBfoVwe1Lj/v81w/tKkABKRboARpPRNKSG0a G0JUACBsd7KJ7hW/AD+bD9fdk9Aiqen/jQAUdpaPo9xO/Ref42j7QZIIyvylEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793344; a=rsa-sha256; cv=none; b=yQazE1FCRz79BRs3pq9covxl8mblJYYxlRW2hr38SqRZTGCqFPJ6IuJ904tkfLAjlj7T/X APuZIDtX9wDKyIG1mi7y7cxeCYEfNbauLirAp/sTg+J4vkEiyJtmtRp9nYC/znAgwbz3k0 L8CJ8IscNQzO5KypUdRsbiDgOpg8m/ILOMoTol029iJ2CLiENvRzH844kN55bazwQ5k3Nh FE07O+DnLoiSFHj1uLCEWVfMFcvnMpFMxKh/xplYb8z4s/Hoo5aJrzT5bLD2vz/K9/BZyt /50gXcm36aVdHJVGVvFa6xfdaN8UVvXg/YBoW97sejwsjfizFnZIRHNRkRuziw== 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 4brwC40YbYzY1j; Tue, 29 Jul 2025 12:49:04 +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 56TCn3aP033361; Tue, 29 Jul 2025 12:49:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn3CS033358; Tue, 29 Jul 2025 12:49:03 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:03 GMT Message-Id: <202507291249.56TCn3CS033358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3ad3ab5f9b6e - stable/14 - unix: Set O_RESOLVE_BENEATH on fds transferred between jails 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3ad3ab5f9b6e91efc923bae9799697a823eb7227 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3ad3ab5f9b6e91efc923bae9799697a823eb7227 commit 3ad3ab5f9b6e91efc923bae9799697a823eb7227 Author: Mark Johnston AuthorDate: 2025-06-24 20:05:37 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 unix: Set O_RESOLVE_BENEATH on fds transferred between jails If a pair of jails with different filesystem roots is able to exchange SCM_RIGHTS messages (e.g., using a unix socket in a shared nullfs mount), a process in one jail can open a directory outside of the root of the second jail and then pass the fd to that second jail, allowing the receiving process to escape the jail chroot. Address this using the new FD_RESOLVE_BENEATH flag. When externalizing an SCM_RIGHTS message into the receiving process, automatically set this flag on all new fds where a jail boundary is crossed. This ensures that the receiver cannot do more than access files underneath the directory; in particular, the received fd cannot be used to access vnodes not accessible by the sender. PR: 262179 Reviewed by: kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D50371 (cherry picked from commit 350ba9672a7f4f16e30534a603df577dfd083b3f) --- sys/amd64/conf/SYZKALLER | 5 +++++ sys/kern/uipc_usrreq.c | 31 +++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sys/amd64/conf/SYZKALLER b/sys/amd64/conf/SYZKALLER new file mode 100644 index 000000000000..965841313616 --- /dev/null +++ b/sys/amd64/conf/SYZKALLER @@ -0,0 +1,5 @@ +include GENERIC-KASAN +ident SYZKALLER + +options COVERAGE +options KCOV diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 80ac5cc0b775..4df36221bc6a 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -58,7 +58,6 @@ * need a proper out-of-band */ -#include #include "opt_ddb.h" #include @@ -68,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -2433,22 +2433,34 @@ unp_freerights(struct filedescent **fdep, int fdcount) free(fdep[0], M_FILECAPS); } +static bool +restrict_rights(struct file *fp, struct thread *td) +{ + struct prison *prison1, *prison2; + + prison1 = fp->f_cred->cr_prison; + prison2 = td->td_ucred->cr_prison; + return (prison1 != prison2 && prison1->pr_root != prison2->pr_root && + prison2 != &prison0); +} + static int unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) { struct thread *td = curthread; /* XXX */ struct cmsghdr *cm = mtod(control, struct cmsghdr *); - int i; int *fdp; struct filedesc *fdesc = td->td_proc->p_fd; struct filedescent **fdep; void *data; socklen_t clen = control->m_len, datalen; - int error, newfds; + int error, fdflags, newfds; u_int newlen; UNP_LINK_UNLOCK_ASSERT(); + fdflags = (flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0; + error = 0; if (controlp != NULL) /* controlp == NULL => free control messages */ *controlp = NULL; @@ -2490,11 +2502,14 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) *controlp = NULL; goto next; } - for (i = 0; i < newfds; i++, fdp++) { - _finstall(fdesc, fdep[i]->fde_file, *fdp, - (flags & MSG_CMSG_CLOEXEC) != 0 ? O_CLOEXEC : 0, - &fdep[i]->fde_caps); - unp_externalize_fp(fdep[i]->fde_file); + for (int i = 0; i < newfds; i++, fdp++) { + struct file *fp; + + fp = fdep[i]->fde_file; + _finstall(fdesc, fp, *fdp, fdflags | + (restrict_rights(fp, td) ? + O_RESOLVE_BENEATH : 0), &fdep[i]->fde_caps); + unp_externalize_fp(fp); } /* From nobody Tue Jul 29 12:49:05 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 4brwC52V27z62x43; Tue, 29 Jul 2025 12:49:05 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC51cDbz3lRt; Tue, 29 Jul 2025 12:49:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793345; 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=sCIeVVbgC3OZ/GvDKtYDwb8z6C0vfk4eKJTE6FoesZ4=; b=BHcvEqi0zbhGzz7kV2jSASqG2bNt3K9gyS75tEmib0dr3khPMxANuyVYVLw3YnzSlcohU2 oHuEnS4vhy5w/SF0vVIb8OmmIc/yItZ+3kaFrPbDDViVJM+79udAnDMw2fft8eSyFZvUCk YEVbteLTA9kTsGkK3/Iwq5eB10ZQ5rK++4e3oMfeJpIPuT8ou2JLFmFQwfllTwa3ABqIXn yjWCgg+hyOlLdnR/BFS2Mw5H/XBY5QzrjrpfgJVjwWf/8hz32d0ip+mRvyxgcYKTduKipg 0lGixk4F00oadzLnIGqL6ccAok824n9CPRwZvV92TWDhkkV0qgWWmAJJ1xJMvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793345; 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=sCIeVVbgC3OZ/GvDKtYDwb8z6C0vfk4eKJTE6FoesZ4=; b=iFFiq3Ze5wTtK8Q2Kx5c4Z3Yp3TRl3EZ5B4g3prt4rferjXBgT39V6b/t1VZEH+cDqDEbK 50KR3qDimZGqsUdDy05lCRKbslyn6Ysa4zbyzM1teiUTTlFUvgRZLupeVc48y3WmAt6zhA /Ssk9YsReVGgi37SpPzOS8rw2JalQM5DsqPDgqOsTq79Ls0Mp/45MQN4SyA7YHF746lsWW 55vEbTLlD5JXm6IafRuGVJdmyDknxqPEFS3OLpwR02+Z7yhsYumLArQDTnOvVhu9GC8sK4 AsBYHrqnWmQ5sABU8QBWqASmDrPTCrApP1+Ajn+Y5ZA44OevNhj4PGOuMsGthQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793345; a=rsa-sha256; cv=none; b=MfRRN7B/kz2vFZExEBGD6JXcQ+ovMErOQDQZaT9zIuTmWWefFKGmhGostD6+FdsDtgx78t DpsBdQyCHw2SzQzRvW2AkiFwpaVIbVRTGX970uKUUCl21Jkd1PD209uJv9+Mttq02ABCxl YYiX06l5D9pqDtHq5zt0TMoyCMss3G04IRwPAY6tDVea9CRwITstuSRr1VcMA4BttwOPVy R1nYrkpjmOdd3BjyxKrdmFWDFxzwT3IE4HsmyKy3s5GqeEKVpIomN9taqHPODkgL3C2DeC GgxT+8DGtWcL4UJVCYcgaHVHoT/D2lPZd/YVWvW2/DPEy/TvASHmEovm8sD8EA== 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 4brwC51B1hzXVp; Tue, 29 Jul 2025 12:49:05 +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 56TCn5HR033397; Tue, 29 Jul 2025 12:49:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn57J033393; Tue, 29 Jul 2025 12:49:05 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:05 GMT Message-Id: <202507291249.56TCn57J033393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ac2279ea57b7 - stable/14 - unix/tests: Add a regression test for fd transfer across jails 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ac2279ea57b72d688cf0af5a6fa7f5dbd1d4521b Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ac2279ea57b72d688cf0af5a6fa7f5dbd1d4521b commit ac2279ea57b72d688cf0af5a6fa7f5dbd1d4521b Author: Mark Johnston AuthorDate: 2025-06-24 20:08:22 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 unix/tests: Add a regression test for fd transfer across jails MFC after: 3 weeks (cherry picked from commit 5843b8ee02e99527c28f579acfc1f48e10033529) --- tests/sys/kern/Makefile | 2 + tests/sys/kern/unix_passfd_test.c | 131 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index cb6c3066a03d..ba53e8ffe40d 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -88,6 +88,8 @@ LIBADD.sendfile_helper+= pthread LIBADD.fdgrowtable_test+= util pthread kvm procstat LIBADD.sigwait+= rt LIBADD.ktrace_test+= sysdecode +LIBADD.unix_passfd_dgram+= jail +LIBADD.unix_passfd_stream+= jail NETBSD_ATF_TESTS_C+= lockf_test NETBSD_ATF_TESTS_C+= mqueue_test diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index d8c0efe5b9ea..dd68020e1bc4 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -28,15 +28,19 @@ #include #include +#include #include #include #include #include #include #include +#include +#include #include #include +#include #include #include #include @@ -946,6 +950,132 @@ ATF_TC_BODY(empty_rights_message, tc) (void)close(putfd); } +ATF_TC_WITH_CLEANUP(cross_jail_dirfd); +ATF_TC_HEAD(cross_jail_dirfd, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(cross_jail_dirfd, tc) +{ + int error, sock[2], jid1, jid2, status; + pid_t pid1, pid2; + + domainsocketpair(sock); + + error = mkdir("./a", 0755); + ATF_REQUIRE(error == 0); + error = mkdir("./b", 0755); + ATF_REQUIRE(error == 0); + error = mkdir("./c", 0755); + ATF_REQUIRE(error == 0); + error = mkdir("./a/c", 0755); + ATF_REQUIRE(error == 0); + + jid1 = jail_setv(JAIL_CREATE, + "name", "passfd_test_cross_jail_dirfd1", + "path", "./a", + "persist", NULL, + NULL); + ATF_REQUIRE_MSG(jid1 >= 0, "jail_setv: %s", jail_errmsg); + + jid2 = jail_setv(JAIL_CREATE, + "name", "passfd_test_cross_jail_dirfd2", + "path", "./b", + "persist", NULL, + NULL); + ATF_REQUIRE_MSG(jid2 >= 0, "jail_setv: %s", jail_errmsg); + + pid1 = fork(); + ATF_REQUIRE(pid1 >= 0); + if (pid1 == 0) { + ssize_t len; + int dfd, error; + char ch; + + error = jail_attach(jid1); + if (error != 0) + err(1, "jail_attach"); + + dfd = open(".", O_RDONLY | O_DIRECTORY); + if (dfd < 0) + err(1, "open(\".\") in jail %d", jid1); + + ch = 0; + len = sendfd_payload(sock[0], dfd, &ch, sizeof(ch)); + if (len == -1) + err(1, "sendmsg"); + + _exit(0); + } + + pid2 = fork(); + ATF_REQUIRE(pid2 >= 0); + if (pid2 == 0) { + int dfd, dfd2, error, fd; + char ch; + + error = jail_attach(jid2); + if (error != 0) + err(1, "jail_attach"); + + /* Get a directory from outside the jail root. */ + recvfd_payload(sock[1], &dfd, &ch, sizeof(ch), + CMSG_SPACE(sizeof(int)), 0); + + if ((fcntl(dfd, F_GETFD) & FD_RESOLVE_BENEATH) == 0) + errx(1, "dfd does not have FD_RESOLVE_BENEATH set"); + + /* Make sure we can't chdir. */ + error = fchdir(dfd); + if (error == 0) + errx(1, "fchdir succeeded"); + if (errno != ENOTCAPABLE) + err(1, "fchdir"); + + /* Make sure a dotdot access fails. */ + fd = openat(dfd, "../c", O_RDONLY | O_DIRECTORY); + if (fd >= 0) + errx(1, "openat(\"../c\") succeeded"); + if (errno != ENOTCAPABLE) + err(1, "openat"); + + /* Accesses within the sender's jail root are ok. */ + fd = openat(dfd, "c", O_RDONLY | O_DIRECTORY); + if (fd < 0) + err(1, "openat(\"c\")"); + + dfd2 = openat(dfd, "", O_EMPTY_PATH | O_RDONLY | O_DIRECTORY); + if (dfd2 < 0) + err(1, "openat(\"\")"); + if ((fcntl(dfd2, F_GETFD) & FD_RESOLVE_BENEATH) == 0) + errx(1, "dfd2 does not have FD_RESOLVE_BENEATH set"); + + _exit(0); + } + + error = waitpid(pid1, &status, 0); + ATF_REQUIRE(error != -1); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + error = waitpid(pid2, &status, 0); + ATF_REQUIRE(error != -1); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + closesocketpair(sock); +} +ATF_TC_CLEANUP(cross_jail_dirfd, tc) +{ + int jid; + + jid = jail_getid("passfd_test_cross_jail_dirfd1"); + if (jid >= 0 && jail_remove(jid) != 0) + err(1, "jail_remove"); + jid = jail_getid("passfd_test_cross_jail_dirfd2"); + if (jid >= 0 && jail_remove(jid) != 0) + err(1, "jail_remove"); +} + ATF_TP_ADD_TCS(tp) { @@ -964,6 +1094,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, truncated_rights); ATF_TP_ADD_TC(tp, copyout_rights_error); ATF_TP_ADD_TC(tp, empty_rights_message); + ATF_TP_ADD_TC(tp, cross_jail_dirfd); return (atf_no_error()); } From nobody Tue Jul 29 12:49:06 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 4brwC64BWwz62xSq; Tue, 29 Jul 2025 12:49:06 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC62fBCz3lS2; Tue, 29 Jul 2025 12:49:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793346; 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=dPrrD95xI9ljqFLKOqRgms+GhvWSemkVG93qZs+8fdI=; b=Aza2EaFPkP12ruyCGBm8GiLQ+sPbRUnOcNRNi7FOca7B72A9lfeDCFt853VfvuRpu2sUYJ QIo7rwyeM6rg+J+pNPUv0J4KfnG8ZsvdWqxn+H5k1aUBwD9jZ3RwRvRm+zcwBq+hb6gGZm tOkMB2AoxZIAQkQ16UUkJobElAUNwAGMphoemkhD5g72XLjbYKOOp1rjpAxUplLywbol65 iegwFIhlB3tklla0cECKaxwqvv4tzyrEG7VBL9vxqvb6INJg6H8CjfZnplxJriMMmslPnS c9bc383MU1LBXMuEGkoAInf0dr5d3LEw6n3BoxAifDQe2VrMLoSA1ZAXZeTrEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793346; 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=dPrrD95xI9ljqFLKOqRgms+GhvWSemkVG93qZs+8fdI=; b=FVCf/PUqzsafKTt23MoVw8be34HfDneK4hev8056YKn6kN+805Z4YqeRiEL9/Tup0iZrKR J53E3ie20YJsGg4kxLF/WB2man87QZtg2Jbl6GCN7irMmaxA+o1xSYeTnF1nF66IOWYuiQ cv+MdHVPSsKef8CxerZuSzhMAVvBAnZOrJvgRvWqLBMtZ7NXNHlhiy+5tI4D6GjeBXDWDu WZ9kGP1rdtyOVNHdQGSc3QQrHwYJLcCstq7RZjBOzydhlEq35P6A888+2wZnYBOt+6pzPU xAt9bUkkD6ooi+5Ki5l2kAjNC4I1aJEDTew/NoqhZlqkILwmByhVnMv3Zq6PnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793346; a=rsa-sha256; cv=none; b=jElD5JJ9SMAL/voF1JjZlJAvIgTkEUKGcRBVNsWu0LU0x+RsvSLRp8nkLJnP4KtaINdclj En8VmElWpOlrgX5d0bArETj7+Mbipi47MvUaQMgCd+/w3Yy+Mox5YEv/EyATlMnCUZfwL4 S1jdHEKCmivWaJsluWtClkEE6VOTqiiNJPaR/NNBbMwuzEWvPJLYBBmV4n3i+BI78Ur1jO iqW8/vHvsGHI430PCfjVJC5gsri9O4IRBkmeRZpITW+AS4pkawhuQu7xuf1lIOkskXrG9I 8R/yebSgExDNwB3uDiZBPnI9HgzzOQwMAPSRJB43iJuwo7k4u6bqB6TftBKJqQ== 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 4brwC61m9mzXVq; Tue, 29 Jul 2025 12:49:06 +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 56TCn6i9033431; Tue, 29 Jul 2025 12:49:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn61H033428; Tue, 29 Jul 2025 12:49:06 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:06 GMT Message-Id: <202507291249.56TCn61H033428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: afe2a4025c1f - stable/14 - savecore/tests: Serialize the livedump test 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: afe2a4025c1fbb9efb62bfbe59e50e573c7124d3 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=afe2a4025c1fbb9efb62bfbe59e50e573c7124d3 commit afe2a4025c1fbb9efb62bfbe59e50e573c7124d3 Author: Mark Johnston AuthorDate: 2025-07-02 15:04:25 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 savecore/tests: Serialize the livedump test It assumes that the output of kldstat doesn't change over the course of the test, but this isn't true with parallel tests enabled. MFC after: 2 weeks (cherry picked from commit 3e041faa828a359ef0b91b5203eed5ab2c11e42d) --- sbin/savecore/tests/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/savecore/tests/Makefile b/sbin/savecore/tests/Makefile index 81e6b8ce2667..7ec3c9aeedcc 100644 --- a/sbin/savecore/tests/Makefile +++ b/sbin/savecore/tests/Makefile @@ -1,3 +1,6 @@ ATF_TESTS_SH= livedump_test log_test +# The test fails if any kernel modules are loaded while the test is running. +TEST_METADATA.livedump_test+= is_exclusive=true + .include From nobody Tue Jul 29 12:49:07 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 4brwC75cSFz62xSr; Tue, 29 Jul 2025 12:49:07 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC72x1mz3lBw; Tue, 29 Jul 2025 12:49:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793347; 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=421g4m5ZJfF70pZesdQLNvZsLd16Dq7FpZGtNyBcGz0=; b=blvGMp+6a0LGfaqHO754LogxfylajkkjNtJEAwZnzqNDIBn8wJQZZg2D4HvwXtrYTaV5XE YKXul9nB4Pkff6wUGInCWlK0l2peBEDdvP5yJhQX3goaiU0ybtflfbW0opbG0M59hbj/5W Th9Dumfe5lmsRC9ZRFYBNDtmV5tnAvv7dXu/D0nSX7eV+4Dhc0McVZt+/zCM6xthMT27dc Z6TD6PBCajWlO1GgpLPf++8bLf6tJAX6a3+29l0u+UcDpFF5Vw0FWL/or502uNXVcwOJkn GKxtVZ+gHXeKSziUuNX+sMl1uEmIu+xfKXuQLur3kxC2Ale2WfEyVtrVrdgDlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793347; 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=421g4m5ZJfF70pZesdQLNvZsLd16Dq7FpZGtNyBcGz0=; b=GXsKaJOvq9eCcYrHwGVOqW+2hDzvhMa/QkWCObe3c1X/+XTBkejBCztWXTtIlxuAyXnrgA y1arbovVs8X1NiNFNhL2/hwbCzDn7Mx60zFSkk4F8Hio7hMV183zJOSOO+4hr9VfpZSz/4 a/093jjQq7V9zdmevu+J+oqvoEbALSKcBkq9bICB87CgcKuOoIawFByYrdS5KQcamz4QVE k0VNduqCkgqbfSI22GhErzZmveMDZB1mK+gQduKTlQJFm+W3ICs/BabXkMaiS73CZNjh4w 7Xv75sh/u9CQjpCGmQcQRJTikJdostsXzWtglplMLMWecBscqbTx0j9M2Oz1TA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793347; a=rsa-sha256; cv=none; b=PdmWEplI1JVu84aSLnVgtHXdXccRvrEJDXNtr0RwxqGYwxtC4pe+OE0Ydw05fe2GhLzeb4 kBHqfsLD6VUaPj1IeB/SZtbJWXXRGPh46ZsWkwokrNT0w0FviYqLlvKaKAZQAKXGSGyvxS n3h/vm6YaLgaYbbrrJbjL0QP4CP3j392Tyj6Ldzpt5GXLTusOG48uuH9x6s8zqmKX7zNxT EIXmGNGvXDPqLS+1+mEuwud+xX07W8mNnV1IwoOqoNos1AkJxL9zJeQvl9KCZGOv7OLo5g 22sFfnKwFuS9g0+ZagdyUZlInitNSVo+nfweFusrAO9kUPkTPV/des6V9LKm2g== 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 4brwC726VHzXq2; Tue, 29 Jul 2025 12:49:07 +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 56TCn73e033464; Tue, 29 Jul 2025 12:49:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn7xb033461; Tue, 29 Jul 2025 12:49:07 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:07 GMT Message-Id: <202507291249.56TCn7xb033461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: cd0359507027 - stable/14 - lposix: Use reentrant passwd and group lookup functions 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cd03595070272fa97b0f3c9ca78e9d828918580b Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cd03595070272fa97b0f3c9ca78e9d828918580b commit cd03595070272fa97b0f3c9ca78e9d828918580b Author: Mark Johnston AuthorDate: 2025-07-04 19:06:10 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 lposix: Use reentrant passwd and group lookup functions The implementation of chown() in the posix module handles user and group names as well as numeric IDs. When resolving names, be sure to use reentrant lookup functions rather than assuming it's safe to clobber the internal buffers used by getpwnam() and getgrnam(). Fix some style nits while here. Reviewed by: imp, bapt MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46555 (cherry picked from commit 88d94ead7f7cfb7ea7c4134b4cd2f89da670a8e1) --- libexec/flua/modules/lposix.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/libexec/flua/modules/lposix.c b/libexec/flua/modules/lposix.c index fa3fd5f8e589..bc55f35a942a 100644 --- a/libexec/flua/modules/lposix.c +++ b/libexec/flua/modules/lposix.c @@ -68,19 +68,24 @@ lua_chown(lua_State *L) { int n; const char *path; - uid_t owner = (uid_t) -1; - gid_t group = (gid_t) -1; + uid_t owner = (uid_t)-1; + gid_t group = (gid_t)-1; + int error; n = lua_gettop(L); luaL_argcheck(L, n > 1, n, "chown takes at least two arguments"); path = luaL_checkstring(L, 1); if (lua_isinteger(L, 2)) - owner = (uid_t) lua_tointeger(L, 2); + owner = (uid_t)lua_tointeger(L, 2); else if (lua_isstring(L, 2)) { - struct passwd *p = getpwnam(lua_tostring(L, 2)); - if (p != NULL) - owner = p->pw_uid; + char buf[4096]; + struct passwd passwd, *pwd; + + error = getpwnam_r(lua_tostring(L, 2), &passwd, + buf, sizeof(buf), &pwd); + if (error == 0) + owner = pwd->pw_uid; else return (luaL_argerror(L, 2, lua_pushfstring(L, "unknown user %s", @@ -93,11 +98,15 @@ lua_chown(lua_State *L) } if (lua_isinteger(L, 3)) - group = (gid_t) lua_tointeger(L, 3); + group = (gid_t)lua_tointeger(L, 3); else if (lua_isstring(L, 3)) { - struct group *g = getgrnam(lua_tostring(L, 3)); - if (g != NULL) - group = g->gr_gid; + char buf[4096]; + struct group gr, *grp; + + error = getgrnam_r(lua_tostring(L, 3), &gr, buf, sizeof(buf), + &grp); + if (error == 0) + group = grp->gr_gid; else return (luaL_argerror(L, 3, lua_pushfstring(L, "unknown group %s", From nobody Tue Jul 29 12:49:08 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 4brwC949qwz62xMv; Tue, 29 Jul 2025 12:49:09 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC84Jvlz3lNb; Tue, 29 Jul 2025 12:49:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793348; 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=KiwhLSEKmGE/vwaJuiSEGWpsi+2A/5GYNJayDP85l8w=; b=YkAx8wj1Oeqbay4HZgs8oQ8fBl1T37iV+V0vNtrqLN09+iEOfh5jPUTXh1Ymuq46C8LguB Zcy3EdAtzysnl4QdCgzFg+yukz3Gf6Uzv45RYpFi49eZVgHJL3WFn9P5+BPHBvhpjRqbM6 cj18nBtl/28VSGhP6VDQrp6WsGmJu5YNDQxV/CeAocwiF1DxdCeoYCYAKfm7egi4a8WDmy TSZytJvP6f77yStXnrYEHK4fpMydDVIZOhYptDpRhJQ7qq0ofpph1VtmLtf9p16DRzlmor 6MttkgZZWbsibCQGa3RhhfTX81enmZQJR5Qb95SYNUl/l+UlPZXs0Ys5qOiDDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793348; 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=KiwhLSEKmGE/vwaJuiSEGWpsi+2A/5GYNJayDP85l8w=; b=cM0CTQ+7M8aPbO83B4j8lClDsx6OGkOgMF4dRhaP8gmYxgs8V5Iv7bWH+d2BLHfriHEZxn vDlwtWlmNsbApg5Ox7bWeQPEK1dP53HFZthK9mt8ESV8ueijT9BXI/9h/E0KAwFNhclrGr eRy0N8MqcQSlPpH6QXCnxsb2PZTtiW3njYZ1vE+k8eEV5uPVaAwEcI14/C05ZZtVM66vv7 QRil+LJJwSkKc5fBG4uh/e3eRT4KyCbFx4t2tSIGyvDwsz6HEsckzT9l/nzgxMoYXBejbU SM4mvk+McwKe7bImAo/BM/q3iygTjK5eby7IfM1JcAF20Me0a5VbUbbFBbdLQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793348; a=rsa-sha256; cv=none; b=TQw9AiK+MWWDGd5WwP1I5uJQc5V/pmwfMLaL8PbhTZKWI73x9OC9Rl3fnyw70qtgfrscBm BQtUkJBKuDQgMdWT/P0HnTXf1FmqOgtVVb6Idbky9fXKSKjnTdni2Edm6DQl5kuapmY+Pw j+HIhbZtqphLZB3HSOHaqNotLQC5/BpeEQT7upQgkZyuzeXujAR9tKe6KH3A6gY/nDdOJs 2bVNSwxzlRDUeCuQG5C5qvNeKWzH2LQVvKL82hKNifjOzSvdSkLTjn5qtN4tB5Bw9oRKoP ZIVAD6BVg8R9tJ0gaKF+y4/PjYwN5II3iyl7Fn5YDZGjzapIdVhHyimUBEgA8A== 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 4brwC82y83zXNx; Tue, 29 Jul 2025 12:49:08 +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 56TCn82D033497; Tue, 29 Jul 2025 12:49:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn8MF033494; Tue, 29 Jul 2025 12:49:08 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:08 GMT Message-Id: <202507291249.56TCn8MF033494@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e9e13081931f - stable/14 - dtrace: fix symbol address resolution 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e9e13081931f7dbe8e785d15502b07aab6267b26 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e9e13081931f7dbe8e785d15502b07aab6267b26 commit e9e13081931f7dbe8e785d15502b07aab6267b26 Author: Jiacong Fang AuthorDate: 2025-07-07 18:51:51 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 dtrace: fix symbol address resolution Dtrace assumes only ELF sections of type SHT_PROGBITS or SHT_NOBITS occupy memory space. However, sections with SHF_ALLOC flag also consume memory space. Moreover, the symbol address initialization skips symbols at the very beginning of a section in ET_REL KLDs. Fix: Check section flag for calculating section offset, and disable the skipping at the beginning of a section. PR: 288000 Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51188 (cherry picked from commit 12bef37a824c52582ee8f38699b8ae4fde17068d) --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 2a0386c33124..f6a328bb9b39 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -109,8 +109,7 @@ dt_module_syminit32(dt_module_t *dmp) if (sym->st_name == 0 || sym->st_name >= ss_size) continue; /* skip null or invalid names */ - if (sym->st_value != 0 && - (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) { + if (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) { asrsv++; /* reserve space in the address map */ #if defined(__FreeBSD__) @@ -159,8 +158,7 @@ dt_module_syminit64(dt_module_t *dmp) if (sym->st_name == 0 || sym->st_name >= ss_size) continue; /* skip null or invalid names */ - if (sym->st_value != 0 && - (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) { + if (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) { asrsv++; /* reserve space in the address map */ #if defined(__FreeBSD__) sym->st_value += (Elf_Addr) dmp->dm_reloc_offset; @@ -245,8 +243,7 @@ dt_module_symsort32(dt_module_t *dmp) for (i = 1; i < n; i++, dsp++) { Elf32_Sym *sym = symtab + dsp->ds_symid; - if (sym->st_value != 0 && - (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) + if (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) *sympp++ = sym; } @@ -269,8 +266,7 @@ dt_module_symsort64(dt_module_t *dmp) for (i = 1; i < n; i++, dsp++) { Elf64_Sym *sym = symtab + dsp->ds_symid; - if (sym->st_value != 0 && - (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) + if (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) *sympp++ = sym; } @@ -1218,7 +1214,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) continue; /* skip any malformed sections */ if (sh.sh_size == 0) continue; - if (sh.sh_type == SHT_PROGBITS || sh.sh_type == SHT_NOBITS) { + if (sh.sh_flags & SHF_ALLOC) { alignmask = sh.sh_addralign - 1; mapbase += alignmask; mapbase &= ~alignmask; From nobody Tue Jul 29 12:49:09 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 4brwC974qGz62xQr; Tue, 29 Jul 2025 12:49:09 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwC954DJz3lSs; Tue, 29 Jul 2025 12:49:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793349; 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=fKz3XhMk18ZZ74YqDAOufgX0tXNPTnFYAcoxjewXFOY=; b=pMsg8X98ayA0J7yoqPzQxpc9TFKV8MUFAl8KSMje66YNefYUHV8wqVDDBmWB4XDO+ORPmF Oju3jWCxO/LsDnMNUiUe3uZs8RfDw7iGla+j3/eS3r5yPhcMOXTmWw76Ez7yas+uo8VIA1 BsfNv7rh7JcKXVrUqXUvMUhpAC6L6yh98gRmI01GkazwaczEzpmYqUNeQ+rwnJ/L07jegk RxNXE9vpN+wy0uVkaLEJEA6HlQQ4Q7ALsD+3yp3ZE9eeskN5FP/NWDvXcLVjADhCFDYGX2 NNqsq1hdKta3iNauxK3p8Rr+OU67/d/y7CoOzsBr+YcCiSbFKUzVCHF0009fJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793349; 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=fKz3XhMk18ZZ74YqDAOufgX0tXNPTnFYAcoxjewXFOY=; b=uwwtuXntQNVrdB8xxfthGUR+WJEDSmoQb0mO2NtBdgPmPRe27PYDpNk5jmkc/btiyAcS14 hejVzdBYVbas44tKTqrkd6h6GMRRAEpqMRm4d9EguN2cdnX+0T/xS1xtInle2cjMkOjH9W IhfPNQChOyW8nuP4p2FtfTF/8bPpkM6w+n1/FUCtmF0puH4K1VVpqigzfQWm2JXufi8B94 cwN7pyawBWQECLq0yFyydqa4HK6/uOEin3ujbgOtCPVovchjJvRQ+QmQETJj0HlUiEAsNE 90nOEPWA2mm5uSAyWYaA5HH8axevmSVvSqDPcYHb0n0xBV15/toylarK0Nyvaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793349; a=rsa-sha256; cv=none; b=gyIGatPbFQPEVwWXIBWNpTBwXXzMmFU2KOSs8l177vI/onbX5BjLvGHBvc4lymHOksAvWo T0kabF0F/lYfWAY9FBv3j36QGO+wXjORRvV1/W88ud12Hv51MxMf7mSqkIYo6EucrDONpo he2G8hsnKvCt6Y/gjI7sEyl+MxyxrADlPZx+XwDriq13yBm48T4JoVaOv1WgD9TYbe6i4N 7WLR37eAkl9A8eqkerWCD/SihOiEkl6bnIeQAISvBvTlqmThRhquFub53eWfCKhbEKg8X4 +tG5g/ENZ30LopEZRsibVXMUEQX9KT5mJh8FFZH+jHQMXzJgJhU7EPw20nfNDA== 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 4brwC93vydzXNy; Tue, 29 Jul 2025 12:49:09 +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 56TCn9Jh033535; Tue, 29 Jul 2025 12:49:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCn9Y4033532; Tue, 29 Jul 2025 12:49:09 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:09 GMT Message-Id: <202507291249.56TCn9Y4033532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 414a01b9e62b - stable/14 - mkimg: Add a reproducible mode 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 414a01b9e62bdd6b10bbae87b0df52983bf4ca14 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=414a01b9e62bdd6b10bbae87b0df52983bf4ca14 commit 414a01b9e62bdd6b10bbae87b0df52983bf4ca14 Author: Mark Johnston AuthorDate: 2025-06-26 14:28:14 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 mkimg: Add a reproducible mode mkimg embeds a UUID in the GPT header and uses the current time of day to generate it, so its output is not reproducible by default. Add a -R flag to ask it to use a fixed time for UUID generation. Merge the FreeBSD-specific implementation of osdep_uuidgen() with that of Linux, as the use of uuidgen(2) is incompatible with reproducible output mode. Reviewed by: bnovkov MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D49716 (cherry picked from commit 95ac5b0e27e9070ba91c28f9a6ecbed743d148cb) --- usr.bin/mkimg/mkimg.1 | 8 +++++++- usr.bin/mkimg/mkimg.c | 10 +++++++++- usr.bin/mkimg/mkimg.h | 3 +++ usr.bin/mkimg/uuid.c | 19 +++++-------------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/usr.bin/mkimg/mkimg.1 b/usr.bin/mkimg/mkimg.1 index 82bbee53a267..f6b151d2d5c7 100644 --- a/usr.bin/mkimg/mkimg.1 +++ b/usr.bin/mkimg/mkimg.1 @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 12, 2024 +.Dd June 25, 2025 .Dt MKIMG 1 .Os .Sh NAME @@ -41,6 +41,7 @@ .Op Fl f Ar format .Op Fl o Ar outfile .Op Fl a Ar active +.Op Fl R .Op Fl v .Op Fl y .Op Fl s Ar scheme Op Fl p Ar partition ... @@ -138,6 +139,11 @@ option is a shorthand to specify the minimum and maximum capacity at the same time. .Pp The +.Fl R +option enables reproducible mode: any timestamps or random identifiers will +be fixed so as to ensure consistent output. +.Pp +The .Fl v option increases the level of output that the .Nm diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index f3bb9cb05708..58bf90fd5ad4 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -62,6 +62,8 @@ static struct option longopts[] = { static uint64_t min_capacity = 0; static uint64_t max_capacity = 0; +bool reproducible = false; + struct partlisthead partlist = TAILQ_HEAD_INITIALIZER(partlist); u_int nparts = 0; @@ -562,7 +564,7 @@ main(int argc, char *argv[]) bcfd = -1; outfd = 1; /* Write to stdout by default */ - while ((c = getopt_long(argc, argv, "a:b:c:C:f:o:p:s:vyH:P:S:T:", + while ((c = getopt_long(argc, argv, "a:b:c:C:f:o:p:s:vyH:P:RS:T:", longopts, NULL)) != -1) { switch (c) { case 'a': /* ACTIVE PARTITION, if supported */ @@ -607,6 +609,9 @@ main(int argc, char *argv[]) if (error) errc(EX_DATAERR, error, "partition"); break; + case 'R': + reproducible = true; + break; case 's': /* SCHEME */ if (scheme_selected() != NULL) usage("multiple schemes given"); @@ -676,6 +681,9 @@ main(int argc, char *argv[]) if (max_capacity != 0 && min_capacity > max_capacity) usage("minimum capacity cannot be larger than the maximum one"); + if (reproducible) + srandom(42); + if (secsz > blksz) { if (blksz != 0) errx(EX_DATAERR, "the physical block size cannot " diff --git a/usr.bin/mkimg/mkimg.h b/usr.bin/mkimg/mkimg.h index e85f77de0ec7..608de458e83c 100644 --- a/usr.bin/mkimg/mkimg.h +++ b/usr.bin/mkimg/mkimg.h @@ -29,6 +29,9 @@ #include #include +#include + +extern bool reproducible; /* Generate reproducible output. */ struct part { TAILQ_ENTRY(part) link; diff --git a/usr.bin/mkimg/uuid.c b/usr.bin/mkimg/uuid.c index 470d92c76293..f3415a8c1111 100644 --- a/usr.bin/mkimg/uuid.c +++ b/usr.bin/mkimg/uuid.c @@ -45,20 +45,9 @@ osdep_uuidgen(mkimg_uuid_t *uuid) } #endif /* __APPLE__ */ -#ifdef __FreeBSD__ -#include - -static void -osdep_uuidgen(mkimg_uuid_t *uuid) -{ - - uuidgen((void *)uuid, 1); -} -#endif /* __FreeBSD__ */ - -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) +#include #include -#include static void osdep_uuidgen(mkimg_uuid_t *uuid) @@ -68,7 +57,9 @@ osdep_uuidgen(mkimg_uuid_t *uuid) u_int i; uint16_t seq; - if (gettimeofday(&tv, NULL) == -1) + if (reproducible) + memset(&tv, 0, sizeof(tv)); + else if (gettimeofday(&tv, NULL) == -1) abort(); time += (uint64_t)tv.tv_sec * 10000000LL; From nobody Tue Jul 29 12:49:10 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 4brwCB6xQBz62xMy; Tue, 29 Jul 2025 12:49:10 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCB4wTNz3lbY; Tue, 29 Jul 2025 12:49:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793350; 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=D8/zqK77CRaXsNb5RbqE1nhpJEHTnetrlkiNmcnNf4g=; b=cXlmxDwI9/7v+DPCrMFpoN24ZA+0ciDC8ywjUln8cVFySuB/DZugiEm7LdmBLOj1g7Flw/ iANnLhx3+wXeT99xVXLpneW8lPZ1Yxw5WyZR+hmfyhFG0ow5/IJ7fJM5hRI5xAu/81eyLa /qpwOBM9Mh/bt7ADuvwQOX59AvNteUgbT6KRm5weWGg9keHrWl2a8I+uzvrVxHkHyNZGUp +EElPj962Kv68DOhVQvpnEL0WrS71X04aXZcWkoKrweT03qzGqQ8Xfz2H84C0IUjd8rXS7 PE+UdMGAhc3lOFp+A5p/UckHhyffKEXPHRQodPJODEbQdVnd8n/b8i1bkG6MBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793350; 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=D8/zqK77CRaXsNb5RbqE1nhpJEHTnetrlkiNmcnNf4g=; b=KTIqOc5WIpaQTJKpe1PaRWu05/4BopTtUF3NN/wB39BmsAfN8vAvrqETAE/d3kAxV+nMMX ITRTrL6Z0jh2Nz9qFHqHeacNlBRVhwZcOOhaYA2PBA4z7lAaFSHu/2izsrUcvP9LvVyAan qvY5q5PrgUHddCmG3SAxXjYMjJoRuJzEzeyqOFvtGzNujXMw8QuQAbIH6MKJEwpKwA4MVp XtBQ/R1UfCIK8p0ajhUB7k6sUO9TtZx48miQNjS+x6dLhZuM2v+EkvOH1mwfJ/BN7P3NFO 0bbQ1p4tznBvgHNZkp4eYIDKTJnkSQeUkukTAFmLIGUAVV3kXTtk+EtdfQB2yw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793350; a=rsa-sha256; cv=none; b=KnJpk5xZE25OSWXDBRBEhNZ7Jt0W8EUmpUQGPxWeTzrP6IB2+6ulK3S1PlL7yE1yKFBP27 q1jqrORE1upq1OqaiXRk4+WJ6YzAsDjdrYP1045YU3EN1uCZ1jsCNHIwU2ITvWmUm2omt5 Xmu41f1RHakN925DxajWOstx9ON0m44+gavLqVaFgLBgGCCcIJrsrKE7w+JZrv7eu2lFYS vPNv9tGFgR6CXtJMK13mddRqgUtRdmZnotTMIdESrlfXxnJeaYQP4b30hj3ASni87BdoTz MvGlxbkyjHs+QQ5v+nq02C3Ha1hZ4ysOYVxbwTYV90cQFw9dRrEHMd9LOCmusQ== 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 4brwCB4XGBzXZd; Tue, 29 Jul 2025 12:49:10 +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 56TCnAxZ033567; Tue, 29 Jul 2025 12:49:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnAur033564; Tue, 29 Jul 2025 12:49:10 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:10 GMT Message-Id: <202507291249.56TCnAur033564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f6ed43d346b1 - stable/14 - mkimg: Make output reproducible using a specific timestamp 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f6ed43d346b1a79f62e33e3a3fe001d3fc5bcbde Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f6ed43d346b1a79f62e33e3a3fe001d3fc5bcbde commit f6ed43d346b1a79f62e33e3a3fe001d3fc5bcbde Author: Mark Johnston AuthorDate: 2025-07-07 20:27:24 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 mkimg: Make output reproducible using a specific timestamp In commit 95ac5b0e27e9 ("mkimg: Add a reproducible mode"), I added a -R flag to mkimg, indicating that output should be reproducible. There is one place in the VHD image backend that uses time(3) to populate an image metadata field; this field is visible to tools which know how to process VHD images. Rather than picking an arbitrary value for that timestamp, it seems better to behave like makefs(8) and let the invoker pick a suitable timestamp. So, remove -R and instead add a -t option which lets the timestamp be specified directly. Then, modify the VHD backend to use that timestamp. Fixes: 95ac5b0e27e9 ("mkimg: Add a reproducible mode") Reviewed by: bnovkov MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51077 (cherry picked from commit 393fefa3d9c78948d911e5de0182a9b858b23475) --- usr.bin/mkimg/mkimg.1 | 8 ++++---- usr.bin/mkimg/mkimg.c | 24 ++++++++++++++++-------- usr.bin/mkimg/mkimg.h | 4 ++-- usr.bin/mkimg/uuid.c | 7 ++++--- usr.bin/mkimg/vhd.c | 2 +- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/usr.bin/mkimg/mkimg.1 b/usr.bin/mkimg/mkimg.1 index f6b151d2d5c7..ae48904eb16c 100644 --- a/usr.bin/mkimg/mkimg.1 +++ b/usr.bin/mkimg/mkimg.1 @@ -41,7 +41,7 @@ .Op Fl f Ar format .Op Fl o Ar outfile .Op Fl a Ar active -.Op Fl R +.Op Fl t Ar timestamp .Op Fl v .Op Fl y .Op Fl s Ar scheme Op Fl p Ar partition ... @@ -139,9 +139,9 @@ option is a shorthand to specify the minimum and maximum capacity at the same time. .Pp The -.Fl R -option enables reproducible mode: any timestamps or random identifiers will -be fixed so as to ensure consistent output. +.Fl t +option causes any timestamps embedded in the output file to be set to the +given time, specified in seconds since the epoch. .Pp The .Fl v diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index 58bf90fd5ad4..80c79777575e 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -62,7 +62,8 @@ static struct option longopts[] = { static uint64_t min_capacity = 0; static uint64_t max_capacity = 0; -bool reproducible = false; +/* Fixed timestamp for reproducible builds. */ +time_t timestamp = (time_t)-1; struct partlisthead partlist = TAILQ_HEAD_INITIALIZER(partlist); u_int nparts = 0; @@ -564,7 +565,7 @@ main(int argc, char *argv[]) bcfd = -1; outfd = 1; /* Write to stdout by default */ - while ((c = getopt_long(argc, argv, "a:b:c:C:f:o:p:s:vyH:P:RS:T:", + while ((c = getopt_long(argc, argv, "a:b:c:C:f:o:p:s:t:vyH:P:S:T:", longopts, NULL)) != -1) { switch (c) { case 'a': /* ACTIVE PARTITION, if supported */ @@ -609,9 +610,6 @@ main(int argc, char *argv[]) if (error) errc(EX_DATAERR, error, "partition"); break; - case 'R': - reproducible = true; - break; case 's': /* SCHEME */ if (scheme_selected() != NULL) usage("multiple schemes given"); @@ -619,6 +617,19 @@ main(int argc, char *argv[]) if (error) errc(EX_DATAERR, error, "scheme"); break; + case 't': { + char *ep; + long long val; + + errno = 0; + val = strtoll(optarg, &ep, 0); + if (ep == optarg || *ep != '\0') + errno = EINVAL; + if (errno != 0) + errc(EX_DATAERR, errno, "timestamp"); + timestamp = (time_t)val; + break; + } case 'y': unit_testing++; break; @@ -681,9 +692,6 @@ main(int argc, char *argv[]) if (max_capacity != 0 && min_capacity > max_capacity) usage("minimum capacity cannot be larger than the maximum one"); - if (reproducible) - srandom(42); - if (secsz > blksz) { if (blksz != 0) errx(EX_DATAERR, "the physical block size cannot " diff --git a/usr.bin/mkimg/mkimg.h b/usr.bin/mkimg/mkimg.h index 608de458e83c..aa0ec2a8d944 100644 --- a/usr.bin/mkimg/mkimg.h +++ b/usr.bin/mkimg/mkimg.h @@ -29,9 +29,9 @@ #include #include -#include +#include -extern bool reproducible; /* Generate reproducible output. */ +extern time_t timestamp; struct part { TAILQ_ENTRY(part) link; diff --git a/usr.bin/mkimg/uuid.c b/usr.bin/mkimg/uuid.c index f3415a8c1111..885a6c36b522 100644 --- a/usr.bin/mkimg/uuid.c +++ b/usr.bin/mkimg/uuid.c @@ -57,9 +57,10 @@ osdep_uuidgen(mkimg_uuid_t *uuid) u_int i; uint16_t seq; - if (reproducible) - memset(&tv, 0, sizeof(tv)); - else if (gettimeofday(&tv, NULL) == -1) + if (timestamp != (time_t)-1) { + tv.tv_sec = timestamp; + tv.tv_usec = 0; + } else if (gettimeofday(&tv, NULL) == -1) abort(); time += (uint64_t)tv.tv_sec * 10000000LL; diff --git a/usr.bin/mkimg/vhd.c b/usr.bin/mkimg/vhd.c index 1e1f1e7f3c3e..c0fe45ab416e 100644 --- a/usr.bin/mkimg/vhd.c +++ b/usr.bin/mkimg/vhd.c @@ -188,7 +188,7 @@ vhd_timestamp(void) time_t t; if (!unit_testing) { - t = time(NULL); + t = timestamp != (time_t)-1 ? timestamp : time(NULL); return (t - 0x386d4380); } From nobody Tue Jul 29 12:49:12 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 4brwCF2df9z62xWD; Tue, 29 Jul 2025 12:49:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCF09rhz3lWL; Tue, 29 Jul 2025 12:49:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793353; 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=cVkCl1EriEukKfarAnqPub1Ck4nk+bj9zZ3FQOwbREE=; b=mo5demti8MJlyU6renm7s9NO82RWuqDFbhCG5QVeMkKsN0CwlSHjb/NrBpofmy2mISXlxk 5lj784d6fmNEtX1YWANq8g9Vg+UZqH9h/g8jKl9qzdnx/peIfBr7eF2ibj8aswW/R/MySQ /Uowr7EENwbpzLsbKtm/3hwVR668i8BGH+Nnw5wFnpcch8U6XMDs132gmK3f1qftJHUw62 mYK9+nmhjrpt5MbHTNgHjScNOlRMHhPv75VqOGuvQupI9aySeMpgoG3/sT3UR/WRHbh8mX +PYSA2RFGW7MF8yDrccVPZi7jKNwlRMo09OA01k/Kh3Nnt4xG20E/0uSglQC4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793353; 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=cVkCl1EriEukKfarAnqPub1Ck4nk+bj9zZ3FQOwbREE=; b=rKBRG7uTh3pLV5thVP8qlIhPJxNr8zlQ2d/TcwFM80YaPMnpozoXghjEGaXCHWfU5fGx0P lnuJw/OY9yQ8B+iUcTdPQOXEeUErL72vnKYbp5AME/yxrhMBKXNMooBL1HmmvaoquBtpP6 vXpDa3enuM7TX+7HyOYnxUWrc7k1WoboCqRwQCD6fYZrOxda1/2sBFEBgJRrMDoqm1FHa9 b5Setc7WZ6xVQl2XpK7Az7229MgEsinBnGJGo/U4ZxF1M8N4W5SOtNTKLJWZ0r2ytNICQt ALIuYEYRsPfTNzpRiB6BGnPlZc2LWnmsuAp2zXXJ9TVin7s7fVjiIhhG9/J+Dg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793353; a=rsa-sha256; cv=none; b=Rd+kbiLy4YwTk/Wc/pcuTvjN1vCsd6LAPo9B2f+i0GwAqifg84/NSN2Ll2EmAyqVXV9xP+ 1vtqALpD4oj72aEFEtzp1pW4mxrS0wSnHofCmlKUuRuakPVlihMQ5/08mk1/QE0KS5pTIo IDVKCWLpRuMICrtooRJN09erLPBauDgiyzVnn28LckHr4zlAGqexLTD9vn4O3MOFLjwrTZ vq+98db1yo2GUqA85N9vcVn0t9b8gsrbmzuH6NcuavVrq1inAAfmu/5+BBrl3b1vPFBgsg xL3KoEeAAJrP8iVBLIoWxOTed/jokEWdkF/mt9FzYpXHntz0uNMjRS6W0rHfxQ== 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 4brwCD6trjzXZf; Tue, 29 Jul 2025 12:49:12 +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 56TCnCen033633; Tue, 29 Jul 2025 12:49:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnCTH033630; Tue, 29 Jul 2025 12:49:12 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:12 GMT Message-Id: <202507291249.56TCnCTH033630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: bb4a12ff9ac0 - stable/14 - nuageinit: Add wrappers for chmod and chown 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bb4a12ff9ac0feb05af7232c1ffc8e7cdd00f2dd Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bb4a12ff9ac0feb05af7232c1ffc8e7cdd00f2dd commit bb4a12ff9ac0feb05af7232c1ffc8e7cdd00f2dd Author: Mark Johnston AuthorDate: 2025-07-05 14:54:07 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 nuageinit: Add wrappers for chmod and chown In the wrappers, check for errors and abort if one is raised. At some point it may be useful to have a mechanism to ignore errors, but I'm not sure yet how that should look. For chmod, let the mode be specified as an octal number, otherwise it's hard to understand what's happening. Note that this must be specified as a string, otherwise tonumber() will raise an error. Reviewed by: bapt MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51159 (cherry picked from commit 667ef8875bad115d334a85c1023db0cf4d8379ba) --- libexec/nuageinit/nuage.lua | 35 +++++++++++++++++++++++++---------- libexec/nuageinit/nuageinit | 7 +++---- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index 11958e8b5cc2..493ae11d6ca7 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -56,6 +56,21 @@ local function errmsg(str, prepend) os.exit(1) end +local function chmod(path, mode) + local mode = tonumber(mode, 8) + local _, err, msg = sys_stat.chmod(path, mode) + if err then + errmsg("chmod(" .. path .. ", " .. mode .. ") failed: " .. msg) + end +end + +local function chown(path, owner, group) + local _, err, msg = unistd.chown(path, owner, group) + if err then + errmsg("chown(" .. path .. ", " .. owner .. ", " .. group .. ") failed: " .. msg) + end +end + local function dirname(oldpath) if not oldpath then return nil @@ -252,12 +267,12 @@ local function addsshkey(homedir, key) f:write(key .. "\n") f:close() if chownak then - sys_stat.chmod(ak_path, 384) - unistd.chown(ak_path, dirattrs.uid, dirattrs.gid) + chmod(ak_path, "0600") + chown(ak_path, dirattrs.uid, dirattrs.gid) end if chowndotssh then - sys_stat.chmod(dotssh_path, 448) - unistd.chown(dotssh_path, dirattrs.uid, dirattrs.gid) + chmod(dotssh_path, "0700") + chown(dotssh_path, dirattrs.uid, dirattrs.gid) end end @@ -296,10 +311,10 @@ local function addsudo(pwd) end f:close() if chmodsudoers then - sys_stat.chmod(sudoers, 416) + chmod(sudoers, "0640") end if chmodsudoersd then - sys_stat.chmod(sudoers, 480) + chmod(sudoers, "0740") end end @@ -521,16 +536,14 @@ local function addfile(file, defer) end f:close() if file.permissions then - -- convert from octal to decimal - local perm = tonumber(file.permissions, 8) - sys_stat.chmod(filepath, perm) + chmod(filepath, file.permissions) end if file.owner then local owner, group = string.match(file.owner, "([^:]+):([^:]+)") if not owner then owner = file.owner end - unistd.chown(filepath, owner, group) + chown(filepath, owner, group) end return true end @@ -538,6 +551,8 @@ end local n = { warn = warnmsg, err = errmsg, + chmod = chmod, + chown = chown, dirname = dirname, mkdir_p = mkdir_p, sethostname = sethostname, diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 84133d4373c5..0fcdc7274db3 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -7,7 +7,6 @@ local nuage = require("nuage") local ucl = require("ucl") local yaml = require("lyaml") -local sys_stat = require("posix.sys.stat") if #arg ~= 2 then nuage.err("Usage: " .. arg[0] .. " ( | )", false) @@ -157,7 +156,7 @@ local function ssh_keys(obj) sshkey:close() end if keytype == "private" then - sys_stat.chmod(path, 384) + nuage.chmod(path, "0600") end end end @@ -281,7 +280,7 @@ local function runcmd(obj) end if f ~= nil then f:close() - sys_stat.chmod(root .. "/var/cache/nuageinit/runcmds", 493) + nuage.chmod(root .. "/var/cache/nuageinit/runcmds", "0755") end end @@ -503,5 +502,5 @@ if line == "#cloud-config" then end elseif line:sub(1, 2) == "#!" then -- delay for execution at rc.local time -- - sys_stat.chmod(root .. "/var/cache/nuageinit/user_data", 493) + nuage.chmod(root .. "/var/cache/nuageinit/user_data", "0755") end From nobody Tue Jul 29 12:49:11 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 4brwCD4Vy3z62xL0; Tue, 29 Jul 2025 12:49:12 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCD0GvMz3ldv; Tue, 29 Jul 2025 12:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793352; 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=YetsfsM8lpe4xd3WSa9wpRHFxJ9xdqHUEziY4SmgmtE=; b=qwMQAgq5ghVHr/sLyT9rFiaJ6NUGTI8Gpd7g8ephgh0zi8oCS2oEz8ptVn/4sgPUJz0vTE nw975bnADgvC9qVON+NaBhkelu/7IUGhDQ09WoKFLQN9tLv97kLWlwFJ5ykt1PxnoXgYQm dkq6zI2qGVMc4BuL51+UuJHCLpuQtzsWVza1k/Uw2j08LkLjBEk6R/T7QQu5WoM4jOCIxZ XjSCtCK2rRdpLog72fViMYAP5ZrMGoJ/3xEER6leby5hyVRZJfl/9HkQ6kPbWwZzFx5e75 dPGgTSEgLOhnjfzrpcXo2GgDW7AQJ//ukm9lMslEvO0B+Y8ZTC5xGNcimb5Jxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793352; 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=YetsfsM8lpe4xd3WSa9wpRHFxJ9xdqHUEziY4SmgmtE=; b=VI4nRle4ahEweliq4Zv47q0JpzGDrh3g4SFsoWqOTiam/uqbvmYsr2Wpcs2q6qt9IvPT1b UIm8bLjam/C/knuAH4S3qiEJ0+CiOxrQqi29Du53TP9oJUeoTM+R1X7xqmtUpMSWzQixep B5KJE3+v4yCV66F96ZRXawEUzE9sAObrzO3vVXn+9zU6Eq0d+CdShhrSpo0Fo59aqeeoki o/au36Nzaw7ttQkjauFu9t9iYHQojzXSllBfVznzqNbwf5Tg1/1UqEi4zq7SKcT7DJE71n qFgkZFKqY94CN2Zj2vWoYTR+N0Y/STDoCsNjHEyxkveGo7tWbiEYVPJL+MpE6g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793352; a=rsa-sha256; cv=none; b=I7hLq9Jsnwu8Yz4xh7/gMKMVoA5VvO8BdVgDdm6H/UBzfZv+LV5dNE0DI2WyE3TZCKnf5n xFe7mSxjsozydyKHCo6NfduG8Gv2FSDlzs5WwvbugvfYH6joP9Rgu4Jzm8xBMmv5JCFKIy 4GGkS18mgsRQZwpxvmdmcbj7ksyKqloVjm8bWSoX8/cnNtyQxpktCST8NRede649MTeE1Z DdEGn+Jqjrp3GWgFgziVwS1tGkl46QYBOfuwfkG1BJfEbarm0aLpce9p4a2O0tT2ZuE4qg RqJ/sWM4kWyfiIZpXIqysV+oRtMxX0KrSB/XICpXgVyqT59ISLYNX9iKkiGp/A== 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 4brwCC5XRVzXVr; Tue, 29 Jul 2025 12:49:11 +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 56TCnBhA033600; Tue, 29 Jul 2025 12:49:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnBCk033597; Tue, 29 Jul 2025 12:49:11 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:11 GMT Message-Id: <202507291249.56TCnBCk033597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 12718429e89f - stable/14 - rc_subr_test: Bump some sleep timeouts 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 12718429e89f1fe64ebe2865db562f2f2296c7a9 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=12718429e89f1fe64ebe2865db562f2f2296c7a9 commit 12718429e89f1fe64ebe2865db562f2f2296c7a9 Author: Mark Johnston AuthorDate: 2025-07-13 15:08:00 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 rc_subr_test: Bump some sleep timeouts The test verifies that the rc framework will OOM-protect a process spawned by rc. It just wraps a 5-second /bin/sleep invocation as part of this test. The rc framework uses procctl to set the OOM-protect bit after the process has started, i.e., it uses procctl -p. So, with a 5 second timeout, it's possible for the process to exit before procctl actually runs, if the system is heavily loaded. (I see this failure occasionally with KMSAN configured and many tests running in parallel.) Bump the timeout to reduce the risk of this happening. The timeout value is arbitrary since the test will stop the rc process, i.e., we don't have to wait for 60 seconds to elapse before the test passes. MFC after: 1 week (cherry picked from commit da89500adbea360533d2442a674c8af0741b7ff1) --- libexec/rc/tests/rc_subr_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rc/tests/rc_subr_test.sh b/libexec/rc/tests/rc_subr_test.sh index 60f77c2c2de3..9931389e7a02 100644 --- a/libexec/rc/tests/rc_subr_test.sh +++ b/libexec/rc/tests/rc_subr_test.sh @@ -52,7 +52,7 @@ oomprotect_all_body() _rc_arg="$4" setvar "${name}_oomprotect" all command="/usr/sbin/daemon" - command_args="-P $pidfile -p $_childpidfile -- /bin/sleep 5" + command_args="-P $pidfile -p $_childpidfile -- /bin/sleep 60" run_rc_command "$_rc_arg" LITERAL @@ -92,7 +92,7 @@ oomprotect_yes_body() setvar "${name}_oomprotect" yes procname="/bin/sleep" command="/usr/sbin/daemon" - command_args="-p $pidfile -- $procname 5" + command_args="-p $pidfile -- $procname 60" run_rc_command "$_rc_arg" LITERAL From nobody Tue Jul 29 12:49:14 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 4brwCG3Tb7z62xN2; Tue, 29 Jul 2025 12:49:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCG0v3Sz3lbt; Tue, 29 Jul 2025 12:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793354; 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=bZxJ6uR9uPESuvUsgFfco+k9TosdaBYR8pUod4jFKIk=; b=VLjQs64nL0DCBtu1mcjSvLR2i1IcCqh3Lz5yojKc5Le+ijSGbnRTydUm69S6dJyQLQ6kXF y46vOZs0gpN7PyFyx9KEfBfxBqfuPIKdmQSXB5zrcKUVwU/OxV85h/ZmLaU1IoWSkfiok0 UpdrSRP4y+HBOFnGHwWWGklVYxyWKu1MA1UdD7r0YGOTEkKeU3aXILjSZcUPtsu9kA1H7R oc152d2R79L7dh9ADGeKxb5dtWdRiiKA7wD/z6PfpIJqfLXrAGUV4ZXEj/VIvawv9RpcJs R645SnlZBA+81bHwRjHEIYPx0GFf96Lac2X6+f/PdhRbgfyarI119Nn/oChu8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793354; 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=bZxJ6uR9uPESuvUsgFfco+k9TosdaBYR8pUod4jFKIk=; b=AH8IE2SGbV/tQGZgIbSc2ViwQaLdUdGJ7JHi0zLDpJ3+jZgeCijSBfhvZnBe+FcrGnoMU7 MEkriKXoQf1IHHXdjHByx3lAVRItxDRqF1BzhpmQHwkiXliuyI88AOu3c12JiORdaA3mJh jrNydAvh3ccsQu+YxRox5OpMU2vl+OFiuld4UqE5N9Lpjg+AH29FCPU3HjsNKn9CofvMDg hQnrTjOgkGB2Tb4zHMvKm8E4dknLvAWcZdshk2/DJXQkcwbmKfMiDldqJne+gbTFZzGlYJ T3o3XVeZeieWqJb/j9I8MSqBgTvLThXSFhpDr75WYD4AYhvjS+Knsc6vgIGD6g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793354; a=rsa-sha256; cv=none; b=ACuATf1brWdv+spesYT1Jvp06k0IVpt5A33vgRSsSxDOa5qNnxyluvAKL5ICckVlWQcxXz pXEYEJ3Agu3GP9MZkHhWCZZ9d5hQAgKIoFUBZLfc8RVkZKZqlzsBX8q5ClNCz/k81yJEIC 4Ap9e2tLKcSFEAqq5msCs29UfXlW1Zt5iCFstfyJ7W0diQ6zrh9gfeChmrCAOKsJi6o1ow BIPEZGSUnnsMww1AVFD8L1Y2oZTeAFnH3YV300i7ZDjngRSYJ8NrdvBla46IspLF5TthSc 21DrLAItD3S/p3yQfl3DbyWSIKQD23C/JHFcDMztzKnhUDuw9N7T1g/DsRjrVg== 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 4brwCG0VLVzXq3; Tue, 29 Jul 2025 12:49:14 +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 56TCnEKk033665; Tue, 29 Jul 2025 12:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnErs033662; Tue, 29 Jul 2025 12:49:14 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:14 GMT Message-Id: <202507291249.56TCnErs033662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6c6add72d064 - stable/14 - msdosfs: Fix handling of eofflag in VOP_READDIR 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6c6add72d0640f83f69843af1d52c65642a96142 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6c6add72d0640f83f69843af1d52c65642a96142 commit 6c6add72d0640f83f69843af1d52c65642a96142 Author: Mark Johnston AuthorDate: 2025-07-13 15:05:51 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 msdosfs: Fix handling of eofflag in VOP_READDIR We also need to set it when an end-of-directory marker is reached. Reported by: vishwin Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51290 (cherry picked from commit 9f6718073382608519912e178e4c313dd61246b3) --- sys/fs/msdosfs/msdosfs_vnops.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 6417b7dac16b..73c235b0f368 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1530,6 +1530,9 @@ msdosfs_readdir(struct vop_readdir_args *ap) ap->a_vp, uio, ap->a_cred, ap->a_eofflag); #endif + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 0; + /* * msdosfs_readdir() won't operate properly on regular files since * it does i/o only with the filesystem vnode, and hence can @@ -1623,8 +1626,11 @@ msdosfs_readdir(struct vop_readdir_args *ap) on = (offset - bias) & pmp->pm_crbomask; n = min(pmp->pm_bpcluster - on, uio->uio_resid); diff = dep->de_FileSize - (offset - bias); - if (diff <= 0) - break; + if (diff <= 0) { + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 1; + goto out; + } n = min(n, diff); error = pcbmap(dep, lbn, &bn, &cn, &blsize); if (error) @@ -1655,6 +1661,8 @@ msdosfs_readdir(struct vop_readdir_args *ap) */ if (dentp->deName[0] == SLOT_EMPTY) { brelse(bp); + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 1; goto out; } /* @@ -1752,15 +1760,6 @@ out: uio->uio_offset = off; - /* - * Set the eofflag (NFS uses it) - */ - if (ap->a_eofflag) { - if (dep->de_FileSize - (offset - bias) <= 0) - *ap->a_eofflag = 1; - else - *ap->a_eofflag = 0; - } return (error); } From nobody Tue Jul 29 12:49:16 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 4brwCJ72M4z62xR3; Tue, 29 Jul 2025 12:49:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCJ2Vchz3lLZ; Tue, 29 Jul 2025 12:49:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793356; 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=30XXBRxxGEVv6lcX1Cj0EnTQf9Fkbrfc06BORyO4mWU=; b=BTg9LW/p/1hl1ljt6yNAk8FWN7pYlWKmk9iPkcj9OmSi2V8yEQ0XKRPAEakBBDZ7F74Hp7 w7RVaYtGLltA84APceN45Y5LYG1KKZofxQZD9uSMC+j48MmwtIQBifmmdQh50miss/FLBS geb8SqCpx8OR1mvUJsfHUO82eOxdUQdAn4j/N3tA3GdD92FWRXvrumgw/Jct1iSegVWfrF kw+qYc4tpitIV6ad1mkC5cQ4oMThdpy7mYJQpgwytUugJ7k26XSiqBzoceoCUfA61fVdId /buoIgldj13uSdXA7RSdpHTMNJruXLJL6T4ZlxImqPqrpijA6RBQMoFCjQivTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793356; 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=30XXBRxxGEVv6lcX1Cj0EnTQf9Fkbrfc06BORyO4mWU=; b=rEpXVrq59HOOCoYZldzDjw+qS9R35XPDCYqvwYBHBSC4Ee+cJEkBAfxdTqfHCtW5w03fPD JLdy2o6F2noL/5EE+Sv1q3c0ucU/9BkGhpR1KnjnQ6z033rmQp3PJYAO30WT+u6XIbPQVi +MGAlr4O9re2iqx4a/qJMyBQYN+ish6msT8QbnMszQRGnGyGsIQJS9lP1FELBDDuW3zEAi D9Eg7dz+W/V28s/CovemSTKju2sU9oQ2ut1u6IgWszXbujfQwbItGX/zRFyx2c4CaNR20x B70FxHRT1vz/B168NbOq1Wb6RzckU5WTOa2V82q+IxJAauAlLC5fL7hk2Hvsxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793356; a=rsa-sha256; cv=none; b=gFIoa+xNRw99rvvtoGqCZGlaYkydk960ghSrCFACr9IKsXvAnyBmu/O+XBMd0Wdk7L6tVY y6uokDQWKMUUCSTybrVcGiW1C0TqMtOb7YpUMn1lJIA/v353lb7rstPHct4N8twA6q4zh0 GBU7O3oG6Acwn9sjtkJxISlEUGlot7Vv0Ek/8aBNlIK2Ln67ww8XeelA8pmHha8ssg/B1u 831q2Fu6YITvyPUS3Zb9RYXUZTyof2BlqHrafFlbShfiWYF4dH/ow6w8i9758L6eyMEgj6 9JnPvu04uLXs6LdoDdgRyn6Ox9OanL60S5d6tIfuSr06uE8xSLS3GpWaJCfDXw== 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 4brwCJ26CgzY1n; Tue, 29 Jul 2025 12:49:16 +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 56TCnG9p033737; Tue, 29 Jul 2025 12:49:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnG06033734; Tue, 29 Jul 2025 12:49:16 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:16 GMT Message-Id: <202507291249.56TCnG06033734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1392b97d0388 - stable/14 - kasan: Use kasan_md_unsupported() to check for invalid addresses 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1392b97d03883e53cf2b92c6c896a9a1ce6f4f04 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1392b97d03883e53cf2b92c6c896a9a1ce6f4f04 commit 1392b97d03883e53cf2b92c6c896a9a1ce6f4f04 Author: Mark Johnston AuthorDate: 2025-07-15 00:31:10 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:46 +0000 kasan: Use kasan_md_unsupported() to check for invalid addresses The subsequent assert verifies that the address is in the kernel map anyway, and this removes uses of the MD DMAP_*_ADDRESS constants from MI code. This fixes the amd64 KASAN build after commit 4dd828c80828 ("amd64: add kva_layout"). MFC after: 2 weeks (cherry picked from commit 1f683624df878b2e4c0187137640bf2e6662c36f) --- sys/kern/subr_asan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 0edb631d1475..464efda1e91a 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -263,8 +263,7 @@ kasan_mark(const void *addr, size_t size, size_t redzsize, uint8_t code) if (__predict_false(!kasan_enabled)) return; - if ((vm_offset_t)addr >= DMAP_MIN_ADDRESS && - (vm_offset_t)addr < DMAP_MAX_ADDRESS) + if (kasan_md_unsupported((vm_offset_t)addr)) return; KASSERT((vm_offset_t)addr >= VM_MIN_KERNEL_ADDRESS && From nobody Tue Jul 29 12:49:15 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 4brwCH4FxDz62xLG; Tue, 29 Jul 2025 12:49: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCH1vC3z3lWZ; Tue, 29 Jul 2025 12:49:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793355; 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=zAjgpqQY8skxMtN6VjzQeGRwWmZ+ZRQXRd+PUmRRHOo=; b=X/lno30Zd85Uy8njfhhyP32igxi7cs0b32jPh/3swQliCgyzdTXvXuSUL0A21wz2fk25Jj EG9wlvJl73S/+64ISbL3WT0281L1u9r+QyWf+QbIM27LRgbpQN9LAT0ubqhwoYGWeL50aH A9sUTP+HaqPtX4IiLo3kvzp/J2lGLP+4tX54shv2Ox+5kLGVgyleE+BQnsv7Y+mnnzFqcD MdXB9jxm1+Y5NddL9BxZPGP9FBnGDvp2bY4VE1e3GxnAJ+ipoOFltjQoI1M2mo1m81YKgw JzLFOyT1hAvpdmLeANiheu4fkOvuU12TiV6QiwTLXD477BswitVSVokYR9hO4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793355; 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=zAjgpqQY8skxMtN6VjzQeGRwWmZ+ZRQXRd+PUmRRHOo=; b=CqahUAD4yf9otFbRkV92jxRshFNXXyzDZyZyvlSvHRVVSZ82nKKElVTq0Jp2M0ZabU47iD FsiZmkzS/OlCYZTTNUDOPNDTeYFRmbx5dTN7xYZF6j1YamAZQ5LgOrVTpZdGb56jV7Hz6Q 5vhWf2RR+L8ZCOCIp/8jWUDDP+jpMejyLHmd90gNLWkHsJIC/gQZ4F/cEim4jaCgpiLOXD rDT8kFQpVo5hTSBdua2mOath3FL0fbmIzWRgDB3m10cNaXJxmrwHeFKuFmpXlEKHW6L0NG eAq04S/aOldsLnxTX1ul3gCt/m/jkSMfZ3+KPPeg5+FI8kkHPUWE9lAVLY9ZqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793355; a=rsa-sha256; cv=none; b=xvciHHM+99Y3gj3lQhhXSub2UVEO4VKPudmNAKQaqB5dEuxYTxBmiZCZp3l5i2JZPJLWwh Fb0aGc/3LVrmec5nFs2jzJY9ZEHdsOCIyCoUfTxq0cCH16wYm5mbAoxTh+TLMFhOyITDq6 TF9itF8baStO9gaPOWgm76mg+ps7j8eNA352g25+EcwnwI9MSILMAmOnIu34hNKKKgkG7Z fd5conx3MZvw20hcATyweLdJSQdqNvMpn60yfDRk1xGMqKkyyKFxrKcAPE1FYyhpFYO28s DacoJn/AF59moHXQqf+CBWdRFPCFYv6aXMxxoieVLgkuM/ylGIZzRXJBFOFUhQ== 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 4brwCH1TBkzXq4; Tue, 29 Jul 2025 12:49:15 +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 56TCnF6H033703; Tue, 29 Jul 2025 12:49:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnFkE033700; Tue, 29 Jul 2025 12:49:15 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:15 GMT Message-Id: <202507291249.56TCnFkE033700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3060f4fda70d - stable/14 - libdtrace: Use a designated array initializer for dt_cook_funcs[] 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3060f4fda70d5bd80720dbdb7014eda09ff1c501 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3060f4fda70d5bd80720dbdb7014eda09ff1c501 commit 3060f4fda70d5bd80720dbdb7014eda09ff1c501 Author: Mark Johnston AuthorDate: 2025-07-21 13:34:21 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:32 +0000 libdtrace: Use a designated array initializer for dt_cook_funcs[] Also make the array const. No functional change intended. MFC after: 1 week (cherry picked from commit 654dea596703eb422055a7d637356fbde36f8540) --- .../opensolaris/lib/libdtrace/common/dt_parser.c | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c index d1ebaa8791da..dd68f9278308 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c @@ -4506,30 +4506,30 @@ dt_cook_none(dt_node_t *dnp, uint_t idflags) return (dnp); } -static dt_node_t *(*dt_cook_funcs[])(dt_node_t *, uint_t) = { - dt_cook_none, /* DT_NODE_FREE */ - dt_cook_none, /* DT_NODE_INT */ - dt_cook_none, /* DT_NODE_STRING */ - dt_cook_ident, /* DT_NODE_IDENT */ - dt_cook_var, /* DT_NODE_VAR */ - dt_cook_none, /* DT_NODE_SYM */ - dt_cook_none, /* DT_NODE_TYPE */ - dt_cook_func, /* DT_NODE_FUNC */ - dt_cook_op1, /* DT_NODE_OP1 */ - dt_cook_op2, /* DT_NODE_OP2 */ - dt_cook_op3, /* DT_NODE_OP3 */ - dt_cook_statement, /* DT_NODE_DEXPR */ - dt_cook_statement, /* DT_NODE_DFUNC */ - dt_cook_aggregation, /* DT_NODE_AGG */ - dt_cook_none, /* DT_NODE_PDESC */ - dt_cook_clause, /* DT_NODE_CLAUSE */ - dt_cook_inline, /* DT_NODE_INLINE */ - dt_cook_member, /* DT_NODE_MEMBER */ - dt_cook_xlator, /* DT_NODE_XLATOR */ - dt_cook_none, /* DT_NODE_PROBE */ - dt_cook_provider, /* DT_NODE_PROVIDER */ - dt_cook_none, /* DT_NODE_PROG */ - dt_cook_none, /* DT_NODE_IF */ +static dt_node_t *(* const dt_cook_funcs[])(dt_node_t *, uint_t) = { + [DT_NODE_FREE] = dt_cook_none, + [DT_NODE_INT] = dt_cook_none, + [DT_NODE_STRING] = dt_cook_none, + [DT_NODE_IDENT] = dt_cook_ident, + [DT_NODE_VAR] = dt_cook_var, + [DT_NODE_SYM] = dt_cook_none, + [DT_NODE_TYPE] = dt_cook_none, + [DT_NODE_FUNC] = dt_cook_func, + [DT_NODE_OP1] = dt_cook_op1, + [DT_NODE_OP2] = dt_cook_op2, + [DT_NODE_OP3] = dt_cook_op3, + [DT_NODE_DEXPR] = dt_cook_statement, + [DT_NODE_DFUNC] = dt_cook_statement, + [DT_NODE_AGG] = dt_cook_aggregation, + [DT_NODE_PDESC] = dt_cook_none, + [DT_NODE_CLAUSE] = dt_cook_clause, + [DT_NODE_INLINE] = dt_cook_inline, + [DT_NODE_MEMBER] = dt_cook_member, + [DT_NODE_XLATOR] = dt_cook_xlator, + [DT_NODE_PROBE] = dt_cook_none, + [DT_NODE_PROVIDER] = dt_cook_provider, + [DT_NODE_PROG] = dt_cook_none, + [DT_NODE_IF] = dt_cook_none, }; /* From nobody Tue Jul 29 12:49:17 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 4brwCL0yT7z62xWJ; Tue, 29 Jul 2025 12:49:18 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCK3bqYz3lg9; Tue, 29 Jul 2025 12:49:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793357; 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=98uWn30uJp77OTibe0MldIYmCTjATri++HOdbh8LtOA=; b=KCzPw5BMWW0SyUg2mH+7FMp1hgnwDCFvZWRcsb42hS55wIdxSK/S2EMoapdLcv2f/r8z5X oTyhtb/nmeXd2SPlxb708KHqDm+ZUrPoc/mumeLv9iMYzJAWmgYv0l2wKXFfFLtPfPTgAB PAPagkwf4vGbnCFuYKXUnpcwOzfLO6ZM2ywWSuZ4371r04j7/AdhONE9OiOHMRh5oNPuyy ZnbFHAAy/MSvGx/ihApVifH7Q4B62Iw8zEZIA8oG+9Q6P2SxEqzrZeBl7np6YH5D/hvNcw J0dqA9doMbjo3efAC08JW69+99P/2qqf/gqlXVGYvZ/82QUiwt/LBgGOgDUg7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793357; 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=98uWn30uJp77OTibe0MldIYmCTjATri++HOdbh8LtOA=; b=OjnC/q5U8gpdSwvsweVg2gveVBn7j2PxAtX5NMA73A3Ija2KAPmUvzFB1Axj0Z8Dx45ABU EvZXsFbMC5kIVMPcVgR3g2bE/qIYqrxHWdT2m19Nj0fijKVbs0BgYel0Se8sQJltoB5rJ7 rvu8aklCp75uSWCqYeHWcG9HSZm1wAnXFPIhEYWymwPDHFrAYNG4J5H9wNh3qa6LVvb7a6 /Rkc6YnHqZvc7i9NTLGjmpVAMoRXyvdCv6DDGL4Yz5cO/XYjapzM4DDSL0jgMojK09ScQu hj1EF1ZQp9vZFfKMMfbaTsc2/1z8BpyWWIAjELHLO5G19sGepfkRin3u2OwEFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793357; a=rsa-sha256; cv=none; b=EpqfFR1qUJMeto0tzqd7kQnOInCbWIvMtGf+mUJUSFWW5Owc/UrYKC/T5saz8SX//Y5C1y JlG22boN8IsTDO0dKWJTY1co3kHzG1m4CeVSm7Hjqkh3yz1ndb8eaNDB7JTW4fK87dekoa zv8gnfdpFkc1CFmmwU2EY2KQnujxvzm4FqrzoGoNYd+hqVqvFptzM9SD8Ro6/HRIIdifXj bYKuMUcvaG7SNVaMAVkA8LCQFmsOdHRzDo/GwbLunW3D/81gpjz06wc02NZk8Pm8g+DjyI i8j95BtuFQlfSa1kW/PsyoCOAJUVvaSitLLli6YN+W+2gMIcs8GvY5MxXLs99Q== 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 4brwCK39HXzY1p; Tue, 29 Jul 2025 12:49:17 +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 56TCnHSw033769; Tue, 29 Jul 2025 12:49:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnHdx033766; Tue, 29 Jul 2025 12:49:17 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:17 GMT Message-Id: <202507291249.56TCnHdx033766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d8ef477a7bfe - stable/14 - fdescfs: Set *eofflag in fdesc_readdir() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d8ef477a7bfeed988561ad5a224878b24ee65352 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d8ef477a7bfeed988561ad5a224878b24ee65352 commit d8ef477a7bfeed988561ad5a224878b24ee65352 Author: Mark Johnston AuthorDate: 2025-07-15 00:38:21 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:08:54 +0000 fdescfs: Set *eofflag in fdesc_readdir() Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51319 (cherry picked from commit da84054f3a508ceab4474e4a002c87813963cc84) --- sys/fs/fdescfs/fdesc_vnops.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 47fb387a007e..f4b3eba91ef3 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -549,6 +549,8 @@ fdesc_readdir(struct vop_readdir_args *ap) fmp = VFSTOFDESC(ap->a_vp->v_mount); if (ap->a_ncookies != NULL) *ap->a_ncookies = 0; + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 0; off = (int)uio->uio_offset; if (off != uio->uio_offset || off < 0 || (u_int)off % UIO_MX != 0 || @@ -561,7 +563,12 @@ fdesc_readdir(struct vop_readdir_args *ap) fcnt = i - 2; /* The first two nodes are `.' and `..' */ FILEDESC_SLOCK(fdp); - while (i < fdp->fd_nfiles + 2 && uio->uio_resid >= UIO_MX) { + while (uio->uio_resid >= UIO_MX) { + if (i >= fdp->fd_nfiles + 2) { + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 1; + break; + } bzero((caddr_t)dp, UIO_MX); switch (i) { case 0: /* `.' */ From nobody Tue Jul 29 12:49:18 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 4brwCM15cRz62xWN; Tue, 29 Jul 2025 12:49:19 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCL4cyxz3lqw; Tue, 29 Jul 2025 12:49:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793358; 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=nqUVrelY1eETxGsUYr0awUZ6hV85vvvsj2j5+17k/ZE=; b=BMqesLVyeTuZpcQ2Hf/TPAoq/SMCF0CxzgY+hZcxkBNokOnsEMixOdcyqlWJCXIFNMgC2i uOJme3PWfQ4HXlpfUM6COxSBp8pZ6qD9aLPoIfFDzDUMYjXh09Id8X0fxhZ0OjYybZA43R jaNIoXz5EQkLHUao/CNOpT+f3EEVF44683V5l8mLDuEw6Kk5psm2N7D6lMf45J3B5p1MY3 ox9rfI8vP1bfTtjRgvtqTdaM+WtVBhNAahht5ESwMD/gIKzBJmWGs1xmH9Cs+1Bageuakm M/9OTYoE8b1TuK4B4gyf0xTBdJI/B60zriEmy4K1Ft5BQmTkoa9NTTlI35trUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793358; 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=nqUVrelY1eETxGsUYr0awUZ6hV85vvvsj2j5+17k/ZE=; b=Jp+Njb+zp1nyOeZAeLctJaCCOSaAE4cLLBSXkfDxIB2o0+zryZwog1Bw5p2tyFYH8OMSvD JCfJTtmV7U9g6P5Zm5jc+wls4YiXdudHZZFWlxFwObYep0PnKwsLybsQ4yP0van2f0i1fL kZjYV4HOdpZz/bNnvbhlhxemVJjitlmGQtJOZKftxXXZU/mJt8bcYnS/SM7KtzuKBy/4Ii cQ7qjqj+NiQ/8qhRcY23eoOziPBZV6L22ezq15Skk+PJtwURQjS1aqjn83/NOzk2zJe77h sTTJgO7xqXUkT6c7zLywkccZxjDhjs282Eb1B4IFpoKrPPJeLnYo+32KNe85qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793358; a=rsa-sha256; cv=none; b=rMvwmlNZc+/WoUfdJLOjXXgCWQRvqNd5+jiI0g3kNoteBtToUsdCaMVG0d9ntZNeWFFQJN OFs3SKSlhNhmXJXyOxPFxx5g9DACerUJyUWCGwuFGXcbpN+nOn4igurrX9IVWFqonkyCHN F5WqKB2sa3SKewhZJTNQ885xbhNqj3wMiK9odjaBVLync0yokBbHFBYBm1nh9qyi3W2m+G kJLTL4me6ylFx0Afep9MvuK1a8ojlikg8KKPMOz2d/mWx775zvsc5llOh3e81jsnNDAeD4 1vemOk2AdwPzSnu0TILYdBUet+rxIF0bZW0ay0JoGtgqGYW/1Cj1LVVPRlFn8w== 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 4brwCL44KXzY1q; Tue, 29 Jul 2025 12:49:18 +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 56TCnIgJ033801; Tue, 29 Jul 2025 12:49:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnIcO033798; Tue, 29 Jul 2025 12:49:18 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:18 GMT Message-Id: <202507291249.56TCnIcO033798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2019311525ce - stable/14 - swap_pager: Convert swap-space-full flags to bools 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2019311525ce724c79bdf7cb677c44bf7383323e Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2019311525ce724c79bdf7cb677c44bf7383323e commit 2019311525ce724c79bdf7cb677c44bf7383323e Author: Mark Johnston AuthorDate: 2025-07-15 15:16:57 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:09:04 +0000 swap_pager: Convert swap-space-full flags to bools No functional change intended. Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51321 (cherry picked from commit 5c76e9f4579677482b0f96d4b3581f5e1ea2e072) --- sys/vm/swap_pager.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 53cd8294e299..c23f8bc1f966 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -377,8 +377,8 @@ swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred) #endif } -static int swap_pager_full = 2; /* swap space exhaustion (task killing) */ -static int swap_pager_almost_full = 1; /* swap space exhaustion (w/hysteresis)*/ +static bool swap_pager_full = true; /* swap space exhaustion (task killing) */ +static bool swap_pager_almost_full = true; /* swap space exhaustion (w/hysteresis) */ static struct mtx swbuf_mtx; /* to sync nsw_wcount_async */ static int nsw_wcount_async; /* limit async write buffers */ static int nsw_wcount_async_max;/* assigned maximum */ @@ -542,14 +542,14 @@ swp_sizecheck(void) { if (swap_pager_avail < nswap_lowat) { - if (swap_pager_almost_full == 0) { + if (!swap_pager_almost_full) { printf("swap_pager: out of swap space\n"); - swap_pager_almost_full = 1; + swap_pager_almost_full = true; } } else { - swap_pager_full = 0; + swap_pager_full = false; if (swap_pager_avail > nswap_hiwat) - swap_pager_almost_full = 0; + swap_pager_almost_full = false; } } @@ -858,11 +858,10 @@ swp_pager_getswapspace(int *io_npages) swp_sizecheck(); swdevhd = TAILQ_NEXT(sp, sw_list); } else { - if (swap_pager_full != 2) { + if (!swap_pager_full) { printf("swp_pager_getswapspace(%d): failed\n", *io_npages); - swap_pager_full = 2; - swap_pager_almost_full = 1; + swap_pager_full = swap_pager_almost_full = true; } swdevhd = NULL; } @@ -2581,10 +2580,8 @@ swapoff_one(struct swdevt *sp, struct ucred *cred, u_int flags) sp->sw_id = NULL; TAILQ_REMOVE(&swtailq, sp, sw_list); nswapdev--; - if (nswapdev == 0) { - swap_pager_full = 2; - swap_pager_almost_full = 1; - } + if (nswapdev == 0) + swap_pager_full = swap_pager_almost_full = true; if (swdevhd == sp) swdevhd = NULL; mtx_unlock(&sw_dev_mtx); From nobody Tue Jul 29 12:49:20 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 4brwCP3Vlsz62xYs; Tue, 29 Jul 2025 12:49:21 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCN6BP7z3lmF; Tue, 29 Jul 2025 12:49:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793360; 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=0RBoLpM6oOz/MW7GHz+XgjHzeX0UQ/aXeWNUyYZhgWA=; b=FZnwSJ1hRF4ceNyPtQtdecf3snnoiwTI+Ok0x9uvzsQzagjMShmCnxXOdElXjxyeUpqG3H x2TDTn56bXKySD5H+dbr++7yVG+EATuEQG8VKFJXTCgBJyhKnbOHYy+91Ldiwh3lzbPfVV AwD67mucyPbdGSG83/8zDPvyFTNVu8w/IIvgLtGyme3Ja9eQd861ACVlxXpL2SDVIGRwV0 VsInq6075xdmiPl/4PtzATtQ9rF6nQjWAB5EPjJ+ZsKWhTddave6P9ir3E//i75KZwHTtz gG1B7IuF3vaAvEYv2Y5dNlbdQNtTG+RAiCLvqVA9bW/tI+Bo6W/jvZFDj82hyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793360; 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=0RBoLpM6oOz/MW7GHz+XgjHzeX0UQ/aXeWNUyYZhgWA=; b=CMIre62Vcy855Kt9Gd0x2Fu3LrbiNVIcKbju1hYeCVQ02Xf//Vy8BBQj8F0zC9leobr1UV aRof7GaUVbBiMqdf+o5oh9mFc7y2qIHme72FZAgznwy5wwvPkjhOau1FdYnoN4UcORtx9u 4j+SKJ2a82yACq57MOEV5aK4zVo7EDBOMOqNjtJqL6y6JnVGmK5yPimXJ4TjHuldJL2mAQ 16lqFeVMqsKvZAWODlnZk6DppKbg6+hXZRInzQsXRZPDrJrZAK3luDDVTHMzXG41HeGfvE HTJAilVHLsL8PFeCCqmjBq7VpxmPDnxkYnDCf2lKEvPiwUt6VPGaP9atwuEnKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793360; a=rsa-sha256; cv=none; b=pyu/FLvQ+iPI7fCr3+dl29AaYq5xMCb1/X5AEea+k4zUWVlPyFm2VtA2E1Eh88+NIVFuvE x0LQY9iN/91dIpEWm1VspTYXjkXK0fTrd/rYmxmreY/tRkBkxxPj1xVLYak8IoHBjiB3Ea 1ILkWHvRy72t01JJD2pFJ17jYvkcTAHP06P2BRjXcbuRNwUBSUBgfLvn5GiYAXRohv+lgB Rlw0HUb8cPPjG+FSg0VXLBc9A81uql08/nzNJU/6eV6LgeZsdqWgGtOshx7quTT8ICjNU9 +9yuMkGLsb7ZZRVB/sAOxr2smkU4zCLEpr7gkhno6+Z4vjMTlnfAgos59dQ2GA== 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 4brwCN5n9GzXZg; Tue, 29 Jul 2025 12:49:20 +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 56TCnKcW033877; Tue, 29 Jul 2025 12:49:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnKm2033873; Tue, 29 Jul 2025 12:49:20 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:20 GMT Message-Id: <202507291249.56TCnKm2033873@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8aeeb4b7f0ff - stable/14 - p9fs: Set *eofflag in p9fs_readdir() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8aeeb4b7f0ff21844617def38f89fe34bf05ae4c Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8aeeb4b7f0ff21844617def38f89fe34bf05ae4c commit 8aeeb4b7f0ff21844617def38f89fe34bf05ae4c Author: Mark Johnston AuthorDate: 2025-07-15 00:20:06 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:09:19 +0000 p9fs: Set *eofflag in p9fs_readdir() Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50760 (cherry picked from commit d4cdba5b2f55b62ba1558995226dd9d93fe00af8) --- sys/fs/p9fs/p9fs_vnops.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index 56bf766ef801..227e2b93883e 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -1784,6 +1784,9 @@ p9fs_readdir(struct vop_readdir_args *ap) return (EBADF); } + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 0; + io_buffer = uma_zalloc(p9fs_io_buffer_zone, M_WAITOK); /* We haven't reached the end yet. read more. */ @@ -1801,8 +1804,11 @@ p9fs_readdir(struct vop_readdir_args *ap) count = p9_client_readdir(vofid, (char *)io_buffer, diroffset, count); - if (count == 0) + if (count == 0) { + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 1; break; + } if (count < 0) { error = EIO; From nobody Tue Jul 29 12:49:19 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 4brwCN2r9pz62xLL; Tue, 29 Jul 2025 12:49:20 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwCM5kWdz3lcq; Tue, 29 Jul 2025 12:49:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793359; 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=32uQH8ag+DTEGdLc2KiJSnKriuUlOplT8TjS/MqESE0=; b=P51Gah5GdcSis0NzsuB2WslHTOx6ni2Ie3MILx/7jmu6pJddTbb8d7bsopodH0negQ4vl7 nqpgLbVmjuC4ZsyyWop65a3qGPQuG0EHxg8T+Jsa98ZEY7uLS+BDo0VTB7ye0/xAoW0IU5 EhepUBCJ1MPw5bB0pbZ1DrsICn+iohUA3T0QPxUJVTRc2fEyCsgnkbx3SDnsyC0Yl9V16B 9Z8YeLmAJelpUS6AkAc8BpPDCUV85mgNOHAbQ+llXYkA2XnT92lEOZxLwBMWsq/9U1otWT O0Hmr1bAaO7InrTL6JZzDYLTAnd3q/zrjeZzkBmCi3cKiWh4tLYxlgXSo5sPCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753793359; 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=32uQH8ag+DTEGdLc2KiJSnKriuUlOplT8TjS/MqESE0=; b=GOlOWQJnAiaPbqbyCwP4ivcjXxFpYHXDsGq776E7Ci2o3rEIZ2FCKSMVKlb/q53MUT7N6n J6RN1dCpPUgvdCh8Gy0ottenaOWLCBADy8DaQE7tcbpT4zWCevnLiTFcXIiA07B3pXI1Ba FzC+8j1BEAISBuVBmpxvpEYbQL0260RGWwMOvn6WQrh27GoVGcoExzv1peCA5ybfGa4rAE p16y5xnsyKFTZ//GR3kda/+QWu7SaZfEZy3PwXoj5iIyGp2xtAzGWX9LB58g0u2kX0+DYp NCbSTItdSqAh15xbhK1/QVZ9pWsGC9JIMq8TW5L1xxXZ7JsJPNPY6+NKRG5kXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753793359; a=rsa-sha256; cv=none; b=g0c2PB4YjhThQhDSdliWkJA5tmS8IAs0M0J6Kh92a3BWFNTPP0Eajw3va6SS6b/BJ5GQ7x G7tu2j4QaJzK/XpUn7XS7PGMCEofz280kaC5pnHw++cH0ayY7GGZ3QRx9oNzOhlG6ddJRP miEwqGrMgxfBpr8iNDBqKTDp0EqVD86zYD5+ZSkZ3K+VI/zWNaBPnus/+9vzUSbiOvwTX5 b7CRU/kwV8aNMs1zV5CY80HfqM12rbc/nIRSQCeqpNQhrw6z6NNG9eV4GKdOAeky5KYOVC Q051vF8BIdI71RYz7fFPs2iyrOq2ev4zmR0sFanxNRjG+FdJxAT9udfKvm5CEA== 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 4brwCM5BWtzY1r; Tue, 29 Jul 2025 12:49:19 +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 56TCnJVh033834; Tue, 29 Jul 2025 12:49:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TCnJQC033831; Tue, 29 Jul 2025 12:49:19 GMT (envelope-from git) Date: Tue, 29 Jul 2025 12:49:19 GMT Message-Id: <202507291249.56TCnJQC033831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 852cc22dda9b - stable/14 - vm_pageout: Remove a volatile qualifier from some vm_domain members 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 852cc22dda9b69dac61068b8507958aee048068a Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=852cc22dda9b69dac61068b8507958aee048068a commit 852cc22dda9b69dac61068b8507958aee048068a Author: Mark Johnston AuthorDate: 2025-07-15 15:16:40 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 12:09:12 +0000 vm_pageout: Remove a volatile qualifier from some vm_domain members These are always accessed using atomic(9) intrinsics, so do not need the qualifier. No functional change intended. Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51322 (cherry picked from commit fad79db405052f3faad7184ea2c8bfe9f92a700d) --- sys/vm/vm_pagequeue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_pagequeue.h b/sys/vm/vm_pagequeue.h index 43cb67a252b5..29280f859bab 100644 --- a/sys/vm/vm_pagequeue.h +++ b/sys/vm/vm_pagequeue.h @@ -260,9 +260,9 @@ struct vm_domain { u_int vmd_inactive_shortage; /* Per-thread shortage. */ blockcount_t vmd_inactive_running; /* Number of inactive threads. */ blockcount_t vmd_inactive_starting; /* Number of threads started. */ - volatile u_int vmd_addl_shortage; /* Shortage accumulator. */ - volatile u_int vmd_inactive_freed; /* Successful inactive frees. */ - volatile u_int vmd_inactive_us; /* Microseconds for above. */ + u_int vmd_addl_shortage; /* (a) Shortage accumulator. */ + u_int vmd_inactive_freed; /* (a) Successful inactive frees. */ + u_int vmd_inactive_us; /* (a) Microseconds for above. */ u_int vmd_inactive_pps; /* Exponential decay frees/second. */ int vmd_oom_seq; int vmd_last_active_scan; From nobody Tue Jul 29 14:20:14 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 4bryDH10wqz6336W; Tue, 29 Jul 2025 14:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bryDH0DShz3KKF; Tue, 29 Jul 2025 14:20:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753798815; 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=tRGC8m2haVEFXA2OuziHfm164CrpIE8UHhI5EPSVmIE=; b=J/T+QCtuDIe8mQAOiIjjaymBV0YUOQBLdTEMlIKxcd7ftR57g0MP3y4gsnKeRItXN6oX2u Zy2SPUiIDkGWO1Z3n1Hqr/a828QeThjFWwZoaXjP/+cYaJ072WffecbjQALFTUcOHZO1i/ WmAf7+Vo0FbOz1J8LivB9D+7W2K+gaqauiDrsJ7Xp4NddowAePhhpRtvN/dM/3tpXGGO0K 4mEOPqfxZnf5+WRQfgRGb4UjPRvqxM8TxtRBftQ+1FV916TMmNXx/OmyUWpTZ0vUGShHHf NlBHrIFZ2lX6rqbN8fL7Z0M8RVAv/hfVk362RyPpsf9NrWou348M1Kiji9hZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753798815; 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=tRGC8m2haVEFXA2OuziHfm164CrpIE8UHhI5EPSVmIE=; b=c2GLySRflELPHgz/QcjU1bssxq+lYIS/xkXSduTJRm0R2Cs7gWHubc+bsBDn7cjwzAvviJ Wc6v25mpMSesED3IzQC/8kPQIge65NtzZE7qNa2j5bAx3efFOZmiXWZ58lz3s4+fAp6uny 4kT2Qb16PwpdunC4hR4Ea1wRdycNqcSjwJnteOeiQiM9s2FkPwkFrYympiYvX47o5BMjnM 9KMy37pbSspOnXnD5Y7vlVs9oT2vRLGZZwnZ4p7ZHokzBGjku4DyO92CxOKKV8SNM1zTRO busbSGrWOsepKaujykQ47gvfKewMaE2e9HHkCYMdwecAgBZTOyuwIct0NUgrZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753798815; a=rsa-sha256; cv=none; b=vjuR4zSFwyW2YEAbByq34Lnx+hFJLNvfiOv+7FGq0ORVkN4W4LkL8aO7Eh+2WvtK5aW4D2 cjfXQrv+b2DLYgRwVPYAsYG+tr7ZJLKybCoICgG87CJ6lr1o+n7Oh/Q6wHXcNN8NGxmt4F 8TSQ6+vTBRTkvnw/wvywZdwkoqO6tI328WrYq5EhytKGR3GkaJyQxcQjmjmQVtJ44tdL8O 29uqhZZjLMCE669vJocnutVr7Junc5VufxLQ79R4d0j81LVh3h/Xk7LhCW+TCdetuhti73 rlsgnGfOs1vzy6tCrwWpxKFitHiMqOd806EGhHihT+RpXttn+A1hhfbrGKmnyQ== 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 4bryDG6fb4zbV3; Tue, 29 Jul 2025 14:20:14 +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 56TEKE1M012972; Tue, 29 Jul 2025 14:20:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TEKEx3012961; Tue, 29 Jul 2025 14:20:14 GMT (envelope-from git) Date: Tue, 29 Jul 2025 14:20:14 GMT Message-Id: <202507291420.56TEKEx3012961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 3fe326bfa030 - stable/14 - memcmp.3: Clarify return value 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3fe326bfa03025654c017dde7ac8124beb5142fb Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3fe326bfa03025654c017dde7ac8124beb5142fb commit 3fe326bfa03025654c017dde7ac8124beb5142fb Author: Ed Maste AuthorDate: 2024-06-05 20:03:13 +0000 Commit: Ed Maste CommitDate: 2025-07-29 14:19:49 +0000 memcmp.3: Clarify return value The return value is not required to be the difference between the differing bytes, only less than zero, zero, or greater than zero. Reviewed by: fuz Event: Kitchener-Waterloo Hackathon 202406 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47683 (cherry picked from commit 5cc53d79655bf7f67b1a794c088d896aa6475c2e) --- lib/libc/string/memcmp.3 | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/lib/libc/string/memcmp.3 b/lib/libc/string/memcmp.3 index bf02412d9e70..8f4980d61c05 100644 --- a/lib/libc/string/memcmp.3 +++ b/lib/libc/string/memcmp.3 @@ -29,14 +29,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)memcmp.3 8.1 (Berkeley) 6/4/93 -.\" -.Dd August 15, 2016 +.Dd November 20, 2024 .Dt MEMCMP 3 .Os .Sh NAME .Nm memcmp -.Nd compare byte string +.Nd compare bytes in memory .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -47,27 +45,25 @@ The .Fn memcmp function -compares byte string +compares byte object .Fa b1 -against byte string +against byte object .Fa b2 . -Both strings are assumed to be +Both objects are assumed to be .Fa len bytes long. .Sh RETURN VALUES The .Fn memcmp -function -returns zero if the two strings are identical, -otherwise returns the difference between the first two differing bytes -(treated as -.Vt "unsigned char" -values, so that -.Sq Li \e200 -is greater than -.Sq Li \&\e0 , -for example). -Zero-length strings are always identical. +function returns zero if the two objects are identical. +Zero-length objects are considered identical. +The +.Fn memcmp +function returns a negative value if the first differing byte has a lower +value in +.Fa b1 +and a positive value if the first differing byte has a higher value in +.Fa b1 . .Sh SEE ALSO .Xr bcmp 3 , .Xr strcasecmp 3 , @@ -82,3 +78,14 @@ The function conforms to .St -isoC . +.Sh CAVEATS +If the objects differ, the C library +.Fn memcmp +implementation returns the difference between the first two differing bytes +.Po treated as +.Vt "unsigned char" +values +.Pc . +This behavior is not specified by +.St -isoC , +is not portable, and may not occur in light of compiler optimizations. From nobody Tue Jul 29 14:20:15 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 4bryDJ1LJVz6336Z; Tue, 29 Jul 2025 14:20:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bryDJ06V4z3KF2; Tue, 29 Jul 2025 14:20:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753798816; 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=zHpeDkIJ6Rb45xEr14rXbdPk4QdTd0VKFFUgZIKMXgk=; b=DExp21kXVxuM6mp2T/4IiYJYtvkQhDm3+4PP/pveRXlPlI8O9W40Ep4/dgFuRQxTZH95/R cZ7vKjMIPX1nVrTYhSezCEKbOYU4Pc87XcqQu5/Sp7kX/zJOcHNPYwwYZ9hDrvIFuwfhI/ rqPIwYtiRNDw3fKFSOPFK0LnnVYSGvTyN7ts7PjelGULHpKsZLqILzieIRfKDDY4cALyoW k1ndrYPxB4sIDqYhwSyEMv5sCVxIgH674ybYKRtWh/PEmPGmc+02Qqi1errXPa2V2DBoQf ge0N3D66VomnfzwEzXR6+0GKSwPrecZBcYEE3MlmQ7HIVaOkk0M9KU6cm2eunA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753798816; 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=zHpeDkIJ6Rb45xEr14rXbdPk4QdTd0VKFFUgZIKMXgk=; b=abtzH0FJ+xe2ybIJ/Mte8ExB5P7qBbqUv+BW3EN/BnvjAFfWJ4kbEPrOg/uHqKsetH+q4e K7qODH1szdkRZsNfEnceLX9XPmGCV/yUKyQvCzjyfZ4Q8n3S4EMNABfwVUamvBXJDivzNq Ygq3jEY08CXbS2+D2t4r6jMDIuhqWD1HXONqAB+s0K0J3Ohup0V1lf5Pm6WwnMiuGrk4nR eqU2V4RLFSvyK1+IOuDl29rrJFavbLk/+vHzR3DTQ9sDPyk5C3bU7ozxYylINLXN495YXE kKuD+fhIvS3Ao2qUL2+MCPAsbpkUlukBo8y38PuGWg8K+J475Lpt3I5Y754RhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753798816; a=rsa-sha256; cv=none; b=D9Ic8zLvuRWV7nxa0a1pH+oNkgXfd9i/6XySlwVCFtnVRfj63iYAPCcaFEn02JRl6fw2VF TdvRkYPMAAAIzc951dpPYLbkOZHad0v6WcOrtW/2FMrRxKgE4CgxtAD9WMr3cRsRLrgva+ 13dJYBAixVkaNiJteBJFYtzJwkXm7uztueKY4fbLPt15JJSxnemhZEMhHVXhpf/keh+lXR BjJxxhx5J8iGS4TpQhH/5iR8aoWq43bQV7hAb5bEeHjISAgNzIo5lxtWZvH1t/6gaqPoco hQijM8c50vtEbhXnIQlptb9P9MtHRE/bYPeut+11m+dNnOUuIgxTY0WKY2U8MA== 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 4bryDH6pcszbD1; Tue, 29 Jul 2025 14:20:15 +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 56TEKFH1013625; Tue, 29 Jul 2025 14:20:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TEKFLe013616; Tue, 29 Jul 2025 14:20:15 GMT (envelope-from git) Date: Tue, 29 Jul 2025 14:20:15 GMT Message-Id: <202507291420.56TEKFLe013616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 27ed3497bb55 - stable/14 - =?utf-8?Q?uk.kbd: Fix =E2=82=AC mapping?= 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 27ed3497bb553374f7d80d7a0ff65f0296ee5ce4 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=27ed3497bb553374f7d80d7a0ff65f0296ee5ce4 commit 27ed3497bb553374f7d80d7a0ff65f0296ee5ce4 Author: Ed Maste AuthorDate: 2025-06-05 15:18:45 +0000 Commit: Ed Maste CommitDate: 2025-07-29 14:19:49 +0000 uk.kbd: Fix € mapping We previously emitted the generic currency sign `¤` for Ctrl+4. Generally speaking the modifer should be AltGr not Ctrl, and this should be the Euro symbol `€`. Fixes: eb8f9028fb38 ("Add the Euro symbol mapping to the UK keyboard keymap.") Fixes: a232c1d130d2 ("Copy country-code .iso syscons keymaps for vt(4)") Fixes: fdd869bd8a89 ("Another rpund of fixes, after checking keymaps for plausibility and with") Reviewed by: ivy Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50702 (cherry picked from commit 5c66d7a2b8a000b6307c0a12e78eb1b50376c9f8) --- share/vt/keymaps/uk.kbd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/vt/keymaps/uk.kbd b/share/vt/keymaps/uk.kbd index 4a805fae12b9..261af190dcbe 100644 --- a/share/vt/keymaps/uk.kbd +++ b/share/vt/keymaps/uk.kbd @@ -7,7 +7,7 @@ 002 '1' '!' nop nop '`' '`' nop nop O 003 '2' '"' nul nul '@' '@' nul nul O 004 '3' 0xa3 nop nop '#' '#' nop nop O - 005 '4' '$' 0xa4 0xa4 '4' '$' nop nop O + 005 '4' '$' nop nop 0x20ac '$' nop nop O 006 '5' '%' nop nop '5' '%' nop nop O 007 '6' '^' rs rs '^' '^' rs rs O 008 '7' '&' nop nop '[' '[' esc esc O From nobody Tue Jul 29 15:16:48 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 4brzTX5KDGz635cj; Tue, 29 Jul 2025 15:16:48 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brzTX4T93z3NqV; Tue, 29 Jul 2025 15:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753802208; 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=gZEV/C4Jc5hChcn1My9xPiBiFf9HyB0Ey70GG3h9TG8=; b=SDgi8yNl2nsSKqej2yzPqzI0wgufq0VuLMiBYf93/nQBWXX6BYje7LsLoyId7wJav6FGeH 4SZlMMHROLVNe45WWJf0046GLv2VPjhb/qw7dfU1zS30S/5GqJb2WZSL+D2/FxrRTIBLM/ lpsOuSWbNOJ7iqMasimf2vB+Gtm4vr02GWDS0H5RUR2yXuqyRiHcdcPuJ/KTwjqzBnSgWH 4x3BXziCsgCSHpBZw+YewlE81Ttkpy+PpWBAxg4ihYl/9YUm8MZ2IyC4kLFYGq666mYEwF qI4+CUfhsiYA07oNAejrTzdK4/D/JZs/5a2VxFgReABXTl8OVQyJfNRppUfwog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753802208; 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=gZEV/C4Jc5hChcn1My9xPiBiFf9HyB0Ey70GG3h9TG8=; b=yNJrIL254GmeJoYmCGxdCkcsJxHpz4tUiixinlv4UXxEB3L8YFsCwOsRe9pJ3FX0UxV5lY 9zV87sEh5G/1q8hy0LDJI0WVuOTXeNRHcTI/9qZJOfgkgtzxqYWxc/mez/3Jc7aCCz/sNE c74Qz3sc5I+RXxVDH08oeOTYhCFlcQgvPfjFIsJiARlnmX5IP63AKtqfGg1hTRNgvn3XCt 5V+Q/XFcnN6SzkQuTSpa1q8cet8GhNbL5QBmEFs/LaQd9c4hzQj72doXmdEYHy/lB3sRa5 f3ZZFF9WdZONZHcqDPpn0nV+0kAuJAf+K1qfVDxnk+YI0l3XVNr1FbBa1QrAaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753802208; a=rsa-sha256; cv=none; b=VcXOyNLF84/O0YWYlyVhvItWv0uRYQ6bKZTw+PmDqKTofRMbjsVOo7umhFzNv82KG/sFmv a5/04PKGnjIf8hHPPnLCLp+WZ9+SiwMMoCdiDulB+HR6XAcRi6e1Qw14NmiKKPJPp5hpIh aUAtmJfMPPUllzBkyYKUwribPGIS0xisMOBwUuPwRNeiXeG/ylBH3YkWZrzf9cH4/1XIhW YCucUh0ZI0JzHG3ebs8t7WfDUZjW7YWJzfRd/eyhf3q+lzs7FVTnDJj/1SyxellatOjHdI rTmFYUJEXxGRaYcCzZzWSyY5vNlXAmnJPToKYPriRTZQz/ii7lY7KMUG+gFVGw== 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 4brzTX3VSYzd1k; Tue, 29 Jul 2025 15:16:48 +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 56TFGm4H018090; Tue, 29 Jul 2025 15:16:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TFGme3018087; Tue, 29 Jul 2025 15:16:48 GMT (envelope-from git) Date: Tue, 29 Jul 2025 15:16:48 GMT Message-Id: <202507291516.56TFGme3018087@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 5aaaa1a61024 - stable/14 - beep: Capsicumize 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5aaaa1a61024bb13aafef1716a4fb10f31147b6b Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5aaaa1a61024bb13aafef1716a4fb10f31147b6b commit 5aaaa1a61024bb13aafef1716a4fb10f31147b6b Author: Ed Maste AuthorDate: 2025-06-05 23:44:05 +0000 Commit: Ed Maste CommitDate: 2025-07-29 14:19:49 +0000 beep: Capsicumize While it's unlikely that beep(1) will be used in a context where a sandbox is particularly valuable, it does offer a simple demonstration of entering a capability sandbox after opening required fds, and is trivial to do. Reviewed by: christos Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50709 (cherry picked from commit 54eda43cc1e6b1d73804b6c397a15002e3519555) --- usr.bin/beep/beep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/beep/beep.c b/usr.bin/beep/beep.c index 0bdfe2cf97a7..9d274770ad75 100644 --- a/usr.bin/beep/beep.c +++ b/usr.bin/beep/beep.c @@ -25,6 +25,7 @@ #include +#include #include #include #include @@ -204,6 +205,9 @@ main(int argc, char **argv) if (f < 0) err(1, "Failed to open '%s'", oss_dev); + if (caph_enter() == -1) + err(1, "Failed to enter capability mode"); + c = 1; /* mono */ if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &c) != 0) errx(1, "ioctl SOUND_PCM_WRITE_CHANNELS(1) failed"); From nobody Tue Jul 29 22:16:54 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 4bs8pH1951z63Sl2; Tue, 29 Jul 2025 22:16:55 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bs8pH0pxNz4DHB; Tue, 29 Jul 2025 22:16:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827415; 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=PXfU16+nFtzRDYT1TTH1wMPzBBt9lqXTMXZvWRsNKnU=; b=o3OFlmqkgqeL8zwSATsjkjBiYot0AJdmEd+uRZ40azkFQgXttTN7OxLBykiZ5G3zFZVmxj c+g6R2rDa1JtjbF+WTv6JIpFEhYnQPRPnnT0r6gCFsGy9o444qw++Bqt8zhJLOZCyFg6fL NbCYNKRuxF9bmSsUjs8ZDY99d1zICIBR/M/FwKZd4gGEQpTUlxWe5x3/+AljhscVqPCGJP RQqr1l7pBSzXC2KKQYosYCSx99Uhev3+L+/4zi8XQ71uCGSiohy3VBDe3L3IxWHrTYWBON d7nZ765Iq4ayJCFuPyOFhhjuMpKd7+jgNVjtUXFKycdF6q66+ek8dxZRTMK6hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827415; 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=PXfU16+nFtzRDYT1TTH1wMPzBBt9lqXTMXZvWRsNKnU=; b=rFEbRgpHmTRmQZNwgh5qVpcohCk95V7/kdrHioZqHYmnCmthaEv0IH+Lxw4ucIsbpGq850 bOG76XEmQ9ECUQp22Ao035XzRytjrlPL3cAVUvgACEbxLnb++4lrOOWaHTfDtHiccQmm9n e4sr8ULyBaBxhpXr/8pM+uUzeYnV3B+LWjDycFbj71gG2AhKmYGQ4hNwuO+vN1f6MPhzQt v5h6Sp9s17P5t4qulKPFpYSmw7nvsxhHdMfTnbR00k5tiHco9ZMHzP16vtMSXnGslkvEOw U4wJIBan6u0QQBD53TjCNBnoA4ZNmLrdnmDCrnKin2SsHDUHo1fwm/COWoJ3rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753827415; a=rsa-sha256; cv=none; b=ncWyn2gy6YY2CdByQyu4DmfsCvkxB8+BsuTGmKZCbigJzCo/em/abbeWV0dRK4EVZPU0lj lDjQHlvWwekShRX80VfIL44uN2v9Udat3z+i8BUPa6x2898dCpMvjDixZJZWcwROqR9eGa CGaONQdUxkwRkNUixmcvA8Obn3Htg5nKJQWX+kOvrjCC3ZnscUcXQJgUfp79C38cOkse0O DXaglWszqsTC7e8NUEqQMi4TEMYDBuQchxgrFhWbSlmvc3goBoJKQNaSNNfjyi62J4eNgd uG4VKZ4ya0AY8Kdc6S7HIlQ0ABe4kwpniyBP3f2arAPmA8IyOVPf8YHzS40mDw== 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 4bs8pH0L9Nzq6m; Tue, 29 Jul 2025 22:16:55 +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 56TMGse2009192; Tue, 29 Jul 2025 22:16:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TMGsMv009189; Tue, 29 Jul 2025 22:16:54 GMT (envelope-from git) Date: Tue, 29 Jul 2025 22:16:54 GMT Message-Id: <202507292216.56TMGsMv009189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 08ad5c42343b - stable/14 - rtlbtfw(8): Add support for firmware file format V2 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 08ad5c42343b3ac15fa4169ac801e52e2de87135 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=08ad5c42343b3ac15fa4169ac801e52e2de87135 commit 08ad5c42343b3ac15fa4169ac801e52e2de87135 Author: Vladimir Kondratyev AuthorDate: 2025-05-14 01:09:40 +0000 Commit: Vladimir Kondratyev CommitDate: 2025-07-29 22:11:43 +0000 rtlbtfw(8): Add support for firmware file format V2 As Realtek changed format of the firmware files for recent adaptors. Sponsored by: Future Crew, LLC MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D50082 (cherry picked from commit b87a926098b291e2baf45ffc13c076ba0b0f0d74) --- usr.sbin/bluetooth/rtlbtfw/main.c | 19 +++- usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c | 195 ++++++++++++++++++++++++++++++++-- usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h | 53 ++++++++- usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.c | 35 ++++++ usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.h | 13 +++ 5 files changed, 302 insertions(+), 13 deletions(-) diff --git a/usr.sbin/bluetooth/rtlbtfw/main.c b/usr.sbin/bluetooth/rtlbtfw/main.c index e0445726c3a2..700b9b43bafa 100644 --- a/usr.sbin/bluetooth/rtlbtfw/main.c +++ b/usr.sbin/bluetooth/rtlbtfw/main.c @@ -76,7 +76,6 @@ static struct rtlbt_devid rtlbt_list[] = { { .vendor_id = 0x04ca, .product_id = 0x4006 }, { .vendor_id = 0x0cb8, .product_id = 0xc549 }, -#ifdef RTLBTFW_SUPPORTS_FW_V2 /* Realtek 8852CE Bluetooth devices */ { .vendor_id = 0x04ca, .product_id = 0x4007 }, { .vendor_id = 0x04c5, .product_id = 0x1675 }, @@ -84,7 +83,6 @@ static struct rtlbt_devid rtlbt_list[] = { { .vendor_id = 0x13d3, .product_id = 0x3587 }, { .vendor_id = 0x13d3, .product_id = 0x3586 }, { .vendor_id = 0x13d3, .product_id = 0x3592 }, -#endif /* Realtek 8852BE Bluetooth devices */ { .vendor_id = 0x0cb8, .product_id = 0xc559 }, @@ -312,6 +310,7 @@ main(int argc, char *argv[]) char *firmware_dir = NULL; char *firmware_path = NULL; char *config_path = NULL; + const char *fw_suffix; int retcode = 1; const struct rtlbt_id_table *ic; uint8_t rom_version; @@ -410,7 +409,8 @@ main(int argc, char *argv[]) if (firmware_dir == NULL) firmware_dir = strdup(_DEFAULT_RTLBT_FIRMWARE_PATH); - firmware_path = rtlbt_get_fwname(ic->fw_name, firmware_dir, "_fw.bin"); + fw_suffix = ic->fw_suffix == NULL ? "_fw.bin" : ic->fw_suffix; + firmware_path = rtlbt_get_fwname(ic->fw_name, firmware_dir, fw_suffix); if (firmware_path == NULL) goto shutdown; @@ -449,7 +449,18 @@ main(int argc, char *argv[]) rtlbt_debug("rom_version = %d", rom_version); /* Load in the firmware */ - r = rtlbt_parse_fwfile_v1(&fw, rom_version); + if (fw_type == RTLBT_FW_TYPE_V2) { + uint8_t key_id, reg_val[2]; + r = rtlbt_read_reg16(hdl, RTLBT_SEC_PROJ, reg_val); + if (r < 0) { + rtlbt_err("rtlbt_read_reg16() failed code %d", r); + goto shutdown; + } + key_id = reg_val[0]; + rtlbt_debug("key_id = %d", key_id); + r = rtlbt_parse_fwfile_v2(&fw, rom_version, key_id); + } else + r = rtlbt_parse_fwfile_v1(&fw, rom_version); if (r < 0) { rtlbt_err("Parseing firmware file failed"); goto shutdown; diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c index bb3d20d79527..c58a8feb41a4 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c @@ -105,20 +105,19 @@ static const struct rtlbt_id_table rtlbt_ic_id_table[] = { .hci_version = 0xb, .flags = RTLBT_IC_FLAG_MSFT, .fw_name = "rtl8852bu", -#ifdef RTLBTFW_SUPPORTS_FW_V2 }, { /* 8852C */ .lmp_subversion = RTLBT_ROM_LMP_8852A, .hci_revision = 0xc, .hci_version = 0xc, .flags = RTLBT_IC_FLAG_MSFT, .fw_name = "rtl8852cu", + .fw_suffix = "_fw_v2.bin", }, { /* 8851B */ .lmp_subversion = RTLBT_ROM_LMP_8851B, .hci_revision = 0xb, .hci_version = 0xc, .flags = RTLBT_IC_FLAG_MSFT, .fw_name = "rtl8851bu", -#endif }, }; @@ -144,10 +143,8 @@ static const uint16_t project_ids[] = { /* Signatures */ static const uint8_t fw_header_sig_v1[8] = {0x52, 0x65, 0x61, 0x6C, 0x74, 0x65, 0x63, 0x68}; /* Realtech */ -#ifdef RTLBTFW_SUPPORTS_FW_V2 static const uint8_t fw_header_sig_v2[8] = {0x52, 0x54, 0x42, 0x54, 0x43, 0x6F, 0x72, 0x65}; /* RTBTCore */ -#endif static const uint8_t fw_ext_sig[4] = {0x51, 0x04, 0xFD, 0x77}; int @@ -260,12 +257,10 @@ rtlbt_get_fw_type(struct rtlbt_firmware *fw, uint16_t *fw_lmp_subversion) fw_type = RTLBT_FW_TYPE_V1; fw_header_len = sizeof(struct rtlbt_fw_header_v1); } else -#ifdef RTLBTFW_SUPPORTS_FW_V2 if (memcmp(fw->buf, fw_header_sig_v2, sizeof(fw_header_sig_v2)) == 0) { fw_type = RTLBT_FW_TYPE_V2; fw_header_len = sizeof(struct rtlbt_fw_header_v2); } else -#endif return (RTLBT_FW_TYPE_UNKNOWN); if (fw->len < fw_header_len + sizeof(fw_ext_sig) + 4) { @@ -367,6 +362,194 @@ rtlbt_parse_fwfile_v1(struct rtlbt_firmware *fw, uint8_t rom_version) return (0); } +static void * +rtlbt_iov_fetch(struct rtlbt_iov *iov, uint32_t len) +{ + void *data = NULL; + + if (iov->len >= len) { + data = iov->data; + iov->data += len; + iov->len -= len; + } + + return (data); +} + +static int +rtlbt_patch_entry_cmp(struct rtlbt_patch_entry *a, struct rtlbt_patch_entry *b, + void *thunk __unused) +{ + return ((a->prio > b->prio) - (a->prio < b->prio)); +} + +static int +rtlbt_parse_section(struct rtlbt_patch_list *patch_list, uint32_t opcode, + uint8_t *data, uint32_t len, uint8_t rom_version, uint8_t key_id) +{ + struct rtlbt_sec_hdr *hdr; + struct rtlbt_patch_entry *entry; + struct rtlbt_subsec_hdr *subsec_hdr; + struct rtlbt_subsec_security_hdr *subsec_security_hdr; + uint16_t num_subsecs; + uint8_t *subsec_data; + uint32_t subsec_len; + int i, sec_len = 0; + struct rtlbt_iov iov = { + .data = data, + .len = len, + }; + + hdr = rtlbt_iov_fetch(&iov, sizeof(*hdr)); + if (hdr == NULL) { + errno = EINVAL; + return (-1); + } + num_subsecs = le16toh(hdr->num); + + for (i = 0; i < num_subsecs; i++) { + subsec_hdr = rtlbt_iov_fetch(&iov, sizeof(*subsec_hdr)); + if (subsec_hdr == NULL) + break; + subsec_len = le32toh(subsec_hdr->len); + + rtlbt_debug("subsection, eco 0x%02x, prio 0x%02x, len 0x%x", + subsec_hdr->eco, subsec_hdr->prio, subsec_len); + + subsec_data = rtlbt_iov_fetch(&iov, subsec_len); + if (subsec_data == NULL) + break; + + if (subsec_hdr->eco == rom_version + 1) { + if (opcode == RTLBT_PATCH_SECURITY_HEADER) { + subsec_security_hdr = (void *)subsec_hdr; + if (subsec_security_hdr->key_id == key_id) + break; + continue; + } + + entry = calloc(1, sizeof(*entry)); + if (entry == NULL) { + errno = ENOMEM; + return (-1); + } + *entry = (struct rtlbt_patch_entry) { + .opcode = opcode, + .len = subsec_len, + .prio = subsec_hdr->prio, + .data = subsec_data, + }; + SLIST_INSERT_HEAD(patch_list, entry, next); + sec_len += subsec_len; + } + } + + return (sec_len); +} + +int +rtlbt_parse_fwfile_v2(struct rtlbt_firmware *fw, uint8_t rom_version, + uint8_t key_id) +{ + struct rtlbt_fw_header_v2 *hdr; + struct rtlbt_section *section; + struct rtlbt_patch_entry *entry; + uint32_t num_sections; + uint32_t section_len; + uint32_t opcode; + int seclen, len = 0, patch_len = 0; + uint32_t i; + uint8_t *section_data, *patch_buf; + struct rtlbt_patch_list patch_list = + SLIST_HEAD_INITIALIZER(patch_list); + struct rtlbt_iov iov = { + .data = fw->buf, + .len = fw->len - 7, + }; + + hdr = rtlbt_iov_fetch(&iov, sizeof(*hdr)); + if (hdr == NULL) { + errno = EINVAL; + return (-1); + } + num_sections = le32toh(hdr->num_sections); + + rtlbt_debug("FW version %02x%02x%02x%02x-%02x%02x%02x%02x", + hdr->fw_version[0], hdr->fw_version[1], + hdr->fw_version[2], hdr->fw_version[3], + hdr->fw_version[4], hdr->fw_version[5], + hdr->fw_version[6], hdr->fw_version[7]); + + for (i = 0; i < num_sections; i++) { + section = rtlbt_iov_fetch(&iov, sizeof(*section)); + if (section == NULL) + break; + section_len = le32toh(section->len); + opcode = le32toh(section->opcode); + + rtlbt_debug("section, opcode 0x%08x", section->opcode); + + section_data = rtlbt_iov_fetch(&iov, section_len); + if (section_data == NULL) + break; + + seclen = 0; + switch (opcode) { + case RTLBT_PATCH_SECURITY_HEADER: + if (key_id == 0) + break; + /* FALLTHROUGH */ + case RTLBT_PATCH_SNIPPETS: + case RTLBT_PATCH_DUMMY_HEADER: + seclen = rtlbt_parse_section(&patch_list, opcode, + section_data, section_len, rom_version, key_id); + break; + default: + break; + } + if (seclen < 0) { + rtlbt_err("Section parse (0x%08x) failed. err %d", + opcode, errno); + return (-1); + } + len += seclen; + } + + if (len == 0) { + errno = ENOMSG; + return (-1); + } + + patch_buf = calloc(1, len); + if (patch_buf == NULL) { + errno = ENOMEM; + return (-1); + } + + SLIST_MERGESORT(&patch_list, NULL, + rtlbt_patch_entry_cmp, rtlbt_patch_entry, next); + while (!SLIST_EMPTY(&patch_list)) { + entry = SLIST_FIRST(&patch_list); + rtlbt_debug("opcode 0x%08x, addr 0x%p, len 0x%x", + entry->opcode, entry->data, entry->len); + memcpy(patch_buf + patch_len, entry->data, entry->len); + patch_len += entry->len; + SLIST_REMOVE_HEAD(&patch_list, next); + free(entry); + } + + if (patch_len == 0) { + errno = EPERM; + return (-1); + } + + free(fw->buf); + fw->buf = patch_buf; + fw->len = patch_len; + + return (0); +} + int rtlbt_append_fwfile(struct rtlbt_firmware *fw, struct rtlbt_firmware *opt) { diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h index 340abacba759..48b30cb2289b 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h @@ -30,7 +30,8 @@ #ifndef __RTLBT_FW_H__ #define __RTLBT_FW_H__ -#include +#include +#include #define RTLBT_ROM_LMP_8703B 0x8703 #define RTLBT_ROM_LMP_8723A 0x1200 @@ -41,12 +42,14 @@ #define RTLBT_ROM_LMP_8852A 0x8852 #define RTLBT_ROM_LMP_8851B 0x8851 +#define RTLBT_PATCH_SNIPPETS 0x01 +#define RTLBT_PATCH_DUMMY_HEADER 0x02 +#define RTLBT_PATCH_SECURITY_HEADER 0x03 + enum rtlbt_fw_type { RTLBT_FW_TYPE_UNKNOWN, RTLBT_FW_TYPE_V1, -#ifdef RTLBTFW_SUPPORTS_FW_V2 RTLBT_FW_TYPE_V2, -#endif }; struct rtlbt_id_table { @@ -58,6 +61,7 @@ struct rtlbt_id_table { #define RTLBT_IC_FLAG_CONFIG (1 << 1) #define RTLBT_IC_FLAG_MSFT (2 << 1) const char *fw_name; + const char *fw_suffix; }; struct rtlbt_firmware { @@ -66,6 +70,21 @@ struct rtlbt_firmware { unsigned char *buf; }; +SLIST_HEAD(rtlbt_patch_list, rtlbt_patch_entry); + +struct rtlbt_patch_entry { + SLIST_ENTRY(rtlbt_patch_entry) next; + uint32_t opcode; + uint32_t len; + uint8_t prio; + uint8_t *data; +}; + +struct rtlbt_iov { + uint8_t *data; + uint32_t len; +}; + struct rtlbt_fw_header_v1 { uint8_t signature[8]; uint32_t fw_version; @@ -78,6 +97,32 @@ struct rtlbt_fw_header_v2 { uint32_t num_sections; } __attribute__ ((packed)); +struct rtlbt_section { + uint32_t opcode; + uint32_t len; + uint8_t data[]; +} __attribute__ ((packed)); + +struct rtlbt_sec_hdr { + uint16_t num; + uint16_t reserved; +} __attribute__ ((packed)); + +struct rtlbt_subsec_hdr { + uint8_t eco; + uint8_t prio; + uint8_t cb[2]; + uint32_t len; +} __attribute__ ((packed)); + +struct rtlbt_subsec_security_hdr { + uint8_t eco; + uint8_t prio; + uint8_t key_id; + uint8_t reserved; + uint32_t len; +} __attribute__ ((packed)); + int rtlbt_fw_read(struct rtlbt_firmware *fw, const char *fwname); void rtlbt_fw_free(struct rtlbt_firmware *fw); char *rtlbt_get_fwname(const char *fw_name, const char *prefix, @@ -87,6 +132,8 @@ const struct rtlbt_id_table *rtlbt_get_ic(uint16_t lmp_subversion, enum rtlbt_fw_type rtlbt_get_fw_type(struct rtlbt_firmware *fw, uint16_t *fw_lmp_subversion); int rtlbt_parse_fwfile_v1(struct rtlbt_firmware *fw, uint8_t rom_version); +int rtlbt_parse_fwfile_v2(struct rtlbt_firmware *fw, uint8_t rom_version, + uint8_t reg_id); int rtlbt_append_fwfile(struct rtlbt_firmware *fw, struct rtlbt_firmware *opt); #endif diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.c b/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.c index 21f2c3e2804f..82e22d406ea9 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.c +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.c @@ -178,6 +178,41 @@ rtlbt_read_rom_ver(struct libusb_device_handle *hdl, uint8_t *ver) return (0); } +int +rtlbt_read_reg16(struct libusb_device_handle *hdl, + struct rtlbt_vendor_cmd *vcmd, uint8_t *resp) +{ + int ret, transferred; + struct rtlbt_hci_event_cmd_compl *event; + uint8_t cmd_buf[offsetof(struct rtlbt_hci_cmd, data) + sizeof(*vcmd)]; + struct rtlbt_hci_cmd *cmd = (struct rtlbt_hci_cmd *)cmd_buf; + cmd->opcode = htole16(0xfc61); + cmd->length = sizeof(struct rtlbt_vendor_cmd); + memcpy(cmd->data, vcmd, sizeof(struct rtlbt_vendor_cmd)); + uint8_t buf[RTLBT_HCI_EVT_COMPL_SIZE(struct rtlbt_vendor_rp)]; + + memset(buf, 0, sizeof(buf)); + + ret = rtlbt_hci_command(hdl, + cmd, + buf, + sizeof(buf), + &transferred, + RTLBT_HCI_CMD_TIMEOUT); + + if (ret < 0 || transferred != sizeof(buf)) { + rtlbt_debug("Can't read reg16: code=%d, size=%d", + ret, + transferred); + return (-1); + } + + event = (struct rtlbt_hci_event_cmd_compl *)buf; + memcpy(resp, &(((struct rtlbt_vendor_rp *)event->data)->data), 2); + + return (0); +} + int rtlbt_load_fwfile(struct libusb_device_handle *hdl, const struct rtlbt_firmware *fw) diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.h b/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.h index bc7c9fee3f57..a7200a440272 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.h +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbt_hw.h @@ -95,9 +95,22 @@ struct rtlbt_hci_dl_rp { uint8_t index; } __attribute__ ((packed)); +/* Vendor USB request payload */ +struct rtlbt_vendor_cmd { + uint8_t data[5]; +} __attribute__ ((packed)); +#define RTLBT_SEC_PROJ (&(struct rtlbt_vendor_cmd) {{0x10, 0xA4, 0x0D, 0x00, 0xb0}}) + +struct rtlbt_vendor_rp { + uint8_t status; + uint8_t data[2]; +}; + int rtlbt_read_local_ver(struct libusb_device_handle *hdl, ng_hci_read_local_ver_rp *ver); int rtlbt_read_rom_ver(struct libusb_device_handle *hdl, uint8_t *ver); +int rtlbt_read_reg16(struct libusb_device_handle *hdl, + struct rtlbt_vendor_cmd *cmd, uint8_t *resp); int rtlbt_load_fwfile(struct libusb_device_handle *hdl, const struct rtlbt_firmware *fw); From nobody Tue Jul 29 22:16:56 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 4bs8pJ319lz63SQd; Tue, 29 Jul 2025 22:16:56 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bs8pJ1yQLz4DBg; Tue, 29 Jul 2025 22:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827416; 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=01B3KpSbt0R9kf9Lxe9zh5QVCEZzVuAQpy1sPDJ8d28=; b=g7XLJn6H1EdSbiqd8laKnSyunod64P9r4z06cErh9/qlG93NfUT21mbSWS54FjkLbrxZOi wnWigD3L15gJi+s+DkpH25Txi3gMP8127oucpVwSyP7n1AL7GqYKkTNbA4LEgX0ucpViPQ gBSAgrVBBZd8D9WUvuOywf4X9gtEb5H9cUd4zEb+ShR9uTkmf/TticCTk3sTBzFZQAZl3e qg/d1Kn5hiUD34ZYtubroVRDz9CoreuZ0YZKeiyChEbXXiz2Y5DUrJuWa7UQ0zd8fGbAEE P+EdJ6zndrkhbOlPWewCueupaTxuvrs3Dd92K9ZRRk0at+6l++cBlh4rRwkcSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827416; 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=01B3KpSbt0R9kf9Lxe9zh5QVCEZzVuAQpy1sPDJ8d28=; b=N/OkrmtuZ5KShlwhJYBHNY3nJbENK0EB2LxD5wUVLxucWTyE8Cpdt9tF464n1TBquT8bGP KCwF5bf4wLuoadP1SbNmQkxxx3ZsT2/CzrWs+IlRmlAoJ2TogYr5ObvivokSKu1QKE3rUJ NgmMsm/M2QMNvBGWvIZyf1vGuM/ccnO1pQbcqiMTxtsZcwkC6W0x1ssz37mpiWsOFLgJbP Fypk753WSA5ontCzdxbpdesxGdAWQ24MJ8jdNQ3L/q4r5zPf9brD4auqeW98fmRJMMzUX7 FAdFrB5diTarYW1fGsFvjgVbqAbVxBZFoYLMOqFgW5evtycA4Y4nvEfSLfXdCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753827416; a=rsa-sha256; cv=none; b=ZuNKJr/bv4wEgIm2uhCK3kIhIn+Dpt9tYmeo/AlABu+EIcxNATJTXojf0AicBTm6+w3tbT NHYV+TlYDnbOuxmwQxr/4hQDEzpcWgVnwcaYfFZq+JWyRIbK5QIxLbdSmThpQaqs2XXGCo JLXI5lQVJ1FWsi09AaS9QzQZizPv2/mq4md50WTBUQpQc+IjgecEvRFIK5oQzaMtgQNJ3h uMgp49s4MoYFw3R3R0Aq9Y5gDEC6684CHjLL7ayhKyUcWLb+ZfF6zM5S/aqtPx9f1YeABk QvitBCWvCx5+qN+5JEyopgino085htUEMMmgU73tpxafL7Qe2fcEOOd09axXug== 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 4bs8pJ1HnGzq6q; Tue, 29 Jul 2025 22:16:56 +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 56TMGuPX009236; Tue, 29 Jul 2025 22:16:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TMGugU009231; Tue, 29 Jul 2025 22:16:56 GMT (envelope-from git) Date: Tue, 29 Jul 2025 22:16:56 GMT Message-Id: <202507292216.56TMGugU009231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 2100a0fecec7 - stable/14 - rtlbtfw(8): Sync device VID/PID list with Linux 6.15-rc4 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2100a0fecec7710debf59ef4e7ddbc28abb7397c Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=2100a0fecec7710debf59ef4e7ddbc28abb7397c commit 2100a0fecec7710debf59ef4e7ddbc28abb7397c Author: Vladimir Kondratyev AuthorDate: 2025-05-14 14:38:10 +0000 Commit: Vladimir Kondratyev CommitDate: 2025-07-29 22:11:58 +0000 rtlbtfw(8): Sync device VID/PID list with Linux 6.15-rc4 Sponsored by: Future Crew, LLC MFC after: 1 month (cherry picked from commit 3e72d0b40040f94c4b99ab9dfa0a0e1b62dff397) --- sys/netgraph/bluetooth/drivers/ubt/ng_ubt_rtl.c | 20 ++++++++ usr.sbin/bluetooth/rtlbtfw/main.c | 20 ++++++++ usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c | 14 ++++++ usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h | 1 + usr.sbin/bluetooth/rtlbtfw/rtlbtfw.conf | 66 ++++++++++++++++++++++++- 5 files changed, 119 insertions(+), 2 deletions(-) diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_rtl.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_rtl.c index c3fb98b46e6a..0181a67ac604 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_rtl.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_rtl.c @@ -84,6 +84,9 @@ const STRUCT_USB_HOST_ID ubt_rtl_devs[] = /* Realtek 8822CU Bluetooth devices */ { USB_VPI(0x13d3, 0x3549, 0) }, + /* Realtek 8851BE Bluetooth devices */ + { USB_VPI(0x13d3, 0x3600, 0) }, + /* Realtek 8852AE Bluetooth devices */ { USB_VPI(0x0bda, 0x2852, 0) }, { USB_VPI(0x0bda, 0xc852, 0) }, @@ -100,11 +103,28 @@ const STRUCT_USB_HOST_ID ubt_rtl_devs[] = { USB_VPI(0x13d3, 0x3587, 0) }, { USB_VPI(0x13d3, 0x3586, 0) }, { USB_VPI(0x13d3, 0x3592, 0) }, + { USB_VPI(0x0489, 0xe122, 0) }, /* Realtek 8852BE Bluetooth devices */ { USB_VPI(0x0cb8, 0xc559, 0) }, + { USB_VPI(0x0bda, 0x4853, 0) }, { USB_VPI(0x0bda, 0x887b, 0) }, + { USB_VPI(0x0bda, 0xb85b, 0) }, + { USB_VPI(0x13d3, 0x3570, 0) }, { USB_VPI(0x13d3, 0x3571, 0) }, + { USB_VPI(0x13d3, 0x3572, 0) }, + { USB_VPI(0x13d3, 0x3591, 0) }, + { USB_VPI(0x0489, 0xe123, 0) }, + { USB_VPI(0x0489, 0xe125, 0) }, + + /* Realtek 8852BT/8852BE-VT Bluetooth devices */ + { USB_VPI(0x0bda, 0x8520, 0) }, + + /* Realtek 8922AE Bluetooth devices */ + { USB_VPI(0x0bda, 0x8922, 0) }, + { USB_VPI(0x13d3, 0x3617, 0) }, + { USB_VPI(0x13d3, 0x3616, 0) }, + { USB_VPI(0x0489, 0xe130, 0) }, /* Realtek 8723AE Bluetooth devices */ { USB_VPI(0x0930, 0x021d, 0) }, diff --git a/usr.sbin/bluetooth/rtlbtfw/main.c b/usr.sbin/bluetooth/rtlbtfw/main.c index 700b9b43bafa..e87a98036265 100644 --- a/usr.sbin/bluetooth/rtlbtfw/main.c +++ b/usr.sbin/bluetooth/rtlbtfw/main.c @@ -67,6 +67,9 @@ static struct rtlbt_devid rtlbt_list[] = { /* Realtek 8822CU Bluetooth devices */ { .vendor_id = 0x13d3, .product_id = 0x3549 }, + /* Realtek 8851BE Bluetooth devices */ + { .vendor_id = 0x13d3, .product_id = 0x3600 }, + /* Realtek 8852AE Bluetooth devices */ { .vendor_id = 0x0bda, .product_id = 0x2852 }, { .vendor_id = 0x0bda, .product_id = 0xc852 }, @@ -83,11 +86,28 @@ static struct rtlbt_devid rtlbt_list[] = { { .vendor_id = 0x13d3, .product_id = 0x3587 }, { .vendor_id = 0x13d3, .product_id = 0x3586 }, { .vendor_id = 0x13d3, .product_id = 0x3592 }, + { .vendor_id = 0x0489, .product_id = 0xe122 }, /* Realtek 8852BE Bluetooth devices */ { .vendor_id = 0x0cb8, .product_id = 0xc559 }, + { .vendor_id = 0x0bda, .product_id = 0x4853 }, { .vendor_id = 0x0bda, .product_id = 0x887b }, + { .vendor_id = 0x0bda, .product_id = 0xb85b }, + { .vendor_id = 0x13d3, .product_id = 0x3570 }, { .vendor_id = 0x13d3, .product_id = 0x3571 }, + { .vendor_id = 0x13d3, .product_id = 0x3572 }, + { .vendor_id = 0x13d3, .product_id = 0x3591 }, + { .vendor_id = 0x0489, .product_id = 0xe123 }, + { .vendor_id = 0x0489, .product_id = 0xe125 }, + + /* Realtek 8852BT/8852BE-VT Bluetooth devices */ + { .vendor_id = 0x0bda, .product_id = 0x8520 }, + + /* Realtek 8922AE Bluetooth devices */ + { .vendor_id = 0x0bda, .product_id = 0x8922 }, + { .vendor_id = 0x13d3, .product_id = 0x3617 }, + { .vendor_id = 0x13d3, .product_id = 0x3616 }, + { .vendor_id = 0x0489, .product_id = 0xe130 }, /* Realtek 8723AE Bluetooth devices */ { .vendor_id = 0x0930, .product_id = 0x021d }, diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c index c58a8feb41a4..d7e9f2f939c6 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.c @@ -118,6 +118,18 @@ static const struct rtlbt_id_table rtlbt_ic_id_table[] = { .hci_version = 0xc, .flags = RTLBT_IC_FLAG_MSFT, .fw_name = "rtl8851bu", + }, { /* 8922A */ + .lmp_subversion = RTLBT_ROM_LMP_8922A, + .hci_revision = 0xa, + .hci_version = 0xc, + .flags = RTLBT_IC_FLAG_MSFT, + .fw_name = "rtl8922au", + }, { /* 8852BT/8852BE-VT */ + .lmp_subversion = RTLBT_ROM_LMP_8852A, + .hci_revision = 0x87, + .hci_version = 0xc, + .flags = RTLBT_IC_FLAG_MSFT, + .fw_name = "rtl8852btu", }, }; @@ -138,6 +150,8 @@ static const uint16_t project_ids[] = { [ 25 ] = RTLBT_ROM_LMP_8852A, /* 8852CU */ [ 33 ] = RTLBT_ROM_LMP_8822B, /* 8822EU */ [ 36 ] = RTLBT_ROM_LMP_8851B, /* 8851BU */ + [ 44 ] = RTLBT_ROM_LMP_8922A, /* 8922A */ + [ 47 ] = RTLBT_ROM_LMP_8852A, /* 8852BT */ }; /* Signatures */ diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h index 48b30cb2289b..e9af6c93950e 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbt_fw.h @@ -41,6 +41,7 @@ #define RTLBT_ROM_LMP_8822B 0x8822 #define RTLBT_ROM_LMP_8852A 0x8852 #define RTLBT_ROM_LMP_8851B 0x8851 +#define RTLBT_ROM_LMP_8922A 0x8922 #define RTLBT_PATCH_SNIPPETS 0x01 #define RTLBT_PATCH_DUMMY_HEADER 0x02 diff --git a/usr.sbin/bluetooth/rtlbtfw/rtlbtfw.conf b/usr.sbin/bluetooth/rtlbtfw/rtlbtfw.conf index d45ba0bd92c4..61ae53db8f39 100644 --- a/usr.sbin/bluetooth/rtlbtfw/rtlbtfw.conf +++ b/usr.sbin/bluetooth/rtlbtfw/rtlbtfw.conf @@ -46,6 +46,16 @@ notify 100 { action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; }; +# Realtek 8851BE Bluetooth devices +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x13d3"; + match "product" "0x3600"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; + # Realtek 8852AE Bluetooth devices notify 100 { match "system" "USB"; @@ -113,6 +123,14 @@ notify 100 { match "product" "(0x3587|0x3586|0x3592)"; action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; }; +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x0489"; + match "product" "0xe122"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; # Realtek 8852BE Bluetooth devices notify 100 { @@ -128,7 +146,43 @@ notify 100 { match "subsystem" "DEVICE"; match "type" "ATTACH"; match "vendor" "0x0bda"; - match "product" "0x887b"; + match "product" "(0x4853|0x887b|0xb85b)"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x13d3"; + match "product" "(0x3570|0x3571|0x3572|0x3591)"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x0489"; + match "product" "(0xe123|0xe125)"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; + +# Realtek 8852BT/8852BE-VT Bluetooth devices +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x0bda"; + match "product" "0x8520"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; + +# Realtek 8922AE Bluetooth devices +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x0bda"; + match "product" "0x8922"; action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; }; notify 100 { @@ -136,7 +190,15 @@ notify 100 { match "subsystem" "DEVICE"; match "type" "ATTACH"; match "vendor" "0x13d3"; - match "product" "0x3571"; + match "product" "(0x3617|0x3616)"; + action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; +}; +notify 100 { + match "system" "USB"; + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "vendor" "0x0489"; + match "product" "0xe130"; action "/usr/sbin/rtlbtfw -d $cdev -f /usr/local/share/rtlbt-firmware"; }; From nobody Tue Jul 29 22:16:57 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 4bs8pK53F7z63Sch; Tue, 29 Jul 2025 22:16:57 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bs8pK2jjWz4Crr; Tue, 29 Jul 2025 22:16:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827417; 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=/e48a99xTXKtznJRvSzVGro8CEIdDZMM0svA7Qo8eTw=; b=V0dqhxTtEQ/dxICCyywnjNMQdXjR/49otIDL4WvtkZLpyBOEp2/hxKOMPs5su7QPLx14bq aOdKthy65Brvmq64IC/yhcoDiYZSX8nZtDkrr6Kk6Cz/Vg+tTWCHxgUySxl9MsauTT8dim JbThjJU8NuNcv+SlnCgzDhUDOZj0+RSSQU/ansm0J1ChG6N3T0bME11x1vCDY6dAURpSJr TNuRgEwNP1CWe6hsoqTdc5WdQQY4hv3YhR0uUARUexCSUjqUykobG7SyQfHg3tgqLum8yZ o1vC/+lXUglX/UtHP7+5BPU+B2DbKIA6PAEJz64hiJrJjunFdHy5PdnRwKGcNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827417; 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=/e48a99xTXKtznJRvSzVGro8CEIdDZMM0svA7Qo8eTw=; b=U683tMiL5xasQstkbHzhDgJbDHruHMx6pq95M820KZfhyY9myzPrR8+5ORyx7dqm8JR/zQ G1o0u907yodilRdsnUzZyI8nhvkit44wAFxUfbOVoMq42FIv2ZEXA/eP1UMq2oNJUZvh+7 uOovaF0nXr5gqbS9ofxnJlJoeKVEVWUCGJvc1QFpZZFfmLwz4C5CnhTpMeQdq5GAKd2UeU 0wF4HiYq2D/P8M48aTPJGyglPmhrccMHBiYwSrsXko/Za1SQGxqEqXWvaEfXgBq6fCOQi7 YuJehdNEiumVaGGuHpaVRE0STmO+kWWrpV8vlco25KAsMKZnZg+C6wEPIuLVNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753827417; a=rsa-sha256; cv=none; b=nwC04uSXjVC/nI73DW9TpOe3DmM2jA/qmdXPh1XQCGXMQrKE9fOpCC3Cl/jMoa7pDhQFut fEH4K/V3aJK9DJtpqtglxfpCApfHDAoc1crFjOmNi6JF1PKI8tMg1wrehH9y+v2c+DFzl+ 4Ser6joeWeX4thpvfULp8LawMpmuv3koEQQoa8I9dfuYng0Y2Csf+EKSnXE1ZwRGvPjckf uwnI+IIi9LFChm8xxA3vp/lhTx4+V856xOBP5ljju04ehyjwTrEbCZAS2nZ5j+kWJ494Vc Y7I1zlN4hhkQUtNrswDtyxFbTyvQwLG5pXQTIYY50CtU0NIJb6iju1Gz3WcbFg== 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 4bs8pK1wzzzqMx; Tue, 29 Jul 2025 22:16:57 +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 56TMGv2k009279; Tue, 29 Jul 2025 22:16:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TMGv28009276; Tue, 29 Jul 2025 22:16:57 GMT (envelope-from git) Date: Tue, 29 Jul 2025 22:16:57 GMT Message-Id: <202507292216.56TMGv28009276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 6296dd08ae52 - stable/14 - Added identifiers for additional PS4 DualShock controller variants 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6296dd08ae52b01ed681381df6f6c8f60e724467 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=6296dd08ae52b01ed681381df6f6c8f60e724467 commit 6296dd08ae52b01ed681381df6f6c8f60e724467 Author: Kevin Reinholz AuthorDate: 2025-05-14 01:09:41 +0000 Commit: Vladimir Kondratyev CommitDate: 2025-07-29 22:12:43 +0000 Added identifiers for additional PS4 DualShock controller variants PR: 285215 MFC after: 1 week (cherry picked from commit d4147ad1a2b9d6e7a862a63894da604c61721786) --- sys/dev/hid/ps4dshock.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/dev/hid/ps4dshock.c b/sys/dev/hid/ps4dshock.c index 537f70cadec0..d3c6b3eeadf9 100644 --- a/sys/dev/hid/ps4dshock.c +++ b/sys/dev/hid/ps4dshock.c @@ -771,18 +771,34 @@ static const struct hidmap_item ps4dsmtp_map[] = { static const struct hid_device_id ps4dshock_devs[] = { { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x9cc), HID_TLC(HUP_GENERIC_DESKTOP, HUG_GAME_PAD) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x5c4), + HID_TLC(HUP_GENERIC_DESKTOP, HUG_GAME_PAD) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0xba0), + HID_TLC(HUP_GENERIC_DESKTOP, HUG_GAME_PAD) }, }; static const struct hid_device_id ps4dsacc_devs[] = { { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x9cc), HID_TLC(HUP_GENERIC_DESKTOP, HUG_MULTIAXIS_CNTROLLER) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x5c4), + HID_TLC(HUP_GENERIC_DESKTOP, HUG_MULTIAXIS_CNTROLLER) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0xba0), + HID_TLC(HUP_GENERIC_DESKTOP, HUG_MULTIAXIS_CNTROLLER) }, }; static const struct hid_device_id ps4dshead_devs[] = { { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x9cc), HID_TLC(HUP_CONSUMER, HUC_HEADPHONE) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x5c4), + HID_TLC(HUP_CONSUMER, HUC_HEADPHONE) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0xba0), + HID_TLC(HUP_CONSUMER, HUC_HEADPHONE) }, }; static const struct hid_device_id ps4dsmtp_devs[] = { { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x9cc), HID_TLC(HUP_DIGITIZERS, HUD_TOUCHPAD) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0x5c4), + HID_TLC(HUP_DIGITIZERS, HUD_TOUCHPAD) }, + { HID_BVP(BUS_USB, USB_VENDOR_SONY, 0xba0), + HID_TLC(HUP_DIGITIZERS, HUD_TOUCHPAD) }, }; static int From nobody Tue Jul 29 22:16:58 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 4bs8pL4rx6z63SKq; Tue, 29 Jul 2025 22:16:58 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bs8pL3F1sz4Cvj; Tue, 29 Jul 2025 22:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827418; 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=7kyi02tRPiXDnH2/EPNM3OME91kyo86qJK9p0zIC0Yg=; b=vZp+XgvSQzF1BFxxCZjKf3uYcgMJXlixLKfEKHMse8wL8IisWdI1iiG0+OdY6g6xruhlU5 lUUIJeEnXAzuQJOqJE7ZfNfPc3FPbK0JmS3XDZyet3roahvvHnIpJPhVetH+DaJd7qieZM 1v4sCy6ZmuEhvcDBVt9JylzMgptPd1fTLiCSf+VUJS5sSb/iOaObebqCsxyc/09mNxS+HH yelDYmxI3ww/Mlo+VRDUw0qEKV/ZVmdarXrSEK92sqNssAb1pXp/qodtJ0SsQTK9sgmK+D BiKBW0WH0SgDNv5B7vXoWdURbejFtmAplTASTuNeNesK5GS8G5r0qWKQP8JBOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827418; 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=7kyi02tRPiXDnH2/EPNM3OME91kyo86qJK9p0zIC0Yg=; b=wosXFpdPedc7DfP6lWQU4W3zDLo8zXlOgIDn2VhdOISHxDCl0whoWSp1RBEEJWTInL1H70 WqT7FaFPhf4sc0vgMmsz5sOP6h7ZEPmmqMNARlBeu9nBv3CeiQkwH6V32y5Ij6akj3bFsC ihlTYHDRpL9rwlXXMZxFw75kjCRayVygyMC8ZEIkWpS+RooCd7FVszOHUJfSLWrMM6Bsce 5oJMIsk6iB46IbTAZlnUGzM3dp8UyEMfglYud5SrRpYR0SC9EddnPSt3L+vosFuAvQRCPI W6zQVG6koeLmhE9CnDLmGojiQRQZWnrm4dly1oXgaOFr1zYSNjt8I9L1/KSPtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753827418; a=rsa-sha256; cv=none; b=L0OqjN8kQsWo+CnhtB+NF1/oK0BIPOgBh0m7qja7WMAPMHAoelCcmaAT8yLlRbQa936vAM a7c1MQZUXCysx8/T6eLBmZXhoEljnYMDSKDUHKtKtPRTXoDwoEr2PG9A9Bmbb7wH0txL3R WvBYPuB99xmiB2fuxA+/beE/9CQVkBMGCrfrgdLzJnXiZqFVPJwGI/AFBjf+PFnV3RD2fD XVhbOenQyuD/np3ckeIwcLsxvLs6Ri3c3UoW3qnyc/JObEdW7SOadu4CBBC3oKGPZSRaeS DvU91gQjCrBHrEZOiouHVmMuRBSvcpdxB7NlSlzX/BCf4J+QeASoaOkYecLPwA== 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 4bs8pL2r0VzqPB; Tue, 29 Jul 2025 22:16:58 +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 56TMGw8Q009314; Tue, 29 Jul 2025 22:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TMGwGQ009311; Tue, 29 Jul 2025 22:16:58 GMT (envelope-from git) Date: Tue, 29 Jul 2025 22:16:58 GMT Message-Id: <202507292216.56TMGwGQ009311@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 6a11b6aed8a9 - stable/14 - psm(4): Add kqueue support 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6a11b6aed8a9d4dee44a151317e3c8fd0d7d6763 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=6a11b6aed8a9d4dee44a151317e3c8fd0d7d6763 commit 6a11b6aed8a9d4dee44a151317e3c8fd0d7d6763 Author: Vladimir Kondratyev AuthorDate: 2025-06-26 21:27:10 +0000 Commit: Vladimir Kondratyev CommitDate: 2025-07-29 22:13:32 +0000 psm(4): Add kqueue support MFC after: 2 weeks (cherry picked from commit b93063c84e4e792ede844d30452d82c4fe12bdd2) --- sys/dev/atkbdc/psm.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 318112e2e3e5..6b6a24ba7f31 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -598,6 +598,7 @@ static d_read_t psmread; static d_write_t psmwrite; static d_ioctl_t psmioctl; static d_poll_t psmpoll; +static d_kqfilter_t psmkqfilter; static int psmopen(struct psm_softc *); static int psmclose(struct psm_softc *); @@ -750,6 +751,7 @@ static struct cdevsw psm_cdevsw = { .d_write = psmwrite, .d_ioctl = psmioctl, .d_poll = psmpoll, + .d_kqfilter = psmkqfilter, .d_name = PSM_DRIVER_NAME, }; @@ -1946,6 +1948,7 @@ psmattach(device_t dev) sc->state = PSM_VALID; callout_init(&sc->callout, 0); callout_init(&sc->softcallout, 0); + knlist_init_mtx(&sc->rsel.si_note, &Giant); /* Setup our interrupt handler */ rid = KBDC_RID_AUX; @@ -2057,6 +2060,8 @@ psmdetach(device_t dev) destroy_dev(sc->cdev); destroy_dev(sc->bdev); + knlist_clear(&sc->rsel.si_note, 1); + knlist_destroy(&sc->rsel.si_note); callout_drain(&sc->callout); callout_drain(&sc->softcallout); @@ -5212,6 +5217,7 @@ next: wakeup(sc); } selwakeuppri(&sc->rsel, PZERO); + KNOTE_LOCKED(&sc->rsel.si_note, 0); if (sc->async != NULL) { pgsigio(&sc->async, SIGIO, 0); } @@ -5249,6 +5255,45 @@ psmpoll(struct cdev *dev, int events, struct thread *td) return (revents); } +static void +psmfilter_detach(struct knote *kn) +{ + struct psm_softc *sc = kn->kn_hook; + + knlist_remove(&sc->rsel.si_note, kn, 0); +} + +static int +psmfilter(struct knote *kn, long hint) +{ + struct psm_softc *sc = kn->kn_hook; + + GIANT_REQUIRED; + + return (sc->queue.count != 0 ? 1 : 0); +} + +static const struct filterops psmfiltops = { + .f_isfd = 1, + .f_detach = psmfilter_detach, + .f_event = psmfilter, +}; + +static int +psmkqfilter(struct cdev *dev, struct knote *kn) +{ + struct psm_softc *sc = dev->si_drv1; + + if (kn->kn_filter != EVFILT_READ) + return(EOPNOTSUPP); + + kn->kn_fop = &psmfiltops; + kn->kn_hook = sc; + knlist_add(&sc->rsel.si_note, kn, 1); + + return (0); +} + /* vendor/model specific routines */ static int mouse_id_proc1(KBDC kbdc, int res, int scale, int *status) From nobody Tue Jul 29 22:19:51 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 4bs8sg5GSRz63SlC; Tue, 29 Jul 2025 22:19:51 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bs8sg4Y3Cz4F50; Tue, 29 Jul 2025 22:19:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827591; 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=cxlLlH09Zb4tvsnumT951YgkqEGUCifyQ0voOr4txII=; b=eqwT0n/SN0pEjX7QOhX77EwsXPfe0tUHUIDua/6FekAOYv2l8FFHvwCskwEQfQcSlpOBYJ Qrv/+wL2dhe5eqIZND//pIZV9Vq8uzsV7M3T8y9R2FoQbflRI9JUyQ43Pq0w9fyiHaOU+B 8Kj3oCHC9D/1yhQBOlJ3OQt/xLrSk1pYK6eGqq3qYEL5+l5hOVHhk8lAaTOAT7ltajcma/ C0lE5VnZLr6qX/fcH4PgpBV489Np+Z4ZNSFql7n9gOKJg9GfcYkGrCVDydCkZP6jmlt/Kc koAlDjeiY5S3Kzt4qSXXm7X47hRBYFJXLOC3eOuvOHRNPVQuaal6aL9gRhyItw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753827591; 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=cxlLlH09Zb4tvsnumT951YgkqEGUCifyQ0voOr4txII=; b=j1/FLlTgiGGNwaNTI72kVIUYw7aaHCoepnZtNsEeu3FZb21YXkRgKhqrpuZK8qyMyxcV9a 5CDJ3IbHaVwcbrFaVtm90Wni3SuaMOFtvARCKG/PZJhVRMgUlczYP+Fm5Rp45Lye4yl97b yoUaqmdlUXl1L0pUJa8ogRiHa+A5/ZUcInru3UpF8vKFOvW/MRkjZDSnmICposv507B9nG NTwWxwyoQB2cPpVx//tu9pMo3ImGEWIhcgvblPQ6Amr3B4rQcSvgMkqs6JcRz5i9WNssB/ /w7xE778j9qi9QNBYzmdkPbTEYUQwdJXQhm4xlhQjFZCo2wLDm370XYb5D7Sqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753827591; a=rsa-sha256; cv=none; b=Y3eTmGXc2L53VkLCBBDDmKI/8Kk8FW5Mkd0nd6vt5GolnVt34LpHmWZhLd15eJLys1EwPO vfK/cTlea8t5NhbA0xTESrrBKpLoI22EdzPbt3g2utEls6zN59/bkdJCfIs7c4WoeMzJZF G08QY7h4J6MR4sLgyyWTjiDZcWKo2GJEqXZqn6ivbZUQuZU2rRGrl26x6KARbuYFdgakrf ZUvs9JAVvNvk1yKCkudJaPCxJCi1jw3Wp/zcAWi3UXwpe6yGicieD3ke0BRnqw0ske8T1B w5V+qYUkRrk9Kpm3M+wuEuqYTMNNMKiBp1ZYDM41DdemuMFBodB0vGQIrG85XQ== 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 4bs8sg3xGCzqN1; Tue, 29 Jul 2025 22:19:51 +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 56TMJpqb010295; Tue, 29 Jul 2025 22:19:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56TMJpai010292; Tue, 29 Jul 2025 22:19:51 GMT (envelope-from git) Date: Tue, 29 Jul 2025 22:19:51 GMT Message-Id: <202507292219.56TMJpai010292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8f6769b82a2a - stable/14 - file: Fix the !CAPABILITIES build 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8f6769b82a2a071cf07080b6d77639e919efbbcf Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8f6769b82a2a071cf07080b6d77639e919efbbcf commit 8f6769b82a2a071cf07080b6d77639e919efbbcf Author: Mark Johnston AuthorDate: 2025-06-29 16:56:59 +0000 Commit: Mark Johnston CommitDate: 2025-07-29 22:19:17 +0000 file: Fix the !CAPABILITIES build Reported by: Ian FREISLICH Fixes: f35525ff2053 ("file: Add a fd flag with O_RESOLVE_BENEATH semantics") (cherry picked from commit 6783dfb10637100067520bd6d9804e154cfee7ee) --- sys/kern/kern_descrip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index d84c97669320..0e6af0f5deff 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2966,7 +2966,7 @@ fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, uint8_t *flagsp, struct file **fpp, struct filecaps *havecapsp) { int error; - error = fget_unlocked(td, fd, needrightsp, flagsp, fpp); + error = fget_unlocked_flags(td, fd, needrightsp, flagsp, fpp); if (havecapsp != NULL && error == 0) filecaps_fill(havecapsp); @@ -3143,7 +3143,6 @@ fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, int *flagsp) flags = fp->f_flag & FSEARCH; flags |= (fde->fde_flags & UF_RESOLVE_BENEATH) != 0 ? O_RESOLVE_BENEATH : 0; - *fsearch = ((fp->f_flag & FSEARCH) != 0); vp = fp->f_vnode; if (__predict_false(vp == NULL || vp->v_type != VDIR)) { return (EAGAIN); From nobody Wed Jul 30 09:36:55 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 4bsRtv2273z63Qb1; Wed, 30 Jul 2025 09:36:55 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsRtv1C6wz46vB; Wed, 30 Jul 2025 09:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868215; 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=lpwVOomgU62B7wwiH1W3s1cbB7NrpvCbCznvj5uFFzU=; b=U38ACmGDYpySgnDM3+PbnSPOQvxCV8MCiieUz9mGAWIqrnEEV2pHrxrXc6t+SaBWvZdJMv 96ci6UTup90qKEsE749JhfzdfnfBgnYt8VpXRaIdFbi6uA4vh7QBX2gUPpCaL9k5uXhHx9 7v8ieoK492ucNGi45mT3lQp32G/7JyVEx6NOE10i4lPVW4GhYS5g3m0sV9/wHbKUsbnu74 vywoYOo5u9Oii65OVDbKpn0SEnZ9uz/7CHNxGOjepiIiq3t6vJMaiBWIKcYT0RQVk6Ywf4 S7/pVuUJ4P3bQJwAjRzsOgWqHUE5VFAYnrInLr7O2/ehednFWji1RKPfNcY1KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868215; 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=lpwVOomgU62B7wwiH1W3s1cbB7NrpvCbCznvj5uFFzU=; b=Ret5YVxDw9msbM+efA9yK/BlgfX8vsnD38sHXDOYWT8BuSiZ8+nAAsPlPDkJPkeaPVPzrS C1k6bwT6wdOUO9J86DeOAmwZslBzvcF9UTInzDe1avVYoG6z4co1rUmaBNGtruadHRuU3A eE5jDvs1SSbUl6ioGem6G4P1q6E6LuksKHXWik3+kceDtwUR0O4VdF/0yBJVLlZqoq4JqL iwisONbODPSN61zOR2uzbZ10SKAO8AQwCAJqUPZ1538ODL23THwnpn5tY7Cc1ILwYNYOdU Hh6JcUggna3cWReLp19orOzFGlwSn9CPaXGXKNr4/rw34vZ9rwstX9BqvMRl7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753868215; a=rsa-sha256; cv=none; b=ghP8+7gl3tenYquxgpm9C3zB4ueXFqlNm6elB0HPkyM5NDrA6KnhERXSxtHNL9Oc7ouoVa rz2bxmUqAk5KGhJ8TqeLtIVAoWf5rrDQsVWDwVerwF704nCOsMyFvd/yPo2yN1OLLXK09K LQFS2K8+mRBoieK0lcXCZ+v7tLRelgFe/1xZPdYBFcl4pjtFqpcMmKG9nKTDBX8hQUnHE/ bReY5jP2R1IM6XGBDEjH/iKNG3LOolXAEElvhcp+SWoHaupbQ2oLxYI8IEQp92DOmq1gsn sp+SjBH5BhpTHv50YjB9oJEdbULZorVcSJc2tNfDIPCcEtjOGhQEL7YsKNwEWg== 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 4bsRtv0pFwz18Wc; Wed, 30 Jul 2025 09:36:55 +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 56U9atR1087495; Wed, 30 Jul 2025 09:36:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56U9atQY087492; Wed, 30 Jul 2025 09:36:55 GMT (envelope-from git) Date: Wed, 30 Jul 2025 09:36:55 GMT Message-Id: <202507300936.56U9atQY087492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 8679496e454e - stable/14 - dtrace.1: Mention providers in SEE ALSO 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: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8679496e454e88031f0c37a67f934130e3d84cb4 Auto-Submitted: auto-generated The branch stable/14 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=8679496e454e88031f0c37a67f934130e3d84cb4 commit 8679496e454e88031f0c37a67f934130e3d84cb4 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-06-14 17:24:03 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-07-30 09:36:01 +0000 dtrace.1: Mention providers in SEE ALSO Reviewed by: bnovkov, christos, markj Approved by: bnovkov (mentor), christos (mentor), markj (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D50852 (cherry picked from commit 177471148a6111537e84912fb9a033b6ac5ecb17) --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index ab8c672a95a1..1836707d72df 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2023 +.Dd June 14, 2025 .Dt DTRACE 1 .Os .Sh NAME @@ -1221,6 +1221,17 @@ Invalid command line options or arguments were specified. .El .Sh SEE ALSO .Xr cpp 1 , +.Xr dtrace_audit 4 , +.Xr dtrace_io 4 , +.Xr dtrace_ip 4 , +.Xr dtrace_kinst 4 , +.Xr dtrace_lockstat 4 , +.Xr dtrace_proc 4 , +.Xr dtrace_sched 4 , +.Xr dtrace_sctp 4 , +.Xr dtrace_tcp 4 , +.Xr dtrace_udp 4 , +.Xr dtrace_udplite 4 , .Xr elf 5 , .Xr SDT 9 .Rs From nobody Wed Jul 30 09:36:56 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 4bsRtw3vDvz63QZ3; Wed, 30 Jul 2025 09:36:56 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsRtw2WCjz46pv; Wed, 30 Jul 2025 09:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868216; 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=t5I+HBJyRvTRVCrBDQYk85k04gZq+1OXgQRBuCFcZuc=; b=pu7iI8f2DtKUdlnnBNZKHKOpAdvF5aop1BgaZ0ASg10WRCYyqLiEJ8NzEZp1KeGtBHlAUU viRW7eNRXkDA277MYG6Ohj5bLshe+PP9N0aJBf8EUaN0jL+EhlGmNJYTVVIp+5f0clZsjP EORblgrrkLfSLDG1tRLmZsWr18/jEpstVPBFpOA6jhmGKaNQ7QkhTFUCG9HQpRnXwdsxjU ItPMzCzFNgaXfssHaHnKeWFSbp1sKlD+9skn4M+wVauFRcfSygEHR/AOlfJPhOPqTROHKx kinkkNSuG5/NWXG8uIPNhsVPpByFhNUzFZd0CHb4CxUlzuJHA7K/XkDEMNlvBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868216; 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=t5I+HBJyRvTRVCrBDQYk85k04gZq+1OXgQRBuCFcZuc=; b=iWa6RypQK50TN27Z6xwr1xWoUQNXJPwbbEXGuLf70ccqzXB+CmkKvvuqb75mgKwtpHbjQd SZAHX7DSycqrHkFKASKKbtM5nFRtiSAXz2dsMGhGPx6kiSAL+eBZJYDW7VQFd+3CnSeRSm 720LjtfbT5cbwYwgUy1Vss4C2kUXP13OFPfPWYwdqny9PMdFwRKhZeUuU6M39YVmspNXiW LolZCWI1er7sXWdg5FK2Y4+h+PLuGz2yGBzbUbjEoyrZerZ5H7th9/3nuAiT6r02oDH7AO yKWlv2vzfAsB6P2XI0fDEPPMjR7yBQI6Tq36W0wZylB6Dn7M4K7L05bGf73Cww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753868216; a=rsa-sha256; cv=none; b=H3l3McLRqTcdBGmxKh8fN5AgtKIW2o0E3/78vskqn/BCTKqpDEdQzHqCPDYHcV7NdU2Dch pv4qVTwrzxigi1FySW8WvNRq1GFBrNRgMYf6JWZ3Oofl+SpLzo6cQQ4TsMJY2y1ejXj6N6 ZQH/o7i66FTHoQY/7i5NXGmbrTM9Y2cpEIn6ihiMV24I1Hk+EEADP0LRWHzM0FI9/h/vEU j19JYU6U/Sk5rReWscQpxvk/RzXiRkx1l4NEDDbEfHuqgw8LFwmxUfQmdo6U2qKIKK/a85 j1+3LRMvOCiZ5w45cApAMFXyyyn9Z9pbpKjdlNifBZeOLZ254tdA963VFeaugQ== 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 4bsRtw1qMJz19R1; Wed, 30 Jul 2025 09:36:56 +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 56U9aulq087530; Wed, 30 Jul 2025 09:36:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56U9aujh087527; Wed, 30 Jul 2025 09:36:56 GMT (envelope-from git) Date: Wed, 30 Jul 2025 09:36:56 GMT Message-Id: <202507300936.56U9aujh087527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTrace fbt provider 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: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0c91fa982437417e09218ad8c2428aff29d9c5bd Auto-Submitted: auto-generated The branch stable/14 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=0c91fa982437417e09218ad8c2428aff29d9c5bd commit 0c91fa982437417e09218ad8c2428aff29d9c5bd Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-06-14 19:26:48 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-07-30 09:36:44 +0000 dtrace_fbt.4: Document the DTrace fbt provider Reported by: markj Reviewed by: christos, markj (earlier version), ziaee Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014 Obtained from: https://wiki.freebsd.org/DTrace/One-Liners MFC after: 2 weeks Relnotes: yes (cherry picked from commit 9388c2887817d7162ebb356b39aa9b4ab67a8c00) --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 5 + share/man/man4/Makefile | 1 + share/man/man4/dtrace_fbt.4 | 332 +++++++++++++++++++++++++++ share/man/man4/dtrace_kinst.4 | 12 +- 4 files changed, 346 insertions(+), 4 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 1836707d72df..9cb6e9dd276f 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,11 @@ .\" .\" $FreeBSD$ .\" +<<<<<<< HEAD .Dd June 14, 2025 +======= +.Dd July 16, 2025 +>>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) .Dt DTRACE 1 .Os .Sh NAME @@ -1222,6 +1226,7 @@ Invalid command line options or arguments were specified. .Sh SEE ALSO .Xr cpp 1 , .Xr dtrace_audit 4 , +.Xr dtrace_fbt 4 , .Xr dtrace_io 4 , .Xr dtrace_ip 4 , .Xr dtrace_kinst 4 , diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 48fead7c6287..f5eca038e800 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -940,6 +940,7 @@ _ccd.4= ccd.4 .if ${MK_CDDL} != "no" _dtrace_provs= dtrace_audit.4 \ + dtrace_fbt.4 \ dtrace_io.4 \ dtrace_ip.4 \ dtrace_kinst.4 \ diff --git a/share/man/man4/dtrace_fbt.4 b/share/man/man4/dtrace_fbt.4 new file mode 100644 index 000000000000..3e35bb8c5bbc --- /dev/null +++ b/share/man/man4/dtrace_fbt.4 @@ -0,0 +1,332 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" +.Dd July 16, 2025 +.Dt DTRACE_FBT 4 +.Os +.Sh NAME +.Nm dtrace_fbt +.Nd a DTrace provider for dynamic kernel tracing based on function boundaries +.Sh SYNOPSIS +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return +.Sh DESCRIPTION +The Function Boundary Tracing +.Pq Nm fbt +provider instruments the entry and return of almost every kernel function +corresponding to an +.Xr elf 5 +symbol in the kernel and loaded kernel modules. +.Pp +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry +fires whenever the +.Ar function +is called. +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return +fires when the +.Ar function +returns. +.Pp +The +.Ar module +in the probe description is either the name of the loaded kernel module +or +.Ql kernel +for functions compiled into the kernel. +.Ss Function Boundary Instrumentation +The +.Nm fbt +will always instrument a function's entry, but +its return will be intsrumented so long as it can find a +.Ql ret +instruction. +.Pp +In some cases, +.Nm fbt +cannot instrument a function's entry and/or return. +Refer to subsection +.Sx Frame Pointer +for more details. +.Ss Probe Arguments +The arguments of the entry probe +.Pq Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry +are the arguments of the traced function call. +.Bl -column -offset indent "Entry Probe Argument" "Definition" +.It Sy Entry Probe Argument Ta Sy Definition +.It Fa args[0] Ta Function's first argument, typed +.Pq e.g., Xr malloc 9 Ap s Ft size_t Fa size +.It Fa args[1] Ta Function's second argument, typed +.Pq e.g., Xr malloc 9 Ap s Ft struct malloc_type Fa *type +.It Fa args[2] Ta Function's third argument, typed +.Pq e.g., Xr malloc 9 Ap s Ft int Fa flags +.It Fa ... Ta ... +.El +.Pp +The arguments of the return probe +.Pq Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return +are +.Fa args[0] +.Po +the offset of the firing return instruction within the function; +useful to tell apart two different return statements in a single function +.Pc +and +.Fa args[1] +.Pq the return value, if any . +.Bl -column -offset indent "Return Probe Argument" "Definition" +.It Sy Return Probe Argument Ta Sy Definition +.It Fa args[0] Ta Offset of the traced return instruction +.It Fa args[1] Ta Function's return value +.Po e.g., a kernel virtual address if returning from a successful +.Xr malloc 9 +.Pc +.El +.Pp +Subsection +.Sx Example 2 : Getting Details About Probe's Arguments +shows how to get probe's argument count and types directly with +.Xr dtrace 1 +without having to resort to the reading function's source code +or documentation. +.Sh EXAMPLES +.Ss Example 1 : Listing Available FBT Probes +The following example shows how to list all the available +.Nm fbt +probes. +.Bd -literal -offset 2n +# dtrace -l -P fbt + ID PROVIDER MODULE FUNCTION NAME +[...] +31868 fbt kernel hammer_time entry +31869 fbt kernel hammer_time return +[...] +.Ed +.Pp +Since +.Fn hammer_time +is a part of the kernel and not a separate loaded module, the +.Ar module +column displays +.Ql kernel . +.Ss Example 2 : Getting Details About Probe's Arguments +The following example shows how to generate a program stability report of +.Xr malloc 9 Ap s +entry and return probes. +Those reports are useful to view +the probe's number of arguments and their types. +.Bd -literal -offset 2n +# dtrace -l -v -n fbt::malloc:entry +[...] + Argument Types + args[0]: size_t + args[1]: struct malloc_type * + args[2]: int +.Ed +.Pp +The count and types of +.Nm fbt Ns Cm \&::malloc:entry +arguments +match the function signature of +.Xr malloc 9 : +.Va args[0] +is +.Ft size_t , +.Va args[1] +is +.Ft "struct malloc_type *" , +and +.Va "args[2]" +is +.Ft int . +.Bd -literal -offset 2n +# dtrace -l -v -n fbt::malloc:return +[...] + Argument Types + args[0]: int + args[1]: void * +.Ed +.Pp +The +.Cm return +probe reports two arguments and their types: +the return instruction offset +.Pq the usual Ft int +and the function's return value, which in this case is +.Ft void * , +as +.Xr malloc 9 +returns a kernel virtual address. +.Ss Example 3 : Counting Kernel Slab Memory Allocation by Function +.Bd -literal -offset 2n +# dtrace -n 'fbt::kmem*:entry { @[probefunc] = count(); }' +dtrace: description 'fbt::kmem*:entry ' matched 47 probes +^C + kmem_alloc_contig 1 + kmem_alloc_contig_domainset 1 + kmem_cache_reap_active 1 + kmem_alloc_contig_pages 2 + kmem_free 2 + kmem_std_destructor 19 + kmem_std_constructor 26 + kmem_cache_free 151 + kmem_cache_alloc 181 +.Ed +.Ss Example 4 : Counting Kernel Slab Memory Allocation by Calling Function +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::kmem*:entry { @[caller] = count(); } END { printa("%40a %@16d\en", @); }' +^C + kernel`contigmalloc+0x33 1 + kernel`free+0xd3 1 + kernel`kmem_alloc_contig+0x29 1 +kernel`kmem_alloc_contig_domainset+0x19a 1 + zfs.ko`arc_reap_cb_check+0x16 1 +.Ed +.Ss Example 5 : Counting Kernel malloc()'s by Calling Function +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::malloc:entry { @[caller] = count(); } END { printa("%45a %@16d\en", @); }' +^C + kernel`devclass_get_devices+0xa8 1 + kernel`sys_ioctl+0xb7 1 + dtrace.ko`dtrace_ioctl+0x15c1 1 + dtrace.ko`dtrace_ioctl+0x972 2 + dtrace.ko`dtrace_dof_create+0x35 2 + kernel`kern_poll_kfds+0x2f0 4 + kernel`kern_poll_kfds+0x28a 19 +.Ed +.Ss Example 6 : Counting Kernel malloc()'s by Kernel Stack Trace +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::malloc:entry { @[stack()] = count(); }' +^C + dtrace.ko`dtrace_dof_create+0x35 + dtrace.ko`dtrace_ioctl+0x827 + kernel`devfs_ioctl+0xd1 + kernel`VOP_IOCTL_APV+0x2a + kernel`vn_ioctl+0xb6 + kernel`devfs_ioctl_f+0x1e + kernel`kern_ioctl+0x286 + kernel`sys_ioctl+0x12f + kernel`amd64_syscall+0x169 + kernel`0xffffffff81092b0b + 2 +.Ed +.Ss Example 7 : Summarizing vmem_alloc()'s by Arena Name and Size Distribution +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::vmem_alloc:entry { @[args[0]->vm_name] = quantize(arg1); }' +^C + + kernel arena dom + value ------------- Distribution ------------- count + 2048 | 0 + 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 + 8192 |@@@@@@@@@@@@@ 2 + 16384 | 0 +.Ed +.Ss Example 8 : Measuring Total Time Spent Executing a Function +This DTrace script measures the total time spent in +.Fn vm_page* +kernel functions. +The +.Fn quantize +aggregation organizes the measurements into power-of-two buckets, +providing a time distribution in nanoseconds for each function. +.Bd -literal -offset 2n +fbt::vm_page*:entry { + self->start = timestamp; +} + +fbt::vm_page*:return /self->start/ { + @[probefunc] = quantize(timestamp - self->start); + self->start = 0; +} +.Ed +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr dtrace_kinst 4 , +.Xr tracing 7 +.Rs +.%A Brendan Gregg +.%A Jim Mauro +.%B DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD +.%I Prentice Hall +.%P pp. 898\(en903 +.%D 2011 +.%U https://www.brendangregg.com/dtracebook/ +.Re +.Rs +.%B The illumos Dynamic Tracing Guide +.%O Chapter fbt Provider +.%D 2008 +.%U https://illumos.org/books/dtrace/chp-fbt.html#chp-fbt +.Re +.Sh AUTHORS +This manual page was written by +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . +.Sh CAVEATS +.Ss Stability and Portability +.Nm fbt +probes are by definition tightly coupled to kernel code; if the code underlying +a script changes, the script may fail to run or may produce incorrect results. +Scripts written for one version of +.Fx +might not work on others, +and almost certainly will not work on other operating systems. +.Pp +Individual +.Nm fbt +probes often do not correspond nicely to logical system events. +For example, consider a DTrace script which prints the destination +address of every IP packet as the kernel hands them over +to the network card driver (NIC). +An +.Nm fbt Ns -based +implementation of such a script is a discouragingly difficult task: +it involves instrumenting at least four different functions in different parts +of the IPv4 and IPv6 code. +At the same time, with the +.Xr dtrace_ip 4 +provider the script is a simple one-liner: +.Dl dtrace -n 'ip:::send {printf("%s", args[2]->ip_daddr);}' +.Pp +Make sure to review available +.Xr dtrace 1 +providers first +before implementing a custom script with the +.Nm fbt +provider. +If none of the DTrace providers offer the desired probes, +consider adding new statically-defined tracing probes +.Pq Xr SDT 9 . +.Ss Frame Pointer +Inline functions are not instrumentable by +.Nm fbt +as they lack a frame pointer. +A developer might explicitly disable inlining by adding the +.Ql __noinline +attribute to a function definition, +but of course this requires a recompilation of the kernel. +Building the kernel with +.Fl fno-omit-frame-pointer +is another way of preserving frame pointers. +Note, that sometimes compilers will omit the frame pointer in leaf functions, +even when configured with +.Fl fno-omit-frame-pointer . +.Pp +Function returns via a tail call are also not instrumentable by +.Nm fbt . +As a result, +a function might have an entry probe +and a mix of instrumented and uninstrumentable returns. +.Pp +Use +.Xr dtrace_kinst 4 +to trace arbitrary instructions inside kernel functions +and work around some of the +limitations +of +.Nm fbt . +.Ss Tracing DTrace +The +.Nm fbt +provider cannot attach to functions inside DTrace provider kernel modules. diff --git a/share/man/man4/dtrace_kinst.4 b/share/man/man4/dtrace_kinst.4 index 9debbc1bd106..c2187689749b 100644 --- a/share/man/man4/dtrace_kinst.4 +++ b/share/man/man4/dtrace_kinst.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 27, 2023 +.Dd July 16, 2025 .Dt DTRACE_KINST 4 .Os .Sh NAME @@ -43,10 +43,13 @@ creates probes on-demand, meaning it searches for and parses the function's instructions each time .Xr dtrace 1 is run, and not at module load time. -This is in contrast to FBT's load-time parsing, since +This is in contrast to +.Xr dtrace_fbt 4 Ap s +load-time parsing, since .Nm kinst can potentially create thousands of probes for just a single function, instead -of up to two (entry and return) in the case of FBT. +of up to two (entry and return) in the case of +.Xr dtrace_fbt 4 . A result of this is that .Cm dtrace -l -P kinst will not match any probes. @@ -79,7 +82,8 @@ Trace all instructions in # dtrace -n 'kinst::amd64_syscall:' .Ed .Sh SEE ALSO -.Xr dtrace 1 +.Xr dtrace 1 , +.Xr dtrace_fbt 4 .Sh HISTORY The .Nm kinst From nobody Wed Jul 30 09:42:02 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 4bsS0q23xjz63QxR; Wed, 30 Jul 2025 09:42:03 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsS0q14MKz47Pk; Wed, 30 Jul 2025 09:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868523; 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=2jSOHjYpS+pAIVHHqIQq5FgsfQPvy2LC0BtEB5qNJq8=; b=jprAV9aXiGzkqZDDLAfU2Kx+tWMLeLKt+gJTeJycG0VIIt0Ph1Rhg6hLi6oib7J/jpwL7+ mkcsGKlpeqfrf9kl33NFQ8xtbfz9lngQDG05d6la3dDr+Q6wlYVOOtQPHeMuEQsXCcDCp7 A2nB4oxk6uz+mGF2hum2uGYgwfpNLRA/kGPdKU+8IIsxQtWQQPCKzOXPIZdrfA3uVfAtL7 rF4If132OLUodnvFCnhI/0VmmCK6ku6eUYCSkqujNt+FpuEqv4KpuWoeTugqpzXtk5gUN6 gyyMjXZL9BTxsQVdT2yJ3JzVaWyUcQ9w9PlL5rLleDMhAIf+c33Ms9mWiPLnuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868523; 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=2jSOHjYpS+pAIVHHqIQq5FgsfQPvy2LC0BtEB5qNJq8=; b=MDNYR8JWVp581rrlyXseNI00Hrg7U1WaCnOEr5NlnpRxESfOB74600LfN9NkirW0YQKijz jWVFj6HXWvXOlwOTe9srg85ETLDoFZX5WwLtg9xWGh/FBo1IHL9XsEofNMBgvrg4lo0++m 3orKkUl9wR6c9sORMU9ScaALZngdDzfsCvqHi4UEnmoFJD9rhQfz/cXxroVPw2kKEjDZov 5DsHVX+HRkRUZCP/HJJOYyJ16Zm/iY3Xvze94WEs1TvoTwTq9UzIfTeqHKg+pHYbTQw2CA ZphcjKHoYPH3I2Wi7V/iaQXMCBcTbaYMTmBzj4zNfGObwFiTat1FHp5bxMZNNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753868523; a=rsa-sha256; cv=none; b=CbbAuZ7pfUdmX18dOLQvjXTNB0KnnhuyNf5ifzBQypUc+byIykUi4KNFij/cTGKiiqqods A3oSL9Z5pcL+I7k6ZvWrea8gY/uUmfDDa0TrpzkCEeydvTVDfJJ28xVRxTi0S6EyjFEc4P zAr5Xlonb/VjChk1bhcFesNUvi8eLt1n9HMYGLt46Lc+sL95AJf4v/GjUXKvUGWNZrCYK7 ORYNuLhv43vBPffc6ubHfhuejUnSz/dk3sk9/XgPf2+OXJvZMp0i+UanSR/tCrPr4EuDCY QW1Dxj16Otki04jPTvTVU+KAXAZdDt7mzhe9gslZZTmNbqTuBcBshAReqD8Tlg== 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 4bsS0q0Y2pz19RN; Wed, 30 Jul 2025 09:42:03 +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 56U9g2cv004565; Wed, 30 Jul 2025 09:42:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56U9g2Kk004562; Wed, 30 Jul 2025 09:42:02 GMT (envelope-from git) Date: Wed, 30 Jul 2025 09:42:02 GMT Message-Id: <202507300942.56U9g2Kk004562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 683f161bd5be - stable/13 - dtrace.1: Mention providers in SEE ALSO 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: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 683f161bd5bee181308a86cec6b1a1d4f3ad0f1e Auto-Submitted: auto-generated The branch stable/13 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=683f161bd5bee181308a86cec6b1a1d4f3ad0f1e commit 683f161bd5bee181308a86cec6b1a1d4f3ad0f1e Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-06-14 17:24:03 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-07-30 09:39:16 +0000 dtrace.1: Mention providers in SEE ALSO Reviewed by: bnovkov, christos, markj Approved by: bnovkov (mentor), christos (mentor), markj (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D50852 (cherry picked from commit 177471148a6111537e84912fb9a033b6ac5ecb17) --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index d1e7ebad189b..e09c89cd64d2 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -18,7 +18,7 @@ .\" CDDL HEADER END .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. .\" -.Dd September 7, 2021 +.Dd June 14, 2025 .Dt DTRACE 1 .Os .Sh NAME @@ -808,6 +808,16 @@ utility first appeared in .Fx 7.1 . .Sh SEE ALSO .Xr cpp 1 , +.Xr dtrace_audit 4 , +.Xr dtrace_io 4 , +.Xr dtrace_ip 4 , +.Xr dtrace_lockstat 4 , +.Xr dtrace_proc 4 , +.Xr dtrace_sched 4 , +.Xr dtrace_sctp 4 , +.Xr dtrace_tcp 4 , +.Xr dtrace_udp 4 , +.Xr dtrace_udplite 4 , .Xr elf 5 , .Xr SDT 9 .Rs From nobody Wed Jul 30 09:42:04 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 4bsS0r2rq8z63QfN; Wed, 30 Jul 2025 09:42:04 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsS0r1gBZz47Pl; Wed, 30 Jul 2025 09:42:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868524; 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=nhg8NoDkzLBZ+KW/hubSn4opgu7/r3zT0Yf/BtYIm4U=; b=agJnwJp0w4eWGYB98Lralql8TB9FzxtTXoIPPMa0b3lWmT9l5ktiNtlFSu/Y/NBL/PvArD uI63fhpgFU0suL1MI4mgsWv+tbw7IHUjmxqygvafKbp6SHypmjL66aQbNL1rU4F3A12urC 3yhZi7zhpERu3Q/Mcv7E+/ecNGKsv7SAZ692QMGwgS978p6RcYN7UBRnRELKJEOg9YnFwc 2xvWChpkgbB/VTDesuuFQicq8NoS2SwqIp5qQ6WF8wkwjRHvHGpWmqJELVquR7NbLkffd0 OOX0bcFWa1cYNnD17eJbKiBrHgs92CF5kQGLIk5uD6EwffdrnmBCPqVZNP4sLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753868524; 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=nhg8NoDkzLBZ+KW/hubSn4opgu7/r3zT0Yf/BtYIm4U=; b=TM+wZKdqEAM5RgRso1LtuVvUcrEuSMJyJS57Iw2xoxrOXoE6PXD156N1vCOiMfZj52x2rq 0v2HKCeRbBYN9Ym+Vv4I3BOLrXinf/BA3G+pcCEcUVKMxa/FZbQWP2ivK1sOkcfHrG6BQt ILiHhO8nCFwaAzeB0jeWLdFz9bnHHMrE1vZFjhdGRqc1kMAumisevc9nh1C2dK1AkslIGi Iz9tfzC5kKZxYNRMmAJkAdUDqUdcaMVPpedt2LoPjf64g48AtcQKyb0CeyJh3/VY/B/xf8 uGtTU4B158mi29YwvKuKRBzvk/tq8VmEhBUPIssUtigsQnrZpRuOz/NqFMjeXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753868524; a=rsa-sha256; cv=none; b=Vx5yaSLHPSQAsIhxs4IZnU+EqkhA+furtVSLj9/w4B9GjWOwyWTZAzJNtqtlLbuudhUrpk jieoRIOujESt2AH6GLmfKfePFiRwvmtDcQBVzJQTiSlJP4QdFbyYWifahSS1V/xoOaGPNy /3/ZE2ssqJEfsAd81CL32XZjM9X3iZPL+wzifW9zlSQGMol8MaUPbb53vLrHmOPKyVuxQS NP6gayke48LX3xDgMTuDjTf4KdpCVqS3WSJqr8JEVYBy07CGfr67XCBHg0xoEPFd5w/8Nu 7qRufYMpjPCUUD2hSrA7iB5VzkUYYyYpJAUhzqOgEjTtvoIV/75ABAZgqr5CRQ== 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 4bsS0r1Cy3z19jd; Wed, 30 Jul 2025 09:42:04 +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 56U9g4W5004607; Wed, 30 Jul 2025 09:42:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56U9g4YN004604; Wed, 30 Jul 2025 09:42:04 GMT (envelope-from git) Date: Wed, 30 Jul 2025 09:42:04 GMT Message-Id: <202507300942.56U9g4YN004604@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 2dded8fb5b25 - stable/13 - dtrace_fbt.4: Document the DTrace fbt provider 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: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2dded8fb5b25cb70629d49fecc540ef175a4fff6 Auto-Submitted: auto-generated The branch stable/13 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=2dded8fb5b25cb70629d49fecc540ef175a4fff6 commit 2dded8fb5b25cb70629d49fecc540ef175a4fff6 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-06-14 19:26:48 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-07-30 09:41:09 +0000 dtrace_fbt.4: Document the DTrace fbt provider Reported by: markj Reviewed by: christos, markj (earlier version), ziaee Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014 Obtained from: https://wiki.freebsd.org/DTrace/One-Liners MFC after: 2 weeks Relnotes: yes (cherry picked from commit 9388c2887817d7162ebb356b39aa9b4ab67a8c00) Do not mention dtrace_kinst(4) as it is not available on FreeBSD 13. --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 7 + share/man/man4/Makefile | 1 + share/man/man4/dtrace_fbt.4 | 323 +++++++++++++++++++++++++++ 3 files changed, 331 insertions(+) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index e09c89cd64d2..9b6eb03226a9 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -18,7 +18,13 @@ .\" CDDL HEADER END .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. .\" +<<<<<<< HEAD .Dd June 14, 2025 +======= +.\" $FreeBSD$ +.\" +.Dd July 16, 2025 +>>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) .Dt DTRACE 1 .Os .Sh NAME @@ -809,6 +815,7 @@ utility first appeared in .Sh SEE ALSO .Xr cpp 1 , .Xr dtrace_audit 4 , +.Xr dtrace_fbt 4 , .Xr dtrace_io 4 , .Xr dtrace_ip 4 , .Xr dtrace_lockstat 4 , diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 8802e5fc35d6..5f576c391086 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -960,6 +960,7 @@ _ccd.4= ccd.4 .if ${MK_CDDL} != "no" _dtrace_provs= dtrace_audit.4 \ + dtrace_fbt.4 \ dtrace_io.4 \ dtrace_ip.4 \ dtrace_lockstat.4 \ diff --git a/share/man/man4/dtrace_fbt.4 b/share/man/man4/dtrace_fbt.4 new file mode 100644 index 000000000000..fc55846f2d0b --- /dev/null +++ b/share/man/man4/dtrace_fbt.4 @@ -0,0 +1,323 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" +.Dd July 16, 2025 +.Dt DTRACE_FBT 4 +.Os +.Sh NAME +.Nm dtrace_fbt +.Nd a DTrace provider for dynamic kernel tracing based on function boundaries +.Sh SYNOPSIS +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return +.Sh DESCRIPTION +The Function Boundary Tracing +.Pq Nm fbt +provider instruments the entry and return of almost every kernel function +corresponding to an +.Xr elf 5 +symbol in the kernel and loaded kernel modules. +.Pp +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry +fires whenever the +.Ar function +is called. +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return +fires when the +.Ar function +returns. +.Pp +The +.Ar module +in the probe description is either the name of the loaded kernel module +or +.Ql kernel +for functions compiled into the kernel. +.Ss Function Boundary Instrumentation +The +.Nm fbt +will always instrument a function's entry, but +its return will be intsrumented so long as it can find a +.Ql ret +instruction. +.Pp +In some cases, +.Nm fbt +cannot instrument a function's entry and/or return. +Refer to subsection +.Sx Frame Pointer +for more details. +.Ss Probe Arguments +The arguments of the entry probe +.Pq Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry +are the arguments of the traced function call. +.Bl -column -offset indent "Entry Probe Argument" "Definition" +.It Sy Entry Probe Argument Ta Sy Definition +.It Fa args[0] Ta Function's first argument, typed +.Pq e.g., Xr malloc 9 Ap s Ft size_t Fa size +.It Fa args[1] Ta Function's second argument, typed +.Pq e.g., Xr malloc 9 Ap s Ft struct malloc_type Fa *type +.It Fa args[2] Ta Function's third argument, typed +.Pq e.g., Xr malloc 9 Ap s Ft int Fa flags +.It Fa ... Ta ... +.El +.Pp +The arguments of the return probe +.Pq Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return +are +.Fa args[0] +.Po +the offset of the firing return instruction within the function; +useful to tell apart two different return statements in a single function +.Pc +and +.Fa args[1] +.Pq the return value, if any . +.Bl -column -offset indent "Return Probe Argument" "Definition" +.It Sy Return Probe Argument Ta Sy Definition +.It Fa args[0] Ta Offset of the traced return instruction +.It Fa args[1] Ta Function's return value +.Po e.g., a kernel virtual address if returning from a successful +.Xr malloc 9 +.Pc +.El +.Pp +Subsection +.Sx Example 2 : Getting Details About Probe's Arguments +shows how to get probe's argument count and types directly with +.Xr dtrace 1 +without having to resort to the reading function's source code +or documentation. +.Sh EXAMPLES +.Ss Example 1 : Listing Available FBT Probes +The following example shows how to list all the available +.Nm fbt +probes. +.Bd -literal -offset 2n +# dtrace -l -P fbt + ID PROVIDER MODULE FUNCTION NAME +[...] +31868 fbt kernel hammer_time entry +31869 fbt kernel hammer_time return +[...] +.Ed +.Pp +Since +.Fn hammer_time +is a part of the kernel and not a separate loaded module, the +.Ar module +column displays +.Ql kernel . +.Ss Example 2 : Getting Details About Probe's Arguments +The following example shows how to generate a program stability report of +.Xr malloc 9 Ap s +entry and return probes. +Those reports are useful to view +the probe's number of arguments and their types. +.Bd -literal -offset 2n +# dtrace -l -v -n fbt::malloc:entry +[...] + Argument Types + args[0]: size_t + args[1]: struct malloc_type * + args[2]: int +.Ed +.Pp +The count and types of +.Nm fbt Ns Cm \&::malloc:entry +arguments +match the function signature of +.Xr malloc 9 : +.Va args[0] +is +.Ft size_t , +.Va args[1] +is +.Ft "struct malloc_type *" , +and +.Va "args[2]" +is +.Ft int . +.Bd -literal -offset 2n +# dtrace -l -v -n fbt::malloc:return +[...] + Argument Types + args[0]: int + args[1]: void * +.Ed +.Pp +The +.Cm return +probe reports two arguments and their types: +the return instruction offset +.Pq the usual Ft int +and the function's return value, which in this case is +.Ft void * , +as +.Xr malloc 9 +returns a kernel virtual address. +.Ss Example 3 : Counting Kernel Slab Memory Allocation by Function +.Bd -literal -offset 2n +# dtrace -n 'fbt::kmem*:entry { @[probefunc] = count(); }' +dtrace: description 'fbt::kmem*:entry ' matched 47 probes +^C + kmem_alloc_contig 1 + kmem_alloc_contig_domainset 1 + kmem_cache_reap_active 1 + kmem_alloc_contig_pages 2 + kmem_free 2 + kmem_std_destructor 19 + kmem_std_constructor 26 + kmem_cache_free 151 + kmem_cache_alloc 181 +.Ed +.Ss Example 4 : Counting Kernel Slab Memory Allocation by Calling Function +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::kmem*:entry { @[caller] = count(); } END { printa("%40a %@16d\en", @); }' +^C + kernel`contigmalloc+0x33 1 + kernel`free+0xd3 1 + kernel`kmem_alloc_contig+0x29 1 +kernel`kmem_alloc_contig_domainset+0x19a 1 + zfs.ko`arc_reap_cb_check+0x16 1 +.Ed +.Ss Example 5 : Counting Kernel malloc()'s by Calling Function +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::malloc:entry { @[caller] = count(); } END { printa("%45a %@16d\en", @); }' +^C + kernel`devclass_get_devices+0xa8 1 + kernel`sys_ioctl+0xb7 1 + dtrace.ko`dtrace_ioctl+0x15c1 1 + dtrace.ko`dtrace_ioctl+0x972 2 + dtrace.ko`dtrace_dof_create+0x35 2 + kernel`kern_poll_kfds+0x2f0 4 + kernel`kern_poll_kfds+0x28a 19 +.Ed +.Ss Example 6 : Counting Kernel malloc()'s by Kernel Stack Trace +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::malloc:entry { @[stack()] = count(); }' +^C + dtrace.ko`dtrace_dof_create+0x35 + dtrace.ko`dtrace_ioctl+0x827 + kernel`devfs_ioctl+0xd1 + kernel`VOP_IOCTL_APV+0x2a + kernel`vn_ioctl+0xb6 + kernel`devfs_ioctl_f+0x1e + kernel`kern_ioctl+0x286 + kernel`sys_ioctl+0x12f + kernel`amd64_syscall+0x169 + kernel`0xffffffff81092b0b + 2 +.Ed +.Ss Example 7 : Summarizing vmem_alloc()'s by Arena Name and Size Distribution +.Bd -literal -offset 2n +# dtrace -q -n 'fbt::vmem_alloc:entry { @[args[0]->vm_name] = quantize(arg1); }' +^C + + kernel arena dom + value ------------- Distribution ------------- count + 2048 | 0 + 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 + 8192 |@@@@@@@@@@@@@ 2 + 16384 | 0 +.Ed +.Ss Example 8 : Measuring Total Time Spent Executing a Function +This DTrace script measures the total time spent in +.Fn vm_page* +kernel functions. +The +.Fn quantize +aggregation organizes the measurements into power-of-two buckets, +providing a time distribution in nanoseconds for each function. +.Bd -literal -offset 2n +fbt::vm_page*:entry { + self->start = timestamp; +} + +fbt::vm_page*:return /self->start/ { + @[probefunc] = quantize(timestamp - self->start); + self->start = 0; +} +.Ed +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr tracing 7 +.Rs +.%A Brendan Gregg +.%A Jim Mauro +.%B DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD +.%I Prentice Hall +.%P pp. 898\(en903 +.%D 2011 +.%U https://www.brendangregg.com/dtracebook/ +.Re +.Rs +.%B The illumos Dynamic Tracing Guide +.%O Chapter fbt Provider +.%D 2008 +.%U https://illumos.org/books/dtrace/chp-fbt.html#chp-fbt +.Re +.Sh AUTHORS +This manual page was written by +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . +.Sh CAVEATS +.Ss Stability and Portability +.Nm fbt +probes are by definition tightly coupled to kernel code; if the code underlying +a script changes, the script may fail to run or may produce incorrect results. +Scripts written for one version of +.Fx +might not work on others, +and almost certainly will not work on other operating systems. +.Pp +Individual +.Nm fbt +probes often do not correspond nicely to logical system events. +For example, consider a DTrace script which prints the destination +address of every IP packet as the kernel hands them over +to the network card driver (NIC). +An +.Nm fbt Ns -based +implementation of such a script is a discouragingly difficult task: +it involves instrumenting at least four different functions in different parts +of the IPv4 and IPv6 code. +At the same time, with the +.Xr dtrace_ip 4 +provider the script is a simple one-liner: +.Dl dtrace -n 'ip:::send {printf("%s", args[2]->ip_daddr);}' +.Pp +Make sure to review available +.Xr dtrace 1 +providers first +before implementing a custom script with the +.Nm fbt +provider. +If none of the DTrace providers offer the desired probes, +consider adding new statically-defined tracing probes +.Pq Xr SDT 9 . +.Ss Frame Pointer +Inline functions are not instrumentable by +.Nm fbt +as they lack a frame pointer. +A developer might explicitly disable inlining by adding the +.Ql __noinline +attribute to a function definition, +but of course this requires a recompilation of the kernel. +Building the kernel with +.Fl fno-omit-frame-pointer +is another way of preserving frame pointers. +Note, that sometimes compilers will omit the frame pointer in leaf functions, +even when configured with +.Fl fno-omit-frame-pointer . +.Pp +Function returns via a tail call are also not instrumentable by +.Nm fbt . +As a result, +a function might have an entry probe +and a mix of instrumented and uninstrumentable returns. +.Ss Tracing DTrace +The +.Nm fbt +provider cannot attach to functions inside DTrace provider kernel modules. From nobody Wed Jul 30 09:55:40 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 4bsSJX4yJGz63RSx; Wed, 30 Jul 2025 09:55:40 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsSJX2XbNz499F; Wed, 30 Jul 2025 09:55:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753869340; 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=inM0EbDDz7hXWkxhI13nO/jpZKU5FCfFXnBzeqcv+WQ=; b=ddXqnPolq8NJzB6E5XkLR5Gc+xkG9jeO63KGgNBzgWe53LacJ9sKaYbzwcmt9SYYqIx6rb NwK2Mvub+6zO6A1x3i4TDmO4xKhKDPcqhoUNEYYRmlzQsGo1IyNTB3hnTO1DKFrxJyxIQL R9MeENsvjcnhXOyUYulIZpNy4Nduw1FQ0T9dJu2tbeWMhWancTd3SWYqCLT4lrIBEIMnrG P4vxnxlhkLkrMMle7KyPAnparCUoJLvZlBpW0WFne71lehHisV30jRg9dqIsinVGYDFXw6 VosL/Yu6jDbJSeS08L1lLYs+lGHyjKLOSRAkGNvKOb2dnTguo632tgb7OLCSrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753869340; 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=inM0EbDDz7hXWkxhI13nO/jpZKU5FCfFXnBzeqcv+WQ=; b=Q+pIe3GexapRMCpZcM84BC1oGnGj6/nCD+zuvQuM5SneENWrA/3hTtXSqD2/nyJxRd7AC9 U+uXY5IwBVks6oRTIH6bdJbIqwawJ34SwjimJNHJHEjzQ4OtKdBk++f4fJVbsI7wDDy7AW 0nWowAWS8CLk20frQ+reF4t+gV+LhjEK6yOlE2qTLq1thf6wCbDp+q3tCMTjt8Llz/SPnF DIZjQvpfyA2YiaG97xAAKY1rc/oYjQVP4MylcSUfI48/i19sI+TMT1Acha/sQmajAq2sqO 9+QSVCsBcTVOC/6+0EFvVcnoUZurNi16h/O4K7vf7qVVhO1RAZ6mzywVSlikSQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753869340; a=rsa-sha256; cv=none; b=erl+BSH+fFMqPdZx7B/2dLcYNc7IRucnVFrQW1ZIEOKIZgj8yKYG5GunCHCILpZgRis90r 1CFPWBPdESUpw1+FPU7pRd4dfpNoWeYEUF+v5fVSBvuqknYqVHt2qEMgFySDUonnWVqlRf 54YO3tQFP43J4OdiqQ6chZop1cbutv0bmuZgfntz+eI6Msa+q/kWaDt1GBxiTA4KRAiVx1 MbgPXXPvm3oPbqsqQEsoC98JaWCmise7oNzXUtZJeAKw58ajsaiz41Ic3+jFDVxc5yu2Qw pF3Io1jE2PTaOPabj8gFD88mtoWqZiytmtg1oVFnocwxTMkitinn6W6UyXEO+Q== 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 4bsSJX24ycz19sS; Wed, 30 Jul 2025 09:55:40 +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 56U9tebP024704; Wed, 30 Jul 2025 09:55:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56U9teRe024701; Wed, 30 Jul 2025 09:55:40 GMT (envelope-from git) Date: Wed, 30 Jul 2025 09:55:40 GMT Message-Id: <202507300955.56U9teRe024701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 943ad2ce5988 - stable/14 - rc: Use check_jail to check values of security.jail MIBs 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: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 943ad2ce59887a63182e5e26ea6962e978ac59bd Auto-Submitted: auto-generated The branch stable/14 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=943ad2ce59887a63182e5e26ea6962e978ac59bd commit 943ad2ce59887a63182e5e26ea6962e978ac59bd Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-07-12 16:20:32 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-07-30 09:55:24 +0000 rc: Use check_jail to check values of security.jail MIBs PR: 282404 Reviewed by: markj, netchild Approved by: markj (mentor) MFC after: 2 weeks Event: Berlin Hackathon 202507 Differential Revision: https://reviews.freebsd.org/D47329 (cherry picked from commit 46f18ecf8d3cdda1cd433841c44a4c1268ab9721) --- libexec/rc/rc | 4 ++-- libexec/rc/rc.d/hostname | 4 ++-- libexec/rc/rc.d/routing | 2 +- libexec/rc/rc.d/zfs | 8 ++++---- libexec/rc/rc.d/zfsbe | 2 +- libexec/rc/rc.shutdown | 4 ++-- libexec/rc/rc.subr | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libexec/rc/rc b/libexec/rc/rc index 462967703d60..ae1b24a6f36d 100644 --- a/libexec/rc/rc +++ b/libexec/rc/rc @@ -78,9 +78,9 @@ load_rc_config trap "_rc_conf_loaded=false; load_rc_config" ALRM skip="-s nostart" -if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then +if check_jail jailed; then skip="$skip -s nojail" - if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then + if ! check_jail vnet; then skip="$skip -s nojailvnet" fi fi diff --git a/libexec/rc/rc.d/hostname b/libexec/rc/rc.d/hostname index f6ac95c9c888..8c3fb23edd71 100755 --- a/libexec/rc/rc.d/hostname +++ b/libexec/rc/rc.d/hostname @@ -42,8 +42,8 @@ hostname_start() # If we are not inside a jail, set the host name. # If we are inside a jail, set the host name if it is permitted. # - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then - if [ `$SYSCTL_N security.jail.set_hostname_allowed` -eq 0 ]; then + if check_jail jailed; then + if ! check_jail set_hostname_allowed; then return fi else diff --git a/libexec/rc/rc.d/routing b/libexec/rc/rc.d/routing index d7113eb90722..89a5620fb5df 100755 --- a/libexec/rc/rc.d/routing +++ b/libexec/rc/rc.d/routing @@ -331,7 +331,7 @@ _check_dynamicrouting() # copied from /etc/rc skip="-s nostart" - if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then skip="$skip -s nojail" fi [ -n "$local_startup" ] && find_local_scripts_new diff --git a/libexec/rc/rc.d/zfs b/libexec/rc/rc.d/zfs index d7c5b20ee6d1..1e887c67f804 100755 --- a/libexec/rc/rc.d/zfs +++ b/libexec/rc/rc.d/zfs @@ -18,7 +18,7 @@ required_modules="zfs" zfs_start_jail() { - if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then + if check_jail mount_allowed; then zfs mount -a fi } @@ -34,7 +34,7 @@ zfs_start_main() zfs_start() { - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then zfs_start_jail else zfs_start_main @@ -54,7 +54,7 @@ zfs_poststart() zfs_stop_jail() { - if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then + if check_jail mount_allowed; then zfs unmount -a fi } @@ -67,7 +67,7 @@ zfs_stop_main() zfs_stop() { - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then zfs_stop_jail else zfs_stop_main diff --git a/libexec/rc/rc.d/zfsbe b/libexec/rc/rc.d/zfsbe index 31b0a180800f..5154a35377d0 100755 --- a/libexec/rc/rc.d/zfsbe +++ b/libexec/rc/rc.d/zfsbe @@ -64,7 +64,7 @@ activate_bootonce() be_start() { - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then : else mount -p | while read _dev _mp _type _rest; do diff --git a/libexec/rc/rc.shutdown b/libexec/rc/rc.shutdown index 18f67f5ca124..3dfd7a7e0936 100644 --- a/libexec/rc/rc.shutdown +++ b/libexec/rc/rc.shutdown @@ -83,9 +83,9 @@ fi # and perform the operation # rcorder_opts="-k shutdown" -if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then +if check_jail jailed; then rcorder_opts="$rcorder_opts -s nojail" - if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then + if ! check_jail vnet; then rcorder_opts="$rcorder_opts -s nojailvnet" fi fi diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 61c10370250e..75110a0313cd 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1314,7 +1314,7 @@ $_cpusetcmd $command $rc_flags $command_args" start) # We cannot use protect(1) inside jails. if [ -n "$_oomprotect" ] && [ -f "${PROTECT}" ] && - [ "$(sysctl -n security.jail.jailed)" -eq 0 ]; then + ! check_jail jailed; then [ -z "${rc_pid}" ] && eval $_pidcmd case $_oomprotect in [Aa][Ll][Ll]) From nobody Wed Jul 30 09:55:44 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 4bsSJd1Lpbz63RWK; Wed, 30 Jul 2025 09:55:45 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsSJc5dDTz49cN; Wed, 30 Jul 2025 09:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753869344; 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=jMp8ydcQZSIH5Qiqlc0dYP/uV4DsTSsVs6FsGMiZNXk=; b=DotsFnl88GVWQYyNhWPoYmyjxhcM/PuRLzaSkwaNKwv8fs7h0XQujaHXkIgYfxLrJe0Ov1 Qte5YlcvkqWyaj39b7Y2jYBu3ITMubZKY5/zLabOnT83Ks9DjvTBEXhnZAsOMsiKJsnWOI v+FKOrH15d3yYvelGBJEbu98hzS0n2fXmDTCCPqZWojVEBd+UO2yb4lSBf1h8Sp26i3C1T 5N5hlomvu3Mc4HiqtwpZ90VnCw5kMeMFlbBVsXHjk++O5NWce3vvx9xQbJzIoxu3eKvyLe huC38HtFlvVaBMZGI+mj0ulj1UqCXjLzq6cxN6IcyEX3ZQ7bVLzUDPVsnl2x1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753869344; 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=jMp8ydcQZSIH5Qiqlc0dYP/uV4DsTSsVs6FsGMiZNXk=; b=V3G/ygyEc/i7qlHxebFUZz/ZX/IHGRZXhnx3I3HhU0/kh2y24HjUvPrrzKWAqesZyd/HKS 8bpYNwylPc5QxcvZcxn9XkV9sU0HJQfoX8vjAdW9+R8hldHYltKfXxOZI5qY2A1bVCN8E7 N52FLGQaS5uID1HeIqwty6vF5YqzOE+KmoCdryUI9Y7XE0o3QU+iiCgwcX8kGQ5mC8wN80 K7hAoqQPJsH9cksZ8Mt+oMPNZM7bfufzIs1PXD6ncwvvb07ylYDsZ2SK55fjShTVaxjc8M 62s/E01WfSCNLKTc1/kGizb4u3/zQmphiBqTPpWCt8PBEfYTn7vu749pyVD1Ug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753869344; a=rsa-sha256; cv=none; b=oodc3TUlDe21UJujC/o8L5tfu3ECSfJX2rf3wScsvH/Mv9MUlwuI0kyXgEVj2f6EAaOx/i 1TcQVOac4BJ+T7GWKY7qxNLL8lx3J/fBCBrqO/SzpaJHU49BxEayAf698Ij/pKECWIvl0H F9R8NTo9ibzcFHDtqTvte4gOZt0piw6OBjtmpK/IsM4rJXGt1rRLPOlhwUv8AxEA+yRxuL KwGofPdT+yfU4Z8N2PFCI7NRTp87nRiuIu6gKJQzV9/LyNyz569o45ZMgkIcTemVCbM0W5 dNP4bvu0TJ7df6QKr0recyhueyFhV7UPj+b8ALLIAG0vFxP0hlvP4Ode8zRYtA== 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 4bsSJc51z7z19pt; Wed, 30 Jul 2025 09:55:44 +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 56U9ti6F024853; Wed, 30 Jul 2025 09:55:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56U9tiox024850; Wed, 30 Jul 2025 09:55:44 GMT (envelope-from git) Date: Wed, 30 Jul 2025 09:55:44 GMT Message-Id: <202507300955.56U9tiox024850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 7ee04c7b17d1 - stable/13 - rc: Use check_jail to check values of security.jail MIBs 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: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7ee04c7b17d15e2296b796e1657b0b152eba9d4c Auto-Submitted: auto-generated The branch stable/13 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ee04c7b17d15e2296b796e1657b0b152eba9d4c commit 7ee04c7b17d15e2296b796e1657b0b152eba9d4c Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-07-12 16:20:32 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-07-30 09:55:30 +0000 rc: Use check_jail to check values of security.jail MIBs PR: 282404 Reviewed by: markj, netchild Approved by: markj (mentor) MFC after: 2 weeks Event: Berlin Hackathon 202507 Differential Revision: https://reviews.freebsd.org/D47329 (cherry picked from commit 46f18ecf8d3cdda1cd433841c44a4c1268ab9721) --- libexec/rc/rc | 4 ++-- libexec/rc/rc.d/hostname | 4 ++-- libexec/rc/rc.d/routing | 2 +- libexec/rc/rc.d/zfs | 8 ++++---- libexec/rc/rc.d/zfsbe | 2 +- libexec/rc/rc.shutdown | 4 ++-- libexec/rc/rc.subr | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libexec/rc/rc b/libexec/rc/rc index 7b750606022b..ab4a86c8e6b1 100644 --- a/libexec/rc/rc +++ b/libexec/rc/rc @@ -78,9 +78,9 @@ load_rc_config trap "_rc_conf_loaded=false; load_rc_config" ALRM skip="-s nostart" -if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then +if check_jail jailed; then skip="$skip -s nojail" - if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then + if ! check_jail vnet; then skip="$skip -s nojailvnet" fi fi diff --git a/libexec/rc/rc.d/hostname b/libexec/rc/rc.d/hostname index f6ac95c9c888..8c3fb23edd71 100755 --- a/libexec/rc/rc.d/hostname +++ b/libexec/rc/rc.d/hostname @@ -42,8 +42,8 @@ hostname_start() # If we are not inside a jail, set the host name. # If we are inside a jail, set the host name if it is permitted. # - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then - if [ `$SYSCTL_N security.jail.set_hostname_allowed` -eq 0 ]; then + if check_jail jailed; then + if ! check_jail set_hostname_allowed; then return fi else diff --git a/libexec/rc/rc.d/routing b/libexec/rc/rc.d/routing index 9b906f69b354..a10b15958613 100755 --- a/libexec/rc/rc.d/routing +++ b/libexec/rc/rc.d/routing @@ -331,7 +331,7 @@ _check_dynamicrouting() # copied from /etc/rc skip="-s nostart" - if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then skip="$skip -s nojail" fi [ -n "$local_startup" ] && find_local_scripts_new diff --git a/libexec/rc/rc.d/zfs b/libexec/rc/rc.d/zfs index d7c5b20ee6d1..1e887c67f804 100755 --- a/libexec/rc/rc.d/zfs +++ b/libexec/rc/rc.d/zfs @@ -18,7 +18,7 @@ required_modules="zfs" zfs_start_jail() { - if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then + if check_jail mount_allowed; then zfs mount -a fi } @@ -34,7 +34,7 @@ zfs_start_main() zfs_start() { - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then zfs_start_jail else zfs_start_main @@ -54,7 +54,7 @@ zfs_poststart() zfs_stop_jail() { - if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then + if check_jail mount_allowed; then zfs unmount -a fi } @@ -67,7 +67,7 @@ zfs_stop_main() zfs_stop() { - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then zfs_stop_jail else zfs_stop_main diff --git a/libexec/rc/rc.d/zfsbe b/libexec/rc/rc.d/zfsbe index 216eb828e13c..1b4752f56c80 100755 --- a/libexec/rc/rc.d/zfsbe +++ b/libexec/rc/rc.d/zfsbe @@ -64,7 +64,7 @@ activate_bootonce() be_start() { - if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + if check_jail jailed; then : else mount -p | while read _dev _mp _type _rest; do diff --git a/libexec/rc/rc.shutdown b/libexec/rc/rc.shutdown index 18f67f5ca124..3dfd7a7e0936 100644 --- a/libexec/rc/rc.shutdown +++ b/libexec/rc/rc.shutdown @@ -83,9 +83,9 @@ fi # and perform the operation # rcorder_opts="-k shutdown" -if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then +if check_jail jailed; then rcorder_opts="$rcorder_opts -s nojail" - if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then + if ! check_jail vnet; then rcorder_opts="$rcorder_opts -s nojailvnet" fi fi diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 6a10dcc8e01f..eaaa3c778bff 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1294,7 +1294,7 @@ $command $rc_flags $command_args" start) # We cannot use protect(1) inside jails. if [ -n "$_oomprotect" ] && [ -f "${PROTECT}" ] && - [ "$(sysctl -n security.jail.jailed)" -eq 0 ]; then + ! check_jail jailed; then [ -z "${rc_pid}" ] && eval $_pidcmd case $_oomprotect in [Aa][Ll][Ll]) From nobody Wed Jul 30 14:30:54 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 4bsZQR2cPgz63fRv; Wed, 30 Jul 2025 14:31:11 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (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 ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E5" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsZQQ4hcLz3dsY; Wed, 30 Jul 2025 14:31:10 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; none Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 1FB65A64805; Wed, 30 Jul 2025 14:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zabbadoz.net; s=20240622; t=1753885853; bh=fuOXdTig2fgeHq/0+uVbrrvtAlMWa7Ldn+/SP+KG5l0=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=ZbLfZRDhbMthEeSZWSQn4dDbL64V29rkfUS7wBEl3Z22cLRSAZO4TgxyYpS2bA/rA TEWEQSe1D2xxNDDs3XM5jrzNte2CxePODn5DIrE081srJELRrF8gto843M/InLCYAw jDEIp06wOQAY5pGqbhChtNHaqO0UVlCTniOeDQGYsvo6vEIkrniwP/oH/d7ThHO+Xf R9tjQKbI0+p5sZvopfKwkacwoC+7QbZDJlcLOURqkX6fRfKIIetce4fvJS1apVkPdb qu3mGgLYWMdfu/5BHw1rc6cLMqOZQdTXYHzQ787f8YUYhh4Kypje25dP+aPypphPgS kIypNrs7oQLLwJB6/wnwokxKxXdlHnsKoTRKo2vo88Gxl2pmL8VxfcTss6MjJstIiN iFJ9GFIk97zQsDtj0fEKsns6sShZMtGOdn4VQp01LS8x37AOOCMK2E3ZLZwJmnauau Thtiwpx/ROiuCBDPtv9TH8sTP0fx2PcYQkXjTvK01CCAL77Y+niQM36eyD7PyEc8Tu 3Vmi3VqviwNAQnd211MjUtO9WpJ1cPeA3uGuRHn10D1XjiEGy32atyC6PguAlpuoET U2LGrg1BznMFkxjLhAWa/c9FB3sZOnNu58csNKCjly3RBPODxQzaoDSoFPBPMpgsPJ YnYTAh7q47gbqGJVIdn6EMvc= Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (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) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id E0FDD2D029E1; Wed, 30 Jul 2025 14:30:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id ht_BDd-ezCGn; Wed, 30 Jul 2025 14:30:55 +0000 (UTC) Received: from strong-iwl0.sbone.de (strong-iwl0.sbone.de [IPv6:fde9:577b:c1a9:4902:a66b:b6ff:fe40:39a9]) (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) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 301292D029D8; Wed, 30 Jul 2025 14:30:54 +0000 (UTC) Date: Wed, 30 Jul 2025 14:30:54 +0000 (UTC) From: "Bjoern A. Zeeb" To: Mateusz Piotrowski <0mp@FreeBSD.org> cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: Re: git: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTrace fbt provider In-Reply-To: <202507300936.56U9aujh087527@gitrepo.freebsd.org> Message-ID: References: <202507300936.56U9aujh087527@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4bsZQQ4hcLz3dsY X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:3320, ipnet:2003::/19, country:DE] On Wed, 30 Jul 2025, Mateusz Piotrowski wrote: > The branch stable/14 has been updated by 0mp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0c91fa982437417e09218ad8c2428aff29d9c5bd > > commit 0c91fa982437417e09218ad8c2428aff29d9c5bd > Author: Mateusz Piotrowski <0mp@FreeBSD.org> > AuthorDate: 2025-06-14 19:26:48 +0000 > Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > CommitDate: 2025-07-30 09:36:44 +0000 > > dtrace_fbt.4: Document the DTrace fbt provider > > Reported by: markj > Reviewed by: christos, markj (earlier version), ziaee > Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014 > Obtained from: https://wiki.freebsd.org/DTrace/One-Liners > MFC after: 2 weeks > Relnotes: yes > > (cherry picked from commit 9388c2887817d7162ebb356b39aa9b4ab67a8c00) > --- > cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 5 + > share/man/man4/Makefile | 1 + > share/man/man4/dtrace_fbt.4 | 332 +++++++++++++++++++++++++++ > share/man/man4/dtrace_kinst.4 | 12 +- > 4 files changed, 346 insertions(+), 4 deletions(-) > > diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > index 1836707d72df..9cb6e9dd276f 100644 > --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > @@ -20,7 +20,11 @@ > .\" > .\" $FreeBSD$ > .\" > +<<<<<<< HEAD > .Dd June 14, 2025 > +======= > +.Dd July 16, 2025 > +>>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) This merge conflict wasn't resolved? > .Dt DTRACE 1 > .Os > .Sh NAME > @@ -1222,6 +1226,7 @@ Invalid command line options or arguments were specified. > .Sh SEE ALSO > .Xr cpp 1 , > .Xr dtrace_audit 4 , > +.Xr dtrace_fbt 4 , > .Xr dtrace_io 4 , > .Xr dtrace_ip 4 , > .Xr dtrace_kinst 4 , > diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile > index 48fead7c6287..f5eca038e800 100644 > --- a/share/man/man4/Makefile > +++ b/share/man/man4/Makefile > @@ -940,6 +940,7 @@ _ccd.4= ccd.4 > > .if ${MK_CDDL} != "no" > _dtrace_provs= dtrace_audit.4 \ > + dtrace_fbt.4 \ > dtrace_io.4 \ > dtrace_ip.4 \ > dtrace_kinst.4 \ > diff --git a/share/man/man4/dtrace_fbt.4 b/share/man/man4/dtrace_fbt.4 > new file mode 100644 > index 000000000000..3e35bb8c5bbc > --- /dev/null > +++ b/share/man/man4/dtrace_fbt.4 > @@ -0,0 +1,332 @@ > +.\" > +.\" SPDX-License-Identifier: BSD-2-Clause > +.\" > +.\" Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org> > +.\" > +.Dd July 16, 2025 > +.Dt DTRACE_FBT 4 > +.Os > +.Sh NAME > +.Nm dtrace_fbt > +.Nd a DTrace provider for dynamic kernel tracing based on function boundaries > +.Sh SYNOPSIS > +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry > +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return > +.Sh DESCRIPTION > +The Function Boundary Tracing > +.Pq Nm fbt > +provider instruments the entry and return of almost every kernel function > +corresponding to an > +.Xr elf 5 > +symbol in the kernel and loaded kernel modules. > +.Pp > +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry > +fires whenever the > +.Ar function > +is called. > +.Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return > +fires when the > +.Ar function > +returns. > +.Pp > +The > +.Ar module > +in the probe description is either the name of the loaded kernel module > +or > +.Ql kernel > +for functions compiled into the kernel. > +.Ss Function Boundary Instrumentation > +The > +.Nm fbt > +will always instrument a function's entry, but > +its return will be intsrumented so long as it can find a > +.Ql ret > +instruction. > +.Pp > +In some cases, > +.Nm fbt > +cannot instrument a function's entry and/or return. > +Refer to subsection > +.Sx Frame Pointer > +for more details. > +.Ss Probe Arguments > +The arguments of the entry probe > +.Pq Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:entry > +are the arguments of the traced function call. > +.Bl -column -offset indent "Entry Probe Argument" "Definition" > +.It Sy Entry Probe Argument Ta Sy Definition > +.It Fa args[0] Ta Function's first argument, typed > +.Pq e.g., Xr malloc 9 Ap s Ft size_t Fa size > +.It Fa args[1] Ta Function's second argument, typed > +.Pq e.g., Xr malloc 9 Ap s Ft struct malloc_type Fa *type > +.It Fa args[2] Ta Function's third argument, typed > +.Pq e.g., Xr malloc 9 Ap s Ft int Fa flags > +.It Fa ... Ta ... > +.El > +.Pp > +The arguments of the return probe > +.Pq Nm fbt Ns Cm \&: Ns Ar module Ns Cm \&: Ns Ar function Ns Cm \&:return > +are > +.Fa args[0] > +.Po > +the offset of the firing return instruction within the function; > +useful to tell apart two different return statements in a single function > +.Pc > +and > +.Fa args[1] > +.Pq the return value, if any . > +.Bl -column -offset indent "Return Probe Argument" "Definition" > +.It Sy Return Probe Argument Ta Sy Definition > +.It Fa args[0] Ta Offset of the traced return instruction > +.It Fa args[1] Ta Function's return value > +.Po e.g., a kernel virtual address if returning from a successful > +.Xr malloc 9 > +.Pc > +.El > +.Pp > +Subsection > +.Sx Example 2 : Getting Details About Probe's Arguments > +shows how to get probe's argument count and types directly with > +.Xr dtrace 1 > +without having to resort to the reading function's source code > +or documentation. > +.Sh EXAMPLES > +.Ss Example 1 : Listing Available FBT Probes > +The following example shows how to list all the available > +.Nm fbt > +probes. > +.Bd -literal -offset 2n > +# dtrace -l -P fbt > + ID PROVIDER MODULE FUNCTION NAME > +[...] > +31868 fbt kernel hammer_time entry > +31869 fbt kernel hammer_time return > +[...] > +.Ed > +.Pp > +Since > +.Fn hammer_time > +is a part of the kernel and not a separate loaded module, the > +.Ar module > +column displays > +.Ql kernel . > +.Ss Example 2 : Getting Details About Probe's Arguments > +The following example shows how to generate a program stability report of > +.Xr malloc 9 Ap s > +entry and return probes. > +Those reports are useful to view > +the probe's number of arguments and their types. > +.Bd -literal -offset 2n > +# dtrace -l -v -n fbt::malloc:entry > +[...] > + Argument Types > + args[0]: size_t > + args[1]: struct malloc_type * > + args[2]: int > +.Ed > +.Pp > +The count and types of > +.Nm fbt Ns Cm \&::malloc:entry > +arguments > +match the function signature of > +.Xr malloc 9 : > +.Va args[0] > +is > +.Ft size_t , > +.Va args[1] > +is > +.Ft "struct malloc_type *" , > +and > +.Va "args[2]" > +is > +.Ft int . > +.Bd -literal -offset 2n > +# dtrace -l -v -n fbt::malloc:return > +[...] > + Argument Types > + args[0]: int > + args[1]: void * > +.Ed > +.Pp > +The > +.Cm return > +probe reports two arguments and their types: > +the return instruction offset > +.Pq the usual Ft int > +and the function's return value, which in this case is > +.Ft void * , > +as > +.Xr malloc 9 > +returns a kernel virtual address. > +.Ss Example 3 : Counting Kernel Slab Memory Allocation by Function > +.Bd -literal -offset 2n > +# dtrace -n 'fbt::kmem*:entry { @[probefunc] = count(); }' > +dtrace: description 'fbt::kmem*:entry ' matched 47 probes > +^C > + kmem_alloc_contig 1 > + kmem_alloc_contig_domainset 1 > + kmem_cache_reap_active 1 > + kmem_alloc_contig_pages 2 > + kmem_free 2 > + kmem_std_destructor 19 > + kmem_std_constructor 26 > + kmem_cache_free 151 > + kmem_cache_alloc 181 > +.Ed > +.Ss Example 4 : Counting Kernel Slab Memory Allocation by Calling Function > +.Bd -literal -offset 2n > +# dtrace -q -n 'fbt::kmem*:entry { @[caller] = count(); } END { printa("%40a %@16d\en", @); }' > +^C > + kernel`contigmalloc+0x33 1 > + kernel`free+0xd3 1 > + kernel`kmem_alloc_contig+0x29 1 > +kernel`kmem_alloc_contig_domainset+0x19a 1 > + zfs.ko`arc_reap_cb_check+0x16 1 > +.Ed > +.Ss Example 5 : Counting Kernel malloc()'s by Calling Function > +.Bd -literal -offset 2n > +# dtrace -q -n 'fbt::malloc:entry { @[caller] = count(); } END { printa("%45a %@16d\en", @); }' > +^C > + kernel`devclass_get_devices+0xa8 1 > + kernel`sys_ioctl+0xb7 1 > + dtrace.ko`dtrace_ioctl+0x15c1 1 > + dtrace.ko`dtrace_ioctl+0x972 2 > + dtrace.ko`dtrace_dof_create+0x35 2 > + kernel`kern_poll_kfds+0x2f0 4 > + kernel`kern_poll_kfds+0x28a 19 > +.Ed > +.Ss Example 6 : Counting Kernel malloc()'s by Kernel Stack Trace > +.Bd -literal -offset 2n > +# dtrace -q -n 'fbt::malloc:entry { @[stack()] = count(); }' > +^C > + dtrace.ko`dtrace_dof_create+0x35 > + dtrace.ko`dtrace_ioctl+0x827 > + kernel`devfs_ioctl+0xd1 > + kernel`VOP_IOCTL_APV+0x2a > + kernel`vn_ioctl+0xb6 > + kernel`devfs_ioctl_f+0x1e > + kernel`kern_ioctl+0x286 > + kernel`sys_ioctl+0x12f > + kernel`amd64_syscall+0x169 > + kernel`0xffffffff81092b0b > + 2 > +.Ed > +.Ss Example 7 : Summarizing vmem_alloc()'s by Arena Name and Size Distribution > +.Bd -literal -offset 2n > +# dtrace -q -n 'fbt::vmem_alloc:entry { @[args[0]->vm_name] = quantize(arg1); }' > +^C > + > + kernel arena dom > + value ------------- Distribution ------------- count > + 2048 | 0 > + 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 > + 8192 |@@@@@@@@@@@@@ 2 > + 16384 | 0 > +.Ed > +.Ss Example 8 : Measuring Total Time Spent Executing a Function > +This DTrace script measures the total time spent in > +.Fn vm_page* > +kernel functions. > +The > +.Fn quantize > +aggregation organizes the measurements into power-of-two buckets, > +providing a time distribution in nanoseconds for each function. > +.Bd -literal -offset 2n > +fbt::vm_page*:entry { > + self->start = timestamp; > +} > + > +fbt::vm_page*:return /self->start/ { > + @[probefunc] = quantize(timestamp - self->start); > + self->start = 0; > +} > +.Ed > +.Sh SEE ALSO > +.Xr dtrace 1 , > +.Xr dtrace_kinst 4 , > +.Xr tracing 7 > +.Rs > +.%A Brendan Gregg > +.%A Jim Mauro > +.%B DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD > +.%I Prentice Hall > +.%P pp. 898\(en903 > +.%D 2011 > +.%U https://www.brendangregg.com/dtracebook/ > +.Re > +.Rs > +.%B The illumos Dynamic Tracing Guide > +.%O Chapter fbt Provider > +.%D 2008 > +.%U https://illumos.org/books/dtrace/chp-fbt.html#chp-fbt > +.Re > +.Sh AUTHORS > +This manual page was written by > +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . > +.Sh CAVEATS > +.Ss Stability and Portability > +.Nm fbt > +probes are by definition tightly coupled to kernel code; if the code underlying > +a script changes, the script may fail to run or may produce incorrect results. > +Scripts written for one version of > +.Fx > +might not work on others, > +and almost certainly will not work on other operating systems. > +.Pp > +Individual > +.Nm fbt > +probes often do not correspond nicely to logical system events. > +For example, consider a DTrace script which prints the destination > +address of every IP packet as the kernel hands them over > +to the network card driver (NIC). > +An > +.Nm fbt Ns -based > +implementation of such a script is a discouragingly difficult task: > +it involves instrumenting at least four different functions in different parts > +of the IPv4 and IPv6 code. > +At the same time, with the > +.Xr dtrace_ip 4 > +provider the script is a simple one-liner: > +.Dl dtrace -n 'ip:::send {printf("%s", args[2]->ip_daddr);}' > +.Pp > +Make sure to review available > +.Xr dtrace 1 > +providers first > +before implementing a custom script with the > +.Nm fbt > +provider. > +If none of the DTrace providers offer the desired probes, > +consider adding new statically-defined tracing probes > +.Pq Xr SDT 9 . > +.Ss Frame Pointer > +Inline functions are not instrumentable by > +.Nm fbt > +as they lack a frame pointer. > +A developer might explicitly disable inlining by adding the > +.Ql __noinline > +attribute to a function definition, > +but of course this requires a recompilation of the kernel. > +Building the kernel with > +.Fl fno-omit-frame-pointer > +is another way of preserving frame pointers. > +Note, that sometimes compilers will omit the frame pointer in leaf functions, > +even when configured with > +.Fl fno-omit-frame-pointer . > +.Pp > +Function returns via a tail call are also not instrumentable by > +.Nm fbt . > +As a result, > +a function might have an entry probe > +and a mix of instrumented and uninstrumentable returns. > +.Pp > +Use > +.Xr dtrace_kinst 4 > +to trace arbitrary instructions inside kernel functions > +and work around some of the > +limitations > +of > +.Nm fbt . > +.Ss Tracing DTrace > +The > +.Nm fbt > +provider cannot attach to functions inside DTrace provider kernel modules. > diff --git a/share/man/man4/dtrace_kinst.4 b/share/man/man4/dtrace_kinst.4 > index 9debbc1bd106..c2187689749b 100644 > --- a/share/man/man4/dtrace_kinst.4 > +++ b/share/man/man4/dtrace_kinst.4 > @@ -22,7 +22,7 @@ > .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > .\" SUCH DAMAGE. > .\" > -.Dd February 27, 2023 > +.Dd July 16, 2025 > .Dt DTRACE_KINST 4 > .Os > .Sh NAME > @@ -43,10 +43,13 @@ creates probes on-demand, meaning it searches for and parses the function's > instructions each time > .Xr dtrace 1 > is run, and not at module load time. > -This is in contrast to FBT's load-time parsing, since > +This is in contrast to > +.Xr dtrace_fbt 4 Ap s > +load-time parsing, since > .Nm kinst > can potentially create thousands of probes for just a single function, instead > -of up to two (entry and return) in the case of FBT. > +of up to two (entry and return) in the case of > +.Xr dtrace_fbt 4 . > A result of this is that > .Cm dtrace -l -P kinst > will not match any probes. > @@ -79,7 +82,8 @@ Trace all instructions in > # dtrace -n 'kinst::amd64_syscall:' > .Ed > .Sh SEE ALSO > -.Xr dtrace 1 > +.Xr dtrace 1 , > +.Xr dtrace_fbt 4 > .Sh HISTORY > The > .Nm kinst > -- Bjoern A. Zeeb r15:7 From nobody Wed Jul 30 18:06:52 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 4bsgCK5yBDz62rw9; Wed, 30 Jul 2025 18:06:53 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsgCK26Tfz42pp; Wed, 30 Jul 2025 18:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753898813; 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=7anN9R+8o36+BmtUu2yBhQeUrZ6ftmGICkqw/UOWsjg=; b=Xd6WXskN5G7cNQJV8VdXHYep77YFl0UTig/fd1Qz/wbyO06sKZerOfZlZF9dC7hwSpPMZd /gddHA64qyx//l6Z5YAv5VSrJ3pTCAZTd1Z2RAJJw22jpKpT9/mhVJRlpu3Y5EstgRqqIk 7/j/EOUyVu5AHMtM1v9pxwWqfl0KB5IV2hp9W+nvZsbZqFn/PfMJ6HnULWPUF+QVM3Cyhj PGQvSRvQOE3ByM+Un4W9hPGbkKmlS6tbOL+N6JJB6MSkgesnbLdL6q37sYLuk/azDgCR3y 8VD7P7ndmW60JHdiLMzGjQcT2vYyRmE9IirFwKLUrxyasCcuAOqPKPHjRpEf+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753898813; 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=7anN9R+8o36+BmtUu2yBhQeUrZ6ftmGICkqw/UOWsjg=; b=ZcAF9aarCGFlV74MatKEZdzEZrSEIV0mBKzefUbn/a7X4iJeJneEdiyMvoCetQYaIyXWJ+ dyOOYVb1jRmRMIowXFwKF4ji9pAype8ZV7CW6m3lVaBx5u3wvGSPprspGrLRVsZjv1fDJZ kWnTWY8uNvrcwMX99kzWWWgdOtnLzs9xF6GNexPjP+kWy4Vu89yeeeg9UB7eVkG0qCt0rG rc2p10/PqfiDaFJBQT+eCEYvCeicBj3lU/i8GDt8aGGyRg3Q4/Vstyn8o7eykLemp+clWL QOQ+/7uUgZ8D4MsoG4OHy/BFBbv0biMkSI1LwYY1/vD74rqV1LMs3euJQySTJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753898813; a=rsa-sha256; cv=none; b=xc4K/olIMipA3Wm6QUVqJ2PrQzxt66ZfSE7oe57sCkSQNEREMvwg3+GD9311RG5vS5XDxx bne4ctMgLBSD1QUC1N9DQiRI91orumBb36OGhW+mqiqfblpqFLligOP5WqOyJDthiMLx+Z xx0SG/bPeiZ4eILORn7hhmj8MOSGMiP+/3Bw5OspP1/C/C/wFr4BW9EPzqZHgzYPCTXXLd w7XmxdIGBav2DDU7MgUzlQd7OsYx0a+EceTPXlrC4unL0relA/aFkVILNF40UQYQ9bdKu+ hdyBuJF6ZE3FTt1chAAexRmLYQGKtN13vQAHTjIOFadqmmCzDuTDygHKoyB6HA== 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 4bsgCJ6C3KzBRs; Wed, 30 Jul 2025 18:06:52 +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 56UI6qCH046914; Wed, 30 Jul 2025 18:06:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56UI6q2G046911; Wed, 30 Jul 2025 18:06:52 GMT (envelope-from git) Date: Wed, 30 Jul 2025 18:06:52 GMT Message-Id: <202507301806.56UI6q2G046911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 185bd9cf2199 - stable/14 - dtrace.1: Resolve merge conflict 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 185bd9cf219999a38093e853bfda8ed1ca21fc5b Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=185bd9cf219999a38093e853bfda8ed1ca21fc5b commit 185bd9cf219999a38093e853bfda8ed1ca21fc5b Author: Ed Maste AuthorDate: 2025-07-30 18:05:29 +0000 Commit: Ed Maste CommitDate: 2025-07-30 18:06:38 +0000 dtrace.1: Resolve merge conflict PR: 288556 Fixes: 0c91fa982437 ("dtrace_fbt.4: Document the DTrace fbt provider") --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 9cb6e9dd276f..0603a32da5e2 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,11 +20,7 @@ .\" .\" $FreeBSD$ .\" -<<<<<<< HEAD -.Dd June 14, 2025 -======= .Dd July 16, 2025 ->>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) .Dt DTRACE 1 .Os .Sh NAME From nobody Wed Jul 30 18:39:12 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 4bsgwd0rV1z62tX0; Wed, 30 Jul 2025 18:39:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsgwd00YTz3DQM; Wed, 30 Jul 2025 18:39:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753900753; 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=NfTgaIrdmMTb6Zem789cQtE9zBezRA32ZF8Q4rLveTE=; b=YCuYLwLAYFioPEnx7AVxLdbOLcePLpHMeRk8OPtIX/uVL30V6jxE/BJRnJVInXuFN/XOSA stZKzezmWXf8HIrYsRjwRMj2elDwKG4ImHTpcq4V6m++Ug+/E38fjjuIcBhOJTuaJIpZKF PnnDzm0+Y131erkXAKV8aHyUbwA0lD0HwfnB3F97la2MSLmuh7R8Zkos6Ls3nAD3WqVk6V TksF8DIihyZlZXByrD/bLDFzZbsSpItrLDykYOYJngl6eUTmppmc5yswKEyFWulH0Fp2In uNs/veFmK1FMjoHyo1QyGFJPSCmx+QdUSA06m0MADuL1X+JZTembVJbmweaPog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753900753; 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=NfTgaIrdmMTb6Zem789cQtE9zBezRA32ZF8Q4rLveTE=; b=vkGfacGTF5wP0Aadhm9gLj2nY2KYxg0wvXgsxpiyVuvYJ/kldc+5RtrPqWDvTR1+32qJOC 5sWpzKmj+Is3/3hA2DkG9j2aLXUykVXe0vcpi+BhUmP+9iPfR0jcLxqpL8FnHxj6ovKznV 6IRLCeX/vUf8w6EHiADHRIQGqmKywwuJBPEvhfnlXUn3ffD1LL1X8I2yaA0V0CbL93IPrB tw2fJIFyfQP1sAQlFaUkhwHcHPYqM495PGncXOTY4zdVpO15d24RZVdF5aNbHEupwQqyTd BVQVqAkuziHmaBQW/bCAm9/6yqM2D9ccufqi57AxfN/VzEXZ5lj7y/ltI12WOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753900753; a=rsa-sha256; cv=none; b=b9cpXSvDfXmAsAtXHTf0NKhqf2tOpLpWmoXnlff/7NITaOS3QT38wQQZ7qZuHGL3KjzpOd iU+PCi/FZjy4XH2JGFl6UdiIvSbYWWc/KY14/ZrlE5rU1XiDGwJoaSDd/o92kJ60FySflZ cqy60KUl6jmP+Xt+YEi7nv2msZZjDP6uePfe8jAyqD1EagnviWccGmgq27mlCph1mEoeh0 0aVt+l1zMFcW1QK38/Lo8UfDFqVfYg0u1y5l0Cr+K+6KH1xfr5yOxIgr5mSK8gjuGUYkS2 RBXMTMGrMDSSFUcwu2TQHchRbsrP27RYWcFkfIXoRwW73Yhg9KtgSrtsVVRWRA== 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 4bsgwc6VrczCXp; Wed, 30 Jul 2025 18:39:12 +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 56UIdCGP004355; Wed, 30 Jul 2025 18:39:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56UIdChV004352; Wed, 30 Jul 2025 18:39:12 GMT (envelope-from git) Date: Wed, 30 Jul 2025 18:39:12 GMT Message-Id: <202507301839.56UIdChV004352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 525795cde28b - stable/14 - bsdinstall: Emit a warning if the system has too little memory 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 525795cde28bbbc0aba3e5f359dfc877b9f248d1 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=525795cde28bbbc0aba3e5f359dfc877b9f248d1 commit 525795cde28bbbc0aba3e5f359dfc877b9f248d1 Author: Ed Maste AuthorDate: 2025-06-19 19:48:14 +0000 Commit: Ed Maste CommitDate: 2025-07-30 18:06:38 +0000 bsdinstall: Emit a warning if the system has too little memory PR: 251993 Reviewed by: adrian Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50944 (cherry picked from commit eb5884c564ae0e37df1d8a3fc5704ab6b2fa07d0) --- usr.sbin/bsdinstall/scripts/auto | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index ab0191feea17..5375b73e57d4 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -178,6 +178,14 @@ environment_save rm -rf $BSDINSTALL_TMPETC mkdir $BSDINSTALL_TMPETC +# With pkgbase, pkg OOM has been observed with QEMU-default 128 MiB memory size. +# Ensure we have at least about 256 MiB (with an allowance for rounding etc.). +physmem=$(($(sysctl -n hw.physmem) / 1048576)) +if [ $physmem -lt 200 ]; then + bsddialog --backtitle "$OSNAME Installer" --title "Warning" \ + --msgbox "Insufficient physical memory (${physmem} MiB) detected. At least 256 MiB is recommended. The installer or installed system may not function correctly." 0 0 +fi + [ -f /usr/libexec/bsdinstall/local.pre-everything ] && f_dprintf "Running local.pre-everything" && sh /usr/libexec/bsdinstall/local.pre-everything "$BSDINSTALL_CHROOT" trap true SIGINT # This section is optional From nobody Wed Jul 30 18:47:43 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 4bsh6h23xyz62tyX; Wed, 30 Jul 2025 18:47:56 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsh6g5W6jz3FSl; Wed, 30 Jul 2025 18:47:55 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3e3f6ae4d08so293035ab.1; Wed, 30 Jul 2025 11:47:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753901275; x=1754506075; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rJWMg91mZv2nRfRHG+ZNoX8Yhk56BVxlRkVdjF4TcCQ=; b=q9iu9Mvu60bVWSOd8uSR+m+sxn/0thiBUPI842xtoAt8HhugfeQCXtGVqRxS3w0or0 UBtzLb5flcxr0vu9K0wzxoAbOhNDc1a8I4fcjWdk1uf1TJgfn7xxK1ySWeuO7XAIXP4n q17qjbMSaHJAYQK2Unu5BcAm2ue8Q4vebg5zj7oU1FgXJbla66uXwbFn8JTA7kxxAF3c sp8szU0eXVp3QkM5J0r0O3S4VHbET1BAQHs786MAk2qEGQOUHM5GIl5D+O2B8lGw2I4N dFHM0mK5xcVH5RcZ6Sw1p7n63zQtgXAsHifqaxVvzz8LInyEHpxrTBGKwF5JfzgkM/9x yiUA== X-Forwarded-Encrypted: i=1; AJvYcCWXD4cW4onQSl0awIew912QiWvhoq8Zq3uR5To6s6aVEcmMmSmGsyzTukr42EMlSlYPB0EQtLGXOdrOLUBB71vEGUlC@freebsd.org, AJvYcCWaVunFJm89+SlkJsuHHe1bDs3arJvisg1wjzm+pjwU28WgYYe/Ca45v4VgN1d9g/VhSAJPDcKAjqEnwo6xJ34=@freebsd.org, AJvYcCX6nL84wFTLis1YVeJL8zw0RovFTj4L2nXAnwHpr93ZT6QgnaZiw4V323C7j6i8NdPIEmj/IyjxNxj7/nbHQIIcONw7dQgdtEhI@freebsd.org X-Gm-Message-State: AOJu0Yz2WA0n8WKc/pOI0p7Ziw3XlPuyPvqtuxpNf3hz889V1pRRftMq QiTAFnlRTC7o7dJNkaMzS4X7FtfzlkMov63NZUwXUYhI4a+5FwUqCSbOVNcxK92/HKVZqM/LIdY 0A4g7WuI3b4P8cmIPUxI+XOrN97m5Xrw93vou X-Gm-Gg: ASbGncs30VNXwmXpOTg8VY62FME4X1NySjtt4ZbteWppGyfgjp4N+SWONAI4b8IrO81 ry8C1UqYEkew5I7mY5HNtArc8BwvVP9zrKx8tGNn/xh8kZoem0RALT0mSRiB8aKyVyjfMSiEPrP LbsdrN8Xar6Tw5b/LYQ/OfDVW+XSnZjVaYrbI355iPByU3bBON2/mSHFyajmY3QMjrC5wRGmVXh Lc+USo= X-Google-Smtp-Source: AGHT+IHQpxAVUD4u6ECRLJJOQQif+OBRprL1Mz+rFPQGdKBkotx5SUoihug9eT0FJ1ftEDmhqoZKyYDxDT5hh+aWYgY= X-Received: by 2002:a05:6e02:4506:10b0:3e3:b35a:e8ff with SMTP id e9e14a558f8ab-3e3e930b406mr86164035ab.6.1753901274462; Wed, 30 Jul 2025 11:47:54 -0700 (PDT) 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 References: <202507300936.56U9aujh087527@gitrepo.freebsd.org> In-Reply-To: From: Ed Maste Date: Wed, 30 Jul 2025 14:47:43 -0400 X-Gm-Features: Ac12FXwAz1DZWT0ePWPnrPhDmDSIHCeUyPD8tkiaaiI0CvXjZKn4VxzKL9JTe5k Message-ID: Subject: Re: git: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTrace fbt provider To: "Bjoern A. Zeeb" Cc: Mateusz Piotrowski <0mp@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4bsh6g5W6jz3FSl X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] On Wed, 30 Jul 2025 at 10:31, Bjoern A. Zeeb wrote: > > On Wed, 30 Jul 2025, Mateusz Piotrowski wrote: > > > The branch stable/14 has been updated by 0mp: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0c91fa982437417e09218ad8c2428aff29d9c5bd > > > > commit 0c91fa982437417e09218ad8c2428aff29d9c5bd > > Author: Mateusz Piotrowski <0mp@FreeBSD.org> > > AuthorDate: 2025-06-14 19:26:48 +0000 > > Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > > CommitDate: 2025-07-30 09:36:44 +0000 > > > > dtrace_fbt.4: Document the DTrace fbt provider > > > > Reported by: markj > > Reviewed by: christos, markj (earlier version), ziaee > > Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014 > > Obtained from: https://wiki.freebsd.org/DTrace/One-Liners > > MFC after: 2 weeks > > Relnotes: yes > > > > (cherry picked from commit 9388c2887817d7162ebb356b39aa9b4ab67a8c00) > > --- > > cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 5 + > > share/man/man4/Makefile | 1 + > > share/man/man4/dtrace_fbt.4 | 332 +++++++++++++++++++++++++++ > > share/man/man4/dtrace_kinst.4 | 12 +- > > 4 files changed, 346 insertions(+), 4 deletions(-) > > > > diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > > index 1836707d72df..9cb6e9dd276f 100644 > > --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > > +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > > @@ -20,7 +20,11 @@ > > .\" > > .\" $FreeBSD$ > > .\" > > +<<<<<<< HEAD > > .Dd June 14, 2025 > > +======= > > +.Dd July 16, 2025 > > +>>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) > > > This merge conflict wasn't resolved? Someone submitted a PR for it and I've fixed it now. From nobody Wed Jul 30 20:21:35 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 4bskBs3F9dz630DN; Wed, 30 Jul 2025 20:21:41 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bskBs1rrbz3S4h; Wed, 30 Jul 2025 20:21:41 +0000 (UTC) (envelope-from rpokala@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753906901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hnHx4hswra/VtlqfbF6JEeep9tjwLVY8IN8eibjCbtk=; b=LqshndovbByo1drpbNskWO0N7fYb1l4/f9ptMUVoeQUhgw2NeDntjD2XDx0qJyHryxBQjY nfHFLrGBaFb2U2x14qB4mLPjf6yuik/C+mcL1eaOhJvb54jtSL4VtNcV7oq0K+IBcUH3mt 7Pn94VoO6petMaMkk+YlnQ9x+ZOg5pM/kBGSkzKzGPuFoRcUcDR27NnwoIDWhnCpfqxa/S IxSerO8cEMfYr7mvky/K8vjsnDPc9fScXbr7BbLIbXLtTEnekexuyydhOMwi97JFd8/gt7 6dy9hImM0jJMHQsLJi9O5SA5+w/a5jUUwsL1tR/E+1ARPippe5jMDuyFJg5M5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753906901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hnHx4hswra/VtlqfbF6JEeep9tjwLVY8IN8eibjCbtk=; b=N2drSir/OVliaUeAoqd54bYJOorOMCXME+Cx/7q0PPJlCqNkXue+Dlzrh4xbfXze8IC2xj 0OIZQnKLGHPm85ggtUB2H9M5HBoMK4l9fGUeHP69eNeSavM8sW1uATsnwggdFyNhcjWWMz JIrg3FQOzVJGEo6yNWQZTD6Ap+KeXclsjvtZvXSkaR/AZnW1fKMmzDVtRIboEtqIbeGT8n Ym0L50yW8J6QfOcKhps6IuFv42StKrq0uPuubiM6SPcrHvaNLsXBqPd49AsjDcWlq2FhZP krzerf8hOV7LedG+CM/nubuMLYKGAn2JfUdHtIt04Wqol04l/SIeidETZxSUCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753906901; a=rsa-sha256; cv=none; b=AI0kT1yRUOR8uWI3at3yh74RoGXKxaD3oWKyTRJ5bz+nfrJAmbtuGQ7J5Lkv9OGFhAtT2z pp8B6YQFvdXK5BOHhvx+u299QSubyXQ5zzMHEJX5N3OmaaGjtBCAPA4cGLUuqjWAdvnXXa r7mDJVwk7z8sUMvNR32cpJeTYdwgArgFNPdCTyEbtuBP7rZX7Xs1Ixa0S7bwBGTVAp0YJf vuxiVPGxP9bzpJxbbW0zkWZCJoSfGLvkg1LjKQm++hrQTeI9FXgReTM8G7r21lqAKCVeCz 3t/zzaZ79D2UbhngvJyhMmFSGXRcmkEOF9KB8IBGuC8m3rQdN77xrqHB8+RcfA== Received: from [172.17.5.122] (unknown [204.148.112.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bskBr2Mvvz1874; Wed, 30 Jul 2025 20:21:40 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.99.25072013 Date: Wed, 30 Jul 2025 13:21:35 -0700 Subject: Re: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTrace fbt provider From: Ravi Pokala To: Ed Maste , "Bjoern A. Zeeb" CC: Mateusz Piotrowski <0mp@freebsd.org>, , , Message-ID: <3EA9D815-0483-4A2A-A568-00023FB66744@panasas.com> Thread-Topic: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTrace fbt provider References: <202507300936.56U9aujh087527@gitrepo.freebsd.org> In-Reply-To: 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: quoted-printable I think the same mis-merge went into stable/13 as well... -Ravi =EF=BB=BF-----Original Message----- From: > on behalf of Ed Maste > Date: Wednesday, July 30, 2025 at 11:47 To: "Bjoern A. Zeeb" > Cc: Mateusz Piotrowski <0mp@freebsd.org >, >, >, > Subject: Re: git: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTr= ace fbt provider On Wed, 30 Jul 2025 at 10:31, Bjoern A. Zeeb > wr= ote: > > On Wed, 30 Jul 2025, Mateusz Piotrowski wrote: > > > The branch stable/14 has been updated by 0mp: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D0c91fa982437417e09218ad8c2= 428aff29d9c5bd > > > > commit 0c91fa982437417e09218ad8c2428aff29d9c5bd > > Author: Mateusz Piotrowski <0mp@FreeBSD.org > > > AuthorDate: 2025-06-14 19:26:48 +0000 > > Commit: Mateusz Piotrowski <0mp@FreeBSD.org > > > CommitDate: 2025-07-30 09:36:44 +0000 > > > > dtrace_fbt.4: Document the DTrace fbt provider > > > > Reported by: markj > > Reviewed by: christos, markj (earlier version), ziaee > > Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014 > > Obtained from: https://wiki.freebsd.org/DTrace/One-Liners > > MFC after: 2 weeks > > Relnotes: yes > > > > (cherry picked from commit 9388c2887817d7162ebb356b39aa9b4ab67a8c00) > > --- > > cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 5 + > > share/man/man4/Makefile | 1 + > > share/man/man4/dtrace_fbt.4 | 332 +++++++++++++++++++++++++++ > > share/man/man4/dtrace_kinst.4 | 12 +- > > 4 files changed, 346 insertions(+), 4 deletions(-) > > > > diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contri= b/opensolaris/cmd/dtrace/dtrace.1 > > index 1836707d72df..9cb6e9dd276f 100644 > > --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > > +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 > > @@ -20,7 +20,11 @@ > > .\" > > .\" $FreeBSD$ > > .\" > > +<<<<<<< HEAD > > .Dd June 14, 2025 > > +=3D=3D=3D=3D=3D=3D=3D > > +.Dd July 16, 2025 > > +>>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) > > > This merge conflict wasn't resolved? Someone submitted a PR for it and I've fixed it now. From nobody Thu Jul 31 00:07:50 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 4bsqCp6zBJz63CJs; Thu, 31 Jul 2025 00:07:50 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsqCp6DrCz3rlb; Thu, 31 Jul 2025 00:07:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753920470; 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=JYgs40vz4pgrbHrHJsVOt5PhoeTVbGPUtI1WSiRChvk=; b=IKBUD9NZoZOu9uZ9YocmeuAtAoj9PRgkG2NA/F6F9hWG0Ekc0Ox367eEIXkCYD7pfaW41I FjtepLrOClz9NCetMblPl6BsfELzS0Ggonqk4rT4arA/74VZDE/C6lVeZAhUWTV0cmRW/5 w2ERrKhWaY+T9y0cJLJdcTdV30nHEdt9PHOcLBkaUmOb9Rns98N0O+flRPA1t9O7my7/6l GH5zZK4TXC/J4bNre1i2bu2FRgPlxXJaAqKO4jHtI1kx3kmjYWPFFCYpr4lq3IIsp1iUDW ZdTDp27Q/9rSLFOY8QwZch12Soy0fkm8xbGy+s9UrsFDg9j4ZxgBuMY6ufDJ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753920470; 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=JYgs40vz4pgrbHrHJsVOt5PhoeTVbGPUtI1WSiRChvk=; b=PSfkP8qVEf/GZ8Scwnt8GfDaJpIyexebHHmDvsu6VHotXJrIHeOE8xe/ejjW3KzktCOnq9 WSZB8fDUe47CdKXQ8scMqb5F0UyadJoKX9DWyb4evTzZIdbVg0oeuUzXogDpczcjXdZgR9 mXzugTsK71cy/p7/WxStr9gNFSu01h1OHkwtXmIZG9bCN/Kv+Pr6RQksk3QhG8YO1W/0hJ tlfanZ2GxiH6bMdN5qF05kshK2+p5Xb7z5Lg4c8O3IuPTXA+ldKvGenHHhd3gBfVHtSn7k +eX3gAJmnWU6WZiHqIBPh0Dv7q0fYF5hJCbglRCutwN1ON7+PFsfmkw6DC1pzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753920470; a=rsa-sha256; cv=none; b=sUhk8RN4QDZXutByUN6WCyeOwAZpTK4bfkTW5l6f10xP7Cf8s1umvFCDOWsqkQlZQVP1Wb OKNKfZuaZ2nCcECpN/sx3AN6aE4zwAVVowE9Xvc/E7/VZZtOfE6MFYvMw8zDb/0z9Hg7bK rNkP6u220xt32a2X6szgir59TEd/p0r7PgTElGqQ1pHmUYrzs/5km4n+7b3Sfdp9X5MDUc vYc6zbLd8MFeb73OB2rwJlZ09E0xe1vSfqDuN3ewIKFIl4DUsy+3FUaILkobXc8Halm0NH RPTtucAgQTFbGdq3AcZsA9p6DdgkNU0Q8L2mInqEBh9reWIxSMrTMZYNp4XQ1Q== 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 4bsqCp57gwzf05; Thu, 31 Jul 2025 00:07:50 +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 56V07oNB026198; Thu, 31 Jul 2025 00:07:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56V07o5E026195; Thu, 31 Jul 2025 00:07:50 GMT (envelope-from git) Date: Thu, 31 Jul 2025 00:07:50 GMT Message-Id: <202507310007.56V07o5E026195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: fd05ce71c736 - stable/13 - dtrace.1: Resolve merge conflict 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fd05ce71c736143f0b3f569765f5374956ce8c10 Auto-Submitted: auto-generated The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=fd05ce71c736143f0b3f569765f5374956ce8c10 commit fd05ce71c736143f0b3f569765f5374956ce8c10 Author: Ed Maste AuthorDate: 2025-07-30 18:05:29 +0000 Commit: Ed Maste CommitDate: 2025-07-31 00:06:49 +0000 dtrace.1: Resolve merge conflict PR: 288556 Fixes: 0c91fa982437 ("dtrace_fbt.4: Document the DTrace fbt provider") (cherry picked from commit 185bd9cf219999a38093e853bfda8ed1ca21fc5b) --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 9b6eb03226a9..853538949a4d 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -18,13 +18,9 @@ .\" CDDL HEADER END .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. .\" -<<<<<<< HEAD -.Dd June 14, 2025 -======= .\" $FreeBSD$ .\" .Dd July 16, 2025 ->>>>>>> 9388c2887817 (dtrace_fbt.4: Document the DTrace fbt provider) .Dt DTRACE 1 .Os .Sh NAME From nobody Thu Jul 31 00:08:38 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 4bsqF01VVhz63CJx; Thu, 31 Jul 2025 00:08:52 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsqDz6YTNz3sY9; Thu, 31 Jul 2025 00:08:51 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-3de2b02c69eso1192095ab.1; Wed, 30 Jul 2025 17:08:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753920530; x=1754525330; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u/q7PSNGxc867O01OUPsMxEIugiBpn7vdc2tRsNj/do=; b=uEEeBk9SceyZrClldL4/wbJoJWyKjEGIgy7kEn6nBAcPelDuTPGb/lZ8mX69hHixu0 zFWhxZ9YTCMTdE/6eToklzoFSyMBJeA+fdvgSgkGkF7fyzqFAwHCPPLOz1I+btiBehly 9Gejm6awscLbNxI+hsm6YFIyvH2fM21p0OmlbnnoUxjX4ty2w0wTJeLrb95adurPL5FZ IP9zx5y7MbkULZqjCzwBGXmJGfZ96cyb2aU6tKFFY//VsOyDk7VEFc8FLSXf4JAHqPDk vYU6QZv5LTWi7L5NAnpKFWMDjRIywn4NL1tZ/jZ3xWAHtBU3h7/Wgjo/mJHlOHVMIksn VxOA== X-Forwarded-Encrypted: i=1; AJvYcCUDYJpWXtHZSxr3p3cGKmcmNiLRqrZkgxriEb0cqo4jX1g+7utD0c4xRD2jIaKMC2edh4TS70uPN6FU+1TrJxs=@freebsd.org, AJvYcCUvfSwLE0tV4kk4LIPNBJ17NhTKj5McFsribVOSquZUclOu5qYX7iQFchDxWKaccsrDJa/9kPkJmw9HzqxQat1X9Q2WbIChNNhk@freebsd.org, AJvYcCV66fiy/NojnqX3Wx5jO63CTMHW/BR36HvtK7+F4YxS6JjCArJrmjTgU7H/AT8Hmr3XWJb0O5Mg0J8w/7g7ENh6i0xIog==@freebsd.org, AJvYcCXwp4cAc6FMLDfwrtcL/XolfKmNnCu5sKd+LaM8RsMGxhfMPacyA8CZv1tIZNSJLp0zaPo=@freebsd.org X-Gm-Message-State: AOJu0YxnI22wDMx6Zcg/kyzje4HdER3PBMOY4fiJcpxo2EX1oRWwwOQx 4NATwM8twQORFTUFzMxI/waf4DKBjNsiT+AZyiaA6rQ6GRRSs09RhmMccWLlUbewiHtXBy5bXvG zlVuNjYu4u0u0wqA0dHKoss2tq/I/mxRHgQ== X-Gm-Gg: ASbGnctxLE+xrQr+OZlBmPXIQS1ZwhNy/KokfGXDsGaRxDj22bsQ9hPmq22QYOzcJDa xgVcHmq0dH0tBGN0W9wV8Nyo7IfNrHN5BzbQkD4QE1xIKT8YP5qRlfB/f1Phx6Q7/EH/aEwdKi2 JJmwvtEbRAOFQd1nhHKHeVMbZt8O4Z9ay0YLI+wy+53kgUh4h8s9U61MPKScJtCcqhKNXbiZxpl V7gc7ds4h4zS+U0qwZwOa0NsvRDqihRwl7VrrkCfg== X-Google-Smtp-Source: AGHT+IFJNUQYefuXXlv+o0gQRlZ4TRoYxcjkbYjlOIZklJ6XJOLrL73CdRWl+BC5UZfuJHZpsWowKGKIBjJR885Z11g= X-Received: by 2002:a05:6e02:1aa1:b0:3e3:d499:73f with SMTP id e9e14a558f8ab-3e3f62af9a7mr101972415ab.18.1753920530189; Wed, 30 Jul 2025 17:08:50 -0700 (PDT) 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 References: <202507300936.56U9aujh087527@gitrepo.freebsd.org> <3EA9D815-0483-4A2A-A568-00023FB66744@panasas.com> In-Reply-To: <3EA9D815-0483-4A2A-A568-00023FB66744@panasas.com> From: Ed Maste Date: Wed, 30 Jul 2025 20:08:38 -0400 X-Gm-Features: Ac12FXx1xP8n9utfeAAS0vZOVdZ6OiXbr1gAWZf-6JLA5Ihy1jhYpN9PT9uPELE Message-ID: Subject: Re: 0c91fa982437 - stable/14 - dtrace_fbt.4: Document the DTrace fbt provider To: Ravi Pokala Cc: "Bjoern A. Zeeb" , Mateusz Piotrowski <0mp@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4bsqDz6YTNz3sY9 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] On Wed, 30 Jul 2025 at 16:21, Ravi Pokala wrote: > > I think the same mis-merge went into stable/13 as well... Ah, thanks for the note - merged the fix from stable/14 there. From nobody Thu Jul 31 04:41:11 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 4bsxHC6SMtz63RSh; Thu, 31 Jul 2025 04:41:11 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsxHC5d8Zz3LZw; Thu, 31 Jul 2025 04:41:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753936871; 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=RUFggHysBZF0HFRSjrrLEx+xwqgZmddTSgnbsjuEUsI=; b=uBofPg/+icNUzwDC2E+VT3fAmWFwZPWeArN7r45HDRjxoK+9p8fbBHuanyH8TBHFqPes/U CoC4dFguic5E2pYwjMtipUC3wEqXm2geMSW7nSOwnsoQb4+UonmWRvBMNbbi7BlHkePdVi 2CUT8u7FYW7KH4NVBgr/uEZ+jGnXb9KZspOuzHzYWxoS2RfiZNiEfsZB2y8d4X959thr+k ddDU+EPw2lsY6u9TlevWxztg/mR21sQTwzA7Eq3u/1edLIjpLGxLATu53WmzYVAdFxTZQO rC9pvlIbUQyHuAYbPxxYKuv0kh5enV8A0fsHla4t9wnlJjMIj1Glsu8XDorweA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753936871; 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=RUFggHysBZF0HFRSjrrLEx+xwqgZmddTSgnbsjuEUsI=; b=Olofy6JPuQvkD6fMUMbNPB5TFYueNlrYFIHgy290X5xUnryyNagcBl3POqoVYHYfu1Vnu+ BCYbR7TPF8kf2vwbTAcIjvOi8ufHAI2HlDIbRUAIkZFLucdUIPtwZK+BPto+Ef9oMMN88A MArkjLo24/jwu+ckciPRC1LLLVnSUnfB85tRxP0GIewtfkqo6i0lPWQUQSUI5maUiLC4we 2oFg3WxkneYFUHjYj3seFOVSeCO4RXdFLCCLggAHFdZnkficCadSedfdNJQ8Axfko3LBC9 JB0x0Zte4HGXx2W96RLBo2Jmyo1wqpwImEMtWIWKFGwNd4gzmP+8YkTLyZvzMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753936871; a=rsa-sha256; cv=none; b=tx0bKwzf3JnVqeQDoS8IwWCjdJBpiDqwcvqMU8eDVJqnnt9SjChFUoHpssFW1DDwHa5Nu1 TGCPltI9/3Vp4j7KmIdoEMLqVpQDopGInLHOnA8k7nUbXSduLRcp8eiHsUj2p+I5z/JRg4 pPc/0exHmO2inWpW95zQkia7vhTsYa7nmwSf7QX4IiyewnYcKbSp7mqh8Lv1Wm35/+VChB O1RCQV7bOCvDuSoWy9n7FaEe9nl9VHxcHpphkeGNzLOoFSCa9NPi9zLhyjb3uyhSYJTNwb s4F3nBLbSLNtYWLyHpISv3uK4l8nh8ABMYEfnJPKqJoITTh1r+BH6EL1+CpnJw== 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 4bsxHC4yntzmv8; Thu, 31 Jul 2025 04:41:11 +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 56V4fB7Z047321; Thu, 31 Jul 2025 04:41:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56V4fBAr047318; Thu, 31 Jul 2025 04:41:11 GMT (envelope-from git) Date: Thu, 31 Jul 2025 04:41:11 GMT Message-Id: <202507310441.56V4fBAr047318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: cdd97f3aacf1 - stable/14 - qlnxe: Fix advertising the IFCAP_LINKSTATE capability 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cdd97f3aacf1e509858207a0caa085b9c47e5e9e Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=cdd97f3aacf1e509858207a0caa085b9c47e5e9e commit cdd97f3aacf1e509858207a0caa085b9c47e5e9e Author: Zhenlei Huang AuthorDate: 2025-07-22 04:11:02 +0000 Commit: Zhenlei Huang CommitDate: 2025-07-31 04:40:23 +0000 qlnxe: Fix advertising the IFCAP_LINKSTATE capability The following up advertising of IFCAP_HWCSUM capability unconditionally overwrite IFCAP_LINKSTATE. Reviewed by: kbowling MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51450 (cherry picked from commit c18860339d5051dea99cb5cee7e322ffa5dd2a81) --- sys/dev/qlnx/qlnxe/qlnx_os.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 39ecad8ef1e1..6519c216ebf5 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -2308,8 +2308,6 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) else if (device_id == QLOGIC_PCI_DEVICE_ID_1644) if_setbaudrate(ifp, IF_Gbps(100)); - if_setcapabilities(ifp, IFCAP_LINKSTATE); - if_setinitfn(ifp, qlnx_init); if_setsoftc(ifp, ha); if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); @@ -2343,7 +2341,6 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) if_setcapabilities(ifp, IFCAP_HWCSUM); if_setcapabilitiesbit(ifp, IFCAP_JUMBO_MTU, 0); - if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTAGGING, 0); if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWFILTER, 0); @@ -2352,6 +2349,7 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) if_setcapabilitiesbit(ifp, IFCAP_TSO4, 0); if_setcapabilitiesbit(ifp, IFCAP_TSO6, 0); if_setcapabilitiesbit(ifp, IFCAP_LRO, 0); + if_setcapabilitiesbit(ifp, IFCAP_LINKSTATE, 0); if_sethwtsomax(ifp, QLNX_MAX_TSO_FRAME_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); From nobody Thu Jul 31 04:41:12 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 4bsxHF1Rc5z63R1L; Thu, 31 Jul 2025 04:41:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bsxHD6MZ9z3LTc; Thu, 31 Jul 2025 04:41:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753936872; 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=uvDHMywJhoaYcMI1KMI15gok+MuBNTlQawhNt1PkquU=; b=NKPRG35KlLXWpJTCnQLI+PHGSJNT0Lx11RPghgnHWhcgoNwLLnAQLXhISvPvW2k076H3Ea JljJradqtStjPqoST7Cm6SbFyRPNcW1hXCpJ+wE3BgaLlZzKc4zqTmkd/SJXD+ebuntFoN ZgyyY1UDeOM+9hltnDTkrThALNSAyDTwnr3QdRVtI2rOiT9UI6C6hSz/nZEIovj+QF9eoT FHZCMBbp2BHq4i1FbjnM6ILbKCxHFVLfbghH+Bw8YEctFGEoE1JJpE1SbvCNBmf+NShfYR wvhP1ZWdcITkmtH65H56RSPRYOOKeG9UArIQ9k9rMiViuG/PgqzU63EYjPl8kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753936872; 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=uvDHMywJhoaYcMI1KMI15gok+MuBNTlQawhNt1PkquU=; b=tQyiHRJoXYt8xGn/71Mp6UftUDtzFCUmQyzGYtKuvGtN8bXkIce9rlgLs6UiaV8z5aTpIC Cy8p+H1jg3GN5SGzXvr0FVQ8Zlr7QMaiBDTmduJFGvVeGTh1ALi75DpIKYHIQUhzsUyoIK UMaY1YhlDbUfFPKsIfzgC+tdL5g07h/D56HPCA5bLOzr6p7Deu6B4QU634NHvi9hm1BKPm Ws1cYGVFz0MA9A3Cm7MzEoPQ2O23drB+uyaNhkTETeKwrQnnsm/Sn83RIfFgYn74WHWdcL seBJz/vzwgdawQX5VZ/e7bHSDUGOVYGqH/H9SpcQ+FdelRiBCYkZsnjkiPHkTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753936872; a=rsa-sha256; cv=none; b=i7RrbkWFGhHhkrm1hWu7i2OLyv0/iOLHgCYfpJVK7KYsSIFs9oSD4u6fJJe6WID02BC3AY WI7Xh8k6CfuinXCB/v5mfsOSKtBBCrHkavLpe9G7yLQ4ynNViCvl3fbDhVIeCflMZV9bpw bMmSa9wEYjJRUzs/xAqeEJD5VTNufRvCWpaTzuMdvgBW1sdOCBZn3JRais08bPX/28qw1L HiFgsVn/wZq0Mwvj+L6zEvuik2hzLwGPHYFN03oFnHQ3q17FwfDhBBNi/96vWfQHAl/jKy YODUpMgHVLeJRUbUK4pzvqtHDOZklulAxfesnBDTf7Aut8BP6ncJMhG80+LiTQ== 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 4bsxHD5wgmznBv; Thu, 31 Jul 2025 04:41:12 +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 56V4fCwg047353; Thu, 31 Jul 2025 04:41:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56V4fCwn047350; Thu, 31 Jul 2025 04:41:12 GMT (envelope-from git) Date: Thu, 31 Jul 2025 04:41:12 GMT Message-Id: <202507310441.56V4fCwn047350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: bfbb93b6de6a - stable/14 - qlnxe: Advertise the IFCAP_HWSTATS capability 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bfbb93b6de6afc8aba8df90e2a28db1c93cbd143 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=bfbb93b6de6afc8aba8df90e2a28db1c93cbd143 commit bfbb93b6de6afc8aba8df90e2a28db1c93cbd143 Author: Zhenlei Huang AuthorDate: 2025-07-22 04:11:02 +0000 Commit: Zhenlei Huang CommitDate: 2025-07-31 04:40:23 +0000 qlnxe: Advertise the IFCAP_HWSTATS capability The hardware can count statistics and the driver has already retrieved them via qlnx_get_counter(). Advertise the IFCAP_HWSTATS capability to avoid the net stack from double counting IFCOUNTER_IBYTES. Reviewed by: kbowling MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51451 (cherry picked from commit 386960a8805edc6d5ac6bb6215ad102a83314549) --- sys/dev/qlnx/qlnxe/qlnx_os.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 6519c216ebf5..1be77dcc3d37 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -2350,6 +2350,7 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) if_setcapabilitiesbit(ifp, IFCAP_TSO6, 0); if_setcapabilitiesbit(ifp, IFCAP_LRO, 0); if_setcapabilitiesbit(ifp, IFCAP_LINKSTATE, 0); + if_setcapabilitiesbit(ifp, IFCAP_HWSTATS, 0); if_sethwtsomax(ifp, QLNX_MAX_TSO_FRAME_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); From nobody Thu Jul 31 09:51:54 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 4bt49l4Pqmz63h2j; Thu, 31 Jul 2025 09:51:55 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bt49l0D1Jz3v0C; Thu, 31 Jul 2025 09:51:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753955515; 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=bQ6FIhkYFrr+SPtSvn/eusjuITWlq2wozTsLvncnQ9A=; b=jGn44QLJv9kFpBUHWUX1uPOy9FW5wtgpOdoR4rnMNVfSMTSwfMVpHLAwrhkgj0kX8qw4pP ySZ89yt4D2b5+Qd5hXwbr3SYvbmFK4fSb+6xZhS7K4628LXmOcxnC92yU1KsRNu89u+xz2 0SohUv9QoL8/FIAW5fcsL6H7UFyAKope6UY+UaoEob8E/MWKF0O2VpilfXQ3988UbOzpFY lGdQMm9esJYDrLuFAOPwEDUlN7OHtarmuLsdZ5wIiQNo7S3c37aqjCZWtreuB3tD58U8NW kJQYrQ4CJuaV1Pwe51zksxWvCzSBN5jmTNv46DKg6CDKiqYXKSCKx5nY+Sp2zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753955515; 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=bQ6FIhkYFrr+SPtSvn/eusjuITWlq2wozTsLvncnQ9A=; b=IY8TTlneM4sQZogLVpLIFtcNjOVpAYJa6Q5VLFp6XDmr5PeOnhymRBZHtgSsUTNjFGUy4H gfsirVYbSAZQBGwWIeeeNAr2Y4CLl4Bf1KGnYcvcqbX8cfEczl7HfDHvoC2JeM0LhbwVpU f7bcFJbfoZPkZkIIXwuOsi3A/ElET1hR2+OASVYblIjDm1mcRZI+oqZkyomQAE1XcQlpgy 57969c1IAS8Hyh1KLdB8IS4CZXnxo/vIqrnC9l91VcXwmdoYcOj7cB5CkZhyuC4AZC5BoN 25hADCxC2VtK/Tus8YSm+D9C5492UWyB7mwZkuId5K4E7LMtDYSDIlNHFSmmyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753955515; a=rsa-sha256; cv=none; b=XzJki2AtXgW9ZLxssYyoJzv0J7prqWc0cGzK9fbfo2yd7MvzQaODEcIh0drVysq0n29AXu bSgqbiNo+EL7oqw6db6c2O2LKLL3GB35DVzEFJag0F5aSHgVOFPn3A3NUaKitwqXasg4TK dIOVnbbMNgk8rPi+8mk4UVZ8Bdyds/xStG+nqdby97lS36lz+XZLmmsRtYeWuyoufdnoH0 BkbIiy26DsfMD0wogSB4VQ/KjwnsPWnTePZKvI0RAg7c1LhfzsZGWYWwuAo8IVTwvqNS3p JBpuYcBeq/H5G2B80GdWX2RQvg5DqkmXgVoLeCmTmqFrHfryvhz3JFKz4VBvkA== 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 4bt49k6k4jzx9s; Thu, 31 Jul 2025 09:51:54 +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 56V9ps13040761; Thu, 31 Jul 2025 09:51:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56V9pscn040758; Thu, 31 Jul 2025 09:51:54 GMT (envelope-from git) Date: Thu, 31 Jul 2025 09:51:54 GMT Message-Id: <202507310951.56V9pscn040758@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: 30218eb7c4bc - stable/14 - clang-scan-deps: Pass ${TDFILE} to tblgen, not ${.ALLSRC} 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 30218eb7c4bcc8d49dc09a3e3001c64588af2e05 Auto-Submitted: auto-generated The branch stable/14 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=30218eb7c4bcc8d49dc09a3e3001c64588af2e05 commit 30218eb7c4bcc8d49dc09a3e3001c64588af2e05 Author: Lexi Winter AuthorDate: 2025-07-27 10:53:19 +0000 Commit: Lexi Winter CommitDate: 2025-07-31 09:11:01 +0000 clang-scan-deps: Pass ${TDFILE} to tblgen, not ${.ALLSRC} ${.ALLSRC} can include the dependency OptParser.td, which causes llvm-tblgen to fail since it only accepts a single input argument. Use ${TDFILE} directly instead, which matches the other invocations of tblgen in the LLVM Makefiles. Fixes: d3c06bed2c16 ("clang: install clang-scan-deps") MFC after: 3 days Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D51569 (cherry picked from commit ad023bc26e106e28e1b4845f991b52b533bd0802) --- usr.bin/clang/clang-scan-deps/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/clang/clang-scan-deps/Makefile b/usr.bin/clang/clang-scan-deps/Makefile index 16fecdb88867..8da12faccc45 100644 --- a/usr.bin/clang/clang-scan-deps/Makefile +++ b/usr.bin/clang/clang-scan-deps/Makefile @@ -10,13 +10,14 @@ SRCS+= ClangScanDeps.cpp \ .include "${SRCTOP}/lib/clang/clang.pre.mk" CFLAGS+= -I${.OBJDIR} -TDFILE= Opts.td -INCFILE= ${TDFILE:.td=.inc} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td GENOPT= -gen-opt-parser-defs ${INCFILE}: ${TDFILE} ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ - -o ${.TARGET} ${.ALLSRC} + -o ${.TARGET} ${TDFILE} TGHDRS+= ${INCFILE} DEPENDFILES+= ${TGHDRS:C/$/.d/} From nobody Thu Jul 31 10:02:13 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 4bt4Pf0lcPz63hgk; Thu, 31 Jul 2025 10:02:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bt4Pd6vNwz3w2f; Thu, 31 Jul 2025 10:02:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956134; 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=hbjwQ+1B8TfnBUAfAmeb16xJ129a2/tX8wwpeTDKJ6I=; b=W86lRaOsiuyobaYu10Bfj2bd/me+rO+GRGuZ1ORuQYzgJ8CH+B2aT6gJzdckxFRf4/5QNU 5BBnTjDM1AIfkmXvPruaiEQQEi5323ToGLMG+1u/AF74weAzE04lpDVZxI/90XTPluDggv CiQoQ+FMpVK96IHLMhUlCJh5QQxUNHfj3b0BEUZWCXnUCnfv2wfHhVJpt/N30tTqwHZGW3 ii53le3dvcsUpZvFX9MNAzs1BEChCWBIlw44TwzEYEUBAZRi85MW/eIux4eoMsxiteA2te UHRaqsz3aSXZ5YSyHd0z116SazXiTkTxn8VWiDCZPlmcLkIAmeWTwSUmuca9yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956134; 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=hbjwQ+1B8TfnBUAfAmeb16xJ129a2/tX8wwpeTDKJ6I=; b=LCeuYYfHFRbEVUeqkdsTyXJ+tmjzHgkAf1/RTEW4tHeFvSGW+nBpgYh3wLd1LHJzjJwOhp cFP0RJyvqF8y6rvEZO869RhNKdwYCY1edKFMvBIg+eH+Wv2KNMes+cnufQEXACAMg3lAGS GjVYQfONixQ4q6E2wP4ETmbAwofNymKLF4xPWpYggNz2MRWL8ltfDaij+DSL5nC+QNiDC5 A/Ddxl4HJPjudP3lzrMwOuxqAn8YNRdd+gmg3FnjTdfHmiZJ0fXWFhR+gWiBgGGZhNj4Td IF3Iz/sA3Hob2LhGoOfinnNe3sXUHihy0oXD9u+buSggnMA6EYBsu2nAlPGStw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753956134; a=rsa-sha256; cv=none; b=RxgNxVIvc73IapWXzSA344C3mD+58BEnEbXLPBFALjPJ+dFlF/EWfly66v47eMfnVEc508 DZn+QNDCvZcdXWSNkqgXlYaRf3gBEHsr+g9l6X5Jn9yfapy5kEBAyuBLRbICVJklAp7iS6 kqHKIg8SScz0vdTRnp73LIf/K1UZ1Ek6bkdtjor/e4l5LwyevkN5Qi8ACEO4TtPqSDwBcP UwOwK6AbDSq5RTAA6ftlYBM9jb4r6KiBJktFrj7jNLcVZObqSXSSl3DBUPpunKb6ierjzX 2QY5dnzAddrNFfofxwseC1AiUPECvoPICsGTJ26Y8WTs3adm/y0afsrDCRNMcQ== 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 4bt4Pd6J6vzxwW; Thu, 31 Jul 2025 10:02:13 +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 56VA2D6l063613; Thu, 31 Jul 2025 10:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56VA2DIQ063610; Thu, 31 Jul 2025 10:02:13 GMT (envelope-from git) Date: Thu, 31 Jul 2025 10:02:13 GMT Message-Id: <202507311002.56VA2DIQ063610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: 0a2335471314 - stable/13 - pom.6: add a more complete bibliography 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a2335471314ea026042944d5971558e301cc779 Auto-Submitted: auto-generated The branch stable/13 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=0a2335471314ea026042944d5971558e301cc779 commit 0a2335471314ea026042944d5971558e301cc779 Author: Lexi Winter AuthorDate: 2025-07-24 21:12:50 +0000 Commit: Lexi Winter CommitDate: 2025-07-31 09:56:30 +0000 pom.6: add a more complete bibliography Source: Wikipedia (cherry picked from commit bf0ee5f2175a3c6eb52f9fc74b93b445d37a6086) --- usr.bin/pom/pom.6 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.bin/pom/pom.6 b/usr.bin/pom/pom.6 index 7b8248ed78a0..7d41d0c5ec61 100644 --- a/usr.bin/pom/pom.6 +++ b/usr.bin/pom/pom.6 @@ -27,7 +27,7 @@ .\" .\" @(#)pom.6 8.1 (Berkeley) 5/31/93 .\" -.Dd July 14, 2010 +.Dd July 24, 2025 .Dt POM 6 .Os .Sh NAME @@ -62,4 +62,10 @@ but not has been specified, it will calculate the phase of the moon on that day at midnight. .Sh SEE ALSO -`Practical Astronomy with Your Calculator' by Duffett-Smith. +.Rs +.%A Peter Duffett-Smith +.%B Practical Astronomy with Your Calculator +.%I Cambridge University Press +.%C Cambridge, UK +.%D 1979 +.Re From nobody Thu Jul 31 10:02:14 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 4bt4Pg2jcnz63hW4; Thu, 31 Jul 2025 10:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bt4Pg0dGbz3wJl; Thu, 31 Jul 2025 10:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956135; 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=RNC1m5Bs4LxemoCTqzXJj+RnjyGmjjDaxpeRLs9brMg=; b=urg45pli6FCIw5zv3bbYgCxMVMaJ/p99neEHTnQqfC5oNZ4HPKM8imo0APaeid/elHCj0t Z5gtaFvt8RREUKxmJY93JgL+UrTaAbh2u24r9vJkOLWTrI0iTwhrZNiFSfpPE8Nqo9IVJj R6nqI+/HBlCuF2De8978vw53eGlPQqEEBdXWyHaDDKgmMFXbRSvzgIN44KcJEZSoULrYQM xiOaZ9s17piO2kHNG+AmFb1rFCvMHLLwATjMwMp0GWGC6h1D6AxdLuMjoLzRXjLpZ1558u l6t9OeTxsPu17xUSY1xkIwxXAf64vgghLoFa6m/UiduOBd+Fjj15/Jhx5HxLtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956135; 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=RNC1m5Bs4LxemoCTqzXJj+RnjyGmjjDaxpeRLs9brMg=; b=nZgGDd4jzqwgECSZFJaSPJIaqKRch6qPD+EaNPq/63/llEDsaGzqRRrUg6AZnYVLX3Ptyn HewuQxW0+6O/RLrSGoFRNe/g/u1G5RpjVlqju2EygdGuLGPo9tUdseY2eQH+OrejofH0+6 oKUaQZSuQEn9wJRRg6Ss2c/sugBSB+cLteS2M7TCLN/QGyyOzjgS5gAMbHo26CjBeNH1q3 nRYr/tESZT63EKpR/2BoX8C+q1XyzZ673g/M0jl0QJfgfQJTgeHXIQ3WfGgmt2XBG1fx7L CrFd+Fnt1GCGiZ4IvbMUXeXQNhjJHPkfsG5UvKqXTo5TsmlsY+UxPCzNpTemTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753956135; a=rsa-sha256; cv=none; b=SBkVCAXdMpK2EruXJzm3WxCrXB9R77gons9v3aNUTop+qZZwG5kBYaR/xrofdM44M9xWpR fyRJmdsVlqxTSvR0ptP8dzcKf172nM0pct/lzH3CSP4atgxmjRSh91EnW7ybst3ZRnv1+M djSk+jcvMA6GqabSRBy4P1tALERAK93p1P675YW9dI4LT+h1nHxaaLMQGAQrWmZZ/37EWu XvjSiCI+2O4f6C3AL8mhrjdDHDbLVyx+1NiB5gax1FUsN+dKhlKeRo/JP4v7PrSN6iBvOp oYWqSRX5/+RtTB9qNjtTiu8CFF+Dw/gjth+j9jm5l4xv+nMixQfTYlqjxf0+fw== 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 4bt4Pf750ZzxBl; Thu, 31 Jul 2025 10:02:14 +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 56VA2ERO063646; Thu, 31 Jul 2025 10:02:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56VA2E7V063643; Thu, 31 Jul 2025 10:02:14 GMT (envelope-from git) Date: Thu, 31 Jul 2025 10:02:14 GMT Message-Id: <202507311002.56VA2E7V063643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: 4eee2c9e9625 - stable/13 - crash.8: update a little 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4eee2c9e9625f32fe822092f4fdbd87b30ec10a8 Auto-Submitted: auto-generated The branch stable/13 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=4eee2c9e9625f32fe822092f4fdbd87b30ec10a8 commit 4eee2c9e9625f32fe822092f4fdbd87b30ec10a8 Author: Lexi Winter AuthorDate: 2025-07-25 13:59:58 +0000 Commit: Lexi Winter CommitDate: 2025-07-31 09:56:56 +0000 crash.8: update a little Replace "cannot mount root" (which is no longer a panic) with a brief description of the mountroot> prompt, and recommend using "system install media" rather than the fixit floppy. Remove "timeout table full" entirely since this panic no longer exists. MFC after: 3 days Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D51512 (cherry picked from commit c9868af774ec24bcf6914fc971378e9723eb44ab) --- share/man/man8/crash.8 | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/share/man/man8/crash.8 b/share/man/man8/crash.8 index e1ccd4259358..4af2629afff1 100644 --- a/share/man/man8/crash.8 +++ b/share/man/man8/crash.8 @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 23, 2011 +.Dd July 25, 2025 .Dt CRASH 8 .Os .Sh NAME @@ -71,18 +71,19 @@ Left unstated in all cases is the possibility that hardware or software error produced the message in some unexpected way. .Pp .Bl -diag -compact -.It "cannot mount root" -This panic message results from a failure to mount the root file system -during the bootstrap process. -Either the root file system has been corrupted, -or the system is attempting to use the wrong device as root file system. -Usually, an alternate copy of the system binary or an alternate root -file system can be used to bring up the system to investigate. -Most often -this is done by the use of the boot floppy you used to install the system, -and then using the -.Dq fixit -floppy. +.It Mounting from failed with error +The system was unable to mount the configured root filesystem. +Either the root filesystem has been corrupted, +or the system is attempting to use the wrong device as root filesystem. +.Pp +This is not a panic message; rather it is followed by an interactive +.Sy mountroot> +prompt where the operator can list detected devices and filesystems, +and select an alternative root filesystem to mount. +Alternatively, the system can be booted from recovery media to repair +the situation. +The system install media provides a live environment which is suitable +for this task. .Pp .It "init: not found" This is not a panic message, as reboots are likely to be futile. @@ -108,11 +109,6 @@ after a crash, hardware failures, or other condition that should not normally occur. A file system check will normally correct the problem. .Pp -.It "timeout table full" -This really should not be a panic, but until the data structure -involved is made to be extensible, running out of entries causes a crash. -If this happens, make the timeout table bigger. -.Pp .\" .It "trap type %d, code = %x, v = %x" .\" An unexpected trap has occurred within the system; the trap types are: .\" .Bl -column xxxx -offset indent From nobody Thu Jul 31 10:02:16 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 4bt4Ph3vsbz63hW5; Thu, 31 Jul 2025 10:02:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bt4Ph1VTxz3wGg; Thu, 31 Jul 2025 10:02:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956136; 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=Gc46FGAl9s7E9AzcWIiYTJU+Nkz9E/mXkDJVCkcEEfM=; b=Rr7jUQvqOk6zlK8F5Gard6X6wLMS3mx5bRu9DbcktQLzjNlg0ltV09IRMUaF3oLufA7xw8 t1svBlT2PgdRK3jo+jry9x8AVvD6XUzASL2KSiTFCrBD+OKhFLfLxr5IA9ksCIHI4kvj0O N0XQ47DF2Lz5dpmx7LxqmEKAlgStfJNLxZETG+rgfm89FZqxUkgEgcdPQhTdPEF5mqjXRz yGkcDW3hii7VdftQ+1sesUaeiiSMFA/jNuQ+taZvQr6x3S9Pf9uzsA7M3PQA2PWbfAaZkH pSDvopT4ANP2hp1hv2oJn909/FrHXF8Ms9UrbYURI25j9MGVhMLWwXhBF9dylA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956136; 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=Gc46FGAl9s7E9AzcWIiYTJU+Nkz9E/mXkDJVCkcEEfM=; b=nPVUD7s52yYGM3j+APc6pRAOV3tPYQ2v2L4rnssolewJQI9qn4mCuTpwGuwYCS8iHWqAoF ZL/ZYZXgIe94+qgtAYMfMb92MyaFT/JGRS1Mb//zEYrwyN0kjH2YG/v5ULTApSKDCj8eDj qVOvrT5tAcAPV3Hj1kaT0yjn8gtTlfZfVjJKqU8WGhDF3gq0uANgfQ3dwgJbvQzRs0UYfT 76RSlrD+4TLisf6gUyjYEGcaJic5irLWQPtrW0fNj6TjBhZg6N4PHRUhJ/LZw4syV6Qetb HPDs8cod9QmpAOAcgWBW94qnDJbpMfyizHJOuytxMMdLLFDKe8cjpUiVVZVSjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753956136; a=rsa-sha256; cv=none; b=A4WE2Zu0opCi4ivZ7pZBsxDFTi6w+lVr1n1esZTH5BrXDdzevJX5KxdsQnGT2a8L5OBqSJ yFciYvFxw3xX+g/0LtCqJa2H3HpiFQFfV/efkBDsshVm1Z9c+UGocktpdcWB52l0aflKUL jwUbzx8uuXAQ2xztlxMgrq1MUWD2oz7IBf5o7uiZMKeTkYW+MVMZkYMNQX5Bw1MMMjVAis J2e1yTvxetL3XWudno+nQweJ6A2+yKGKX1HE29k4epk3RJraEic4Xe2MPOSl+UBXdVI7ab OUr4xVonYSIwX0FsGLdnW5c1EthIVvuKxbz0lfOI8GDaMlA4UTtO3Ewme3smrA== 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 4bt4Ph136KzxVm; Thu, 31 Jul 2025 10:02:16 +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 56VA2GVu063679; Thu, 31 Jul 2025 10:02:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56VA2G7E063676; Thu, 31 Jul 2025 10:02:16 GMT (envelope-from git) Date: Thu, 31 Jul 2025 10:02:16 GMT Message-Id: <202507311002.56VA2G7E063676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: de19b9d6e967 - stable/13 - clang-scan-deps: Pass ${TDFILE} to tblgen, not ${.ALLSRC} 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: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: de19b9d6e967a91565605b04c9f4b61b2099f096 Auto-Submitted: auto-generated The branch stable/13 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=de19b9d6e967a91565605b04c9f4b61b2099f096 commit de19b9d6e967a91565605b04c9f4b61b2099f096 Author: Lexi Winter AuthorDate: 2025-07-27 10:53:19 +0000 Commit: Lexi Winter CommitDate: 2025-07-31 09:57:54 +0000 clang-scan-deps: Pass ${TDFILE} to tblgen, not ${.ALLSRC} ${.ALLSRC} can include the dependency OptParser.td, which causes llvm-tblgen to fail since it only accepts a single input argument. Use ${TDFILE} directly instead, which matches the other invocations of tblgen in the LLVM Makefiles. Fixes: d3c06bed2c16 ("clang: install clang-scan-deps") MFC after: 3 days Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D51569 (cherry picked from commit ad023bc26e106e28e1b4845f991b52b533bd0802) --- usr.bin/clang/clang-scan-deps/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/clang/clang-scan-deps/Makefile b/usr.bin/clang/clang-scan-deps/Makefile index 16fecdb88867..8da12faccc45 100644 --- a/usr.bin/clang/clang-scan-deps/Makefile +++ b/usr.bin/clang/clang-scan-deps/Makefile @@ -10,13 +10,14 @@ SRCS+= ClangScanDeps.cpp \ .include "${SRCTOP}/lib/clang/clang.pre.mk" CFLAGS+= -I${.OBJDIR} -TDFILE= Opts.td -INCFILE= ${TDFILE:.td=.inc} + +INCFILE= Opts.inc +TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td GENOPT= -gen-opt-parser-defs ${INCFILE}: ${TDFILE} ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ - -o ${.TARGET} ${.ALLSRC} + -o ${.TARGET} ${TDFILE} TGHDRS+= ${INCFILE} DEPENDFILES+= ${TGHDRS:C/$/.d/} From nobody Thu Jul 31 10:12:22 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 4bt4dM2fZZz63hVQ; Thu, 31 Jul 2025 10:12:23 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bt4dM0TQLz3xwp; Thu, 31 Jul 2025 10:12:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956743; 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=AI2dDdJkg2SfLRaGcpCUBfM/rixr+fSKPZ9PHLiFO08=; b=Fb4mhW12j2o56m8jBPLK89mRwBWI1ukucHeGMN5qjQpRZyd6OKMcJYtUXq+aPDkdwAcaoc /sJ0aNCUsn57rAaCg9Qr5gXNkP21cMibmTlDjWhtOmRVKbvxoeMdneA6LPO5Tnl/G2GmdU owSnetpaFztcYDJ4yfErHdaSadJmhVfczydALBwt4EYyfXEH+kITdXp6eaMtvwSyJ4ZoJx W1Bd6rMvlh4VXNCX57TAzDynCqXCW3EngauBWO7wTyrAwVYpfxZuIH6RP3dmuktnjTGBcc R1TY/8UaDDqo1p4+0W+WvarCUy7ady7dk3uc+sjkeB1QMe9bbtyTVC3KsawWHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956743; 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=AI2dDdJkg2SfLRaGcpCUBfM/rixr+fSKPZ9PHLiFO08=; b=gNn/KGFuskBd5b5kdIAgdC3XGPuyW/uOKDKys9b1QZnuBAMRPAc1sHPMRXiFWk1LCybboZ uYVkx6i7LjIDw58IoUX7sTf65aQBublG48n9bpINSAOjybEit60yXSTlONJIsleQRCTDv0 hlXqtcWmvVmhbq7GUpHxukrfi5mNA6ShJf66Ot2PBt2nggDCwjCGVLWe523zg9T61Cgjma mT4RWZoINSxrm4O+mBE99sTDqCadP8N7Q43HJlyzKk2tEDBuH5gfe4GuHsbUxP9NCefNz/ YBeCUijwdRLO/RhXoMAl3O+ktPIAV5DXIOfR9p9yBXfV286rTSWb0KCrDDXqbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753956743; a=rsa-sha256; cv=none; b=XDdOuOc0Az7uw7h70T3y8UBsOl9wibtUkW5jfuWYSp9IvrVTOHwu5TEqwtz0ip/h+YDbLL OZY75uA0zH/z3nC0/R/PByg0LW0cN5Qr64cYj85bK/dwkd3wUEMtdlacFYKT68CdRJTBDm S/99UhotG2b4sd5xibN/KdaUwMcEmOCJ57vjv3DRg7l2XhMn2pxNKvldgUKobNNpTNo2lH xtuMHC3DxcQXUSj5pRX7wZldIu1XvZ+JUoxxZu/erU4uhSZUHUHlXP7aBd2+oP/1gD+qNb 7bpsyLqbMzGIsAqbmq8GrGFK3mrkUPqVw8ugGkQDBCyM2AKfAaT77vQsHbRwMA== 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 4bt4dM05N9zxgm; Thu, 31 Jul 2025 10:12:23 +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 56VACM16084733; Thu, 31 Jul 2025 10:12:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56VACMuG084730; Thu, 31 Jul 2025 10:12:22 GMT (envelope-from git) Date: Thu, 31 Jul 2025 10:12:22 GMT Message-Id: <202507311012.56VACMuG084730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 8c49d0a9f825 - stable/13 - if_genet: Consistently use the boolean form 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c49d0a9f825a1915a3ff8eb5ef8ee8223b5d5f1 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=8c49d0a9f825a1915a3ff8eb5ef8ee8223b5d5f1 commit 8c49d0a9f825a1915a3ff8eb5ef8ee8223b5d5f1 Author: Zhenlei Huang AuthorDate: 2025-07-19 17:07:54 +0000 Commit: Zhenlei Huang CommitDate: 2025-07-31 10:11:51 +0000 if_genet: Consistently use the boolean form The variable eaddr_found is declared as bool. This change improves readability a little. No functional change intended. MFC after: 3 days (cherry picked from commit 2fc051d090933203e1af6a8452cdd87a4c76ad5b) (cherry picked from commit 97d5f16c6966e2ae261ddabe1f16a9675dedf43a) --- sys/arm64/broadcom/genet/if_genet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index e1a43b427ca4..967583aad62c 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -350,7 +350,7 @@ gen_attach(device_t dev) } /* If address was not found, create one based on the hostid and name. */ - if (eaddr_found == 0) + if (!eaddr_found) ether_gen_addr(sc->ifp, &eaddr); /* Attach ethernet interface */ ether_ifattach(sc->ifp, eaddr.octet); From nobody Thu Jul 31 10:12: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 4bt4dN4cPJz63hqQ; Thu, 31 Jul 2025 10:12: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bt4dN17Cxz3xkk; Thu, 31 Jul 2025 10:12:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956744; 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=rJ+xPGIAi61tHqzYqd6NcIUGdNdENUSOohJ5BckJvM4=; b=gVODZlBpZ5+wUaAiSYTqgl1Kh+VkFKEW5UMB4QAt1YhiWkjlDsNdv4gwBbaOJEUtTa82RD wwKj2B/hnKCc3vjlQ8ek09bY3dLKZK2u9bCT1S9uJjoLbKJVmHJ+USuPMvjjd1wfBb2w61 5Tmg22RuJZmT51+F8xmvyK7G+D3Pp9T0NIh/JeeNNyQ4c8Rs3gxCtP3sRs5k0+c6VFYZim z8rs32qcocBiGILkDEHb1FD/Dh5XsCJouQbkKh03HERuNx4s+lfKN54uFujQrdllrgCDJe FdAf2QorDA6hLbDARN22kSPIeYIg43plc3+L/w/N5L5cqlK5ZGLNnmve9P5l3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753956744; 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=rJ+xPGIAi61tHqzYqd6NcIUGdNdENUSOohJ5BckJvM4=; b=vUeUgzNqEMn/+ifH1XzzoMu7whNLdbs8HpqmMYTElrRY/QOC+Pbo2VD1i59r5AzqfIYF62 MukOJofGymRjqF763mywYFfKcJk8FvKxcLw7dD2OrjkeHUj8dZPbKjZoT60iFT0pPU0VaI iTiRNxfsrpTiy+bJ02tFCmgFPdFEqa9CJXzcoa/atd0oOdYS2trzTXACUEgIXBCw0+iM8G 4sj3G+kmv1zZdDfFxp0Mair2C8tkdpQv9qrWXoQr56sJ9L0EzlpjNu+SbtGI6J6fSH9EdE uiltIXylIRTOMriQ9QTJVzzjLCBYhzBGOZe0rsE9aFpaeWhiiO+Lk1z3DTZkOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753956744; a=rsa-sha256; cv=none; b=FpNj8cnMN1cGeW4Js9tgQdG9ULZ4CS8ga9abbEIAO5K4UYJspurrvvudFKX1Dok8+0Ejgy DbgMMpojQnqThJH7YtE50QykZ4oiqnYAo7+n8ZVS0nO9LYgi9Gf5LNDfNyiXrlOlLIUQkD /4xrgeNd1nfACw33aMWyeJd9/VkoQDzF03QYCYO4QPBDazEPTBWJvxWwqtuJ3JzUwwi7SF VoQJMK3+gBTeW5Rwc7tWbL1L8W3/niwKnCgDKGgG47TlF32JzQP2Non89y7WPTD0SaunCh bPP7GP4kzFxDG3kn195yPVPIUz9d0lBtZlf4cUZtFdxmrMaAHo7xX9SckoA0Rw== 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 4bt4dN0jPpzxhl; Thu, 31 Jul 2025 10:12: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 56VACOfX084778; Thu, 31 Jul 2025 10:12:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56VACOic084774; Thu, 31 Jul 2025 10:12:24 GMT (envelope-from git) Date: Thu, 31 Jul 2025 10:12:24 GMT Message-Id: <202507311012.56VACOic084774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: aee028cb4e96 - stable/13 - if_genet: Plug memory leaks 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aee028cb4e96541150c528767c1aeb0ca3869d37 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=aee028cb4e96541150c528767c1aeb0ca3869d37 commit aee028cb4e96541150c528767c1aeb0ca3869d37 Author: Zhenlei Huang AuthorDate: 2025-07-19 17:07:54 +0000 Commit: Zhenlei Huang CommitDate: 2025-07-31 10:11:52 +0000 if_genet: Plug memory leaks The rx_buf_tag should be checked when destroying rx dma mappings. PR: 288309 Reviewed by: zlei Submitted by: Mike Belanger MFC after: 3 days (cherry picked from commit f46e95ae3addc9f7b975c187f71125825a38ffb1) (cherry picked from commit 337c3e9859e7b5d971e84bf546a51c2cf9a9e44f) --- sys/arm64/broadcom/genet/if_genet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 967583aad62c..68966fcfc956 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -657,7 +657,7 @@ gen_bus_dma_teardown(struct gen_softc *sc) error); } - if (sc->tx_buf_tag != NULL) { + if (sc->rx_buf_tag != NULL) { for (i = 0; i < RX_DESC_COUNT; i++) { error = bus_dmamap_destroy(sc->rx_buf_tag, sc->rx_ring_ent[i].map); From nobody Fri Aug 1 00:23:44 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 4btRWh3HPWz63F5w; Fri, 01 Aug 2025 00:23:44 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4btRWh2KhYz3LNH; Fri, 01 Aug 2025 00:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754007824; 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=WXPFbx6iApH9fD7GYhBXZi4zBp5o0PgZYwcTznRol/E=; b=UeItUun3JAmYCGdP1bwNV/WosAclh7eKYaISdFVxhu0PYzZkWswTy65SBuVKzxncWPBSJx iSpzLh8NXhl5hyIdllW0ZL0qG4kVEXzsGEFMAo5J6DoAB7ra7YzXeOp9m4qEU2q0e6XloV NSNJgSaxw1AjsICFUjGW2WvwM2It9oJCzJ03bvqZDdWP2VgER3NlgeVuwQaPSCrSKe+4lb 2EBG/XYtLuHgrsi89k5VKt9tL+KLZrzV2YXIYSzwjzzQfPUwdlb+vvmIabI4ePfx2gBYlr S/bsN8LAAHsABYSQ44zkPf2MG/uHDSrd6UmsC+/vrKPtPsX0wva0fA4hhbCZSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754007824; 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=WXPFbx6iApH9fD7GYhBXZi4zBp5o0PgZYwcTznRol/E=; b=cmPG/EychsvtQI1022rL35RM3b+J+fOcvmDvwZXnz9fDKWtuknoTy5mvs4Y0EjhVMghxRl u7LDrhsekc4/d1zMGc/McwdYNJAXXMKOE57OE1I0VBX5fJcsRwQQ0HDCPkHSW+Yyu8Uthi qV8uPlJ4k3QlqFMfv+O7Dn8zCTYK1r/eBzZzOXQYXtZ2FveREyPPHQDPWLsZ5UnLa7RQsv mFYvykafWP5P354Zkkzhz3g7FvZmYz51BO9SSZc1sfT/XZdLWmfLauKg4n7NevjPqCCpJo 2LnIFeDfHijOsxQPf1ILRK0UJiEAg2fcMSbCw03RCEQWXbINShtxdlHPHtbJsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754007824; a=rsa-sha256; cv=none; b=CX1BL28laRMt8JZt4RCeEEZYNg+qgXEqm50vAvREGnc5h9vEK8qWGrT4i0TtRxwJuIUTiQ wxyOWCQXWZUmRg93PYIUHHc3PJLamgDSXF2Spl0vl92SRoAizgoalK3UvTZQwh3VQ49/b8 llyHZf2LTWZs+Tjo57PKHqpauq36O7exSC5Gwejh4zOcQSIkFrxFeRUac/TJjqMlON7o0T 7TJikeKz+SHwr8klZkqHIT0Gy2yJve91s98WYiMS0QBPc4Ad9OycuAdsLDz84SxMHiJlHb E+c1i/A2yJonNqHZwQIJnSiJsaWHHPim0UFl2iCBmNBjxKxltf3ybSLnnrpKfQ== 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 4btRWh1wJBz8rj; Fri, 01 Aug 2025 00:23:44 +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 5710NiPG084184; Fri, 1 Aug 2025 00:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5710Niiw084181; Fri, 1 Aug 2025 00:23:44 GMT (envelope-from git) Date: Fri, 1 Aug 2025 00:23:44 GMT Message-Id: <202508010023.5710Niiw084181@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: 3a54914b0e52 - stable/14 - kern/kern_thread.c: fix typo in comment 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/14 X-Git-Reftype: branch X-Git-Commit: 3a54914b0e52ebe07c8f03ef53b73a1f5c5d0776 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a54914b0e52ebe07c8f03ef53b73a1f5c5d0776 commit 3a54914b0e52ebe07c8f03ef53b73a1f5c5d0776 Author: Konstantin Belousov AuthorDate: 2025-07-29 23:32:24 +0000 Commit: Konstantin Belousov CommitDate: 2025-08-01 00:23:01 +0000 kern/kern_thread.c: fix typo in comment (cherry picked from commit a0041aee49bebd306179382658bcf965e6db5aef) --- sys/kern/kern_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index d0a5a7ffac61..ec9127939f31 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -569,7 +569,7 @@ threadinit(void) /* * Thread structures are specially aligned so that (at least) the - * 5 lower bits of a pointer to 'struct thead' must be 0. These bits + * 5 lower bits of a pointer to 'struct thread' must be 0. These bits * are used by synchronization primitives to store flags in pointers to * such structures. */ From nobody Fri Aug 1 00:23:45 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 4btRWj4vgzz63FWk; Fri, 01 Aug 2025 00:23:45 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4btRWj3H8hz3LwW; Fri, 01 Aug 2025 00:23:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754007825; 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=L+XN4rRLdbjavuNG3g0YfDdyB5EWGAiD3KCR83FsY4A=; b=fOsxFDtWEL+cf47sUJAzH1x3V5JeCFJYXTzIvBjyR0Q9dAHeyw1R1lv25d+jx+zjFczq79 FhytdCH3InkNuNSvcjpIqSIR8wFK2VMK7Gu9PE3NXreaoCqmN19X+etTZijgUT+p4jDXeQ ew6VLvSQvNWiY5oo/Wr1388eWgvvNt1QrG9DP0hH/uH1dy8IaFHl2TKezak4mFuAIVghhj zmvOzW3ukqqD49y+P9QMiYFJFI38ezV0JCD0mx9bwBobqUvsAq6+6n1dEJG42PaVGyAx8A 8FuIuyLGA7IHPP3yLYAvPpA7NvAoOSQ1V3nKTE3p7u83u0KiiIqdtqlf4QxPZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754007825; 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=L+XN4rRLdbjavuNG3g0YfDdyB5EWGAiD3KCR83FsY4A=; b=JdeyAZZNBPG3wl0j70a9rLVKEWiPC5keiPhofp3xEiZSEqUcXf8GjTNNmrjiujc0D4Zkmb xuhfh6SfUbgAJ8KB2NPBRb48RAv4ELaVmUenIn9oWS+lfeLEFLyK7sb0r3OsicbiITxqnQ Mh1blbxoJFgTrSWZuQzl05k1dXUOZJ28UbjWTT3XhmcQ+V6y/+tyAMTgKlpx44diML/LUr 0QpIPdbR8UgvmwevaOj772xAKKZCJtaEfQXe1EO3cmBBbgwMCt5koeP0OYnHefGnDegFGJ aXS+QN+WvDq+tfbXS6fJIntKxKoR3KKhMbc2Cmo6SuMZi3/6V89LN7vhU3BuwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754007825; a=rsa-sha256; cv=none; b=OIIpIpB2qo7Yndb4Ouy0WSaNcr3EiwrfgWna020fTsf00j2ZY56U8bTuUM2vjs97eFqLAX mdhR9f6tMBwaZ8ElEuyF+fwHJ5gs+LnNsxcQk9P9IC3+Yenc13LED1Z+M9gigwqeF1pleh aY95297VOPI1QdSY0mjYU8MG00NgdQ1Q8kc9g9RyR/RpvDQWKgsn4QAoveQx5t91Ejp3Vg 8ysKV0Yjc7Pgul9I+py+a+d/zj0sbco2pru7vaDiBhLQGNdlupnlZHpjK4vjxz6T9Fssvw j7UKFOE0PMBtnQb982/qcMOw1jyaqCuYFPlLFvJIwisEKH6bWck7EG+gkYubeg== 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 4btRWj2rJgz8rk; Fri, 01 Aug 2025 00:23:45 +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 5710Nj5R084218; Fri, 1 Aug 2025 00:23:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5710Nje0084215; Fri, 1 Aug 2025 00:23:45 GMT (envelope-from git) Date: Fri, 1 Aug 2025 00:23:45 GMT Message-Id: <202508010023.5710Nje0084215@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: c0b4b2db0adb - stable/14 - libthr: fix typo in comment 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/14 X-Git-Reftype: branch X-Git-Commit: c0b4b2db0adb7c95367a3b7470f0cbf7f7e9b711 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0b4b2db0adb7c95367a3b7470f0cbf7f7e9b711 commit c0b4b2db0adb7c95367a3b7470f0cbf7f7e9b711 Author: Konstantin Belousov AuthorDate: 2025-07-29 23:33:04 +0000 Commit: Konstantin Belousov CommitDate: 2025-08-01 00:23:01 +0000 libthr: fix typo in comment (cherry picked from commit b87013fe70c051278e67d103d93c5292721cbcba) --- lib/libthr/thread/thr_getthreadid_np.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libthr/thread/thr_getthreadid_np.c b/lib/libthr/thread/thr_getthreadid_np.c index ade332519dfb..ffecd0bc7ea9 100644 --- a/lib/libthr/thread/thr_getthreadid_np.c +++ b/lib/libthr/thread/thr_getthreadid_np.c @@ -36,7 +36,7 @@ __weak_reference(_thr_getthreadid_np, _pthread_getthreadid_np); __weak_reference(_thr_getthreadid_np, pthread_getthreadid_np); /* - * Provide the equivelant to AIX pthread_getthreadid_np() function. + * Provide the equivalent to AIX pthread_getthreadid_np() function. */ int _thr_getthreadid_np(void) From nobody Sat Aug 2 05:31:12 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 4bvBJ11Tm7z63cFd; Sat, 02 Aug 2025 05:31:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bvBJ05yn3z3CsC; Sat, 02 Aug 2025 05:31:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754112672; 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=EnYDCtkPHrbQOuJeLGf0BIPby9ubWGidKwsSTdgBfgQ=; b=ZFlcJx4uWqsD0/1srD+rbrB0WdH/0VXu8q8UefsFzs4VgzD80k/Mb6vMonpMJY7yoQocWk bFE7A2eIRp3ANRofCfYCM5MJOOe8ZRvb2a17xbl/XfWFrM37RoU6iZoEeMEL2IiIJGH6IX ZMxK6gn9fvATJlrdSPNnevw/IGIT12Y6Dxfxjlfbo4+hgz9gqON89ULAUAGXY00GyQbY8/ xjQqZpEGJwhfiwUHy8/45dZjmxruT2g5q6v2PJ/6i4ZGt4E6sKKoOjGyk9vzL+DX/KmVp1 hZDsDHVa5mrfIzPPwiozyylxXt5s5Wek4Z3WOZ/2iofzgT/5og9adj8OQWJ80w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754112672; 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=EnYDCtkPHrbQOuJeLGf0BIPby9ubWGidKwsSTdgBfgQ=; b=T+9OO8t2F+tJ+HxxMCe+FgiVLIdehbm3PU4w5MOf7xK7bk5XwpHFDlaZk1U5MNgfNo/1Cb vq/e/FYxsvTqd8ShCqFOwm8e1SR9rltcDeupd1CWogffmeiV9zuWTaCgB2v+/FMAgOW/A5 9Rm3+UJKuMEz8M1aepe0nLUtsEv/r6eNIEEkB5o+5G8vOBMfFfZMXDDYEX9OZmev2y5Vix IGfFrP1MlvJdrUr8YvytsY2svHUozKsTCIXDxsd5FNdTnACC5fwOdtQEDWe4Wkgcg3jO4g ij8I4FHF7emRArc8rmtXXgy+2rQ8kv1FZWr7r65pWYFb5XG3wnHoRYFP2iLnSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754112672; a=rsa-sha256; cv=none; b=oiRaU3Y73oi2Pc6d+CsjT2xMdJhEzNYmWX6zHLzWtJCaPA831Z6y7svu8+HpCnXbAo2L+L 38qkqEfNbefI1XV01KkSMcSfm+wFqnxS1IgwOb8FfA8I9MbEUU+2qEtFRVC+IIehnD5l42 NiPfxjCj8EW6TFRf2MbxCWjf83+1pM8IdcZZS6Ew2OYzpiJygXYcb+yR2ashU5oBwMIW8T 39HNqy8+BpWMR0ycc2ZRcfkVKwEeNiQc72XzEOC2bhqvy2eJCJPA4lM+Q+7b3SwyrEz6dE l+fIIQ/xwlNdvWVZ4/0WTnq13XuIXNlD8o/VzIPWKkjLHgNcYXI//87GA/wMDQ== 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 4bvBJ05RGwz1Jxt; Sat, 02 Aug 2025 05:31:12 +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 5725VCYN065952; Sat, 2 Aug 2025 05:31:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5725VCap065949; Sat, 2 Aug 2025 05:31:12 GMT (envelope-from git) Date: Sat, 2 Aug 2025 05:31:12 GMT Message-Id: <202508020531.5725VCap065949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Romain =?utf-8?Q?Tarti=C3=A8re?= Subject: git: 8d4464377219 - stable/14 - vm_page: Fix loading bad memory addresses from file 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: romain X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8d4464377219dcf45e87510b73767c9ec3515bc2 Auto-Submitted: auto-generated The branch stable/14 has been updated by romain: URL: https://cgit.FreeBSD.org/src/commit/?id=8d4464377219dcf45e87510b73767c9ec3515bc2 commit 8d4464377219dcf45e87510b73767c9ec3515bc2 Author: Romain Tartière AuthorDate: 2025-07-25 18:31:57 +0000 Commit: Romain Tartière CommitDate: 2025-08-02 05:30:18 +0000 vm_page: Fix loading bad memory addresses from file When loading bad memory addresses from a file, we are passed an end pointer that points on the first byte after the buffer. We want the buffer to be null-terminated (by changing the last byte to \0 if it is reasonable to do so), so adjust the end pointer to be on that byte. Approved by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51433 (cherry picked from commit 202f8bde836dc86627be2b5b98174d9a0fb2eaba) --- sys/vm/vm_page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index ac922f4a3bc8..f013cbc84c25 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -393,7 +393,7 @@ vm_page_blacklist_load(char **list, char **end) } *list = ptr; if (ptr != NULL) - *end = ptr + len; + *end = ptr + len - 1; else *end = NULL; return; From nobody Sat Aug 2 05:32:01 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 4bvBJy39zNz63c1t; Sat, 02 Aug 2025 05:32:02 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bvBJx4SQWz3D2X; Sat, 02 Aug 2025 05:32:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754112721; 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=5OHW39W9OBPWZtqELXnd6kaIjNOTUjCNUjRzgG0vOHM=; b=ayU03OzfHR5EWMGr9GkpHKiprNpoG0raT6uSG5c1l27rv+mBVBRrroEIt4b3PPr9AwALWM QqQiPncNbPPtcfyXcfBtxST1fk+5P60yyCH2wNS+P+1ek7QN1O0YV4Jo7XNJwaf+k20KHk pvfdKIY5/piHeD+eh7aO1mXS8jGbyrXd8Y9RP6zuBHOPlQu3bXhWepQ4VveGb5QrbU+vIU 2I4p3JQmcjnLJstUuMAN2u9fzHS/RVsOSZEMVNzVxO62Kd2hlSnmJaGFxAw58C/S4sl24f Xi+x41PqwIyv4rwwtdyA+Sg0AV9aKWjdoAPu5bOhBrJPeWKG/V249r7r3WXyBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754112721; 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=5OHW39W9OBPWZtqELXnd6kaIjNOTUjCNUjRzgG0vOHM=; b=QadB/kbEFYmtxTcJBtDN1NLoJGU02qJMv4VWncp/RNtPRDde+Lp/4secpDCoLWx4lS7CfB qL/mTGrlb9PUiDhDbOVf8ijjEHV52FeW92UALp7yufjpcSNDqd29m13V4CDb1c+CixhJ2E SvQoZOpM6OWaMXGPtw50/J6FQkcUyeypSTLjwhU2Al8dhRgi6nTNWPtbuqhkwyZkSBI2Pj 00zc7xTSA+84higtYR83jmUXUpHxm5l7veplzsWO49IFWqSBfAgzSGmzLHAWqUn85cfllW RGBREd1I42ZBDc1HpNoBILDB8bgrh7eO7E/tU0gnX1JBxPZkvQjAiYevaZhTrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754112721; a=rsa-sha256; cv=none; b=U8d+5IHfjBtcnP8xeN0L/n/5iL1e8qIvWmhp2rF7Q9GQuVCopXJWmUw5z16QMP+DFUMIU2 yJyHvCFWHaSxTO2My4xVwbtC4Gctn6b3FlJwfKDMeLljz0OvAwS+cOUKc4amU2/zqeyybA 8a/0AgI0eU1FaaWiqUYEcT++N/goJcpzuwF8yM6VJfNuLHbZ/jUUq+496vBy8uzvsUA9WL bLsg3wBhwDA+padOfeJzMM6bas9WRLzSiV3lqYtMTdaXIciG09E7RHDweBVpieWuokshYx w3XhQThx7NpPlpPYFD9jvQPlFh5ODzgLA5vDd0qsdVC4fXK8C3BbSKOtvrSMBg== 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 4bvBJx2wh0z1KP6; Sat, 02 Aug 2025 05:32:01 +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 5725W1G7069227; Sat, 2 Aug 2025 05:32:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5725W18b069209; Sat, 2 Aug 2025 05:32:01 GMT (envelope-from git) Date: Sat, 2 Aug 2025 05:32:01 GMT Message-Id: <202508020532.5725W18b069209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Romain =?utf-8?Q?Tarti=C3=A8re?= Subject: git: e4624465c16a - stable/13 - vm_page: Fix loading bad memory addresses from file 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: romain X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e4624465c16adb0e60a6b0edeb570dc103b40831 Auto-Submitted: auto-generated The branch stable/13 has been updated by romain: URL: https://cgit.FreeBSD.org/src/commit/?id=e4624465c16adb0e60a6b0edeb570dc103b40831 commit e4624465c16adb0e60a6b0edeb570dc103b40831 Author: Romain Tartière AuthorDate: 2025-07-25 18:31:57 +0000 Commit: Romain Tartière CommitDate: 2025-08-02 05:31:38 +0000 vm_page: Fix loading bad memory addresses from file When loading bad memory addresses from a file, we are passed an end pointer that points on the first byte after the buffer. We want the buffer to be null-terminated (by changing the last byte to \0 if it is reasonable to do so), so adjust the end pointer to be on that byte. Approved by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51433 (cherry picked from commit 202f8bde836dc86627be2b5b98174d9a0fb2eaba) --- sys/vm/vm_page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index d21022930396..ed43a05f0e64 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -393,7 +393,7 @@ vm_page_blacklist_load(char **list, char **end) } *list = ptr; if (ptr != NULL) - *end = ptr + len; + *end = ptr + len - 1; else *end = NULL; return; From nobody Sat Aug 2 06:39:09 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 4bvCpn0GSwz63fwL for ; Sat, 02 Aug 2025 06:39:29 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic.asd.mail.yahoo.com (sonic310-20.consmr.mail.gq1.yahoo.com [98.137.69.146]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4bvCpm2qXHz3JBZ for ; Sat, 02 Aug 2025 06:39:28 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=B5vtaZeH; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.69.146 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1754116761; bh=bqXIZQ7GDypeCDtAAjR6qEVlikn5zORCzShMjA0KC4U=; h=From:Subject:Date:Cc:To:References:From:Subject:Reply-To; b=B5vtaZeH8lYwJW7NBYELKX18A909/oE3ejUhIggtRh4ICvgRBHaXikarqunbQVMwDjrDHbp80j4DH7pGLjsDze1IUtDzHltchluRImySKtDxzy3ld3qaZXmaWYfcZ5SvoXUBhLg7uzIk+3r7e5X6Lr7XMatKSbS114ZBGU0+XPYIWg8dcj4IoaPLWjR0wKybRwgKLtCv4xvw6zUPeTnbgrTcMSQSAhN7OIFg8SXWEFe5/YJ0ZlcktdRUycn3UVCZS5hbL0lJuABli8gkizUss39m9PJtJxvczReks9J7lmYvi7P/LE824PITC8Tpu+LqyeSFIgk2Gh37U8ExIvxF5w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1754116761; bh=f6/wwgnbPNgprt4T9ZJqi6xQwAVzb75GMPWYmNKkJyr=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=a3MvTkibBUrtXWe5D7MhNVFk+SvR+37IFEAZxB8Vn0qUEczztMUmR47ROM8G86+YGrrhmBsHn82DkGRIO5VQpXfvg37K8LSzuTni2zcwEFPcYXeaWYdbM5SSYHjIae9lW/D0cwt0ZgEqLy6JejnL3wZ39s+IfaE6AAfqlhWSMJJr0TgR5FQZuFbqRVfvw2b6/O9Q3ED/RqLbQeSnXYQwlY2IjAptZJzPzln4qAbDxaCu7lmcO+uEmzPnPdhwILsyGXFrO1An/XSQhDseWzqSBkWC07yCIpSyNoDUz2lMCap93JoSF959tcj+ctjPRfAgED3VO3RDmU9KlFVSolrd5g== X-YMail-OSG: zxmkMa8VM1nfDaOsyEpEZdJo1B..0wEf5oAN9POuVQl9eYpQhcn5Jy0.x8.gKp6 zyHbuNJnf6nOduratVAWtBcriP0Id5oXs63b6oXowdcjAbBl53xAx7oS0JdrAvZMORfIqV4sG9H. AHspDbcX34pXINTvxaKZX2GTgnL41e.IFwgKuvDkrVfx.cnno3D6pSOGSme_K8lxAser5TsPZqCW 2GaiZFcJUtSguA0YqOmOVOCdUpPGsJqVKQ9OhyI6kqcGJlXj.upFfrJCKlHgrirtmTJ7YqNYRfkd 9MSHLZjkfO8QioVll6ttLaGv5U8z2MwtWlvCvVd_a7ZxbtIEl1vOA.8PE2Ga1We2ROatOm25WTO6 hbZzOQr5ILTPLKlxmNVTfOWK.7iXNK7Fs1IxeoFU4Rwflz_YELAST62AeiUa2zdhh4g7mobWioZo BJWKRFpZ957EfceBXNkn0pSrLGXd4vF4ODaJLXMUtDMY78Rom_CmZrTRegbW4QQOthLcUwyCYcuZ d0LAWcuunD6dYAspA02rxV1YWgvpTBDIyVtS_4JyWVVfoF8SWUM1vHPWh2u6C5Laj._WN7i5X2hU T0fj5tZbxigH6w2ChJFC1aD_86j4C1S2pAgKCv_BXCALXq1_FJC_VWlZ7CUhdSFtjv2wFdtUlNtt RzBkZovCJYSlI9ztjR3pxf6AgN1pZdhLDR.J27ZW9qmGe4Z4CFDYBlhHW80mhRUkoQJe_bJIRueq TWoxG_Z0jzQev1ockB8BkfzkYKBPCbiORKB7QJiHEcD4jSGDys1qAwjyvC30KPlKzU1VmUMpEiMB f4qh9K0f7z6sHPcbIcGrRl8LjJbA6qd4EwxRqgr6gNfLaer18sG16vOFU2WkYs3j5hwEtPYYSuZf LBo9vo5VLzqD4RgSGybkc26hEC1COXjmhpJr51IzFshto7Au_jDtybSlR2gvSAiEHeEq6TQ1H2Rt bgcp29ZB.gTIf2IDFBjJn4PZbon8fySRPCBPLD8frjLyrfUpAibFVchbYZe2hSEBfScbxYdUlP6n 7MVLwopreUo3cBM_jRTE3MdkTao77dlWrTozyeoJ3qcGZKCRWKp5IFbS1_1U1AwXwIS99.mHkGP7 A8N4Qg.SuUTUiaZIHBbAgjzTIhV1cRobtUwskUX2IZnDcvuEZa5pnDQ3Jeh9wOdoqmZB2XdM9asj .qLIUaXuEtSTCciWsNUGnp5e7GIdtCCsxYVij_Ru2PaEmj0M.uTp2rhEpQrXv_fVzmFWqa8Hs1em cytCqIDx3jodQAGVjg0Yuy0jaD_fGIfV9PrVrHgBWSxHIeMPJoiY1Cp3InXv33sQFECdTD1xj0q7 uHjM2XOM.Z8MbdukhYljutbrZD5l6Jzs5YYTuDxrTzWasZsHKiYRS_QhfeO_9pnOsOLejRmYSJIG rlmDLUcAUX6Nz35cWKbFKfmVFHSpkq.biwukJEieMWbcltYW3VvTkaPE9hLVGRE5To0.H1F0Xj3b L34_R5wnkPLWv4t3u4G4GBB1eNGplK7O.hL6FGsSIEpaDrTNq0uuHg0XcFMdo2VQLFJPGCulijUF BPVbGkWR59kAta.B0.y3Uw09sHgBz6q_8zkVMpjbMWYEHFpp7XR0YZUzcuwG2umn6mjSzSwsThcP SrSfw6V9t6kPClDuXz98C8kVUZnp2CizAqfIG9lJUQXdANGoTRg9xbMJR8V1m6YviVz4xTKsriIO Un.ixKwqw_NTOxmbzNbfeGQ8LvwpcBoVXvLizOuw2lWTSyf59xZqF8PB5ODZgvt8Lf817D9l0k64 1SlbLcnVcP4ZeizoWRo1Z.dznzaGlgk4vZvUl6xGQIcRv7bL5xIm2VBAqXIo2Ydn4n4S8Rki4k13 UU0uhNkU2btGEn6jnFPZOdP2iVrtvPdU8GwuE1QCZhhY3kGiEvD6Q_LBVmFocvCtd1FwNIjQLbH2 HLdDuIS6mHtTdPeOtenecQ919WKIGUv1olIOQCdgcqR5hZAv0FVp7i8K4ljs2gfKwSj28NAG9ZN3 XXTpldvZt0M5AkIXFGBXW48orNvhe1bpAbL1XfccZ1DpOY11XivbwXtujXNzizxUfJtfJVEth2vc EEjsjE8U91P.47aXHNqhO6IJeQn1OYTXiwmZ1iP.9HX5cu3yPb8WDob4Yd_nGWouqP9v._BlvSjp oDLQhHqmOqjuv8swmfehLv4RR1STBQO87cY_zSBEu8TCIj9MM4KhQL2I.gKOsq909DJQi8WqSJE9 dcEA.c0XXoPIPMX4XNwDRcYdbHqdiP7b7NDe1tH7sth9BVP_INaohQca6U1zBAZwdcwzMduPddT9 3kO13HV9pKUcEcOrBjhN5S.3CwXODn2ha1zg4mDBLyFEI3uE- X-Sonic-MF: X-Sonic-ID: d4921dd5-5939-483d-a190-971f2945b0eb Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Sat, 2 Aug 2025 06:39:21 +0000 Received: by hermes--production-gq1-74d64bb7d7-r4nbl (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 48eb9184372d616902793749eae74ec1; Sat, 02 Aug 2025 06:39:20 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: RE: git: 8d4464377219 - stable/14 - vm_page: Fix loading bad memory addresses from file Message-Id: Date: Fri, 1 Aug 2025 23:39:09 -0700 Cc: Konstantin Belousov , Mark Johnston To: "romain@freebsd.org" , dev-commits-src-branches@freebsd.org, dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3826.600.51.1.1) References: X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; MIME_GOOD(-0.10)[text/plain]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; FREEMAIL_FROM(0.00)[yahoo.com]; FROM_HAS_DN(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RCVD_IN_DNSWL_NONE(0.00)[98.137.69.146:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MLMMJ_DEST(0.00)[dev-commits-src-branches@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.69.146:from]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_FIVE(0.00)[5] X-Rspamd-Queue-Id: 4bvCpm2qXHz3JBZ X-Spamd-Bar: --- Romain Tarti=C3=A8re wrote on Date: Sat, 02 Aug 2025 05:31:12 UTC : > Romain Tarti=C3=A8re > Date: Sat, 02 Aug 2025 05:31:12 UTC > The branch stable/14 has been updated by romain: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D8d4464377219dcf45e87510b73767c9e= c3515bc2 >=20 > commit 8d4464377219dcf45e87510b73767c9ec3515bc2 > Author: Romain Tarti=C3=A8re > AuthorDate: 2025-07-25 18:31:57 +0000 > Commit: Romain Tarti=C3=A8re > CommitDate: 2025-08-02 05:30:18 +0000 >=20 > vm_page: Fix loading bad memory addresses from file > =20 > When loading bad memory addresses from a file, we are passed an = end > pointer that points on the first byte after the buffer. We want = the > buffer to be null-terminated (by changing the last byte to \0 if = it is > reasonable to do so), so adjust the end pointer to be on that = byte. > =20 > Approved by: kib, markj > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D51433 > =20 > (cherry picked from commit = 202f8bde836dc86627be2b5b98174d9a0fb2eaba) > --- > sys/vm/vm_page.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c > index ac922f4a3bc8..f013cbc84c25 100644 > --- a/sys/vm/vm_page.c > +++ b/sys/vm/vm_page.c > @@ -393,7 +393,7 @@ vm_page_blacklist_load(char **list, char **end) > } > *list =3D ptr; > if (ptr !=3D NULL) > - *end =3D ptr + len; > + *end =3D ptr + len - 1; This looks wrong to me if/when len=3D=3D0 is possible. It looks possible, see below. > else > *end =3D NULL; > return; > return; More context, original code(from main): . . . mod =3D preload_search_by_type("ram_blacklist"); if (mod !=3D NULL) { ptr =3D preload_fetch_addr(mod); len =3D preload_fetch_size(mod); } *list =3D ptr; if (ptr !=3D NULL) *end =3D ptr + len; else *end =3D NULL; return; . . . But in /usr/src/sys/kern/subr_module.c : size_t preload_fetch_size(caddr_t mod) { size_t *mdp; mdp =3D (size_t *)preload_search_info(mod, MODINFO_SIZE); if (mdp =3D=3D NULL) return (0); return (*mdp); } Note the "return (0);" (possibly *mdp=3D=3D0 as well when mdp!=3D0 ?). Then, for that return, showing the substitution: + *end =3D ptr + 0 - 1; Simplifying for the specific case: + *end =3D ptr - 1; That looks likely to be wrong to me. =3D=3D=3D Mark Millard marklmi at yahoo.com From nobody Sun Aug 3 00:58:01 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 4bvhBL2c3Bz63nBZ; Sun, 03 Aug 2025 00:58:02 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bvhBL1N5Kz46jG; Sun, 03 Aug 2025 00:58:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754182682; 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=MOKueup9rnWOJeLReGwdayWrVe/1BEPo575cHaVgMxk=; b=J9susMmX17cXD6ueqIIvW2+aMW0L/fgAu143Rtp3wCnSypxDAI8g9WEYC/n6mZshwB7+im J3ebUjkBaiPpqGKu2X3oMPCJHOKNhFsOras0TAz4iH7dNiF/pvfsMsKWctLrL54+au2H+0 AN+rrOy/XQqQ8C3L5ycxwn1wdgimGWImFUEfO0Y3stzMxuWYfHLw/S6+EfHwDSOTnAP+x7 eGFX0y3pkkyDjgSsubC9pTjFUh9vtUWkEqpZrC5sUAeFOwDrV2YrCjwsPC6YFaptfiT/tv /zFUq0Eg1z3xmihBaMjHsRL75GhgIlL5zmKlpRwxVPukzhLFN1NtpXhNjIeKHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754182682; 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=MOKueup9rnWOJeLReGwdayWrVe/1BEPo575cHaVgMxk=; b=Te47B5krVEXK1R6o2tVkzUTax/HY+zlkIGwcWdtcT10uLsbQVwjqMzuNgIwN/o8tmSim/3 yZJgVAaW7gfmwcbSeIK0VRidDD8IFFZN6idrz7d0ZSz2ycSmNokurNM4iBX62soFwdmPSX TLE+czO0fKQDJFn1aPBqOOE9dxy42DVR3xayvumBx9aYNsqQ+iPYGC2K4qN0OGe73YaiCi wJ6/o9PA3ZMlm1HBRv2WBAayRqQDADG4l3NRVz5QBoniWZB/AbopUjsfRiZVrSogChjjva y/3/rO3bWVnMgFLgRAVApjyye0nvAAJ2KeCm//IHELy3JrteWtxYfPpH8kJ9eA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754182682; a=rsa-sha256; cv=none; b=yg0dPnziVA72NOF+3K1CY2gXu+UF/yM6AN5z/xrvkYnTO66Wg7X2dMACJid2sk7djxQgms 7BNcy03HzkWS5ZbDHT1fgFv1NMtKn6W7DeymzEGasvM8vGyq32r5vRiB6O4apc4ag9smmT m3BU0b5bvX4m3ggcEumWmi1wQYC+CjvCGp5kcCmVSq1T/3ItR4xTqNW6rudfYfZ9oDx4VB rvtyMNm8zdaRHlKdg1s27OXYAl/0fd4FO+DJap3WaCydPvXwu8SF3vXNQkivR+epbn4Yo7 XZGLhbQyF7CbhANncB+vof4vAl7UQU2zxuIwBLnP3IeS/DwFh8CKMzAhahWUpA== 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 4bvhBL0RFFzhgC; Sun, 03 Aug 2025 00:58:02 +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 5730w1er056823; Sun, 3 Aug 2025 00:58:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5730w16t056820; Sun, 3 Aug 2025 00:58:01 GMT (envelope-from git) Date: Sun, 3 Aug 2025 00:58:01 GMT Message-Id: <202508030058.5730w16t056820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 7f41c76b84d0 - stable/14 - MFC: MFV: less v679. 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: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7f41c76b84d0f24feb7d60bc566630735dbc78e3 Auto-Submitted: auto-generated The branch stable/14 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=7f41c76b84d0f24feb7d60bc566630735dbc78e3 commit 7f41c76b84d0f24feb7d60bc566630735dbc78e3 Author: Xin LI AuthorDate: 2025-07-20 17:33:52 +0000 Commit: Xin LI CommitDate: 2025-08-03 00:55:19 +0000 MFC: MFV: less v679. (cherry picked from commit 76bafc90692608c1db8df3276e966212201c270c) --- contrib/less/NEWS | 10 ++++++++++ contrib/less/decode.c | 2 +- contrib/less/help.c | 2 +- contrib/less/less.h | 9 +++++---- contrib/less/less.nro | 2 +- contrib/less/lessecho.nro | 2 +- contrib/less/lesskey.nro | 2 +- contrib/less/os.c | 6 +++--- contrib/less/version.c | 4 +++- 9 files changed, 26 insertions(+), 13 deletions(-) diff --git a/contrib/less/NEWS b/contrib/less/NEWS index 5767ded21a00..cdc8196a5f16 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -9,6 +9,16 @@ Report bugs, suggestions or comments at https://github.com/gwsw/less/issues. +====================================================================== + + Major changes between "less" versions 678 and 679 + +* Fix bad parsing of lesskey file an env var is a prefix of another + env var (github #626). + +* Fix unexpected exit using -K if a key press is received while reading + the input file (github #628). + ====================================================================== Major changes between "less" versions 668 and 678 diff --git a/contrib/less/decode.c b/contrib/less/decode.c index 2942a30863cb..8e451d1810c9 100644 --- a/contrib/less/decode.c +++ b/contrib/less/decode.c @@ -750,7 +750,7 @@ static int cmd_search(constant char *cmd, constant unsigned char *table, constan { action = taction; *extra = textra; - } else if (match > 0) /* cmd is a prefix of this table entry */ + } else if (match > 0 && action == A_INVALID) /* cmd is a prefix of this table entry */ { action = A_PREFIX; } diff --git a/contrib/less/help.c b/contrib/less/help.c index 81e0943fe4e2..5d8ba9a1b0fe 100644 --- a/contrib/less/help.c +++ b/contrib/less/help.c @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 20:41 on 2025/5/1 */ +/* This file was generated by mkhelp.pl from less.hlp at 19:46 on 2025/5/28 */ #include "less.h" constant char helpdata[] = { '\n', diff --git a/contrib/less/less.h b/contrib/less/less.h index 94a3e2235906..7b2d2c25bfc6 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -575,10 +575,11 @@ typedef enum { #endif #endif -#define S_INTERRUPT 01 -#define S_STOP 02 -#define S_WINCH 04 -#define ABORT_SIGS() (sigs & (S_INTERRUPT|S_STOP)) +#define S_INTERRUPT (1<<0) +#define S_SWINTERRUPT (1<<1) +#define S_STOP (1<<2) +#define S_WINCH (1<<3) +#define ABORT_SIGS() (sigs & (S_INTERRUPT|S_SWINTERRUPT|S_STOP)) #ifdef EXIT_SUCCESS #define QUIT_OK EXIT_SUCCESS diff --git a/contrib/less/less.nro b/contrib/less/less.nro index 6b74ec5f161b..25a9869a9c59 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,5 +1,5 @@ '\" t -.TH LESS 1 "Version 678: 01 May 2025" +.TH LESS 1 "Version 679: 28 May 2025" .SH NAME less \- display the contents of a file in a terminal .SH SYNOPSIS diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index 696fcb13b214..f0cccc4de6da 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 678: 01 May 2025" +.TH LESSECHO 1 "Version 679: 28 May 2025" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS diff --git a/contrib/less/lesskey.nro b/contrib/less/lesskey.nro index 61ba056b04c6..0a17c9deff71 100644 --- a/contrib/less/lesskey.nro +++ b/contrib/less/lesskey.nro @@ -1,5 +1,5 @@ '\" t -.TH LESSKEY 1 "Version 678: 01 May 2025" +.TH LESSKEY 1 "Version 679: 28 May 2025" .SH NAME lesskey \- customize key bindings for less .SH "SYNOPSIS (deprecated)" diff --git a/contrib/less/os.c b/contrib/less/os.c index 98a7ecf70c3c..357cbb356a16 100644 --- a/contrib/less/os.c +++ b/contrib/less/os.c @@ -275,7 +275,7 @@ start: if (ret != 0) { if (ret == READ_INTR) - sigs |= S_INTERRUPT; + sigs |= S_SWINTERRUPT; reading = FALSE; return (ret); } @@ -287,7 +287,7 @@ start: int c; c = WIN32getch(); - sigs |= S_INTERRUPT; + sigs |= S_SWINTERRUPT; reading = FALSE; if (c != CONTROL('C') && c != intr_char) WIN32ungetch((char) c); @@ -348,7 +348,7 @@ public int iopen(constant char *filename, int flags) while (!opening && SET_JUMP(open_label)) { opening = FALSE; - if (sigs & S_INTERRUPT) + if (sigs & (S_INTERRUPT|S_SWINTERRUPT)) { sigs = 0; #if HAVE_SETTABLE_ERRNO diff --git a/contrib/less/version.c b/contrib/less/version.c index 9a97f1658940..68a42a6272fa 100644 --- a/contrib/less/version.c +++ b/contrib/less/version.c @@ -1047,6 +1047,8 @@ v675 4/3/25 Add ESC-b. v676 4/16/25 Fix two OSC 8 display bugs. v677 4/27/25 Fix & filtering bug. v678 5/1/25 Don't change stty tab setting. +v679 5/28/25 Fix lesskey parsing bug when env var is prefix of another; + fix unexpected exit when using -K. */ -char version[] = "678"; +char version[] = "679"; From nobody Sun Aug 3 01:01:25 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 4bvhGF3S5Pz63nB3; Sun, 03 Aug 2025 01:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bvhGF1s3hz46wS; Sun, 03 Aug 2025 01:01:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754182885; 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=mB8beivFbDi9GVwOh3hWvz/j+7dKFuz6gY3mET7aP14=; b=fZ6P5MRdaf4zjZIB/AWah9pS2VLbBri0m1rhe+xQX8A97y/8YR4UKXUx7sDWnirs8QhF0d Ua6Yty6iUAknCSV6Zzm0cgqf3G2DEVPOLYdR4/UORr/YEvm+ciwLy9waiZymthLZZ4ZsUI 3JC7XO/jskfJzri39adnd9Lwk0jXPIGRejKQbHvJ/SweN8tSjjnfI94rflBYRm7LEytc07 ai+p4CrRNVUBQ7Wg8vfoW5zKiLAEcsp/PbPEwOURV6oSWHP7n5yi/VgEHqHHKMdMt4cV5u 1OdqjiFCGPAnscc2nhkBF/VB7+e46ElSJldDoszySAQjnlAeFRnd/qy++B3i+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754182885; 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=mB8beivFbDi9GVwOh3hWvz/j+7dKFuz6gY3mET7aP14=; b=Fo6osNFBcSA2D4VOad0osV4dLe59htGK63BFHIBd/hpZqYkAFHOLTreefdEtHjOukh+04d BxUI2NHVe+COUJ/b3TwLu2tDyNAHsIF78xXm/Kl8EmkjuYQBGEuJGczdz8xi8J7m3zgE0o vorDtC4uWyZgzzIsLKkwxkPA9AiktsN7sO4jOH9KWyWOytv6GEo9z77G54g6WsTNNqqOYR bBUNP8XGQKzOqjLTsAluLvnjXvgDdzlmqslE9Fu2J8h7KaT7xgzvmvJKO2gx/ycbZZm+p6 AHA5rIin3Y1ixaVC7AsrTmiQYfh8PWcmR7Sd1xHaTykInhzQKd5v9bNxbt/MHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754182885; a=rsa-sha256; cv=none; b=oTwbFMEjQ60rAI7BEO1CWxS3HlF0bf+8qFZo46nrDD8Nd9lCHKZcT2MO4iZklgGIYCwqbb JJkpoELhCpgURtkn41xoySvxyJEoPOcxcM25o13tTKG1zvBfWbfma97SAhQHy/F3OXwOtF Up5VdHoIMS05zZi4LKULcYfkHlW4YWj43sl3iJT879/eFmbD+EufRZDF2ZKeRBsrYgPPcc 9XVGekPbx6GCS+dCwgU2jpZ40QNQoa/DVAnRxIAU9AWgHHRX21Bc5yQEg7XVx+mB3E1lXy v0m1n1JKGNi9vgTVvHeY7aH0fdNh7tWMlSMZJo1MxFHg+bz8v4Dd4fTzoZ/RQw== 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 4bvhGF1QPszhTs; Sun, 03 Aug 2025 01:01:25 +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 57311Ppm072021; Sun, 3 Aug 2025 01:01:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57311PvZ072018; Sun, 3 Aug 2025 01:01:25 GMT (envelope-from git) Date: Sun, 3 Aug 2025 01:01:25 GMT Message-Id: <202508030101.57311PvZ072018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 4266bc4fcf9b - stable/13 - MFC: MFV: less v679. 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: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4266bc4fcf9b46565f20e46f12ccd2afec9c0734 Auto-Submitted: auto-generated The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=4266bc4fcf9b46565f20e46f12ccd2afec9c0734 commit 4266bc4fcf9b46565f20e46f12ccd2afec9c0734 Author: Xin LI AuthorDate: 2025-07-20 17:33:52 +0000 Commit: Xin LI CommitDate: 2025-08-03 01:00:44 +0000 MFC: MFV: less v679. (cherry picked from commit 76bafc90692608c1db8df3276e966212201c270c) --- contrib/less/NEWS | 10 ++++++++++ contrib/less/decode.c | 2 +- contrib/less/help.c | 2 +- contrib/less/less.h | 9 +++++---- contrib/less/less.nro | 2 +- contrib/less/lessecho.nro | 2 +- contrib/less/lesskey.nro | 2 +- contrib/less/os.c | 6 +++--- contrib/less/version.c | 4 +++- 9 files changed, 26 insertions(+), 13 deletions(-) diff --git a/contrib/less/NEWS b/contrib/less/NEWS index 5767ded21a00..cdc8196a5f16 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -9,6 +9,16 @@ Report bugs, suggestions or comments at https://github.com/gwsw/less/issues. +====================================================================== + + Major changes between "less" versions 678 and 679 + +* Fix bad parsing of lesskey file an env var is a prefix of another + env var (github #626). + +* Fix unexpected exit using -K if a key press is received while reading + the input file (github #628). + ====================================================================== Major changes between "less" versions 668 and 678 diff --git a/contrib/less/decode.c b/contrib/less/decode.c index 2942a30863cb..8e451d1810c9 100644 --- a/contrib/less/decode.c +++ b/contrib/less/decode.c @@ -750,7 +750,7 @@ static int cmd_search(constant char *cmd, constant unsigned char *table, constan { action = taction; *extra = textra; - } else if (match > 0) /* cmd is a prefix of this table entry */ + } else if (match > 0 && action == A_INVALID) /* cmd is a prefix of this table entry */ { action = A_PREFIX; } diff --git a/contrib/less/help.c b/contrib/less/help.c index 81e0943fe4e2..5d8ba9a1b0fe 100644 --- a/contrib/less/help.c +++ b/contrib/less/help.c @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 20:41 on 2025/5/1 */ +/* This file was generated by mkhelp.pl from less.hlp at 19:46 on 2025/5/28 */ #include "less.h" constant char helpdata[] = { '\n', diff --git a/contrib/less/less.h b/contrib/less/less.h index 94a3e2235906..7b2d2c25bfc6 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -575,10 +575,11 @@ typedef enum { #endif #endif -#define S_INTERRUPT 01 -#define S_STOP 02 -#define S_WINCH 04 -#define ABORT_SIGS() (sigs & (S_INTERRUPT|S_STOP)) +#define S_INTERRUPT (1<<0) +#define S_SWINTERRUPT (1<<1) +#define S_STOP (1<<2) +#define S_WINCH (1<<3) +#define ABORT_SIGS() (sigs & (S_INTERRUPT|S_SWINTERRUPT|S_STOP)) #ifdef EXIT_SUCCESS #define QUIT_OK EXIT_SUCCESS diff --git a/contrib/less/less.nro b/contrib/less/less.nro index 6b74ec5f161b..25a9869a9c59 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,5 +1,5 @@ '\" t -.TH LESS 1 "Version 678: 01 May 2025" +.TH LESS 1 "Version 679: 28 May 2025" .SH NAME less \- display the contents of a file in a terminal .SH SYNOPSIS diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index 696fcb13b214..f0cccc4de6da 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 678: 01 May 2025" +.TH LESSECHO 1 "Version 679: 28 May 2025" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS diff --git a/contrib/less/lesskey.nro b/contrib/less/lesskey.nro index 61ba056b04c6..0a17c9deff71 100644 --- a/contrib/less/lesskey.nro +++ b/contrib/less/lesskey.nro @@ -1,5 +1,5 @@ '\" t -.TH LESSKEY 1 "Version 678: 01 May 2025" +.TH LESSKEY 1 "Version 679: 28 May 2025" .SH NAME lesskey \- customize key bindings for less .SH "SYNOPSIS (deprecated)" diff --git a/contrib/less/os.c b/contrib/less/os.c index 98a7ecf70c3c..357cbb356a16 100644 --- a/contrib/less/os.c +++ b/contrib/less/os.c @@ -275,7 +275,7 @@ start: if (ret != 0) { if (ret == READ_INTR) - sigs |= S_INTERRUPT; + sigs |= S_SWINTERRUPT; reading = FALSE; return (ret); } @@ -287,7 +287,7 @@ start: int c; c = WIN32getch(); - sigs |= S_INTERRUPT; + sigs |= S_SWINTERRUPT; reading = FALSE; if (c != CONTROL('C') && c != intr_char) WIN32ungetch((char) c); @@ -348,7 +348,7 @@ public int iopen(constant char *filename, int flags) while (!opening && SET_JUMP(open_label)) { opening = FALSE; - if (sigs & S_INTERRUPT) + if (sigs & (S_INTERRUPT|S_SWINTERRUPT)) { sigs = 0; #if HAVE_SETTABLE_ERRNO diff --git a/contrib/less/version.c b/contrib/less/version.c index 9a97f1658940..68a42a6272fa 100644 --- a/contrib/less/version.c +++ b/contrib/less/version.c @@ -1047,6 +1047,8 @@ v675 4/3/25 Add ESC-b. v676 4/16/25 Fix two OSC 8 display bugs. v677 4/27/25 Fix & filtering bug. v678 5/1/25 Don't change stty tab setting. +v679 5/28/25 Fix lesskey parsing bug when env var is prefix of another; + fix unexpected exit when using -K. */ -char version[] = "678"; +char version[] = "679"; From nobody Sun Aug 3 18:53:55 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 4bw8414bh7z63hnV; Sun, 03 Aug 2025 18:54:09 +0000 (UTC) (envelope-from romain@blogreen.org) Received: from agrajag.blogreen.org (agrajag.blogreen.org [135.181.146.104]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4bw84057Mbz3R8X; Sun, 03 Aug 2025 18:54:08 +0000 (UTC) (envelope-from romain@blogreen.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=blogreen.org header.s=marvin header.b=XPddry2f; spf=pass (mx1.freebsd.org: domain of romain@blogreen.org designates 135.181.146.104 as permitted sender) smtp.mailfrom=romain@blogreen.org; dmarc=pass (policy=reject) header.from=blogreen.org Received: by agrajag.blogreen.org (Postfix, from userid 1001) id B1A1FA6805; Sun, 03 Aug 2025 21:54:00 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=blogreen.org; s=marvin; t=1754247240; bh=HlNy4zY+8ltQCvsAKg8KiYCoXOiFPmyYGNGudTWZBGA=; h=From:From; b=XPddry2fgEHDiisN++Gls8fTIf47PHzORBBTRlJk8Y15bgm/WoF9vPVx2iOXfD5e3 5hM7gX7G7XnpBlY9Cr9CmRoaZhrrd2fJcQcINdTZvYQ2EeLgozIcv2V5hXod2oULgm VB2wwMcuII2ERm+UCOMPxl3HH+usy61caU6UKyc8= Date: Sun, 3 Aug 2025 08:53:55 -1000 From: Romain =?iso-8859-1?Q?Tarti=E8re?= To: Mark Millard Cc: dev-commits-src-branches@freebsd.org, dev-commits-src-main@freebsd.org, Konstantin Belousov , Mark Johnston Subject: Re: git: 8d4464377219 - stable/14 - vm_page: Fix loading bad memory addresses from file Message-ID: References: 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: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J9NsQzbtQ/QfLRbh" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://romain.blogreen.org/pubkey.asc X-Spamd-Result: default: False [-5.90 / 15.00]; SIGNED_PGP(-2.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[blogreen.org,reject]; R_SPF_ALLOW(-0.20)[+mx]; ONCE_RECEIVED(0.20)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_DKIM_ALLOW(-0.20)[blogreen.org:s=marvin]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEFALL_USER(0.00)[romain]; RCVD_COUNT_ONE(0.00)[1]; MISSING_XM_UA(0.00)[]; FROM_HAS_DN(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-branches@freebsd.org,dev-commits-src-main@freebsd.org]; ASN(0.00)[asn:24940, ipnet:135.181.0.0/16, country:DE]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_TO(0.00)[yahoo.com]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[blogreen.org:+] X-Rspamd-Queue-Id: 4bw84057Mbz3R8X X-Spamd-Bar: ----- --J9NsQzbtQ/QfLRbh Content-Type: text/plain; protected-headers=v1; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Sun, 3 Aug 2025 08:53:55 -1000 From: Romain =?iso-8859-1?Q?Tarti=E8re?= To: Mark Millard Cc: dev-commits-src-branches@freebsd.org, dev-commits-src-main@freebsd.org, Konstantin Belousov , Mark Johnston Subject: Re: git: 8d4464377219 - stable/14 - vm_page: Fix loading bad memory addresses from file On Fri, Aug 01, 2025 at 11:39:09PM -0700, Mark Millard wrote: > [...] > > > - *end =3D ptr + len; > > + *end =3D ptr + len - 1; >=20 > This looks wrong to me if/when len=3D=3D0 is possible. Thansk, let's track this here: https://reviews.freebsd.org/D51717 --=20 Romain Tarti=E8re http://romain.blogreen.org/ pgp: 8234 9A78 E7C0 B807 0B59 80FF BA4D 1D95 5112 336F (ID: 0x5112336F) (plain text =3Dnon-HTML=3D PGP/GPG encrypted/signed e-mail much appreciated) --J9NsQzbtQ/QfLRbh Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQGzBAABCAAdFiEEgjSaeOfAuAcLWYD/uk0dlVESM28FAmiPsEMACgkQuk0dlVES M2//PwwAno1sJXTN9ZFXsTb0bowBLM3iPrvmN31vqJbh2b97JAgwPQgPCbz2e5hA 7BH6CcqMCc47f48PT68JEuvz8E5XF8jV3ZNvPSAG1E5owKYgo6eqWHr8/1gmSkdS Vy4DgIKC+hNTsibnHK08GuDbgz0/2pYDKwxVDiCtCPF5NV8FrcUryARw9grsBcv0 kytTf3RpNeA+WFCUgTMXEHirlJVLSnG1gEGJ0zXmmRAH95Lz+JvMdVCi/+2ho/JS ojgodPvlSDoegFu8ZYTV8P8l2SIAR54UJ9dDrOfXdVQKS36NVZ/scLZF/oU9/yQV VQEjmOpm4yeRQLjrQ28t8FD5GyqrwS2bUikIy8s2SidAIBjte4WmCX0xHy+6y5f2 4UxOHg8Z9TbivY4qPeBs5w7CUVGgRWn8+PHe+/+B4lJVQxvvYOtQ5faDj6cYfc8E YEdm+CCXBfsr7gb0Z3ckbnmFJpThDk7j8uT7pdTpNePiwvqHlhpaK3D8+DoCXz3m puGUZvTN =vYiH -----END PGP SIGNATURE----- --J9NsQzbtQ/QfLRbh--