From nobody Mon Aug 5 08:00:29 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WcplL1Mmxz5SnCL; Mon, 05 Aug 2024 08:00: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WcplL0ZTcz4mhK; Mon, 5 Aug 2024 08:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722844830; 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=GCQJps21LNS3m0BY0TlKE7scpJ30EnV9nC3qRHoDlFQ=; b=cgCAJpiYBVCqwHdpazjY5zXbouTUmDGxN/pcJw1aPLmbU1nVvUvm0jV6Jl7RL5eJvctwkj 6qAkYVQzsc+7tZlNDJZqY83T1h25j1FxpDx0ylL6JB+OaJNuC48RbzEBU16RUlJrjl4cf8 nbi7kazlr16HgML4s1iQRxor4FG6MGUR91WOrZIIK04K/NmPVsuaxCu2xqx6CEltFvcmHa v0F1jKWMXq6l9rIRKCe8kGGcbn+q8jbR8MGHjG4p9/2R9TpIgbDdC8DiF1rwSLqfr5wSSd 4HUOTdcaBfiiVPn+jK5QWyX2wFFOyKsBdqbENwuRBddLMtxfBYnnV8ctTBP2MQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722844830; a=rsa-sha256; cv=none; b=tytgsMUa2YgU0LkuZjTsWctch8jnNWlyoK7caDR9xSnnO704GiRkqp8ZGqM4BrdCFHwawR 39S/WkPzTaye4sWyUveIsTMoREYduXRa9wAXmIHbOJmmRePuRVD+Wzs4kmQpGC50eDmYRg md/HRkJ+b3l8+soOX8uqm2w7EI1wgQa6GnmUYzOOfBnVqsF+acY/FxYQq6enAtsddHKuAR p/ewiN+jq8OHHL0AKHkpPezStOIMkBQSBCOBWuzRkghGqXBHNMjzdtATnDxpjbAnyRc9w5 ZPbMXNmNefPmnt5X5r7FZ0DYOw023N5OBmJa0G2cXDMuirxoIHuGr3tk9slQEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722844830; 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=GCQJps21LNS3m0BY0TlKE7scpJ30EnV9nC3qRHoDlFQ=; b=g0EML6jCyGnZvJ51n7WCPmc0GeQYZeB35Ltel5IdRmPUUvQmYI0JvqySeNULj5d2A8mtTD Km62PjlX+pRy5C+ldPFDmEobX+JE3bm8r3rKAgxJAwTqOS7wuGy3CgWv4bTUTc7HOo4j3N NgUA9vaW0AxTPlqiZUwI8M81ZtXMVwPLLzZ1NXfu2vfERU/LEQcNNS8lS5nZEvZ64vm1m1 Vkbs4fVA6UtKHki0rbOioPQEiAdq+2CZUQ6G9lrSn6rx8L6FyUpluUVnORE2aluA7wKCqp b49EfR7cAqNBoHqWDWkm00iQhaj8DrG97nsENcEWfTOiIzoDxNXpmCLVeGUbZA== 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 4WcplL05FHzFxr; Mon, 5 Aug 2024 08:00: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 47580TlU057250; Mon, 5 Aug 2024 08:00:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47580TxN057247; Mon, 5 Aug 2024 08:00:29 GMT (envelope-from git) Date: Mon, 5 Aug 2024 08:00:29 GMT Message-Id: <202408050800.47580TxN057247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Corvin =?utf-8?Q?K=C3=B6hne?= Subject: git: 1f3bfc60550c - main - bhyve: avoid a potential deadlock List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f3bfc60550cdd019f00bf6d274db762fda4ed2c Auto-Submitted: auto-generated The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=1f3bfc60550cdd019f00bf6d274db762fda4ed2c commit 1f3bfc60550cdd019f00bf6d274db762fda4ed2c Author: Pierre Pronchery AuthorDate: 2024-08-05 07:46:01 +0000 Commit: Corvin Köhne CommitDate: 2024-08-05 07:48:22 +0000 bhyve: avoid a potential deadlock This unlocks a mutex in an error path, that would otherwise remain locked and potentially cause a deadlock later on. Reported by: Coverity Scan CID: 1521334 Reviewed by: corvink, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45401 --- usr.sbin/bhyve/tpm_intf_crb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/tpm_intf_crb.c b/usr.sbin/bhyve/tpm_intf_crb.c index af0214dd1760..0f9a8d1dd53b 100644 --- a/usr.sbin/bhyve/tpm_intf_crb.c +++ b/usr.sbin/bhyve/tpm_intf_crb.c @@ -348,8 +348,10 @@ tpm_crb_mem_handler(struct vcpu *vcpu __unused, const int dir, pthread_mutex_lock(&crb->mutex); tpm_crb_mmiocpy(&start, val, size); - if (!start.start || crb->regs.ctrl_start.start) + if (!start.start || crb->regs.ctrl_start.start) { + pthread_mutex_unlock(&crb->mutex); break; + } crb->regs.ctrl_start.start = true; From nobody Mon Aug 5 11:13:52 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wcv2S558Bz5T40x; Mon, 05 Aug 2024 11:13:52 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wcv2S3k3Kz45TD; Mon, 5 Aug 2024 11:13:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722856432; 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=nkUgRRhxqAzLv71kk5nA4WKgSr59iJeeT1ermElOG+g=; b=qVG1AKl77wh9uCMNMlNqRzQgYDEEEl7jQbJIsPRiOk4J2ImHD5yB6eITAQRVh6j/2qAOWP s5yTmQpIvbgZpFaxxxFo6mPti4151sWC+cIc5CaSfUzCn9o1geaB8FaoXhszJU4Gp6jOaA I68ke1+Pvp832qiE+BsVfn3sTTDoNoTzUkZca0Q4V9Fs8ieau25NyXyObkj0y4k7YZ4GIG 7lIdr2wPZwdJqKeBl4Tk/y5M74H4EWRsL23lymhKjmbCN7NAOTTf33BauzW/dQ6balO6WT /O1BQCuwVGcPJd4HI+Z55H1S0UTOKTt5TWJIfoApyGeLbklvkzGbGYx+x9a09w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722856432; a=rsa-sha256; cv=none; b=sE7GseQvKhHMOgVDsewJV72abuawuF3CPZZCncebG3Px9TxX1/rfvqwod//bOakPBYsdUJ tx18mLt+Iy7xh+MlHNJACtGy2dT/7XE/UIfn3w80Z07+4W59l2zOjLcefS4RZSF63Xf80O /2slrJiBq4LaJyhEPBXSPQj3PwBKAI9mJi0bbvC61eR+cBVjLOlaJ9SAm0FgI1oRqHm/RF BGGE6f2ErPGIPON/itQbZWEwD26PNqDKyym2VUOG1iTkwTFMqELaVoh+50ywpdKHvueehP KsZ0AGjxnKk4f9UkYEF9iONZk/qIZflT1teEdbmFOawhgV8Q+l/wJAvxzXsjtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722856432; 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=nkUgRRhxqAzLv71kk5nA4WKgSr59iJeeT1ermElOG+g=; b=MH6S1L1hFAB/q2qNHf6Z/4fKl6PQJyCQmYImWfkaSHMfbFOgWWtZY/0PbEqvbRBw6u5cVo VqfOlshP8KThPc5l0usLsQL2G622F6XcIVwE3g20JHlSSkNRGCbvbosWoIhKfYgdgzPi5X 61mzyxnlacKDZ/VEz4dJYtmtos6wLKoqFz8QQzA4+SoUB0XjK6jn9dqaNn+YdXaZHmYYIo h7JT8Ha699M8c40u9W0hvjDuh9mTSZquy8x2oZ2vl/pZgZYa838WnJl5e3cn8/CytRoSbn BC8db/+vl525SRtZIVeBLzmJ9sq9dXXhwW6hq2LdXBNbUWprpyE9L9nqBXzgJw== 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 4Wcv2S2VVwzLfD; Mon, 5 Aug 2024 11:13: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 475BDqaj087140; Mon, 5 Aug 2024 11:13:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475BDq4L087136; Mon, 5 Aug 2024 11:13:52 GMT (envelope-from git) Date: Mon, 5 Aug 2024 11:13:52 GMT Message-Id: <202408051113.475BDq4L087136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 6e744de1a3dc - main - mixer.3: Fix mixer_get_mode() description List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e744de1a3dc5dde8d2ee51e97a1224a01bdfb21 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6e744de1a3dc5dde8d2ee51e97a1224a01bdfb21 commit 6e744de1a3dc5dde8d2ee51e97a1224a01bdfb21 Author: Christos Margiolis AuthorDate: 2024-08-05 11:13:44 +0000 Commit: Christos Margiolis CommitDate: 2024-08-05 11:13:44 +0000 mixer.3: Fix mixer_get_mode() description Improve wording and also fix the constants' names. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46220 --- lib/libmixer/mixer.3 | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/libmixer/mixer.3 b/lib/libmixer/mixer.3 index 4008867ef2fb..04aa3bd1dca7 100644 --- a/lib/libmixer/mixer.3 +++ b/lib/libmixer/mixer.3 @@ -19,7 +19,7 @@ .\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN .\" THE SOFTWARE. .\" -.Dd May 22, 2024 +.Dd August 4, 2024 .Dt MIXER 3 .Os .Sh NAME @@ -388,18 +388,15 @@ controls. .Pp The .Fn mixer_get_mode -function returns the playback/recording mode of the audio device the mixer \ -belongs to. -The available values are the following: -.Bl -tag -width "MIX_STATUS_PLAY | MIX_STATUS_REC" -offset indent -.It Dv MIX_STATUS_NONE -Neither playback nor recording. -.It Dv MIX_STATUS_PLAY -Playback. -.It Dv MIX_STATUS_REC -Recording. -.It Dv MIX_STATUS_PLAY | MIX_STATUS_REC -Playback and recording. +function returns the operating mode of the audio device the mixer belongs to. +The following values can be OR'ed in case more than one mode is supported: +.Bl -tag -width "MIX_MODE_MIXER" -offset indent +.It Dv MIX_MODE_MIXER +The audio device has a mixer. +.It Dv MIX_MODE_PLAY +The audio device supports playback. +.It Dv MIX_MODE_REC +The audio device supports recording. .El .Pp The From nobody Mon Aug 5 13:01:30 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WcxQf6V7kz5S06g; Mon, 05 Aug 2024 13:01: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WcxQf5l9qz4HCq; Mon, 5 Aug 2024 13:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722862890; 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=5EjChnGmjInYwfVngik9oDSumNcVSHd889GFiGnVbqA=; b=OqfQs9UaBJlkWVw2Bn5ztwUWNX85a4G62l4HMmWKm05XutHek9ygQQIEU5rc1UjJPhQ6OY eaC7MjKZmAT/Hx4Ukb1XUa5q2M//YQdUDvY9VFkAJL6Ok7s4d8bpYX5MnNCeZHV+OIcazK nQXit18Jlp2ioLqd3ar+5I14RjjLRxJf6IQDIwp+WfS9/jCZA0o/Pz7SBMbABl0/LYJjVL KKsXM0CMHMFtCnqOxzQyXM9ndPxTx7ZLqmwu05wohiWXRlW/gueLVheerCegTkW9sQKujn ukpH9FrYsjyR/AcvPPEJ2fUYxqSNRe5P+poC2qyojQbARrWZZnykTAaxIdvnxg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722862890; a=rsa-sha256; cv=none; b=C1TC79ERP+/CCxClBmlwGnJdKKJA9FS4LtE+9tcxMGscnURqB22P29ZwXWdZE0cm7q+Vpv hXXwOSByLzyuWol9cJBfgP/qN2ynkPXpgSNEvpmXXMy5Db0lDZYPHHLg/YOahVflOCuKQT rzEuMkmVgGHW0jWImNpkIYxISiaU3855j0myKZPpGmCep7NPc0HBkOGtuaLIRxH6fJYJTI WUYV59+hjy1IIMcaxpPbtozJKR0buD3pCdetiFq8YYzvcJkIafGQwH7AvHi6lWj9nK4xT5 dwXgKhSw7P3BMfi3y0bpXpSBipGZB2XWOVWPtsDBnuYiqNK6f0nY4y19CqmfEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722862890; 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=5EjChnGmjInYwfVngik9oDSumNcVSHd889GFiGnVbqA=; b=yg34488lIyBwIbH/ii4Fw23DXTws2NPEm6nuTWfqA4r5o3OHnT+5bSl73CEYp1U1QvMR6r SRn8tc0F6mXymh6Hp6/DmKZsniJOCOmn3+xbuomD62Ue+XLCcciNyxOxbIXTB0Z7Zy5VpY C6zEMwNGV+Gnxcfu7x3VZNxs+OvUUyREldrmFUTXKki4LJU0aHwIZOUyyxaOURJsVmG0zk sHTKWhK4saOywtFtUeRUuX0Q3Q+vD9g4GWIJRPEMkebjlL47gKVFQBNp6zcDownORTjaIU nq6tYnUMUMoP2ul5BYYTkIHZwXvHaUI+Skt11vZ8xqTriA5z9lxJdbvL0czR+g== 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 4WcxQf5LVXzP39; Mon, 5 Aug 2024 13:01: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 475D1UeD072605; Mon, 5 Aug 2024 13:01:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475D1Ur6072602; Mon, 5 Aug 2024 13:01:30 GMT (envelope-from git) Date: Mon, 5 Aug 2024 13:01:30 GMT Message-Id: <202408051301.475D1Ur6072602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: fef0e39f64a1 - main - cxgbe/t4_tom: bugfixes in stop/restart. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fef0e39f64a1db796ded8777dbee71fc287f6107 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=fef0e39f64a1db796ded8777dbee71fc287f6107 commit fef0e39f64a1db796ded8777dbee71fc287f6107 Author: Navdeep Parhar AuthorDate: 2024-07-25 01:43:54 +0000 Commit: Navdeep Parhar CommitDate: 2024-08-05 12:56:22 +0000 cxgbe/t4_tom: bugfixes in stop/restart. 1. Remove toepcb from the toep_list on active open failure. 2. Purge the wr_list for an L2T entry on an adpater stop. Fixes: c1c524852f62 cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_connect.c | 14 ++++++++++ sys/dev/cxgbe/tom/t4_listen.c | 3 +++ sys/dev/cxgbe/tom/t4_tom.c | 58 +++++++++++++++++++++++++----------------- 3 files changed, 52 insertions(+), 23 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c index 1c98e70a4df5..99e4c222996d 100644 --- a/sys/dev/cxgbe/tom/t4_connect.c +++ b/sys/dev/cxgbe/tom/t4_connect.c @@ -115,10 +115,17 @@ act_open_failure_cleanup(struct adapter *sc, struct toepcb *toep, u_int status) struct inpcb *inp = toep->inp; struct toedev *tod = &toep->td->tod; struct epoch_tracker et; + struct tom_data *td = sc->tom_softc; if (toep->tid >= 0) { free_atid(sc, toep->tid); toep->tid = -1; + mtx_lock(&td->toep_list_lock); + if (toep->flags & TPF_IN_TOEP_LIST) { + toep->flags &= ~TPF_IN_TOEP_LIST; + TAILQ_REMOVE(&td->toep_list, toep, link); + } + mtx_unlock(&td->toep_list_lock); } CURVNET_SET(toep->vnet); @@ -234,6 +241,7 @@ t4_connect(struct toedev *tod, struct socket *so, struct nhop_object *nh, struct sockaddr *nam) { struct adapter *sc = tod->tod_softc; + struct tom_data *td; struct toepcb *toep = NULL; struct wrqe *wr = NULL; if_t rt_ifp = nh->nh_ifp; @@ -380,6 +388,12 @@ t4_connect(struct toedev *tod, struct socket *so, struct nhop_object *nh, } offload_socket(so, toep); + /* Add the TOE PCB to the active list */ + td = toep->td; + mtx_lock(&td->toep_list_lock); + TAILQ_INSERT_TAIL(&td->toep_list, toep, link); + toep->flags |= TPF_IN_TOEP_LIST; + mtx_unlock(&td->toep_list_lock); NET_EPOCH_ENTER(et); rc = t4_l2t_send(sc, wr, toep->l2te); NET_EPOCH_EXIT(et); diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 897c5bcaab1e..f91d193c0fed 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -1090,7 +1090,10 @@ t4_offload_socket(struct toedev *tod, void *arg, struct socket *so) update_tid(sc, synqe->tid, toep); synqe->flags |= TPF_SYNQE_EXPANDED; mtx_lock(&td->toep_list_lock); + /* Remove synqe from its list and add the TOE PCB to the active list. */ TAILQ_REMOVE(&td->synqe_list, synqe, link); + TAILQ_INSERT_TAIL(&td->toep_list, toep, link); + toep->flags |= TPF_IN_TOEP_LIST; mtx_unlock(&td->toep_list_lock); inp->inp_flowtype = (inp->inp_vflag & INP_IPV6) ? M_HASHTYPE_RSS_TCP_IPV6 : M_HASHTYPE_RSS_TCP_IPV4; diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 58a77ff93c86..9b1dcf304196 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -256,12 +256,6 @@ offload_socket(struct socket *so, struct toepcb *toep) toep->inp = inp; toep->flags |= TPF_ATTACHED; in_pcbref(inp); - - /* Add the TOE PCB to the active list */ - mtx_lock(&td->toep_list_lock); - TAILQ_INSERT_HEAD(&td->toep_list, toep, link); - toep->flags |= TPF_IN_TOEP_LIST; - mtx_unlock(&td->toep_list_lock); } void @@ -280,7 +274,6 @@ undo_offload_socket(struct socket *so) struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp = intotcpcb(inp); struct toepcb *toep = tp->t_toe; - struct tom_data *td = toep->td; struct sockbuf *sb; INP_WLOCK_ASSERT(inp); @@ -303,11 +296,6 @@ undo_offload_socket(struct socket *so) toep->flags &= ~TPF_ATTACHED; if (in_pcbrele_wlocked(inp)) panic("%s: inp freed.", __func__); - - mtx_lock(&td->toep_list_lock); - toep->flags &= ~TPF_IN_TOEP_LIST; - TAILQ_REMOVE(&td->toep_list, toep, link); - mtx_unlock(&td->toep_list_lock); } static void @@ -331,6 +319,12 @@ release_offload_resources(struct toepcb *toep) remove_tid(sc, tid, toep->ce ? 2 : 1); release_tid(sc, tid, toep->ctrlq); toep->tid = -1; + mtx_lock(&td->toep_list_lock); + if (toep->flags & TPF_IN_TOEP_LIST) { + toep->flags &= ~TPF_IN_TOEP_LIST; + TAILQ_REMOVE(&td->toep_list, toep, link); + } + mtx_unlock(&td->toep_list_lock); } if (toep->ce) { t4_release_clip_entry(sc, toep->ce); @@ -346,8 +340,6 @@ release_offload_resources(struct toepcb *toep) static void done_with_toepcb(struct toepcb *toep) { - struct tom_data *td = toep->td; - KASSERT(!(toep->flags & TPF_CPL_PENDING), ("%s: %p has CPL pending.", __func__, toep)); KASSERT(!(toep->flags & TPF_ATTACHED), @@ -370,13 +362,7 @@ done_with_toepcb(struct toepcb *toep) MPASS(toep->tid == -1); MPASS(toep->l2te == NULL); MPASS(toep->ce == NULL); - - mtx_lock(&td->toep_list_lock); - if (toep->flags & TPF_IN_TOEP_LIST) { - toep->flags &= ~TPF_IN_TOEP_LIST; - TAILQ_REMOVE(&td->toep_list, toep, link); - } - mtx_unlock(&td->toep_list_lock); + MPASS((toep->flags & TPF_IN_TOEP_LIST) == 0); free_toepcb(toep); } @@ -2039,6 +2025,8 @@ stop_atids(struct adapter *sc) if ((uintptr_t)toep >= (uintptr_t)&t->atid_tab[0] && (uintptr_t)toep < (uintptr_t)&t->atid_tab[t->natids]) continue; + if (__predict_false(toep == NULL)) + continue; MPASS(toep->tid == atid); MPASS(toep->incarnation == sc->incarnation); /* @@ -2052,6 +2040,8 @@ stop_atids(struct adapter *sc) toep->tid = -1; #endif mtx_lock(&td->toep_list_lock); + toep->flags &= ~TPF_IN_TOEP_LIST; + TAILQ_REMOVE(&td->toep_list, toep, link); TAILQ_INSERT_TAIL(&td->stranded_atids, toep, link); mtx_unlock(&td->toep_list_lock); } @@ -2109,16 +2099,32 @@ static void stop_tom_l2t(struct adapter *sc) { struct l2t_data *d = sc->l2t; + struct tom_data *td = sc->tom_softc; struct l2t_entry *e; + struct wrqe *wr; int i; + /* + * This task cannot be enqueued because L2 state changes are not being + * processed. But if it's already scheduled or running then we need to + * wait for it to cleanup the atids in the unsent_wr_list. + */ + taskqueue_drain(taskqueue_thread, &td->reclaim_wr_resources); + MPASS(STAILQ_EMPTY(&td->unsent_wr_list)); + for (i = 0; i < d->l2t_size; i++) { e = &d->l2tab[i]; mtx_lock(&e->lock); if (e->state == L2T_STATE_VALID) e->state = L2T_STATE_RESOLVING; - if (!STAILQ_EMPTY(&e->wr_list)) - CXGBE_UNIMPLEMENTED("l2t e->wr_list"); + /* + * stop_atids is going to clean up _all_ atids in use, including + * these that were pending L2 resolution. Just discard the WRs. + */ + while ((wr = STAILQ_FIRST(&e->wr_list)) != NULL) { + STAILQ_REMOVE_HEAD(&e->wr_list, link); + free(wr, M_CXGBE); + } mtx_unlock(&e->lock); } } @@ -2140,6 +2146,12 @@ t4_tom_stop(struct adapter *sc) stop_tids(sc); taskqueue_enqueue(taskqueue_thread, &td->cleanup_stranded_tids); + /* + * L2T and atid_tab are restarted before t4_tom_restart so this assert + * is not valid in t4_tom_restart. This is the next best place for it. + */ + MPASS(STAILQ_EMPTY(&td->unsent_wr_list)); + return (0); } From nobody Mon Aug 5 15:07:41 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd0DF5cWqz5SBHr; Mon, 05 Aug 2024 15:07: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd0DF55tcz4T9F; Mon, 5 Aug 2024 15:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722870461; 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=0R8oUJ7fJ2KrazO/jDvU/i7YqSVv3vQJ/K6rRHP6V2U=; b=gEZYwYzg02XDQ7c/g+ghlM8ZComGg/bMXKnY/hYUQqY9CE06hJT/WNlnZD3VyXqh4mFxSe jMY5pxMIW9ke9fqi5ZyPiiTmVppAKGNY5PuIwQ28/Bs+kTJm//uzTfFOqE4N3FOkQLb+qB ddG9Ju35rMs5eWNan1aX8vKzZUfQTTLGd8MNLXHcVqd56EdJxqt1OiEYuwSrLAZajEWpuk xQgA099A0lYGfell2EWg+iMaDRKJrITjII/7Utk357JSseQaOamOtcWHgWRLxyp0pxZ2BM g66ocRXMNhEAsWGSLnuEC7OYaS9WLzi/bohAbCZ0wCPxJrqYI8yUEOz8CREeBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722870461; a=rsa-sha256; cv=none; b=ed2Unb/HVvbHlJRRZ7zpNFG/2b313laAnXlTuys3HrSK8tD379eEsU/rDndpS1kZo3Kxj7 9HWS94lxZGO8NZZYTu/pIwiHsGnGw5O1pki41OSpYNASihox3z9LHZ+wp1iE/GWzkYJ9iw yciANzfPbg0ALelMihsLcWi2TJdgeXrJ/8kMOdKuOWuk9nuIYHErllPGr/81mIUK30OrEv eoK7tW9X1ZGEcEE2gdoINRoTo6rMTTw2PhQuUH0A4+44Kt1XumLEtecIx54N8w9j/GfvVe T9HKwXYwlJeq1ggkXCzs3gzrtgtEFP3q6LxoOzbzr+nRh7fEDeXRVtbnKoS10g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722870461; 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=0R8oUJ7fJ2KrazO/jDvU/i7YqSVv3vQJ/K6rRHP6V2U=; b=DwG7TU6QGfDpLDdFWQiEkfAD/gW1CuQOTnULJeVXTbxH3ZRvUjMTvzoC81obSow8/CvqK9 cFeIHiQ3meMyxKXYtT2wA1N59eUgBXqaSc2WlpuJ/tfjuk4niNw8EhDMfmDVrCYYit+a8Y ZnGVfo9tXrRpNbCdv70SD0+8tP5i8XCBZrBA3LtOkZakSvzeYc2DEAK9smuJvNxY0OKABu 13l9ElhLUcnGHpOmO6vbh/00ZLC1dGfL6WSVxiL0VcapGJWBnZYo2AjZbeE51E7c8uk9Hi 72pETV/lVbl1cwFZw1CDCOzcHFTzxghbssT11uPbHDlmiUYLOpNjsHTh9jbcLA== 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 4Wd0DF4hKzzSW3; Mon, 5 Aug 2024 15:07: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 475F7fM9081459; Mon, 5 Aug 2024 15:07:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475F7fPu081456; Mon, 5 Aug 2024 15:07:41 GMT (envelope-from git) Date: Mon, 5 Aug 2024 15:07:41 GMT Message-Id: <202408051507.475F7fPu081456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8bb6b413f6d3 - main - vm/vm_pageout.c: eliminate write-only variable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8bb6b413f6d32a7db111246b5d2aa8a2b9e50734 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8bb6b413f6d32a7db111246b5d2aa8a2b9e50734 commit 8bb6b413f6d32a7db111246b5d2aa8a2b9e50734 Author: Konstantin Belousov AuthorDate: 2024-08-05 15:05:15 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-05 15:07:18 +0000 vm/vm_pageout.c: eliminate write-only variable PR: 280631 Fixes: acb4cb33d35838e3e86412202cd63d9021b21ce2 (non-debug builds) Sponsored by: The FreeBSD Foundation --- sys/vm/vm_pageout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 0d054da34866..f6c5e6291692 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -366,12 +366,10 @@ vm_pageout_flushable(vm_page_t m) static int vm_pageout_cluster(vm_page_t m) { - vm_object_t object; vm_page_t mc[2 * vm_pageout_page_count - 1]; int alignment, num_ends, page_base, pageout_count; - object = m->object; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_WLOCKED(m->object); vm_page_assert_xbusied(m); From nobody Mon Aug 5 16:46:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd2QC32SLz5SLCP; Mon, 05 Aug 2024 16:46: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd2QC2Ld8z4dVr; Mon, 5 Aug 2024 16:46:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722876387; 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=qrUmjnFPcmxcAdMDd4YJ5L14rtBlNiKgK85FmU2Yg/A=; b=j3vVYjOdzpCzwW3Aka8EX8WiIRCmofHQ2iltXaUvpJffidi6F9TC1wEi7tdXHC7Mn3ZAeG LHnnHW1T3Or4YnkRqSF00+t+I+sbdDEDYiposz9ASnvjN+SQXJzZEcKRSx+aP24Lt14URE h55nBsvhcdGpaF1OFy4QlHpHXdVnUx2o2D2imqkOpO8nSSe0ghqJk2yBD1hW6ZsfwNhuyj aaSRqir7k1uNhHkHyvG/oXPpBWkXFmF6NQPHW7Jxjg0etrYiVCkI7RZ4HvDi9M/qRuAd25 zb2knEO93Uhlt9DUY7/4NfsUKGUHL9zg+Gmtup0biCI2uJFSYiQZIq0FfyCkNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722876387; a=rsa-sha256; cv=none; b=WITa4RkuroGsBMmhFxc9NC9lA3Q1e6Qj26J8SXn/C2+lxeY6GK7Q4L3Ia1BC4ztOXIFt4s kKB+JpbOptLP65+LvYOYM4/9TYH8NfmCroQP25LidJPFenxR64G7TtvytedP16ZJBjEsb5 atM5LuJF7+cHcG+zvr2SFLIgTm1goX2akfBhpA7pOKUogtxnt0qQPq5CtYLrNf0l+1PjYy xMya8ARIayZfGd1mddDH1cdrXbtw08JBGZxA+HVGkB4WUznMySPx37BkHTd9L8OFjsOQBm 2KZVMb4Kbd5hI/iMSfcqL6OFm8HUHi7S20ZfQZbNZAnzni79Am/ikQioT98VPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722876387; 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=qrUmjnFPcmxcAdMDd4YJ5L14rtBlNiKgK85FmU2Yg/A=; b=TugMbBFPZd7BC0nlamPIRsdHwF/Kb1zF5lAaDEwngcn/YLtsGx+aLHR8dUwQU3vH4t4CNb r+IpsnbM8N+HzxyZcYVNMyE9Zue8FDQgcv1iDzobdUqPSclEEFWszgU/RKbDM/8AUibsjd BDRz8rak4Wnpt/Md306krazrpOylGtyketSW3rJlMhJHXZ8re5pbyeCeX04o4UjEH3o6qn TEtF75xM88L4OdPnn0FVuW0oaSca7eUheHD512t1kncasTO09WUC76nyUdDcKf8YZYDph9 KtKtRVnqv/Gp6L2FHTD4ybNL1DddNOfd2dKLsV6SV7fkrIs0Gh6cJEdD0udMfg== 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 4Wd2QC1n7CzXHL; Mon, 5 Aug 2024 16:46: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 475GkRlE050419; Mon, 5 Aug 2024 16:46:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475GkRU3050416; Mon, 5 Aug 2024 16:46:27 GMT (envelope-from git) Date: Mon, 5 Aug 2024 16:46:27 GMT Message-Id: <202408051646.475GkRU3050416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: 31cc65708c66 - main - man9: Document M_NEVERFREED and VM_ALLOC_NOFREE List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31cc65708c664c2a0257c26503d39ebc506f674e Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=31cc65708c664c2a0257c26503d39ebc506f674e commit 31cc65708c664c2a0257c26503d39ebc506f674e Author: Bojan Novković AuthorDate: 2024-07-31 17:36:55 +0000 Commit: Bojan Novković CommitDate: 2024-08-05 16:41:22 +0000 man9: Document M_NEVERFREED and VM_ALLOC_NOFREE Reviewed by: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D46198 --- share/man/man9/malloc.9 | 11 ++++++++++- share/man/man9/vm_page_alloc.9 | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/share/man/man9/malloc.9 b/share/man/man9/malloc.9 index 0ab5b2ed6e8d..d8759a255492 100644 --- a/share/man/man9/malloc.9 +++ b/share/man/man9/malloc.9 @@ -28,7 +28,7 @@ .\" .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" -.Dd October 12, 2022 +.Dd August 4, 2024 .Dt MALLOC 9 .Os .Sh NAME @@ -269,6 +269,15 @@ This option should only be used in combination with .Dv M_NOWAIT when an allocation failure cannot be tolerated by the caller without catastrophic effects on the system. +.It Dv M_NEVERFREED +This is an internal flag used by the +.Xr UMA 9 +allocator and should not be used in regular +.Fn malloc +invocations. +See the description of VM_ALLOC_NOFREE in +.Xr vm_page_alloc 9 +for more details. .El .Pp Exactly one of either diff --git a/share/man/man9/vm_page_alloc.9 b/share/man/man9/vm_page_alloc.9 index 7d6cf1692bb1..4bf8db33a28d 100644 --- a/share/man/man9/vm_page_alloc.9 +++ b/share/man/man9/vm_page_alloc.9 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" -.Dd July 21, 2024 +.Dd August 4, 2024 .Dt VM_PAGE_ALLOC 9 .Os .Sh NAME @@ -307,6 +307,10 @@ pages will be allocated by the caller in the near future. must be no larger than 65535. If the system is short of free pages, this hint may cause the kernel to reclaim memory more aggressively than it would otherwise. +.It Dv VM_ALLOC_NOFREE +The caller asserts that the returned page will never be released. +If this flag is specified, the allocator will try to fetch a page from a +special per-domain arena in order to curb long-term physical memory fragmentation. .El .Sh RETURN VALUES If the allocation was successful, a pointer to the From nobody Mon Aug 5 16:46:28 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd2QD4llkz5SL92; Mon, 05 Aug 2024 16:46: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd2QD2vPKz4dVs; Mon, 5 Aug 2024 16:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722876388; 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=NjPhvVaJqTFkWyIVNGg8p8WckB1D2dTXZTbPkzkWYqI=; b=pdm02SHb9tYRJLDRGrCqPW1PyUs/dHzPqqsvx8kRZT/gQvTiQiKDzhaGwp5GBfYlxul7ie 60Epocp6CA1lkMyTQf6snMhwreT63RVlZTjCYhroRpxnfyPrQ3ZnzC4w8JgIa9OcPspt7h tmlOKL/COlfkzJM9qfrnUWZ1CWkawEcEBRbkM/7qXU8sEimuRqQ8d4Lu7jL8Q6XMtz7IdZ X1rZu5bORv49w+MpN6yY65QeMdSK7kYK2hXZ+ion21jtnvEO/PA+nwxSxLzKA9osQfHsa/ jpmK4kMR5Zl+hK+7IlWxepJFVlvHzY3m3JjusXB5zsSTN8MHoHa8DnayxSQBDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722876388; a=rsa-sha256; cv=none; b=IoMnm0li27/SAko74UV8blhLNmqMqJpu8X3KXUJKSbN2JL9Eg2cnWiJmuKS7OTLDcIC7QL E5wNkehvJqGl8jSDCXhgfJIAh92sVdz5cZR0oT2o16sRHmbYu9wxf0OAmyT7fvfeXe4xaO pSkRo6fX1CEjwkIfs8JTBvXvZ7Syo2g8vqWvV7VsTU/DxIib6re5vTYrrXTkwMvXvyUUt4 3WPM7Pb7RpgdNtuJtPEejeHZv9oli9DGGRQQF0cp/F/GoJItnAGLlShPocfC+GG9bSdBCo T+GdYWGpu1t0oxp58UfMwsE8E7TpbaUCY/PddEHtEOjCBCZp8+D9bQtwsSj5pw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722876388; 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=NjPhvVaJqTFkWyIVNGg8p8WckB1D2dTXZTbPkzkWYqI=; b=JdHwS7VYfAg8swcBYvFH5X+nwSILT0UC2XsNrq3Vos/lEhL0PHeFzpruMVgV6nAKGBhCuP 1EMLm9Dz0GilUqib3g2G7PhJNhP7Sn4p7EaU6ONO+hEuF7BaMO+L5IcLwjciMBuo4cnbWD F65QWc2CFgV4qlvecovMzQjPnULL17K99338XLV0vr6coI6F+1yL0unkV7GtQSCmm/7pWp 0Mqo/q5p64OXT+gLbaT70Z43BThA2oAxqayPw6oYi5/KgFf3gHs1sSBIXlRddxJN8tLptg eD0lrkfRs/3IIVz9pp/V1icJs0pKPO8/zLf1gerItGyz/3OiNnBaMfA5kVlxRA== 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 4Wd2QD2VxNzXHM; Mon, 5 Aug 2024 16:46: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 475GkSZd050461; Mon, 5 Aug 2024 16:46:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475GkSFO050458; Mon, 5 Aug 2024 16:46:28 GMT (envelope-from git) Date: Mon, 5 Aug 2024 16:46:28 GMT Message-Id: <202408051646.475GkSFO050458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: 06134ea2f38c - main - malloc(9): Check for M_NEVERFREED List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06134ea2f38ca214b53a1613e110e8332b2804e4 Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=06134ea2f38ca214b53a1613e110e8332b2804e4 commit 06134ea2f38ca214b53a1613e110e8332b2804e4 Author: Bojan Novković AuthorDate: 2024-07-31 17:43:31 +0000 Commit: Bojan Novković CommitDate: 2024-08-05 16:44:10 +0000 malloc(9): Check for M_NEVERFREED The recently introduced M_NEVERFREED flag is not meant to be used for regular malloc requests. Enforce this by checking for M_NEVERFREED in malloc_dbg. Reviewed by: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D46199 --- sys/kern/kern_malloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 3c4cb63003c4..9d7e0464e0f7 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -542,6 +542,8 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp, once++; } } + KASSERT((flags & M_NEVERFREED) == 0, + ("malloc: M_NEVERFREED is for internal use only")); #endif #ifdef MALLOC_MAKE_FAILURES if ((flags & M_NOWAIT) && (malloc_failure_rate != 0)) { From nobody Mon Aug 5 16:52:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd2Xl57FLz5SLNV; Mon, 05 Aug 2024 16:52: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd2Xl4btPz4gYx; Mon, 5 Aug 2024 16:52:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722876727; 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=MKIf/vuxON+eIYpqSJ7lO/xCTb+u5TCTaJc/4Z+ejQU=; b=W1lS76o90DA0z0CDjZnDwoLRC2i77z+bwCJwWGlZnC2ZIIovCVoIcX3E3rJ1/YknNPBldk ypW9WPmtwUKZiom7H0sxwxjiXMT8zs86kfdubg39nIYRaOCfQlcRMNyWFiKfWKj77m7CG1 8TuvrzcNoIZ7ra163BOrySMGz6l0LIf09VgWGEat2u+FX9rpUHj18hq5jfmNmkD9G0u1jc CiuYb0xKsGxNP99GT6j4fyTOeyUAWvjp+zJggIt46boSWaaXB+bZddB8wSY9Y3n0aSDrFT vsXDZuQVWLbjTI/ZJ1nugELfMvDPebGgD3/m23XXD3BCe2pKTKvU6aS4OZvVdw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722876727; a=rsa-sha256; cv=none; b=WkvDjMsqgTSpkAYfNaaoV85Squ6L794inG0zu+MBNBpw6oUkNsszWjFCAGJxFUxviAI9f5 OhL5KodTM6vWABmEyyR0YG2zdNJU1OcgaCBnI4bYsOS5sHkDgf1Obc0hmubD+8khvLaA38 yHXKktqW+3iIOTWP+csJuYpAN1ECyA8JfjAi5nhK3aTS4eRKzMVHYSFPdjbiTawvqWGEir gpToonhg0ewOpNpEMi614i3Gbvvo+33elad2xJSprjRlP894WjOXXWvQ21Zhu/V4FkMfB2 A/hmBU32gjblifeXHG8vpTK3zELCnGPnX/qio2NNBuIkZXrQ0x0JnXCfiMpCkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722876727; 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=MKIf/vuxON+eIYpqSJ7lO/xCTb+u5TCTaJc/4Z+ejQU=; b=Pw8kBzCqIt6f9vFmwKP0R5EZONaqT8xg0J3itZjNGytBXH/kiE/bg3tmJZGUnc9HuO+2Xt ARwAC1tIvm6UlZEqyblIGHLLKNH8xJFtkRYPGf6u8B0BplJWTB+w6pOL1eTlIguewcdnZA /ACEOzlA0oxIEjlj8QBOaG21k8aiiGnNVLu2cEzHNnhIpkcZV3aHlaRUI7ONXfqgLQe5I8 LDqOJBGpetFbmYmd4JfxaRiGkpONAQ8u6BG4RuNNdOrK3YNvLVol9Pk73Gu3qE+l02mffl tLTwGG3ZpN+P74EWXWhANPdBz87042n+kO2BBkvqEEr7Q3yl/C859ae6G9bdzw== 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 4Wd2Xl4CMTzXdM; Mon, 5 Aug 2024 16:52: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 475Gq7Ts067141; Mon, 5 Aug 2024 16:52:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475Gq7jA067138; Mon, 5 Aug 2024 16:52:07 GMT (envelope-from git) Date: Mon, 5 Aug 2024 16:52:07 GMT Message-Id: <202408051652.475Gq7jA067138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 1f628be888b7 - main - tcp_ratelimit: provide an api for drivers to release ratesets at detach List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f628be888b74f1219b3ea7ccea1e7a3d1db77a2 Auto-Submitted: auto-generated The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=1f628be888b74f1219b3ea7ccea1e7a3d1db77a2 commit 1f628be888b74f1219b3ea7ccea1e7a3d1db77a2 Author: Andrew Gallatin AuthorDate: 2024-08-05 15:45:42 +0000 Commit: Andrew Gallatin CommitDate: 2024-08-05 16:51:35 +0000 tcp_ratelimit: provide an api for drivers to release ratesets at detach When the kernel is compiled with options RATELIMIT, the mlx5en driver cannot detach. It gets stuck waiting for all kernel users of its rates to drop to zero before finally calling ether_ifdetach. The tcp ratelimit code has an eventhandler for ifnet departure which causes rates to be released. However, this is called as an ifnet departure eventhandler, which is invoked as part of ifdetach(), via either_ifdetach(). This means that the tcp ratelimit code holds down many hw rates when the mlx5en driver is waiting for the rate count to go to 0. Thus devctl detach will deadlock on mlx5 with this stack: mi_switch+0xcf sleepq_timedwait+0x2f _sleep+0x1a3 pause_sbt+0x77 mlx5e_destroy_ifp+0xaf mlx5_remove_device+0xa7 mlx5_unregister_device+0x78 mlx5_unload_one+0x10a remove_one+0x1e linux_pci_detach_device+0x36 linux_pci_detach+0x24 device_detach+0x180 devctl2_ioctl+0x3dc devfs_ioctl+0xbb vn_ioctl+0xca devfs_ioctl_f+0x1e kern_ioctl+0x1c3 sys_ioctl+0x10a To fix this, provide an explicit API for a driver to call the tcp ratelimit code telling it to detach itself from an ifnet. This allows the mlx5 driver to unload cleanly. I considered adding an ifnet pre-departure eventhandler. However, that would need to be invoked by the driver, so a simple function call seemed better. The mlx5en driver has been updated to call this function. Reviewed by: kib, rrs Differential Revision: https://reviews.freebsd.org/D46221 Sponsored by: Netflix --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 8 +++++++- sys/netinet/tcp_ratelimit.c | 6 ++++++ sys/netinet/tcp_ratelimit.h | 9 +++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index ccbdf11a1dd5..a80235f0f347 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -4876,7 +4877,12 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) #ifdef RATELIMIT /* - * The kernel can have reference(s) via the m_snd_tag's into + * Tell the TCP ratelimit code to release the rate-sets attached + * to our ifnet. + */ + tcp_rl_release_ifnet(ifp); + /* + * The kernel can still have reference(s) via the m_snd_tag's into * the ratelimit channels, and these must go away before * detaching: */ diff --git a/sys/netinet/tcp_ratelimit.c b/sys/netinet/tcp_ratelimit.c index 1834c702c493..22bdf707fa89 100644 --- a/sys/netinet/tcp_ratelimit.c +++ b/sys/netinet/tcp_ratelimit.c @@ -1298,6 +1298,12 @@ tcp_rl_ifnet_departure(void *arg __unused, struct ifnet *ifp) NET_EPOCH_EXIT(et); } +void +tcp_rl_release_ifnet(struct ifnet *ifp) +{ + tcp_rl_ifnet_departure(NULL, ifp); +} + static void tcp_rl_shutdown(void *arg __unused, int howto __unused) { diff --git a/sys/netinet/tcp_ratelimit.h b/sys/netinet/tcp_ratelimit.h index cd540d1164e1..0ce42dea0d90 100644 --- a/sys/netinet/tcp_ratelimit.h +++ b/sys/netinet/tcp_ratelimit.h @@ -94,6 +94,8 @@ CK_LIST_HEAD(head_tcp_rate_set, tcp_rate_set); #ifndef ETHERNET_SEGMENT_SIZE #define ETHERNET_SEGMENT_SIZE 1514 #endif +struct tcpcb; + #ifdef RATELIMIT #define DETAILED_RATELIMIT_SYSCTL 1 /* * Undefine this if you don't want @@ -131,6 +133,9 @@ tcp_get_pacing_burst_size_w_divisor(struct tcpcb *tp, uint64_t bw, uint32_t segs void tcp_rl_log_enobuf(const struct tcp_hwrate_limit_table *rte); +void +tcp_rl_release_ifnet(struct ifnet *ifp); + #else static inline const struct tcp_hwrate_limit_table * tcp_set_pacing_rate(struct tcpcb *tp, struct ifnet *ifp, @@ -218,6 +223,10 @@ tcp_rl_log_enobuf(const struct tcp_hwrate_limit_table *rte) { } +static inline void +tcp_rl_release_ifnet(struct ifnet *ifp) +{ +} #endif /* From nobody Mon Aug 5 18:44:03 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd51w0T6yz5SVyM; Mon, 05 Aug 2024 18:44: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd51v71qQz4tgd; Mon, 5 Aug 2024 18:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722883444; 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=jkKI2o8zgS74e4Taef8aSsNV+0cXO+8E1jrsyjZgN0E=; b=FUBUz0/iW/vRaDSZL9+uasXtVSgshj5rVTK05q8Uz+PKwkYMTt2RrhRwU3iYrrSWYOVXuB dvBblqaPEAJUVLiNjCzAVSC8e9xrBIcuTHA7gXx2b5qWKlEfw8SwZhMYywNrKDHwntQpKL Hsf2dOJ8XzKxRv6UuJqlLqj77qDggJVBu2bhmkAk8vSvYqNXmBQAzfMe+F6B/HmOVorRS8 eWRuITDGYKVS8ipH8p4NyI9m2oZCBOxPm5qJkNdLbVjxGSmpXUS3f+Tl0gTsM/THwQ1Wgm HUmA0kFLH0er6OvrJ83zYLXLDL9Mq7H5MIZnaxMxOST2Biif7cLMD0EaW4+u+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722883444; a=rsa-sha256; cv=none; b=nl5T50KN35BVw3V3Vj1rlUIsyZmbcEcxAnGCOQfa9f7eaOsTsG+hHLwtw57/X/IJzCZ1t1 65ZsT60tGVzCJNl4DjyYqeIpkC7HY8u4Yl28GNwhK1Tv+HQcXjUi5gTkXZ/iQPP1a2WqZX HwKnBBsvz2okB4MUe3BMF7foNy1clX6ghu6HqsOCrP5KNO0r9YpRjaMqfevkP5XY1AraRM NxQuRZjJbw5CvjK6wyBdk1n/cd3xgF5LvrkzhLQYmmMXtRnQecsx/HvlzzxEOIBk5yc16+ GLucLQX9Xm47WHxFzgAaKhAOsxcWWmIE3WSpnQp2KFv573pYYwqxrA/sbNKwBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722883444; 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=jkKI2o8zgS74e4Taef8aSsNV+0cXO+8E1jrsyjZgN0E=; b=cxCM8tttFT8yd3iRE40Os36z0qTg0Og1rWZYSjzzft8OewIX127MEtxDG930399VXqBhe9 Gp3AsOTBnjarDhZVGz68Wm5SgzdIHe0dc7JF8EG+eaFU67hQCYB/7o7m5kSHtV05ng2Bk7 teakhgmhyEmcNpA0MiScLgfCAYOcl7jSzfQ1kJ7DMyYIXn1tI62KgFcGlN/vfW35NBVl9n CxXNhYu6hCkUNSg6O/HffvuH87Ox3cuCVrJDGvmD1gt7RTLnnWbxGAocuVzJGY9Zp/97n2 nodukSpzXck8ITwmpq1DCN9ZzBCQd2XwPIE9LCi5VZlK6HSh+9V9909SVpp5MQ== 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 4Wd51v6VdNzbHK; Mon, 5 Aug 2024 18:44: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 475Ii34c053456; Mon, 5 Aug 2024 18:44:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475Ii3SS053453; Mon, 5 Aug 2024 18:44:03 GMT (envelope-from git) Date: Mon, 5 Aug 2024 18:44:03 GMT Message-Id: <202408051844.475Ii3SS053453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6cb8b61efe88 - main - calendar: don't setlogin(2) in the -a user handlers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6cb8b61efe8899ee9194563108d0ae90c1eb89e3 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6cb8b61efe8899ee9194563108d0ae90c1eb89e3 commit 6cb8b61efe8899ee9194563108d0ae90c1eb89e3 Author: Kyle Evans AuthorDate: 2024-08-05 18:43:56 +0000 Commit: Kyle Evans CommitDate: 2024-08-05 18:43:56 +0000 calendar: don't setlogin(2) in the -a user handlers As of e67975d331 ("Fix 'calendar -a' in several ways."), `calendar -a` will now fork off a new process for each user and do all of its own processing in the user's own context. As a side-effect, calendar(1) started calling setlogin(2) in each of the forked processes and inadvertently hijacked the login name for the session it was running under, which was typically not a fresh session but rather that of whatever cron/periodic run spawned it. Thus, daily and security e-mails started coming from completely arbitrary user. We could create a new session, but it appears that nothing calendar(1) does really needs the login name to be clobbered; opt to just avoid the setlogin(2) call entirely rather than incur the overhead of a new session for each process. PR: 280418 Reviewed by: des, olce Fixes: e67975d331 ("Fix 'calendar -a' in several ways.") Differential Revision: https://reviews.freebsd.org/D46095 --- usr.bin/calendar/calendar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index 7610ad034759..ebc8d7f5c35e 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -211,7 +211,7 @@ main(int argc, char *argv[]) lc = login_getpwclass(pw); if (setusercontext(lc, pw, pw->pw_uid, - LOGIN_SETALL) != 0) + LOGIN_SETALL & ~LOGIN_SETLOGIN) != 0) errx(1, "setusercontext"); setenv("HOME", pw->pw_dir, 1); cal(); From nobody Mon Aug 5 19:13:23 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd5gm1fS5z5SXpT; Mon, 05 Aug 2024 19:13: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd5gm0dmgz4yM8; Mon, 5 Aug 2024 19:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722885204; 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=harMMnHJCDqZ+YRrN+bGWfXq62ZnNrKV4+MjyxV5JO0=; b=NtHi1zc74Nmjp8sbB8O9RgAioVImtOqq0h7Uy6Jw25zToJqKRu2b8gMLkfkGwcmsAECT4l sBEj8vS/1wyuadaL4CMx9LBG/3TYjiJG+jmDGZreMNawMPm89DyGqmsb6Sdpw4BvxL9XNT Xui9KZj6hmWvEDRGjCslYaGyvuLw+Tlj8ec6HbIC4qEw5wwk6n5pnFjKnKNeBVxdA5JGdd RU27lKnaCohKYk3v0Ffm6ie1f6EXoozLTUE9gs8F08zG6O5wJ5VZwQMGALDbOZJl092mF+ oVRy8/qhYp3eI7IknwKQP/2GRb7BhMZjSRCr2TUQOhG/FO3rjDk5dFGUOXSC7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722885204; a=rsa-sha256; cv=none; b=jvlrWCCmMmoGRpBZscWuAvh77B5UIPz9aErszLOfsIu/Zy0TeY6NG/NoA5cr81WjcTEUuh OBdr5dmYOj+BBxNB9ZvZV3mKSn08tvHOV3yghqGNeBKL/NeHylOTSsy7JWn1EdsXydcOfJ HYQLwjD8Ol6whQlBkOhHbzWMu3zCCjlSfq/NkW7/d6pTMeAdmiZknljzdh591YjGqRN+Dv w8Hg6vtqY+x1yHDCPRXwCsmke1NkNDW1ct3hR9001+PWF7BOssl4ecIR8JrmdiFYTBUXgI COutMOfivGFumoN4Bt5/+7R60g2r9kdpK+rKdchOzuoWi4G5A/RgcWnOVjF/nA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722885204; 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=harMMnHJCDqZ+YRrN+bGWfXq62ZnNrKV4+MjyxV5JO0=; b=IvEZhaIUtkvn0rzFPOZaTIe3DaigX3oVgUzf2HBeaJO3NZoy+5pIFIQSLnDzCGbapopfYM huGauOxNvsGB8bokIO0Jt4yjXXVIfD3puUu53qKF/u22gtJSLU7Ptrhppij0celPcsK+my B08CKFevlQWfOxGpAnRS9jmvCKFT5HOXQacylk28ppfil+nIvNe+W7ykwSvZVJ3d2Bjjt1 CGK7APgERfNFvVW6WvNqOp5JSVQV5RlTQnNEP+nul4JP4EsjaL/KJtBCmEApL2/bArTw3c xPWEwke9TG2hT5WNfXLjCVwzVtNGP0o0dfnhYWors4QYGbHj1D64aefek4B22A== 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 4Wd5gm08VnzbLk; Mon, 5 Aug 2024 19:13: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 475JDNmb004671; Mon, 5 Aug 2024 19:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475JDNOU004668; Mon, 5 Aug 2024 19:13:23 GMT (envelope-from git) Date: Mon, 5 Aug 2024 19:13:23 GMT Message-Id: <202408051913.475JDNOU004668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 792226e53023 - main - qlnxe: Allow MAC address override List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 792226e53023cb09566cb78b2135b052e9b62e0e Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=792226e53023cb09566cb78b2135b052e9b62e0e commit 792226e53023cb09566cb78b2135b052e9b62e0e Author: Keith Reynolds AuthorDate: 2024-08-05 19:10:18 +0000 Commit: Kevin Bowling CommitDate: 2024-08-05 19:10:18 +0000 qlnxe: Allow MAC address override The qlnxe driver always sets the NIC's rx mac address to the card's default MAC, ignoring any MAC address set via ifconfig. PR: 278085 MFC after: 1 week --- sys/dev/qlnx/qlnxe/qlnx_os.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 6665894d058d..49d3f20aa0c2 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -7055,8 +7055,17 @@ qlnx_set_rx_mode(qlnx_host_t *ha) { int rc = 0; uint8_t filter; + const struct ifnet *ifp = ha->ifp; + struct sockaddr_dl *sdl; - rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, ha->primary_mac); + if (ifp->if_type == IFT_ETHER && ifp->if_addr != NULL && + ifp->if_addr->ifa_addr != NULL) { + sdl = (struct sockaddr_dl *) ifp->if_addr->ifa_addr; + + rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, LLADDR(sdl)); + } else { + rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, ha->primary_mac); + } if (rc) return rc; From nobody Mon Aug 5 19:19:52 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd5qD5mH0z5SYLc; Mon, 05 Aug 2024 19:19:52 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd5qD3YfPz52QD; Mon, 5 Aug 2024 19:19:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722885592; 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=3cGGpjhrCffLQ1TuUYYL2Oq+CUgPR5v90J7fLrCdJfI=; b=vQMFSQUGwxYAz0zUlE7qTe/EdkFJgWq8D/CqiA05TsNi3TgakHvGMPKjRKqmvwRBg43oih D+w2pOM7ur4V/PLIojCt0e2Afygv8dZTeNWZ18VuFQ4/aekjxUAbGtAmFzEQQ/K0jHapmc mMoj6JgALkkCVqeNEwFoudBGDrAx44UqcD97DUa1hGEVSAg84NvITL8DyJyfKpn1TCIX1/ CP/5re1gYHv/w+aigdIwMAPDASYmGFUpZZIPdf7jH6TbHvlu/j/3SEQNp5XOpOj+uoNW/Q VcSe0uL85CxmaHEkGxucuffnV82iRP9AfpPNYiFBEhsyZihXGey5C+6Qqzlujw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722885592; a=rsa-sha256; cv=none; b=OCLtAak0GrxWJ9voAD0SdAlDziRkjEO+k4wpLnpe27SkLfcJIIbvjfXv8VtSapjJ5WYgpx OMkVx6DwJM3+Pq4okp+GdwPhegDbW6pg3gNVep0L+e1oe+DqE5gqclSm4qlq0E2ZTwNYO5 ywwgtbzcBtsCllnaPuobqOy3mjsm4YogCXH+9/mD6fHoSYaRokiCos0y3cua+1ktZY5zfT hxdn66eEiq2gi6KTmNxX5fiGlNIeYJABweEDLGdehhMwD68pdZgZ9knvy9QK0xQUsxzhJH a7mMJY2UHaF7Ad9zv5rcBK8SnJnO2sZajlzdeHr6TgVI3SNBjGsFHLLkgvOXsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722885592; 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=3cGGpjhrCffLQ1TuUYYL2Oq+CUgPR5v90J7fLrCdJfI=; b=JjS8rg4Ou6jqOFho8vth54fCr6bPbbd91X0g57gxOISNesv/7Pyt6kbSKtACm/tVbvsEal XeWjp/wZSxBXRR7eesPayyG/ahb78V8M1rSfqwaZw9fJLpB3SCtPU97fdAEnqkeA54+IFI 4mEFTsZoXjwxqh8zyF9Dyh6Quh0BHy4FHO1ebaLsgHTV0atUZ8jyGFPQ6rCdEMQFwoz50F /UTRpnk3uoXP+Y8VpBq6EWTql4wOwaBVmYoV9umH3k2MV6M1IQcu6GgKhKI79Xd+STBEnf oocB9A7p+JgjAAiW4zJ6r7Bi4eaxETzMkaGqoXtp+Pc6/hT5255gRKFMfEm0dA== 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 4Wd5qD2m90zbn7; Mon, 5 Aug 2024 19:19: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 475JJqxR005703; Mon, 5 Aug 2024 19:19:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475JJqGe005700; Mon, 5 Aug 2024 19:19:52 GMT (envelope-from git) Date: Mon, 5 Aug 2024 19:19:52 GMT Message-Id: <202408051919.475JJqGe005700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9bc300465e48 - main - Merge commit cb7a03b41fff from llvm git (by Nikolas Klauser): List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9bc300465e48e19d794d88d0c158a2adb92c7197 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9bc300465e48e19d794d88d0c158a2adb92c7197 commit 9bc300465e48e19d794d88d0c158a2adb92c7197 Author: John Baldwin AuthorDate: 2024-08-05 19:19:30 +0000 Commit: John Baldwin CommitDate: 2024-08-05 19:19:30 +0000 Merge commit cb7a03b41fff from llvm git (by Nikolas Klauser): [libc++] Fix failures with GCC 14 (#92663) Fixes #91831 Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D46003 --- contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h | 2 +- contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h | 5 +++++ contrib/llvm-project/libcxx/include/bitset | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h b/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h index 198f0f5e6809..46ad388ec2ea 100644 --- a/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h +++ b/contrib/llvm-project/libcxx/include/__string/constexpr_c_functions.h @@ -108,7 +108,7 @@ __constexpr_memcmp_equal(const _Tp* __lhs, const _Up* __rhs, __element_count __n } return true; } else { - return __builtin_memcmp(__lhs, __rhs, __count * sizeof(_Tp)) == 0; + return ::__builtin_memcmp(__lhs, __rhs, __count * sizeof(_Tp)) == 0; } } diff --git a/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h b/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h index 54390a1939f7..1048f67055a2 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/remove_pointer.h @@ -23,8 +23,13 @@ struct remove_pointer { using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); }; +# ifdef _LIBCPP_COMPILER_GCC +template +using __remove_pointer_t = typename remove_pointer<_Tp>::type; +# else template using __remove_pointer_t = __remove_pointer(_Tp); +# endif #else // clang-format off template struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; diff --git a/contrib/llvm-project/libcxx/include/bitset b/contrib/llvm-project/libcxx/include/bitset index 308c58995dc3..5ea48d491303 100644 --- a/contrib/llvm-project/libcxx/include/bitset +++ b/contrib/llvm-project/libcxx/include/bitset @@ -376,8 +376,11 @@ template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const { unsigned long long __r = __first_[0]; + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshift-count-overflow") for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) __r |= static_cast(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT); + _LIBCPP_DIAGNOSTIC_POP return __r; } From nobody Mon Aug 5 19:49:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wd6TM3d0Bz5SbPK; Mon, 05 Aug 2024 19: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd6TM34MJz56Ln; Mon, 5 Aug 2024 19: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=1722887367; 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=KYu9WH2qfs6Ue8t9PxywSlZLb+d+oYZ70ktawPV58Lg=; b=FGvTxej5R+aNnxX3QGceaD/YmgOkFOLvJGgpyaHniUxLm9z5GDzprEFRlZ1d26TPz66d8f XCX1Sn/wsL6uFvWgEHFEPoHlAZ7N72sAWPGa26JSIMB2rgQUPmKa27bmlogEH9G8flFh1A p7JmyaCA0GnD2JOyoA/yRcldnc0q/qCcxB8W/SfMnyTmN4UBDE6eADDNbRfNivLru6m3pH 2CZMt7zZP2NshT4ggi3zLqrf80q52jQqF0up9ChmB4NEuw35tpu5ZQ4XDOMcyeykbgTGT7 yRcM4XhcNCrPpe9ZXHixzwqYlxJxMnB8AzipqDMWemXmJFMMonVvyQkqmGK+EQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722887367; a=rsa-sha256; cv=none; b=nsiUjHInevMefaOgp6F+8OB7WpBN7qhzMCKArtvsIJAMgOOY6EpmbTdZ4fscCdVV5dVxGu sg2kVYvV0wxvxpzXXAAw8PEK9i8IkcTKfiVg91HWcLuoKh6T1ql+0oRh057E+g7iWEYDnZ H13qeIiXZg2AUdSBceY1F/YIgjxH1DhL2WWp7tglnrTyv4ZZwiQeFNSTqPIdPYCvV4J9jz vUZ00MXbMY71JeSOnJLpPT24dog4ANDIYw9fUCfOL8hQxrFxD+EPRUwuBb59krvLk/kLqF j42dhEZ2VipDFg2eIreZvtfMMYba5NkI/PRUMWVafn8VoyupzIGXtkPOWYObWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722887367; 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=KYu9WH2qfs6Ue8t9PxywSlZLb+d+oYZ70ktawPV58Lg=; b=FQSgYywv/pM5/QUXiWVT39lRcJN7S4O0R8HbVt89nSWHogCVZiOokxIWqliiUkScobwLEE 8s0FEQKcoveqUpuxUy86KxgElit1cx6NAvwTAk1kYLmC1yxC92VT4XBarjTl0dvtdD8DOd Ukq/KOl911622XADdcq8mXzWgvZdiYM7HvZET2avZo7i4mfVZirwTvSymqUZVpBBwD3och LoQu47vfVZFventZwAVgD48bGl3bResb4Nom0RvoxZjmxU4hUu68ReuoElMPqCuhP+UdaZ D9LJKR0bO5afGk1P0gMQ0GkajsKb8uXqokz9mLAKgOHzfYO0ibnNGUv/qUwDxA== 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 4Wd6TM2dj8zcNc; Mon, 5 Aug 2024 19: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 475JnRsx055963; Mon, 5 Aug 2024 19:49:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 475JnRAM055960; Mon, 5 Aug 2024 19:49:27 GMT (envelope-from git) Date: Mon, 5 Aug 2024 19:49:27 GMT Message-Id: <202408051949.475JnRAM055960@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3a4b04e82df6 - main - depend-cleanup.sh: Simplify handling for stale syscall.S List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a4b04e82df6bb9b28aa0c3c670c19063843d644 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3a4b04e82df6bb9b28aa0c3c670c19063843d644 commit 3a4b04e82df6bb9b28aa0c3c670c19063843d644 Author: John Baldwin AuthorDate: 2024-08-05 19:49:06 +0000 Commit: John Baldwin CommitDate: 2024-08-05 19:49:06 +0000 depend-cleanup.sh: Simplify handling for stale syscall.S Remove the outer grep and depend on the greps in clean_dep instead. Reviewed by: brooks, imp Obtained from: CheriBSD Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D46103 --- tools/build/depend-cleanup.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index b93d50a57ff4..b7231422c5ed 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -171,9 +171,7 @@ clean_dep lib/libc statfs c # 20240308 e6ffc7669a56 Remove pointless MD syscall(2) # 20240308 0ee0ae237324 Remove pointless MD syscall(2) # 20240308 7b3836c28188 Remove pointless MD syscall(2) -if [ ${MACHINE} != i386 -a -f "$OBJTOP"/lib/libsys/.depend.syscall.o ] && \ - grep -q -e 'libsys/[^ /]*/syscall.S' "$OBJTOP"/lib/libsys/.depend.syscall.*; then - echo "Removing stale /syscall.S depends" +if [ ${MACHINE} != i386 ]; then clean_dep lib/libsys syscall S clean_dep lib/libc syscall S fi From nobody Tue Aug 6 03:08:01 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdJCP4G8jz5SWG7; Tue, 06 Aug 2024 03:08:01 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdJCP3VYtz4f1J; Tue, 6 Aug 2024 03:08:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722913681; 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=/RXOKJHCxe6ORThHzYQboBwHqjmmWYMot6ZNAiSFnIE=; b=Ow+rDFz1XMDyZkeikn1PdLlTKlWFFwgO1w0D/dP9jZe17P5g6I1tAWxyoFNBowWuRGC6jU iU9HGWIiKsXoZgnGsB1feiIpRs1JuKGnxPf4GsRIUETejvIMPyqVw46oIekY5LmQvQZ7RR crkawBmQdIINcxkgwCZx4Li9kfcWhyEULjZKDEusVMKGyBzSusWqTzxZ6ovU/QMgeu0LA0 9LMxoCuBrJRcNuHl9uOFNhpKXy153ek6uNwz6ALMwghsIt1Xka/rz0ytaaCuiFP2OnL2yf MdVRKWwgTXJUl9kq0e38fe7ZeOolHOuvgPgAH9Y3oNEXra//vjWBODHb2PUpCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722913681; a=rsa-sha256; cv=none; b=EKA7swQHrNOo7o+PXP9aNUgYTznbYR97sgymHmdU2IXQgFmLFTqdC46vpoHS1mPjNedQZL lOBRYqIYvbhl/pruVGt094YmnVjqtrNxNBHrPwc/jkgFZxkb4Wi3VlgQ2c9hETg757yU8G CtPzD5vTuXMnnzx61weC3H/nMVHpR5s1wosPXBGFrhb3YV8j6Y7Uj/kEtdS0x9pheRKn0v 2C0jFvxWGckTL/iNhaLRkq/AUpdv0K1+qkwKANarL7/GAS4aarImYa9himgWzOFw+C/SOu QTAfqY6MgwIV+VE6ob8Nr0mY69fs7ygc+bjN/xZXARpdtNwdMQtUBg8RDqR6Ow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722913681; 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=/RXOKJHCxe6ORThHzYQboBwHqjmmWYMot6ZNAiSFnIE=; b=t3dYn8caHJgaNtsC7Gpmvlx7vdXhtecQNlONJlakp6SG7gqMiaEtS0ZWqa9R9JKX8PPqjL +rLb+xhpKoJNq68uh5o1VXkwIrkzGNgW7F1ScOWRqmHLd166N+eW6UoLb3bw4TmwnKz7H3 /Xn/HUz2ASc2iFwFOZyeCtfyT3TB/PlgbcV5mzmDKQURsqBF4DzUSAA3UohJ5rmsuKL2YC Vr/2IZykmLKh4DiWcTuIFqizwoqqfBvhiE6o1uqwKMdHJoq6y9Y97sgzp0AxmnGyiES0RQ Ocj7w2H9Kpm3ugMh9wlj8TQqxgO/VnGGXoZKJDW402uufB55xqL/3DeW0/WRbg== 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 4WdJCP35lFzq7b; Tue, 6 Aug 2024 03:08: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 476381qs002453; Tue, 6 Aug 2024 03:08:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47638110002450; Tue, 6 Aug 2024 03:08:01 GMT (envelope-from git) Date: Tue, 6 Aug 2024 03:08:01 GMT Message-Id: <202408060308.47638110002450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "David E. O'Brien" Subject: git: 1d9b60bf4d5a - main - SEE ALSO lagg(4) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d9b60bf4d5aad14cac3e23614b0f74f657b547c Auto-Submitted: auto-generated The branch main has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=1d9b60bf4d5aad14cac3e23614b0f74f657b547c commit 1d9b60bf4d5aad14cac3e23614b0f74f657b547c Author: David E. O'Brien AuthorDate: 2024-08-05 05:39:16 +0000 Commit: David E. O'Brien CommitDate: 2024-08-06 03:07:55 +0000 SEE ALSO lagg(4) Add a reference in 'man 4 ng_one2many' to lagg(4) since its functionality is so similar. --- share/man/man4/ng_one2many.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/share/man/man4/ng_one2many.4 b/share/man/man4/ng_one2many.4 index 8a73c51d2bcf..06bcbabedb63 100644 --- a/share/man/man4/ng_one2many.4 +++ b/share/man/man4/ng_one2many.4 @@ -250,6 +250,7 @@ With a similar setup on a peer machine (using the address Ethernet connection with four times normal bandwidth is achieved. .Sh SEE ALSO +.Xr lagg 4 , .Xr netgraph 4 , .Xr ng_bridge 4 , .Xr ng_ether 4 , From nobody Tue Aug 6 04:06:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKVy6Kz2z5Sbbl; Tue, 06 Aug 2024 04:06:34 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKVy5g70z4kMs; Tue, 6 Aug 2024 04:06:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917194; 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=x0WG6nP2buLvo1KCoQCgXEt6ldo3H2D9OgMNoNpYK3s=; b=K8zjmZg8PPZcI1ld/6Q1X9bzEnWOUjHXGbeDoK01UjKUNpSCpTUvy7l6tWOl8IoUzgdGrl OcVGzvz+kyGhCy3F0fHGCjoaoHkV7kkjyIXQyn/fLxGjSizLM1sOwNqjM7LC3ZwqPWBcVd SYYF3S9QU0rqgOnZwfXke/hc4p7uGMzZ7dgwFDvu6jP76eqVpw5cqrKaV8c5K+TYc0iWgm U3aD5+KWerLDgKdKKY0kOAApNymB73kLSMpLk4H1K3dgE+aNNFYLh8zZ3+D+JS+l2aEYDX Dznl7bVvDoDSDBaD1NIjYIfV++5mTJssbpvrvBM+V6XiDsA5CUIgsqkJhLPU2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917194; a=rsa-sha256; cv=none; b=nygjSYN066a09Ee4E3T6DTTxIVJJydcR8kciDUA3wGKfh0ejD2WPHzFPkq1IbgsjtIJ66C spIaSBQn0xYG2nS7qLVrc/i4orKbhdbvRsW/2fO6suxZIjtrC8/ZQQB/Lf9a/EieetQKLD lk81jkvyu2dp9y52zuoP2Z5tWbHCCUADoommuqx0BBC3sfU6GtNMobVgQDl55xAS3flkDp 5/Uedvs/xPCGOjspqYCj5w820BBZA26o7Bbl9hGosyi59RPtwXbAp+JVtNrjbm/I7UIgz6 OqfNT+OFoTCriyS6de4+TW9ilmSTkdRKFeyOupi38qGqjQ0j/PRkyCA55tJQKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917194; 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=x0WG6nP2buLvo1KCoQCgXEt6ldo3H2D9OgMNoNpYK3s=; b=VqfQHIRHfnkwxL6YPkD9TekqrC+ccxi8cKxpu2t7nsd03pCVyFqKHkLVA4zcdyenTO5Y5Y 8xpgogRgRPYVE0TMEmBL85yU+aa66CF9cr0GZwqZJa1QwCrmN7QlxWtBk6ppCA9BazNFHW f3C4Gxt7zgPo/D1w8R+Nv8RIykD7O1hr6/GqFuh1W2QK6ggwPZquULHn0w8739wgWaQf2K XkKaZ4bZbX+9vzEqrIYQexcuypreiILL2FH3BmreaAk3cSOr2Kelpmr0CuOTOTIWbl4VCI 7jQRgOih0IrPzXztr5ic48AlgR4MFVZYPRL0ZuuMBZPd17JS7Haj+TXWqMZ08Q== 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 4WdKVy4rz8zrqP; Tue, 6 Aug 2024 04:06:34 +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 47646Yeh004526; Tue, 6 Aug 2024 04:06:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646YVu004523; Tue, 6 Aug 2024 04:06:34 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:34 GMT Message-Id: <202408060406.47646YVu004523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c3d8a93126b9 - main - Re-implement rangelocks part 1 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3d8a93126b9dd05fcfed3685bc3817f3c1eccc9 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c3d8a93126b9dd05fcfed3685bc3817f3c1eccc9 commit c3d8a93126b9dd05fcfed3685bc3817f3c1eccc9 Author: Konstantin Belousov AuthorDate: 2023-08-07 04:45:01 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 Re-implement rangelocks part 1 Using the algorithms from https://doi.org/10.1145/3342195.3387533. For the first part, consider all range lock requests as exclusive. Reviewed by: markj, Olivier Certner Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 455 +++++++++++++++++++++++++--------------------- sys/kern/kern_thread.c | 1 - sys/kern/uipc_shm.c | 8 +- sys/kern/vfs_subr.c | 2 - sys/sys/rangelock.h | 45 ++--- sys/sys/vnode.h | 13 +- 6 files changed, 267 insertions(+), 257 deletions(-) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index a9d8c342c267..186a42caebf0 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -27,304 +27,335 @@ */ #include +#include #include #include #include #include #include -#include +#include +#include #include +/* + * Implementation of range locks based on the paper + * https://doi.org/10.1145/3342195.3387533 + * arXiv:2006.12144v1 [cs.OS] 22 Jun 2020 + * Scalable Range Locks for Scalable Address Spaces and Beyond + * by Alex Kogan, Dave Dice, and Shady Issa + */ + +static struct rl_q_entry *rl_e_unmark(const struct rl_q_entry *e); + +/* + * rl_q_next links all granted ranges in the lock. We cannot free an + * rl_q_entry while in the smr section, and cannot reuse rl_q_next + * linkage since other threads might follow it even after CAS removed + * the range. Use rl_q_free for local list of ranges to remove after + * the smr section is dropped. + */ struct rl_q_entry { - TAILQ_ENTRY(rl_q_entry) rl_q_link; + struct rl_q_entry *rl_q_next; + struct rl_q_entry *rl_q_free; off_t rl_q_start, rl_q_end; int rl_q_flags; +#ifdef INVARIANTS + struct thread *rl_q_owner; +#endif }; static uma_zone_t rl_entry_zone; +static smr_t rl_smr; static void rangelock_sys_init(void) { - rl_entry_zone = uma_zcreate("rl_entry", sizeof(struct rl_q_entry), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct rl_q_entry), + UMA_ZONE_SMR); + rl_smr = uma_zone_get_smr(rl_entry_zone); } -SYSINIT(vfs, SI_SUB_LOCK, SI_ORDER_ANY, rangelock_sys_init, NULL); +SYSINIT(rl, SI_SUB_LOCK, SI_ORDER_ANY, rangelock_sys_init, NULL); static struct rl_q_entry * -rlqentry_alloc(void) +rlqentry_alloc(vm_ooffset_t start, vm_ooffset_t end, int flags) { + struct rl_q_entry *e; + + e = uma_zalloc_smr(rl_entry_zone, M_WAITOK); + e->rl_q_next = NULL; + e->rl_q_free = NULL; + e->rl_q_start = start; + e->rl_q_end = end; + e->rl_q_flags = flags; +#ifdef INVARIANTS + e->rl_q_owner = curthread; +#endif + return (e); +} - return (uma_zalloc(rl_entry_zone, M_WAITOK)); +void +rangelock_init(struct rangelock *lock) +{ + lock->sleepers = false; + atomic_store_ptr(&lock->head, NULL); } void -rlqentry_free(struct rl_q_entry *rleq) +rangelock_destroy(struct rangelock *lock) { + struct rl_q_entry *e, *ep; - uma_zfree(rl_entry_zone, rleq); + MPASS(!lock->sleepers); + for (e = (struct rl_q_entry *)atomic_load_ptr(&lock->head); + e != NULL; e = rl_e_unmark(ep)) { + ep = atomic_load_ptr(&e->rl_q_next); + uma_zfree_smr(rl_entry_zone, e); + } } -void -rangelock_init(struct rangelock *lock) +static bool +rl_e_is_marked(const struct rl_q_entry *e) { + return (((uintptr_t)e & 1) != 0); +} - TAILQ_INIT(&lock->rl_waiters); - lock->rl_currdep = NULL; +static struct rl_q_entry * +rl_e_unmark(const struct rl_q_entry *e) +{ + MPASS(rl_e_is_marked(e)); + return ((struct rl_q_entry *)((uintptr_t)e & ~1)); } -void -rangelock_destroy(struct rangelock *lock) +static struct rl_q_entry * +rl_q_load(struct rl_q_entry **p) { + return ((struct rl_q_entry *)atomic_load_acq_ptr((uintptr_t *)p)); +} - KASSERT(TAILQ_EMPTY(&lock->rl_waiters), ("Dangling waiters")); +void +rangelock_unlock(struct rangelock *lock, void *cookie) +{ + struct rl_q_entry *e; + + e = cookie; + MPASS(lock != NULL && e != NULL); + MPASS(!rl_e_is_marked(rl_q_load(&e->rl_q_next))); + MPASS(e->rl_q_owner == curthread); + + sleepq_lock(&lock->sleepers); +#ifdef INVARIANTS + int r = atomic_testandset_long((uintptr_t *)&e->rl_q_next, 0); + MPASS(r == 0); +#else + atomic_set_ptr((uintptr_t *)&e->rl_q_next, 1); +#endif + lock->sleepers = false; + sleepq_broadcast(&lock->sleepers, SLEEPQ_SLEEP, 0, 0); + sleepq_release(&lock->sleepers); } /* - * Two entries are compatible if their ranges do not overlap, or both - * entries are for read. + * result: -1 if e1 before e2 + * 1 if e1 after e2 + * 0 if e1 and e2 overlap */ static int -ranges_overlap(const struct rl_q_entry *e1, - const struct rl_q_entry *e2) +rl_e_compare(const struct rl_q_entry *e1, const struct rl_q_entry *e2) { - - if (e1->rl_q_start < e2->rl_q_end && e1->rl_q_end > e2->rl_q_start) + if (e1 == NULL) return (1); + if (e1->rl_q_start >= e2->rl_q_end) + return (1); + if (e2->rl_q_start >= e1->rl_q_end) + return (-1); return (0); } -/* - * Recalculate the lock->rl_currdep after an unlock. - */ static void -rangelock_calc_block(struct rangelock *lock) +rl_insert_sleep(struct rangelock *lock) { - struct rl_q_entry *entry, *nextentry, *entry1; - - for (entry = lock->rl_currdep; entry != NULL; entry = nextentry) { - nextentry = TAILQ_NEXT(entry, rl_q_link); - if (entry->rl_q_flags & RL_LOCK_READ) { - /* Reads must not overlap with granted writes. */ - for (entry1 = TAILQ_FIRST(&lock->rl_waiters); - !(entry1->rl_q_flags & RL_LOCK_READ); - entry1 = TAILQ_NEXT(entry1, rl_q_link)) { - if (ranges_overlap(entry, entry1)) - goto out; - } - } else { - /* Write must not overlap with any granted locks. */ - for (entry1 = TAILQ_FIRST(&lock->rl_waiters); - entry1 != entry; - entry1 = TAILQ_NEXT(entry1, rl_q_link)) { - if (ranges_overlap(entry, entry1)) - goto out; - } - - /* Move grantable write locks to the front. */ - TAILQ_REMOVE(&lock->rl_waiters, entry, rl_q_link); - TAILQ_INSERT_HEAD(&lock->rl_waiters, entry, rl_q_link); - } - - /* Grant this lock. */ - entry->rl_q_flags |= RL_LOCK_GRANTED; - wakeup(entry); - } -out: - lock->rl_currdep = entry; + smr_exit(rl_smr); + DROP_GIANT(); + lock->sleepers = true; + sleepq_add(&lock->sleepers, NULL, "rangelk", 0, 0); + sleepq_wait(&lock->sleepers, PRI_USER); + PICKUP_GIANT(); + smr_enter(rl_smr); } -static void -rangelock_unlock_locked(struct rangelock *lock, struct rl_q_entry *entry, - struct mtx *ilk, bool do_calc_block) +static bool +rl_q_cas(struct rl_q_entry **prev, struct rl_q_entry *old, + struct rl_q_entry *new) { - - MPASS(lock != NULL && entry != NULL && ilk != NULL); - mtx_assert(ilk, MA_OWNED); - - if (!do_calc_block) { - /* - * This is the case where rangelock_enqueue() has been called - * with trylock == true and just inserted this entry in the - * queue. - * If rl_currdep is this entry, rl_currdep needs to - * be set to the next entry in the rl_waiters list. - * However, since this entry is the last entry in the - * list, the next entry is NULL. - */ - if (lock->rl_currdep == entry) { - KASSERT(TAILQ_NEXT(lock->rl_currdep, rl_q_link) == NULL, - ("rangelock_enqueue: next entry not NULL")); - lock->rl_currdep = NULL; - } - } else - KASSERT(entry != lock->rl_currdep, ("stuck currdep")); - - TAILQ_REMOVE(&lock->rl_waiters, entry, rl_q_link); - if (do_calc_block) - rangelock_calc_block(lock); - mtx_unlock(ilk); - if (curthread->td_rlqe == NULL) - curthread->td_rlqe = entry; - else - rlqentry_free(entry); + return (atomic_cmpset_rel_ptr((uintptr_t *)prev, (uintptr_t)old, + (uintptr_t)new) != 0); } -void -rangelock_unlock(struct rangelock *lock, void *cookie, struct mtx *ilk) +static bool +rl_insert(struct rangelock *lock, struct rl_q_entry *e, bool trylock, + struct rl_q_entry **free) { + struct rl_q_entry *cur, *next, **prev; + int r; + +again: + prev = &lock->head; + if (rl_q_load(prev) == NULL && rl_q_cas(prev, NULL, e)) + return (true); + + for (cur = rl_q_load(prev);;) { + if (rl_e_is_marked(cur)) + goto again; + + if (cur != NULL) { + next = rl_q_load(&cur->rl_q_next); + if (rl_e_is_marked(next)) { + next = rl_e_unmark(next); + if (rl_q_cas(prev, cur, next)) { +#ifdef INVARIANTS + cur->rl_q_owner = NULL; +#endif + cur->rl_q_free = *free; + *free = cur; + } + cur = next; + continue; + } + } - MPASS(lock != NULL && cookie != NULL && ilk != NULL); - - mtx_lock(ilk); - rangelock_unlock_locked(lock, cookie, ilk, true); -} - -/* - * Unlock the sub-range of granted lock. - */ -void * -rangelock_unlock_range(struct rangelock *lock, void *cookie, off_t start, - off_t end, struct mtx *ilk) -{ - struct rl_q_entry *entry; - - MPASS(lock != NULL && cookie != NULL && ilk != NULL); - entry = cookie; - KASSERT(entry->rl_q_flags & RL_LOCK_GRANTED, - ("Unlocking non-granted lock")); - KASSERT(entry->rl_q_start == start, ("wrong start")); - KASSERT(entry->rl_q_end >= end, ("wrong end")); - - mtx_lock(ilk); - if (entry->rl_q_end == end) { - rangelock_unlock_locked(lock, cookie, ilk, true); - return (NULL); + r = rl_e_compare(cur, e); + if (r == -1) { + prev = &cur->rl_q_next; + cur = rl_q_load(prev); + } else if (r == 0) { + sleepq_lock(&lock->sleepers); + if (__predict_false(rl_e_is_marked(rl_q_load( + &cur->rl_q_next)))) { + sleepq_release(&lock->sleepers); + continue; + } + if (trylock) { + sleepq_release(&lock->sleepers); + return (false); + } + rl_insert_sleep(lock); + /* e is still valid */ + goto again; + } else /* r == 1 */ { + e->rl_q_next = cur; + if (rl_q_cas(prev, cur, e)) { + atomic_thread_fence_acq(); + return (true); + } + /* Reset rl_q_next in case we hit fast path. */ + e->rl_q_next = NULL; + cur = rl_q_load(prev); + } } - entry->rl_q_end = end; - rangelock_calc_block(lock); - mtx_unlock(ilk); - return (cookie); } -/* - * Add the lock request to the queue of the pending requests for - * rangelock. Sleep until the request can be granted unless trylock == true. - */ -static void * -rangelock_enqueue(struct rangelock *lock, off_t start, off_t end, int mode, - struct mtx *ilk, bool trylock) +static struct rl_q_entry * +rangelock_lock_int(struct rangelock *lock, struct rl_q_entry *e, + bool trylock) { - struct rl_q_entry *entry; - struct thread *td; - - MPASS(lock != NULL && ilk != NULL); - - td = curthread; - if (td->td_rlqe != NULL) { - entry = td->td_rlqe; - td->td_rlqe = NULL; - } else - entry = rlqentry_alloc(); - MPASS(entry != NULL); - entry->rl_q_flags = mode; - entry->rl_q_start = start; - entry->rl_q_end = end; - - mtx_lock(ilk); - /* - * XXXKIB TODO. Check that a thread does not try to enqueue a - * lock that is incompatible with another request from the same - * thread. - */ - - TAILQ_INSERT_TAIL(&lock->rl_waiters, entry, rl_q_link); - /* - * If rl_currdep == NULL, there is no entry waiting for a conflicting - * range to be resolved, so set rl_currdep to this entry. If there is - * no conflicting entry for this entry, rl_currdep will be set back to - * NULL by rangelock_calc_block(). - */ - if (lock->rl_currdep == NULL) - lock->rl_currdep = entry; - rangelock_calc_block(lock); - while (!(entry->rl_q_flags & RL_LOCK_GRANTED)) { - if (trylock) { - /* - * For this case, the range is not actually locked - * yet, but removal from the list requires the same - * steps, except for not doing a rangelock_calc_block() - * call, since rangelock_calc_block() was called above. - */ - rangelock_unlock_locked(lock, entry, ilk, false); - return (NULL); - } - msleep(entry, ilk, 0, "range", 0); + struct rl_q_entry *free, *x, *xp; + bool res; + + free = NULL; + smr_enter(rl_smr); + res = rl_insert(lock, e, trylock, &free); + smr_exit(rl_smr); + MPASS(trylock || res); + if (!res) { + e->rl_q_free = free; + free = e; + e = NULL; + } + for (x = free; x != NULL; x = xp) { + MPASS(!rl_e_is_marked(x)); + xp = x->rl_q_free; + MPASS(!rl_e_is_marked(xp)); + uma_zfree_smr(rl_entry_zone, x); } - mtx_unlock(ilk); - return (entry); + return (e); } void * -rangelock_rlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk) +rangelock_rlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { + struct rl_q_entry *e; - return (rangelock_enqueue(lock, start, end, RL_LOCK_READ, ilk, false)); + e = rlqentry_alloc(start, end, RL_LOCK_READ); + return (rangelock_lock_int(lock, e, false)); } void * -rangelock_tryrlock(struct rangelock *lock, off_t start, off_t end, - struct mtx *ilk) +rangelock_tryrlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { + struct rl_q_entry *e; - return (rangelock_enqueue(lock, start, end, RL_LOCK_READ, ilk, true)); + e = rlqentry_alloc(start, end, RL_LOCK_READ); + return (rangelock_lock_int(lock, e, true)); } void * -rangelock_wlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk) +rangelock_wlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { + struct rl_q_entry *e; - return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk, false)); + e = rlqentry_alloc(start, end, RL_LOCK_WRITE); + return (rangelock_lock_int(lock, e, true)); } void * -rangelock_trywlock(struct rangelock *lock, off_t start, off_t end, - struct mtx *ilk) +rangelock_trywlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { + struct rl_q_entry *e; - return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk, true)); + e = rlqentry_alloc(start, end, RL_LOCK_WRITE); + return (rangelock_lock_int(lock, e, true)); } #ifdef INVARIANT_SUPPORT void _rangelock_cookie_assert(void *cookie, int what, const char *file, int line) { - struct rl_q_entry *entry; - int flags; - - MPASS(cookie != NULL); - entry = cookie; - flags = entry->rl_q_flags; - switch (what) { - case RCA_LOCKED: - if ((flags & RL_LOCK_GRANTED) == 0) - panic("rangelock not held @ %s:%d\n", file, line); - break; - case RCA_RLOCKED: - if ((flags & (RL_LOCK_GRANTED | RL_LOCK_READ)) != - (RL_LOCK_GRANTED | RL_LOCK_READ)) - panic("rangelock not rlocked @ %s:%d\n", file, line); - break; - case RCA_WLOCKED: - if ((flags & (RL_LOCK_GRANTED | RL_LOCK_WRITE)) != - (RL_LOCK_GRANTED | RL_LOCK_WRITE)) - panic("rangelock not wlocked @ %s:%d\n", file, line); - break; - default: - panic("Unknown rangelock assertion: %d @ %s:%d", what, file, - line); - } } #endif /* INVARIANT_SUPPORT */ + +#include "opt_ddb.h" +#ifdef DDB +#include + +DB_SHOW_COMMAND(rangelock, db_show_rangelock) +{ + struct rangelock *lock; + struct rl_q_entry *e, *x; + + if (!have_addr) { + db_printf("show rangelock addr\n"); + return; + } + + lock = (struct rangelock *)addr; + db_printf("rangelock %p sleepers %d\n", lock, lock->sleepers); + for (e = lock->head;;) { + x = rl_e_is_marked(e) ? rl_e_unmark(e) : e; + if (x == NULL) + break; + db_printf(" entry %p marked %d %d start %#jx end %#jx " + "flags %x next %p", + e, rl_e_is_marked(e), rl_e_is_marked(x->rl_q_next), + x->rl_q_start, x->rl_q_end, x->rl_q_flags, x->rl_q_next); +#ifdef INVARIANTS + db_printf(" owner %p (%d)", x->rl_q_owner, + x->rl_q_owner != NULL ? x->rl_q_owner->td_tid : -1); +#endif + db_printf("\n"); + e = x->rl_q_next; + } +} + +#endif /* DDB */ diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 00f99516773c..c951e7297c89 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -478,7 +478,6 @@ thread_fini(void *mem, int size) td = (struct thread *)mem; EVENTHANDLER_DIRECT_INVOKE(thread_fini, td); - rlqentry_free(td->td_rlqe); turnstile_free(td->td_turnstile); sleepq_free(td->td_sleepqueue); umtx_thread_fini(td); diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 7672ded459df..49b5b56dee17 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -184,13 +184,13 @@ SYSCTL_INT(_vm_largepages, OID_AUTO, reclaim_tries, "Number of contig reclaims before giving up for default alloc policy"); #define shm_rangelock_unlock(shmfd, cookie) \ - rangelock_unlock(&(shmfd)->shm_rl, (cookie), &(shmfd)->shm_mtx) + rangelock_unlock(&(shmfd)->shm_rl, (cookie)) #define shm_rangelock_rlock(shmfd, start, end) \ - rangelock_rlock(&(shmfd)->shm_rl, (start), (end), &(shmfd)->shm_mtx) + rangelock_rlock(&(shmfd)->shm_rl, (start), (end)) #define shm_rangelock_tryrlock(shmfd, start, end) \ - rangelock_tryrlock(&(shmfd)->shm_rl, (start), (end), &(shmfd)->shm_mtx) + rangelock_tryrlock(&(shmfd)->shm_rl, (start), (end)) #define shm_rangelock_wlock(shmfd, start, end) \ - rangelock_wlock(&(shmfd)->shm_rl, (start), (end), &(shmfd)->shm_mtx) + rangelock_wlock(&(shmfd)->shm_rl, (start), (end)) static int uiomove_object_page(vm_object_t obj, size_t len, struct uio *uio) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8012fab29081..f192c6798858 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2180,8 +2180,6 @@ freevnode(struct vnode *vp) VNASSERT(bo->bo_dirty.bv_cnt == 0, vp, ("dirtybufcnt not 0")); VNASSERT(pctrie_is_empty(&bo->bo_dirty.bv_root), vp, ("dirty blk trie not empty")); - VNASSERT(TAILQ_EMPTY(&vp->v_rl.rl_waiters), vp, - ("Dangling rangelock waiters")); VNASSERT((vp->v_iflag & (VI_DOINGINACT | VI_OWEINACT)) == 0, vp, ("Leaked inactivation")); VI_UNLOCK(vp); diff --git a/sys/sys/rangelock.h b/sys/sys/rangelock.h index 62ccf77c03bc..310371bef879 100644 --- a/sys/sys/rangelock.h +++ b/sys/sys/rangelock.h @@ -29,12 +29,14 @@ #ifndef _SYS_RANGELOCK_H #define _SYS_RANGELOCK_H -#include +#include +#ifndef _KERNEL +#include +#endif #define RL_LOCK_READ 0x0001 #define RL_LOCK_WRITE 0x0002 #define RL_LOCK_TYPE_MASK 0x0003 -#define RL_LOCK_GRANTED 0x0004 struct rl_q_entry; @@ -44,42 +46,25 @@ struct rl_q_entry; * all existing lock owners are compatible with the request. Two lock * owners are compatible if their ranges do not overlap, or both * owners are for read. - * - * Access to the structure itself is synchronized with the externally - * supplied mutex. - * - * rl_waiters is the queue containing in order (a) granted write lock - * requests, (b) granted read lock requests, and (c) in order of arrival, - * lock requests which cannot be granted yet. - * - * rl_currdep is the first lock request that cannot be granted now due - * to the preceding requests conflicting with it (i.e., it points to - * position (c) in the list above). */ struct rangelock { - TAILQ_HEAD(, rl_q_entry) rl_waiters; - struct rl_q_entry *rl_currdep; + struct rl_q_entry *head; + bool sleepers; }; #ifdef _KERNEL -struct mtx; - void rangelock_init(struct rangelock *lock); void rangelock_destroy(struct rangelock *lock); -void rangelock_unlock(struct rangelock *lock, void *cookie, - struct mtx *ilk); -void *rangelock_unlock_range(struct rangelock *lock, void *cookie, - off_t start, off_t end, struct mtx *ilk); -void *rangelock_rlock(struct rangelock *lock, off_t start, off_t end, - struct mtx *ilk); -void *rangelock_tryrlock(struct rangelock *lock, off_t start, off_t end, - struct mtx *ilk); -void *rangelock_wlock(struct rangelock *lock, off_t start, off_t end, - struct mtx *ilk); -void *rangelock_trywlock(struct rangelock *lock, off_t start, off_t end, - struct mtx *ilk); -void rlqentry_free(struct rl_q_entry *rlqe); +void rangelock_unlock(struct rangelock *lock, void *cookie); +void *rangelock_rlock(struct rangelock *lock, vm_ooffset_t start, + vm_ooffset_t end); +void *rangelock_tryrlock(struct rangelock *lock, vm_ooffset_t start, + vm_ooffset_t end); +void *rangelock_wlock(struct rangelock *lock, vm_ooffset_t start, + vm_ooffset_t end); +void *rangelock_trywlock(struct rangelock *lock, vm_ooffset_t start, + vm_ooffset_t end); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) void _rangelock_cookie_assert(void *cookie, int what, const char *file, int line); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index dc926d7a9c9e..0d0f228f7051 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -833,18 +833,15 @@ void vn_seqc_write_end(struct vnode *vp); #define vn_seqc_consistent(vp, seq) seqc_consistent(&(vp)->v_seqc, seq) #define vn_rangelock_unlock(vp, cookie) \ - rangelock_unlock(&(vp)->v_rl, (cookie), VI_MTX(vp)) -#define vn_rangelock_unlock_range(vp, cookie, start, end) \ - rangelock_unlock_range(&(vp)->v_rl, (cookie), (start), (end), \ - VI_MTX(vp)) + rangelock_unlock(&(vp)->v_rl, (cookie)) #define vn_rangelock_rlock(vp, start, end) \ - rangelock_rlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) + rangelock_rlock(&(vp)->v_rl, (start), (end)) #define vn_rangelock_tryrlock(vp, start, end) \ - rangelock_tryrlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) + rangelock_tryrlock(&(vp)->v_rl, (start), (end)) #define vn_rangelock_wlock(vp, start, end) \ - rangelock_wlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) + rangelock_wlock(&(vp)->v_rl, (start), (end)) #define vn_rangelock_trywlock(vp, start, end) \ - rangelock_trywlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) + rangelock_trywlock(&(vp)->v_rl, (start), (end)) #define vn_irflag_read(vp) atomic_load_short(&(vp)->v_irflag) void vn_irflag_set_locked(struct vnode *vp, short toset); From nobody Tue Aug 6 04:06:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKVz6jD1z5SbT6; Tue, 06 Aug 2024 04:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKVz65h9z4kBd; Tue, 6 Aug 2024 04:06:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917195; 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=L0SCShTUwHO19Ua0eISUuzX3DEzBRCNLUeB3whw++us=; b=BFHBf1svUDEa4PAWGAJDx00uccrNkpOEn+qJlP7JLeaa/94VUgq307EiLPXuyW+GmAqFJj D/LhR7SUhTjYo8+ENkyDHGYt9dgBjyjcrbFuh55Ag/0tOVFKPOaTI/eUzGjQM6EM0do6vx MsihqBidOh1SUb05VW4injVJwG5w2hBcAQZkD/SB9TuAHiNsspEYYd7+UWWmHyWxDXJn5R k1UTOTsxAJ+vlf/XGh51+V0OKjAMk5FTE+JZ28A41QQ641KVlN3RD/WOjXep/+d+GnvOiD /l0lvxYPzZXOXceAUstGfh2EQfbkY2Qq1sUFn2UWy8+A6L8wuTYL4T67hOovgA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917195; a=rsa-sha256; cv=none; b=QBaTJr87qZ6sD/zPiEXCrv55mK2QQaa+TaABkw28yqQBMmmCHkxIDgUCFHwyQR5tAlalTs uXd3orwDppY74PTVugRurCZaOaqES38nUQAvB31HemNL5zrXm3DTA2pQ7hI5gzUDzycU5o /1fwqtC63ju80oHU7waB2zb5W0i4CnG0VaireK8jE9GmPXZaY38rvThNxCdwkcq8KIevC4 Jk0tvRkzRbA+czLLt8s82N6/Ec3TPtgtzwpZdk4eIm9kto7o99XZm+tRlxVmA4kWTfrUja yh1Owx6aWtVCjtzCfSCNU6OOTtlU+ZFekq5OBSjenPLyegUBxGlN4ujArSf+FQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917195; 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=L0SCShTUwHO19Ua0eISUuzX3DEzBRCNLUeB3whw++us=; b=IIoQ01R1UD3qz/qoanmcnhfHgMOd6MNUkPoxYzZth2wNuSxzCKOaVRstEvUUx29zJl9e4d jQh9QDWhei6dcFPt59r59s3T5xdpJLsa+4ROd4wYa7MrOCFy4XdAA+JmAtqeeD4XlFWyv9 TIbO8dIizET7QaLFgYkrS1u0c68t/skKX4ftzovPhpKq574ql2VzLz6D9pQnmKZpBsTMck 9wVR7EUml+FeKXoO2yo7l6JdYR+WMgUIBjTKpsDfwAu0irQkCxRjkZLtmkBS9SoI/MdzRp EfaRFIJXhj5mnnBZJ9Xl/wt0+GGS//pAXjq0U8NYMBFeSz2s5tgF3yx14h3vMg== 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 4WdKVz5k87zrb2; Tue, 6 Aug 2024 04:06: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 47646Zrh004568; Tue, 6 Aug 2024 04:06:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646ZRw004565; Tue, 6 Aug 2024 04:06:35 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:35 GMT Message-Id: <202408060406.47646ZRw004565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 6c32d89ecabe - main - kern_rangelock.c: add rl_e_is_rlock() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c32d89ecabeba8fe5ad79a33aa134412175856e Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6c32d89ecabeba8fe5ad79a33aa134412175856e commit 6c32d89ecabeba8fe5ad79a33aa134412175856e Author: Konstantin Belousov AuthorDate: 2023-08-18 17:59:05 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 kern_rangelock.c: add rl_e_is_rlock() Reviewed by: markj, Olivier Certner Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index 186a42caebf0..2ed26db49f19 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -134,6 +134,12 @@ rl_q_load(struct rl_q_entry **p) return ((struct rl_q_entry *)atomic_load_acq_ptr((uintptr_t *)p)); } +static bool +rl_e_is_rlock(const struct rl_q_entry *e) +{ + return ((e->rl_q_flags & RL_LOCK_TYPE_MASK) == RL_LOCK_READ); +} + void rangelock_unlock(struct rangelock *lock, void *cookie) { From nobody Tue Aug 6 04:06:36 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKW11fMQz5SbW4; Tue, 06 Aug 2024 04:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKW10n2Lz4kVn; Tue, 6 Aug 2024 04:06:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917197; 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=Q+/uv1VbExL7qd7DIoKDJCsLogqdm70aWbF9tDhfqcY=; b=KvcDYoEWICzylHfaKxMUKPgs706d+eoR58JLtOWnN5zS/KPo5TQd51L8ZDJLA/zyuocOlu JgX/R6CJ3KmqZhRsfsg1HlNhtCk77bPqmH4iXR3fBeMK0W7e1JEfsXdP/ZG/fHxoNVkxhR NH9q93dGtjQ6l6r6xKlJo8iL8Nuu6RNBGRwJJikBSKmxOMAPXDsoLQVn2OwMabnxY5wfgG ujv4SUKv9de8aN9IoiCRHE2JjYn2P19XJsaY8iJ9RqWr7qXmxGoPkVPgW8U21vPAXfJN2J ajXvyTonndCqDNmuDViUTUX3g3zbPTnvTUqQ/MRIiVsDD4nXvfLGQqphx6Mq0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917197; a=rsa-sha256; cv=none; b=J36Hye4Mh18gfwpXqAQi+EV2p7dvlWB4suNbzQ97fg8PDfnW40WOXVHt+XcBZAFNYuLt0q C9h04T2B6B9MPiYpSctDuAKMFHDHeR2i/aOdzVG8gRJN4J0ar6y5E+MrnBi2+FC1tACCaZ LvtoM0kEVkZ/ZnyQRf2osqSZgJakI9q2qc8lSAZZl2DVI9Q7XrPHidKhQ34vIUJFji2DRP smqoQG++RaqN2HEOsDUMG7NtvCpohpnDMlYn0Cu9tpYuUn9dNPFWiQJeA7/YusizQdeT+g 9+qILQ0fUhXweCBvc7aVIslsEJBfC7t4UDb3SDUpONoOJAK74+ffkonnkPJWLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917197; 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=Q+/uv1VbExL7qd7DIoKDJCsLogqdm70aWbF9tDhfqcY=; b=UtvlaKfvCpepoc7SjAJGqc6oiGJkQTUM6nLf/itqquaGpj7NEb5YNDahCCvGM0FWzxM6AH hhWQENj5OclbNx40ZGPcPjgcILnpNyb/qN77eW2tlWsUXzs8njm9T5yNuKhr3o0nAbmuGh x63IGJ0h4NTflkKIuiUsX/Twjuxda0RXDZSiA9ZM7YrCoBiO4XdeR4CZBcb89U+0+GFPck 4Fpqo1rxQelAuXMJZSj2v4P5zllT4A9lrn5CMR+xvPE8Vcm8tR51+VXkazboxAcvii83ZH dU87pe/9OkIOcl+VWQF1KKH7dr6yk1O2InWknvsF+rvk14I51GmAdRWqCSGSeg== 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 4WdKW06k3Zzs99; Tue, 6 Aug 2024 04:06: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 47646a1K004610; Tue, 6 Aug 2024 04:06:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646aWe004607; Tue, 6 Aug 2024 04:06:36 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:36 GMT Message-Id: <202408060406.47646aWe004607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5badbeeaf061 - main - Re-implement rangelocks part 2 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5badbeeaf0614568d37b2466d0f52676ff08a049 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5badbeeaf0614568d37b2466d0f52676ff08a049 commit 5badbeeaf0614568d37b2466d0f52676ff08a049 Author: Konstantin Belousov AuthorDate: 2023-08-18 17:32:01 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 Re-implement rangelocks part 2 Allow read locks to overlap. Reviewed by: markj, Olivier Certner Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 232 +++++++++++++++++++++++++++++++++------------- 1 file changed, 169 insertions(+), 63 deletions(-) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index 2ed26db49f19..9c6b7fb871f9 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -121,11 +121,28 @@ rl_e_is_marked(const struct rl_q_entry *e) return (((uintptr_t)e & 1) != 0); } +static struct rl_q_entry * +rl_e_unmark_unchecked(const struct rl_q_entry *e) +{ + return ((struct rl_q_entry *)((uintptr_t)e & ~1)); +} + static struct rl_q_entry * rl_e_unmark(const struct rl_q_entry *e) { MPASS(rl_e_is_marked(e)); - return ((struct rl_q_entry *)((uintptr_t)e & ~1)); + return (rl_e_unmark_unchecked(e)); +} + +static void +rl_e_mark(struct rl_q_entry *e) +{ +#if defined(INVARIANTS) && defined(__LP64__) + int r = atomic_testandset_long((uintptr_t *)&e->rl_q_next, 0); + MPASS(r == 0); +#else + atomic_set_ptr((uintptr_t *)&e->rl_q_next, 1); +#endif } static struct rl_q_entry * @@ -140,42 +157,49 @@ rl_e_is_rlock(const struct rl_q_entry *e) return ((e->rl_q_flags & RL_LOCK_TYPE_MASK) == RL_LOCK_READ); } -void -rangelock_unlock(struct rangelock *lock, void *cookie) +static void +rangelock_unlock_int(struct rangelock *lock, struct rl_q_entry *e) { - struct rl_q_entry *e; - - e = cookie; MPASS(lock != NULL && e != NULL); MPASS(!rl_e_is_marked(rl_q_load(&e->rl_q_next))); MPASS(e->rl_q_owner == curthread); - sleepq_lock(&lock->sleepers); -#ifdef INVARIANTS - int r = atomic_testandset_long((uintptr_t *)&e->rl_q_next, 0); - MPASS(r == 0); -#else - atomic_set_ptr((uintptr_t *)&e->rl_q_next, 1); -#endif + rl_e_mark(e); lock->sleepers = false; sleepq_broadcast(&lock->sleepers, SLEEPQ_SLEEP, 0, 0); +} + +void +rangelock_unlock(struct rangelock *lock, void *cookie) +{ + sleepq_lock(&lock->sleepers); + rangelock_unlock_int(lock, cookie); sleepq_release(&lock->sleepers); } /* - * result: -1 if e1 before e2 - * 1 if e1 after e2 - * 0 if e1 and e2 overlap + * result: -1 if e1 before e2, or both locks are readers and e1 + * starts before or at e2 + * 1 if e1 after e2, or both locks are readers and e1 + * starts after e2 + * 0 if e1 and e2 overlap and at least one lock is writer */ static int rl_e_compare(const struct rl_q_entry *e1, const struct rl_q_entry *e2) { + bool rds; + if (e1 == NULL) return (1); - if (e1->rl_q_start >= e2->rl_q_end) - return (1); if (e2->rl_q_start >= e1->rl_q_end) return (-1); + rds = rl_e_is_rlock(e1) && rl_e_is_rlock(e2); + if (e2->rl_q_start >= e1->rl_q_start && rds) + return (-1); + if (e1->rl_q_start >= e2->rl_q_end) + return (1); + if (e1->rl_q_start >= e2->rl_q_start && rds) + return (1); return (0); } @@ -199,7 +223,95 @@ rl_q_cas(struct rl_q_entry **prev, struct rl_q_entry *old, (uintptr_t)new) != 0); } -static bool +enum RL_INSERT_RES { + RL_TRYLOCK_FAILED, + RL_LOCK_SUCCESS, + RL_LOCK_RETRY, +}; + +static enum RL_INSERT_RES +rl_r_validate(struct rangelock *lock, struct rl_q_entry *e, bool trylock, + struct rl_q_entry **free) +{ + struct rl_q_entry *cur, *next, **prev; + + prev = &e->rl_q_next; + cur = rl_q_load(prev); + MPASS(!rl_e_is_marked(cur)); /* nobody can unlock e yet */ + for (;;) { + if (cur == NULL || cur->rl_q_start > e->rl_q_end) + return (RL_LOCK_SUCCESS); + next = rl_q_load(&cur->rl_q_next); + if (rl_e_is_marked(next)) { + next = rl_e_unmark(next); + if (rl_q_cas(prev, cur, next)) { + cur->rl_q_free = *free; + *free = cur; + } + cur = next; + continue; + } + if (rl_e_is_rlock(cur)) { + prev = &cur->rl_q_next; + cur = rl_e_unmark_unchecked(rl_q_load(prev)); + continue; + } + if (!rl_e_is_marked(rl_q_load(&cur->rl_q_next))) { + sleepq_lock(&lock->sleepers); + if (rl_e_is_marked(rl_q_load(&cur->rl_q_next))) { + sleepq_release(&lock->sleepers); + continue; + } + rangelock_unlock_int(lock, e); + if (trylock) { + sleepq_release(&lock->sleepers); + return (RL_TRYLOCK_FAILED); + } + rl_insert_sleep(lock); + return (RL_LOCK_RETRY); + } + } +} + +static enum RL_INSERT_RES +rl_w_validate(struct rangelock *lock, struct rl_q_entry *e, + bool trylock, struct rl_q_entry **free) +{ + struct rl_q_entry *cur, *next, **prev; + + prev = &lock->head; + cur = rl_q_load(prev); + MPASS(!rl_e_is_marked(cur)); /* head is not marked */ + for (;;) { + if (cur == e) + return (RL_LOCK_SUCCESS); + next = rl_q_load(&cur->rl_q_next); + if (rl_e_is_marked(next)) { + next = rl_e_unmark(next); + if (rl_q_cas(prev, cur, next)) { + cur->rl_q_next = *free; + *free = cur; + } + cur = next; + continue; + } + if (cur->rl_q_end <= e->rl_q_start) { + prev = &cur->rl_q_next; + cur = rl_e_unmark_unchecked(rl_q_load(prev)); + continue; + } + sleepq_lock(&lock->sleepers); + rangelock_unlock_int(lock, e); + if (trylock) { + sleepq_release(&lock->sleepers); + return (RL_TRYLOCK_FAILED); + } + rl_insert_sleep(lock); + return (RL_LOCK_RETRY); + } +} + +static enum RL_INSERT_RES rl_insert(struct rangelock *lock, struct rl_q_entry *e, bool trylock, struct rl_q_entry **free) { @@ -208,14 +320,15 @@ rl_insert(struct rangelock *lock, struct rl_q_entry *e, bool trylock, again: prev = &lock->head; - if (rl_q_load(prev) == NULL && rl_q_cas(prev, NULL, e)) - return (true); - - for (cur = rl_q_load(prev);;) { - if (rl_e_is_marked(cur)) - goto again; + cur = rl_q_load(prev); + if (cur == NULL && rl_q_cas(prev, NULL, e)) + return (RL_LOCK_SUCCESS); + for (;;) { if (cur != NULL) { + if (rl_e_is_marked(cur)) + goto again; + next = rl_q_load(&cur->rl_q_next); if (rl_e_is_marked(next)) { next = rl_e_unmark(next); @@ -244,7 +357,7 @@ again: } if (trylock) { sleepq_release(&lock->sleepers); - return (false); + return (RL_TRYLOCK_FAILED); } rl_insert_sleep(lock); /* e is still valid */ @@ -253,7 +366,9 @@ again: e->rl_q_next = cur; if (rl_q_cas(prev, cur, e)) { atomic_thread_fence_acq(); - return (true); + return (rl_e_is_rlock(e) ? + rl_r_validate(lock, e, trylock, free) : + rl_w_validate(lock, e, trylock, free)); } /* Reset rl_q_next in case we hit fast path. */ e->rl_q_next = NULL; @@ -263,27 +378,30 @@ again: } static struct rl_q_entry * -rangelock_lock_int(struct rangelock *lock, struct rl_q_entry *e, - bool trylock) +rangelock_lock_int(struct rangelock *lock, bool trylock, vm_ooffset_t start, + vm_ooffset_t end, int locktype) { - struct rl_q_entry *free, *x, *xp; - bool res; - - free = NULL; - smr_enter(rl_smr); - res = rl_insert(lock, e, trylock, &free); - smr_exit(rl_smr); - MPASS(trylock || res); - if (!res) { - e->rl_q_free = free; - free = e; - e = NULL; - } - for (x = free; x != NULL; x = xp) { - MPASS(!rl_e_is_marked(x)); - xp = x->rl_q_free; - MPASS(!rl_e_is_marked(xp)); - uma_zfree_smr(rl_entry_zone, x); + struct rl_q_entry *e, *free, *x, *xp; + enum RL_INSERT_RES res; + + for (res = RL_LOCK_RETRY; res == RL_LOCK_RETRY;) { + free = NULL; + e = rlqentry_alloc(start, end, locktype); + smr_enter(rl_smr); + res = rl_insert(lock, e, trylock, &free); + smr_exit(rl_smr); + if (res == RL_TRYLOCK_FAILED) { + MPASS(trylock); + e->rl_q_free = free; + free = e; + e = NULL; + } + for (x = free; x != NULL; x = xp) { + MPASS(!rl_e_is_marked(x)); + xp = x->rl_q_free; + MPASS(!rl_e_is_marked(xp)); + uma_zfree_smr(rl_entry_zone, x); + } } return (e); } @@ -291,37 +409,25 @@ rangelock_lock_int(struct rangelock *lock, struct rl_q_entry *e, void * rangelock_rlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { - struct rl_q_entry *e; - - e = rlqentry_alloc(start, end, RL_LOCK_READ); - return (rangelock_lock_int(lock, e, false)); + return (rangelock_lock_int(lock, false, start, end, RL_LOCK_READ)); } void * rangelock_tryrlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { - struct rl_q_entry *e; - - e = rlqentry_alloc(start, end, RL_LOCK_READ); - return (rangelock_lock_int(lock, e, true)); + return (rangelock_lock_int(lock, true, start, end, RL_LOCK_READ)); } void * rangelock_wlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { - struct rl_q_entry *e; - - e = rlqentry_alloc(start, end, RL_LOCK_WRITE); - return (rangelock_lock_int(lock, e, true)); + return (rangelock_lock_int(lock, true, start, end, RL_LOCK_WRITE)); } void * rangelock_trywlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { - struct rl_q_entry *e; - - e = rlqentry_alloc(start, end, RL_LOCK_WRITE); - return (rangelock_lock_int(lock, e, true)); + return (rangelock_lock_int(lock, true, start, end, RL_LOCK_WRITE)); } #ifdef INVARIANT_SUPPORT From nobody Tue Aug 6 04:06:37 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKW23ltRz5Sbbr; Tue, 06 Aug 2024 04:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKW20y4Bz4kW3; Tue, 6 Aug 2024 04:06:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917198; 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=XRLGexf4rNdB+XjYu++3tYIvFwELAaLEog24bsn9g5E=; b=ikutxVe8zDzdbPKzrFTIrrJUVb7zoCF6mQGdhdD4aUuyu985ykU1ULUJJg9LgJaePmyiBQ W41BA5g5G444UZWrnwtXRY+7Uan0p3IiUMhle0qG/rZXiqRPasbnVpEiio3cOfbm49l/d8 THJ9td8a+f2arKs666JPweETSS4ocWKHhy3ndMfWo+P1mGi8k0EEB8N9ffvKEwo7l2pCf5 1SuDFjZl5ZgaOq72pTt8vo8cSXX6TJLO/1L89JDRAYQosEGa3EfqMJ/JE1zfSJg4vAM8K8 sdxotpj2uErC7Oiz/zntFmBVY4E/nCQgKWENh620VekNPnSLy1tdiSqPJoCLTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917198; a=rsa-sha256; cv=none; b=GB3AD58rNQFq+hNdVg4EeLO6Ysb6B4qQ/5YW2iO0CScmawgtv7vsJh22d26TKkp8fHDxCa f/aQvmDS/8r7KMJDRrvoENs1yp0oUAfTp9yR/C6Eye0cKviOgnwLxxbquXX5LfSa0d9o00 STCMhVLA8mPMMEK8eAc9rFU57Tz814BX6HUGUbg1yBQr/DrDbBUyJZJmjIPkmFfHWIiiG9 6zB/TjzbSsfeCe9435M3VSrKVtjdtOZfbyTr25zBQqsZka6fcvfKSscdpFcklawJVt366T LV7bonoTmdVXI6120nlfbxOpGm8/6EPV/YsytyMF6pwcB6CYSr7/NJIirBaIAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917198; 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=XRLGexf4rNdB+XjYu++3tYIvFwELAaLEog24bsn9g5E=; b=xw4PAZmA2A7h+OJ08XFyUWds0TxBq2Aq9J/VuEJDkOW3bFtDhiUjZ03FC/Ef8a1F9tRPuF zEPkESe8qRZOK2dGFi+YscZZnKsws5q51LEoOOfvO4Za3JByMjZjy2RKaJl3n/5dYVjOPf rP0/TC0neZCJbQQhqydSrt4df/nM3n167i8DSvNioiy8E6mGUwepr+42jtsW2qvgdw5PAj kpR73k33Mj3W0aYMDrCHH5HXiC5BeL56FqLaeBjP4DXRa0IeXYsmZZsCwCnyeP2OMthj5F +HDS2CAvBA/uTXqSsb4IDAQ8DI9vZaAos6HNeDTqJhIzvO+MQ7SIYtV8JgSbYw== 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 4WdKW20MZrzs7S; Tue, 6 Aug 2024 04:06: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 47646bbG004643; Tue, 6 Aug 2024 04:06:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646btU004640; Tue, 6 Aug 2024 04:06:37 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:37 GMT Message-Id: <202408060406.47646btU004640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c31580080e05 - main - Microoptimize rangelock_unlock_int() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c31580080e055573a32d886b1ea83bebd9ef4e77 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c31580080e055573a32d886b1ea83bebd9ef4e77 commit c31580080e055573a32d886b1ea83bebd9ef4e77 Author: Konstantin Belousov AuthorDate: 2023-10-04 18:55:49 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 Microoptimize rangelock_unlock_int() Only broadcast if there are sleepers. Suggested by: markj Reviewed by: markj, Olivier Certner Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index 9c6b7fb871f9..355b2125dd9b 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -160,13 +160,17 @@ rl_e_is_rlock(const struct rl_q_entry *e) static void rangelock_unlock_int(struct rangelock *lock, struct rl_q_entry *e) { + bool sleepers; + MPASS(lock != NULL && e != NULL); MPASS(!rl_e_is_marked(rl_q_load(&e->rl_q_next))); MPASS(e->rl_q_owner == curthread); rl_e_mark(e); + sleepers = lock->sleepers; lock->sleepers = false; - sleepq_broadcast(&lock->sleepers, SLEEPQ_SLEEP, 0, 0); + if (sleepers) + sleepq_broadcast(&lock->sleepers, SLEEPQ_SLEEP, 0, 0); } void From nobody Tue Aug 6 04:06:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKW34hbTz5SbW7; Tue, 06 Aug 2024 04:06:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKW31RF7z4kbZ; Tue, 6 Aug 2024 04:06:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917199; 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=/Ar2TTZxdhSbbhnHjnbaqWozukRpB1JC2Ln/LQ6+qiQ=; b=JFu6KID0vP0cPxY4nRM9bx/q/P1h+lZee99wxarD+uj9/u1Xlfv0up53RtPLtixwK1Ciqd 2WTtvOzjsq5EApxZiqs3TK3x/bfk8rF7bUs/6kxnOnyxIDp9xnw04zjlJ+c2gnBQNJ+Q+W ousN3GeQIQRYSAuXMDCRk4tfg6X9lbobRYA8y8TlN4sjobUdWYPdQZ1WpsuWrwzMO2k/eI raN5nQYtZe2X6aL89li4AU29dvLB4dF4q8096JmnQRXYVf0NWBA7zpoz/2iXAdhEr6zQim jjJAxncmyGEWP9igXyIQ6bG5uQTaRYUM75JDCj0zyO2Hy+c6vfQS2BZRx0qObg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917199; a=rsa-sha256; cv=none; b=qZDgConPJs4Tp9I1xO+/V+JAL5/SlPTksy+ryQV5YFS0W1xY2wotbLG2C6ZxdPRKLRWx+f ETBx3fDimGqYpUicvR2ALNJ5425s0XOJOyDCF7cuyhWewskVg2xgI+ttvY4Aic0310tCTo IFxRxXk2+sedVnvgJM2idJQ3Rff6WYXRXz4fXePNlCcQ/C/bSbHk7q4dPnPD3nG4SLg+VQ O1Bum5f413fLtiQ85jwchLR0BnqK6qz/hk8FGjKmGCbKzWKoiho2wnWfeLiC+AeRuLEQVq Nh2juabvag67ghu3cZPlSo48wHGJQEkpdL0FwOg/xKz51yh+eiWksbVEZELmZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917199; 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=/Ar2TTZxdhSbbhnHjnbaqWozukRpB1JC2Ln/LQ6+qiQ=; b=Hky0euggJmKzQwSugDCaDuEyRhPqkj9JMOHaMQYj1Dhd6x/GqrGuPFU+IugSkprbIzRrzb d/S+Njxg7zf4Ao2QqmDTc0amypUWV3FzNYyT02JwpUfPG56CIbemlOHNNcSBov91flmSrE kCYEmxuXSay+A6XWHOHkX1OsanwcFr6B61COHA3KxxmALRoBJM4NUxUsDJvTn4hSjsgVQf l+42DpRZmuEms6KXrjtIgBVGIj8izzjo365noYsZYCjSTBeIqkop4nlaaiqdixE4+gs4yT GmOGN7JXuuZYCD6r9Qky5trKGD0asiQ4oZQQpYCnIc3+w9aO18m/4Lhb+H7zGQ== 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 4WdKW313r8zs7T; Tue, 6 Aug 2024 04:06: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 47646djS004712; Tue, 6 Aug 2024 04:06:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646dvJ004709; Tue, 6 Aug 2024 04:06:39 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:39 GMT Message-Id: <202408060406.47646dvJ004709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ff1ae3b3639d - main - rangelocks: restore caching of the single rl entry in the struct thread List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff1ae3b3639d39a6485cfc655bf565cd04b9caa6 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ff1ae3b3639d39a6485cfc655bf565cd04b9caa6 commit ff1ae3b3639d39a6485cfc655bf565cd04b9caa6 Author: Konstantin Belousov AuthorDate: 2023-08-23 23:29:50 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 rangelocks: restore caching of the single rl entry in the struct thread Reviewed by: markj, Olivier Certner Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 33 +++++++++++++++++++++++++++------ sys/kern/kern_thread.c | 1 + sys/sys/rangelock.h | 1 + 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index 355b2125dd9b..2f16569b19aa 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -82,8 +82,15 @@ static struct rl_q_entry * rlqentry_alloc(vm_ooffset_t start, vm_ooffset_t end, int flags) { struct rl_q_entry *e; - - e = uma_zalloc_smr(rl_entry_zone, M_WAITOK); + struct thread *td; + + td = curthread; + if (td->td_rlqe != NULL) { + e = td->td_rlqe; + td->td_rlqe = NULL; + } else { + e = uma_zalloc_smr(rl_entry_zone, M_WAITOK); + } e->rl_q_next = NULL; e->rl_q_free = NULL; e->rl_q_start = start; @@ -95,6 +102,12 @@ rlqentry_alloc(vm_ooffset_t start, vm_ooffset_t end, int flags) return (e); } +void +rangelock_entry_free(struct rl_q_entry *e) +{ + uma_zfree_smr(rl_entry_zone, e); +} + void rangelock_init(struct rangelock *lock) { @@ -106,6 +119,7 @@ void rangelock_destroy(struct rangelock *lock) { struct rl_q_entry *e, *ep; + struct thread *td; MPASS(!lock->sleepers); for (e = (struct rl_q_entry *)atomic_load_ptr(&lock->head); @@ -386,8 +400,10 @@ rangelock_lock_int(struct rangelock *lock, bool trylock, vm_ooffset_t start, vm_ooffset_t end, int locktype) { struct rl_q_entry *e, *free, *x, *xp; + struct thread *td; enum RL_INSERT_RES res; + td = curthread; for (res = RL_LOCK_RETRY; res == RL_LOCK_RETRY;) { free = NULL; e = rlqentry_alloc(start, end, locktype); @@ -401,10 +417,15 @@ rangelock_lock_int(struct rangelock *lock, bool trylock, vm_ooffset_t start, e = NULL; } for (x = free; x != NULL; x = xp) { - MPASS(!rl_e_is_marked(x)); - xp = x->rl_q_free; - MPASS(!rl_e_is_marked(xp)); - uma_zfree_smr(rl_entry_zone, x); + MPASS(!rl_e_is_marked(x)); + xp = x->rl_q_free; + MPASS(!rl_e_is_marked(xp)); + if (td->td_rlqe == NULL) { + smr_synchronize(rl_smr); + td->td_rlqe = x; + } else { + uma_zfree_smr(rl_entry_zone, x); + } } } return (e); diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index c951e7297c89..9c3694feb945 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -480,6 +480,7 @@ thread_fini(void *mem, int size) EVENTHANDLER_DIRECT_INVOKE(thread_fini, td); turnstile_free(td->td_turnstile); sleepq_free(td->td_sleepqueue); + rangelock_entry_free(td->td_rlqe); umtx_thread_fini(td); MPASS(td->td_sel == NULL); } diff --git a/sys/sys/rangelock.h b/sys/sys/rangelock.h index 310371bef879..60f394b67677 100644 --- a/sys/sys/rangelock.h +++ b/sys/sys/rangelock.h @@ -65,6 +65,7 @@ void *rangelock_wlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end); void *rangelock_trywlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end); +void rangelock_entry_free(struct rl_q_entry *e); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) void _rangelock_cookie_assert(void *cookie, int what, const char *file, int line); From nobody Tue Aug 6 04:06:40 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKW43TCHz5SbQW; Tue, 06 Aug 2024 04:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKW42GgHz4khM; Tue, 6 Aug 2024 04:06:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917200; 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=sz1cN0BeT7v/QLJtmLGlna4FEPe+VNCUXXi4zQCXzjE=; b=I9D7aQL4Wirqo1mQbD+mHaVkXnH5kKuQYY+HArhJ9WI1IYS26dhMV381fJyNZvPorKvjwp dWG2MCC4l7bJnsZLkDVB28CmBekh+WDrbBC0s07ecjnxu+PuQBxFyjJvpCQbEDFO5+N7+r Gm+kjUBbitn1WrvFr1VLSk9Ffp/AFREnvR/hVKYB2fvFh7IzLwm8y974pzjFePHwf7z3Xy 7iURIbIlWiFUTPZsE9ZVe4PsQFCEz2x5+WNyOCtxg9PDRBGxdWjuYiI7Vm30VxoyAjx+VG rKQaCndlQLoCoR1D2M23tWtmp66HlJc96LtKubg4TKHuzrjS1IGHVGRw8+ut6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917200; a=rsa-sha256; cv=none; b=PM+v1lQpZXJ/TpLBJ4G00dGTPzv/xKGSDVaxL+J1sLzFUAWWrhaOh5T8xxFfHVK2AUjoog If+nlUtTkUr7FsKGxe4VwWaedBgDB52O3CRLBGZ5XRvgrj7m3z53Dsi7f/15k55I0KKOH4 INFjSrzaEp8lWPI4nJPUtJB2JFxiNqMao9G1nTJHoUz3IY5UvJDPZfypQFh6IPlwfjHSK4 /wtU4bU1mnNwZRA3/4yvrWHXi54Jx6RJgKuQ/lWidcAv0XW5kbzpMKH4Lk5UDjiu15xHZK HCWTu8KKeYOkeZo0c2D3Upndws8Y3JJK9hLqvScyoXYmAEDe6yGu0Ehc/j3FNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917200; 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=sz1cN0BeT7v/QLJtmLGlna4FEPe+VNCUXXi4zQCXzjE=; b=tobrDwncMas62o2kRGDJqLz9lz4jlfXogOhsP/s2gVa3PjbFhlpH5sBN5pz8DOMkSpVXSr 0ieMwTiuTlXWEhwQL613u3aSPwGCIfQhJ8ZiOZUrEqSgYqUXTf7E+rDp36ksSjUYmmnZts V4/jbltxUD/77gzmiJnZR3erY1mh+tQQI/OteBKVAwklppH3UtGUbvl1JMzCDbfHFvYU8L KgvJF7NF7gHaNe8wjqrsC6xdLVveJ1RYnV4uIXZzhTjjCVGhpm+3IfTPaUdiXIInYX+f1i rJTT/RPADryWjQnzzOKt20qbvgJ1Yv3URleLZQA1uW7Se4STM39kra2w7Q4zsw== 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 4WdKW41sYBzs7V; Tue, 6 Aug 2024 04:06: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 47646exI004764; Tue, 6 Aug 2024 04:06:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646e5q004761; Tue, 6 Aug 2024 04:06:40 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:40 GMT Message-Id: <202408060406.47646e5q004761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9ef425e560a9 - main - rangelocks: add fast cheating mode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ef425e560a97cabd1862e803eeb48468f89de18 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9ef425e560a97cabd1862e803eeb48468f89de18 commit 9ef425e560a97cabd1862e803eeb48468f89de18 Author: Konstantin Belousov AuthorDate: 2023-08-24 23:16:02 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 rangelocks: add fast cheating mode Reviewed by: markj, Olivier Certner Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 239 ++++++++++++++++++++++++++++++++++++++++++++-- sys/sys/rangelock.h | 2 +- 2 files changed, 234 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index 2f16569b19aa..5ec443d3199c 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -35,9 +35,223 @@ #include #include #include +#include #include +/* + * Immediately after initialization (subject to 'rangelock_cheat' + * below), and until a request comes that conflicts with granted ones + * based on type, rangelocks serve requests in the "cheating" mode. + * In this mode, a rangelock behaves like a sxlock, as if each request + * covered the whole range of the protected object. On receiving a + * conflicting request (any request while a write request is + * effective, or any write request while some read ones are + * effective), all requests granted in "cheating" mode are drained, + * and the rangelock then switches to effectively keeping track of the + * precise range of each new request. + * + * Normal sx implementation is not used to not bloat structures (most + * important, vnodes) which embeds rangelocks. + * + * The cheating greatly helps very common pattern where file is first + * written single-threaded, and then read by many processes. + * + * Lock is in cheat mode when RL_CHEAT_CHEATING bit is set in the + * lock->head. Special cookies are returned in this mode, and + * trylocks are same as normal locks but do not drain. + */ + +static int rangelock_cheat = 1; +SYSCTL_INT(_debug, OID_AUTO, rangelock_cheat, CTLFLAG_RWTUN, + &rangelock_cheat, 0, + ""); + +#define RL_CHEAT_MASK 0x7 +#define RL_CHEAT_CHEATING 0x1 +/* #define RL_CHEAT_RLOCKED 0x0 */ +#define RL_CHEAT_WLOCKED 0x2 +#define RL_CHEAT_DRAINING 0x4 + +#define RL_CHEAT_READER 0x8 + +#define RL_RET_CHEAT_RLOCKED 0x1100 +#define RL_RET_CHEAT_WLOCKED 0x2200 + +static bool +rangelock_cheat_lock(struct rangelock *lock, int locktype, bool trylock, + void **cookie) +{ + uintptr_t v, x; + + v = (uintptr_t)atomic_load_ptr(&lock->head); + if ((v & RL_CHEAT_CHEATING) == 0) + return (false); + if ((v & RL_CHEAT_DRAINING) != 0) { +drain: + if (trylock) { + *cookie = NULL; + return (true); + } + sleepq_lock(&lock->head); +drain1: + DROP_GIANT(); + for (;;) { + v = (uintptr_t)atomic_load_ptr(&lock->head); + if ((v & RL_CHEAT_DRAINING) == 0) + break; + sleepq_add(&lock->head, NULL, "ranged1", 0, 0); + sleepq_wait(&lock->head, PRI_USER); + sleepq_lock(&lock->head); + } + sleepq_release(&lock->head); + PICKUP_GIANT(); + return (false); + } + + switch (locktype) { + case RL_LOCK_READ: + for (;;) { + if ((v & RL_CHEAT_WLOCKED) != 0) { + if (trylock) { + *cookie = NULL; + return (true); + } + x = v | RL_CHEAT_DRAINING; + sleepq_lock(&lock->head); + if (atomic_fcmpset_rel_ptr(&lock->head, &v, + x) != 0) + goto drain1; + sleepq_release(&lock->head); + /* Possibly forgive passed conflict */ + continue; + } + x = (v & ~RL_CHEAT_MASK) + RL_CHEAT_READER; + x |= RL_CHEAT_CHEATING; + if (atomic_fcmpset_acq_ptr(&lock->head, &v, x) != 0) + break; + if ((v & RL_CHEAT_CHEATING) == 0) + return (false); + if ((v & RL_CHEAT_DRAINING) != 0) + goto drain; + } + *(uintptr_t *)cookie = RL_RET_CHEAT_RLOCKED; + break; + case RL_LOCK_WRITE: + for (;;) { + if ((v & ~RL_CHEAT_MASK) >= RL_CHEAT_READER || + (v & RL_CHEAT_WLOCKED) != 0) { + if (trylock) { + *cookie = NULL; + return (true); + } + x = v | RL_CHEAT_DRAINING; + sleepq_lock(&lock->head); + if (atomic_fcmpset_rel_ptr(&lock->head, &v, + x) != 0) + goto drain1; + sleepq_release(&lock->head); + /* Possibly forgive passed conflict */ + continue; + } + x = RL_CHEAT_WLOCKED | RL_CHEAT_CHEATING; + if (atomic_fcmpset_acq_ptr(&lock->head, &v, x) != 0) + break; + if ((v & RL_CHEAT_CHEATING) == 0) + return (false); + if ((v & RL_CHEAT_DRAINING) != 0) + goto drain; + } + *(uintptr_t *)cookie = RL_RET_CHEAT_WLOCKED; + break; + default: + __assert_unreachable(); + break; + } + return (true); +} + +static bool +rangelock_cheat_unlock(struct rangelock *lock, void *cookie) +{ + uintptr_t v, x; + + v = (uintptr_t)atomic_load_ptr(&lock->head); + if ((v & RL_CHEAT_CHEATING) == 0) + return (false); + + MPASS((uintptr_t)cookie == RL_RET_CHEAT_WLOCKED || + (uintptr_t)cookie == RL_RET_CHEAT_RLOCKED); + + switch ((uintptr_t)cookie) { + case RL_RET_CHEAT_RLOCKED: + for (;;) { + MPASS((v & ~RL_CHEAT_MASK) >= RL_CHEAT_READER); + MPASS((v & RL_CHEAT_WLOCKED) == 0); + x = (v & ~RL_CHEAT_MASK) - RL_CHEAT_READER; + if ((v & RL_CHEAT_DRAINING) != 0) { + if (x != 0) { + x |= RL_CHEAT_DRAINING | + RL_CHEAT_CHEATING; + if (atomic_fcmpset_rel_ptr(&lock->head, + &v, x) != 0) + break; + } else { + sleepq_lock(&lock->head); + if (atomic_fcmpset_rel_ptr(&lock->head, + &v, x) != 0) { + sleepq_broadcast( + &lock->head, + SLEEPQ_SLEEP, 0, 0); + sleepq_release(&lock->head); + break; + } + sleepq_release(&lock->head); + } + } else { + x |= RL_CHEAT_CHEATING; + if (atomic_fcmpset_rel_ptr(&lock->head, &v, + x) != 0) + break; + } + } + break; + case RL_RET_CHEAT_WLOCKED: + for (;;) { + MPASS((v & RL_CHEAT_WLOCKED) != 0); + if ((v & RL_CHEAT_DRAINING) != 0) { + sleepq_lock(&lock->head); + atomic_store_ptr(&lock->head, 0); + sleepq_broadcast(&lock->head, + SLEEPQ_SLEEP, 0, 0); + sleepq_release(&lock->head); + break; + } else { + if (atomic_fcmpset_ptr(&lock->head, &v, + RL_CHEAT_CHEATING) != 0) + break; + } + } + break; + default: + __assert_unreachable(); + break; + } + return (true); +} + +static bool +rangelock_cheat_destroy(struct rangelock *lock) +{ + uintptr_t v; + + v = (uintptr_t)atomic_load_ptr(&lock->head); + if ((v & RL_CHEAT_CHEATING) == 0) + return (false); + MPASS(v == RL_CHEAT_CHEATING); + return (true); +} + /* * Implementation of range locks based on the paper * https://doi.org/10.1145/3342195.3387533 @@ -112,16 +326,17 @@ void rangelock_init(struct rangelock *lock) { lock->sleepers = false; - atomic_store_ptr(&lock->head, NULL); + atomic_store_ptr(&lock->head, rangelock_cheat ? RL_CHEAT_CHEATING : 0); } void rangelock_destroy(struct rangelock *lock) { struct rl_q_entry *e, *ep; - struct thread *td; MPASS(!lock->sleepers); + if (rangelock_cheat_destroy(lock)) + return; for (e = (struct rl_q_entry *)atomic_load_ptr(&lock->head); e != NULL; e = rl_e_unmark(ep)) { ep = atomic_load_ptr(&e->rl_q_next); @@ -190,6 +405,9 @@ rangelock_unlock_int(struct rangelock *lock, struct rl_q_entry *e) void rangelock_unlock(struct rangelock *lock, void *cookie) { + if (rangelock_cheat_unlock(lock, cookie)) + return; + sleepq_lock(&lock->sleepers); rangelock_unlock_int(lock, cookie); sleepq_release(&lock->sleepers); @@ -297,7 +515,7 @@ rl_w_validate(struct rangelock *lock, struct rl_q_entry *e, { struct rl_q_entry *cur, *next, **prev; - prev = &lock->head; + prev = (struct rl_q_entry **)&lock->head; cur = rl_q_load(prev); MPASS(!rl_e_is_marked(cur)); /* head is not marked */ for (;;) { @@ -337,7 +555,7 @@ rl_insert(struct rangelock *lock, struct rl_q_entry *e, bool trylock, int r; again: - prev = &lock->head; + prev = (struct rl_q_entry **)&lock->head; cur = rl_q_load(prev); if (cur == NULL && rl_q_cas(prev, NULL, e)) return (RL_LOCK_SUCCESS); @@ -401,8 +619,11 @@ rangelock_lock_int(struct rangelock *lock, bool trylock, vm_ooffset_t start, { struct rl_q_entry *e, *free, *x, *xp; struct thread *td; + void *cookie; enum RL_INSERT_RES res; + if (rangelock_cheat_lock(lock, locktype, trylock, &cookie)) + return (cookie); td = curthread; for (res = RL_LOCK_RETRY; res == RL_LOCK_RETRY;) { free = NULL; @@ -446,7 +667,7 @@ rangelock_tryrlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) void * rangelock_wlock(struct rangelock *lock, vm_ooffset_t start, vm_ooffset_t end) { - return (rangelock_lock_int(lock, true, start, end, RL_LOCK_WRITE)); + return (rangelock_lock_int(lock, false, start, end, RL_LOCK_WRITE)); } void * @@ -470,6 +691,7 @@ DB_SHOW_COMMAND(rangelock, db_show_rangelock) { struct rangelock *lock; struct rl_q_entry *e, *x; + uintptr_t v; if (!have_addr) { db_printf("show rangelock addr\n"); @@ -478,7 +700,12 @@ DB_SHOW_COMMAND(rangelock, db_show_rangelock) lock = (struct rangelock *)addr; db_printf("rangelock %p sleepers %d\n", lock, lock->sleepers); - for (e = lock->head;;) { + v = lock->head; + if ((v & RL_CHEAT_CHEATING) != 0) { + db_printf(" cheating head %#jx\n", (uintmax_t)v); + return; + } + for (e = (struct rl_q_entry *)(lock->head);;) { x = rl_e_is_marked(e) ? rl_e_unmark(e) : e; if (x == NULL) break; diff --git a/sys/sys/rangelock.h b/sys/sys/rangelock.h index 60f394b67677..127f101ddc2e 100644 --- a/sys/sys/rangelock.h +++ b/sys/sys/rangelock.h @@ -48,7 +48,7 @@ struct rl_q_entry; * owners are for read. */ struct rangelock { - struct rl_q_entry *head; + uintptr_t head; bool sleepers; }; From nobody Tue Aug 6 04:06:41 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdKW55R3xz5SbTN; Tue, 06 Aug 2024 04:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdKW53TfBz4kc0; Tue, 6 Aug 2024 04:06:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917201; 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=y1/VChQpksxCMqbm8BEkL9stqnTcEquTmvHF0Us+PHs=; b=ReV2NkZtRuSz2jtlwO6ok9JY/qtxuhtxNUicy6RHsCzPUghJdg8vNKydnO77dEtWwBXxzk +zvyglb+aM4P+cfcuHrYbO1rWB5IlnoJqnpxt0pHX0ShL83tbJeVuPJsYC78iYQdNGkkYK DEU0tmLQQ5xxP6OWzmn46mx5XqqTO88WyUuURyWAptaWo80qwqAfNyYM6w/WwoEViuQ23f qLULJFwIOsQ4X31ymzytP144qYZL0+nN0Cd+jtTfJhD8q7PaobpBUg7rUbKGLdrgYqjOui Ezp5bsiFjoWOd8Ka42Y1ycZLg6xrRSeJwgSD1MWyXZRWwHN5F0SOtWdhRU7a8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722917201; a=rsa-sha256; cv=none; b=G9lOYLO3Ewo2p3nF9EborKzsj3d4espqkYLMKFozDoRt8KG3hewN7jPVvTb0v3Uo5kOPQN 5VZ8+xF/ZrlctLQzCKGCgLMBN1Alcs+BSpO1valHZ29dw7xZ6CC2lHo+lRu/BLvkuj/UQm gzk/J8GKjMwNtMQqJ5NELcolPeavB4TH9HGTf6Gwwv2xsFe3sGJWGHOuveWlLaWXsQ09Ko jnk76cFoahAWilFTzc5O++vsvJFrK1DpbAtNLHQErNhvQqSBdgD62qUSyGnFiV8RCC6K9s +xzdWtm6irLyabTh+JuSdbV2jmh6X5pqXnHf1OAWS6UghmxV7QJSm27JP4gpQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722917201; 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=y1/VChQpksxCMqbm8BEkL9stqnTcEquTmvHF0Us+PHs=; b=OsNMIE3eW+9asjZU3jgUw5GwE6xKBVDnKfmnUBWhN6TngnYdTCi4anYwgXRFe6s4NzOuFX ewTDQTxwPapgp8PgYB1cMXGiVoM0QBob/WZffPSmLLmtCW9NxkVWRbiGURBF3NFRiQhPUS 7P22JsHlcbBPvh7BevZN0dcB9SCDpo+lZqx+AgaruAuX9oY3L34isBzvVkllOHHmb9Y8eZ rRONf9/8mAd9eDF3TgVzrgWpgHqk1XHp98Un2kFpHNGL25wpfETM0IFNya+XW7GqxWYvx4 2/yTTCuKSOOhT+rUlMk+BOw1Z9B1P8A+fnjNdB3K2j4OAVXdNyes6RkqxxNgCA== 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 4WdKW5361TzrqQ; Tue, 6 Aug 2024 04:06: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 47646fpX004812; Tue, 6 Aug 2024 04:06:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47646fP3004809; Tue, 6 Aug 2024 04:06:41 GMT (envelope-from git) Date: Tue, 6 Aug 2024 04:06:41 GMT Message-Id: <202408060406.47646fP3004809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d8a16b6a4c44 - main - kern_rangelock.c: add Foundation copyright, remove sys/cdefs.h include List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8a16b6a4c4479a50a0620136b73ed287ff29c1d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d8a16b6a4c4479a50a0620136b73ed287ff29c1d commit d8a16b6a4c4479a50a0620136b73ed287ff29c1d Author: Konstantin Belousov AuthorDate: 2023-08-30 03:43:16 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-06 04:05:58 +0000 kern_rangelock.c: add Foundation copyright, remove sys/cdefs.h include Also drop 'All rights reserved' line from my copyright. Reviewed by: markj, Olivier Certner Discussed with: emaste (whole series) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D41787 --- sys/kern/kern_rangelock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index 5ec443d3199c..89b52d2550f0 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -2,7 +2,11 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2009 Konstantin Belousov - * All rights reserved. + * Copyright (c) 2023 The FreeBSD Foundation + * + * Portions of this software were developed by + * Konstantin Belousov 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 Tue Aug 6 18:19:28 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdhR50qP0z5SPtY; Tue, 06 Aug 2024 18:19:29 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdhR45N6hz49l6; Tue, 6 Aug 2024 18:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722968368; 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=S4FsEfgIkQ99Wx9LKeTbZs3Qu5qLbqYXY6CH7BiVqwI=; b=hybQYRxBAAY6ii+pnNY2iLdtVvW8pNq7ijct5fK2suJuKhfYG1Ugmh+b/DRS1zMrhh/hsL qtJo2sb7s6NVhbsYLclj279DT/6AuoK3gzOSJbUSB67tny/x1tclDSHMHNc0CGW/FEWMQW kLLFeGmEvbL5fU1lF5QYR9kVKxWK1WAIDva3wjuL5D6rKZ4TzK29MmPMpNMS4dsdON/J3J dHPBalrSJ+8iQRA985xbnrpRiHCaf7zN8RNUwnU0pL+LiUXzYaEB31J+ZT7krGYOeuv6VB zVdbUHnDxB7lmco9LlDwkZ1+A4+ngJDZnLo63K7o75xR3za7B4NnNCmqV4fF5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722968368; a=rsa-sha256; cv=none; b=uzvIp3nxQcbp/cUGEtziuPh6uo1urMyBXvIBbJHq+KbwRhyrwVCGkHUOkY26dG7GY/+02J Hl84rNqy4Z6G+MzaCpESPHMo0DnLMDjKxDAjOp2CzKbffqRyN5eRNJ8sD8YBGOMgVpm4dJ 9jrV0SUF7w5jjuFD6WYEzzlt5WJzcJY7Onp1Q306SZauzkQcjZq1ruh7Wi0d7NetN0v5ut CNUYfgo1VtLBt8O3C47858m9Iz0zOpCRfg4aqAHAlv0pCdTNqvkXuzC4Sx3CldFDZXSi0U CWAcVF+YxFUwI664ClNZvLBdZY1rPgbo3FRkICIX5keYUHE5cCCQBfY4WA8dgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722968368; 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=S4FsEfgIkQ99Wx9LKeTbZs3Qu5qLbqYXY6CH7BiVqwI=; b=i6yZ8tnu/5Y5npWFtLtKqFXwcL77FnFT5mslqaViDy9x+/cEbXCEb8xfwdAkMVmUouEEYf TJpdSWrPsSVqXmaEGq6/N8EIzkXCrChNZcWrpwJMxTcddt56aN6XFUzHdiCBHIYxwjvqty 9NHMR6FnLae6i2RSikQWTJvCKHi8/4jKnL+3WlhZPya8aWhQgAIZ0pPOwIbbknsoQQViNy BTLDQCITDH79GXiin29tA/5YhLP9KF6a2gyPrdCU5qUKYUoG/FIEQXzGr5kSaJfTKC2rxo lmqcFJB51eVAk9Ww5pAsT1FHbYxg3PJcwEv45bNtQZgEivZ5Pyk9YU1MqLPFEA== 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 4WdhR4505pzHW0; Tue, 6 Aug 2024 18:19: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 476IJSUb044448; Tue, 6 Aug 2024 18:19:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476IJStK044445; Tue, 6 Aug 2024 18:19:28 GMT (envelope-from git) Date: Tue, 6 Aug 2024 18:19:28 GMT Message-Id: <202408061819.476IJStK044445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: b5c95c93fdd4 - main - sys/mman.h: consistently use `#define` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5c95c93fdd47c0764219b8bf293ce54369caf27 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=b5c95c93fdd47c0764219b8bf293ce54369caf27 commit b5c95c93fdd47c0764219b8bf293ce54369caf27 Author: Brooks Davis AuthorDate: 2024-08-06 18:19:09 +0000 Commit: Brooks Davis CommitDate: 2024-08-06 18:19:09 +0000 sys/mman.h: consistently use `#define` There were 12 cases of `#define` and 91 of `#define` and in some cases like msync() flags (MS_*) there wasn't consistency. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D46233 --- sys/sys/mman.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/sys/mman.h b/sys/sys/mman.h index 8feba252e2fe..6ee2d5562db1 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -30,7 +30,7 @@ */ #ifndef _SYS_MMAN_H_ -#define _SYS_MMAN_H_ +#define _SYS_MMAN_H_ #include #include @@ -39,10 +39,10 @@ /* * Inheritance for minherit() */ -#define INHERIT_SHARE 0 -#define INHERIT_COPY 1 -#define INHERIT_NONE 2 -#define INHERIT_ZERO 3 +#define INHERIT_SHARE 0 +#define INHERIT_COPY 1 +#define INHERIT_NONE 2 +#define INHERIT_ZERO 3 #endif /* @@ -118,9 +118,9 @@ * Flags provided to shm_rename */ /* Don't overwrite dest, if it exists */ -#define SHM_RENAME_NOREPLACE (1 << 0) +#define SHM_RENAME_NOREPLACE (1 << 0) /* Atomically swap src and dest */ -#define SHM_RENAME_EXCHANGE (1 << 1) +#define SHM_RENAME_EXCHANGE (1 << 1) #endif /* __BSD_VISIBLE */ @@ -128,21 +128,21 @@ /* * Process memory locking */ -#define MCL_CURRENT 0x0001 /* Lock only current memory */ -#define MCL_FUTURE 0x0002 /* Lock all future memory as well */ +#define MCL_CURRENT 0x0001 /* Lock only current memory */ +#define MCL_FUTURE 0x0002 /* Lock all future memory as well */ #endif /* * Error return from mmap() */ -#define MAP_FAILED ((void *)-1) +#define MAP_FAILED ((void *)-1) /* * msync() flags */ #define MS_SYNC 0x0000 /* msync synchronously */ -#define MS_ASYNC 0x0001 /* return immediately */ -#define MS_INVALIDATE 0x0002 /* invalidate all cached data */ +#define MS_ASYNC 0x0001 /* return immediately */ +#define MS_INVALIDATE 0x0002 /* invalidate all cached data */ /* * Advice to madvise From nobody Tue Aug 6 18:21:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdhTz6pgXz5SPyj; Tue, 06 Aug 2024 18:21:59 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdhTy2CyVz4D6Y; Tue, 6 Aug 2024 18:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722968518; 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=BdVqmjYT/e4An1GCLZLSyFjmAh23AR0AqgXI/EAJGns=; b=c8Su7a5ruHWmLl5jzEZYWVPzE9ZPHXpd4iF1pG9QJuqMMwecVAKPil+b6HGxytfKGydu86 xx2CuZGk/fGpK6XDMQMFdqIOaKmIMcm+V24bFYo0y/4iNedDdyy6mOUnemYZ/8bMo202FI CKrejfUYOhkW0kouXFUGchxV6tC+i3xNoi+pV53WQe/yGWtSJO2lPgN4Qz4D14r8GxYsgI 3tCCtR1D6vvu6XcpMK/lK7GIQe8WxxbMw2OUIrp7qn2KCMBmQIit1q7XYgBW7znA5pQAuh lS+rlddyvIpzWJP09AIh/0zesanzSQMWbOVHbQcr3L+CaA/c/QQdb8fYsud7LQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722968518; a=rsa-sha256; cv=none; b=lL/dA6YJ1bMqjaTYhOhwmGCdZoYu4Qvp7s1jxZ5FYJ0/AXhNYeHJ6AEvhx49j/yFAQNH1E I6lzd9DBqbBu9xK6h6x1AP5DOyJNV2qE+SAceA90wqZkFdPv/6f7t9c9F7K4sCmcjsk8/B IdVoUDbzp6qhUyty32bdIjRmGSww488/drzXOi4ryxTSsa124y3qp73mak7POiuR+bfy1J qQgGaFm6tJts+61lQVhCoBCymzMKQz2Kkfai32hRlS2F2LGJCqQKBadC9++fApTP2rwRtm KlR/a7RYM0AO/gcGV0/WJ0xr8N06t+wNRsj1Zh19jX772mMhfnxnDycbrpuuNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722968518; 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=BdVqmjYT/e4An1GCLZLSyFjmAh23AR0AqgXI/EAJGns=; b=lxo6r55ggwq7z8zSYoJy9QEIPOIbb8y/9GqE8PTctbSM7DsTvbtuk62rDpQLIMd9vGenfr 8waPHHTYApfjnyfKTBpBWe2AZCKe8PJGfWvQgJfqY3wq8z4Jy4OrOCVXdMYT8DMufG/dYm k5ligVx4zI/1WCE9YIFYYDk4rCVPkmpfw45wo7mZe1G7QC5Zpi711B/7IQ/TiXnSUm4qKH YyD/u/dutCVN8yHhNMvAppXnuibEUQY928rfWxpT4Dv5Hx+/T+sPdoz/Bnsh72t5cueB+g RDnwYDB28ew8Dm4qywwqnFa68A+0bq8zEplzZFGLDoVs8xbizF3S7YrAb0WSqg== 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 4WdhTy10x7zHWW; Tue, 6 Aug 2024 18:21: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 476ILwfC059157; Tue, 6 Aug 2024 18:21:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476ILwgR059154; Tue, 6 Aug 2024 18:21:58 GMT (envelope-from git) Date: Tue, 6 Aug 2024 18:21:58 GMT Message-Id: <202408061821.476ILwgR059154@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: e4d064e4a8e3 - main - sys/sys/mman.h: ignore b5c95c93fdd4 in blame List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4d064e4a8e3818c5b1d059b40bd02bc7cede05c Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=e4d064e4a8e3818c5b1d059b40bd02bc7cede05c commit e4d064e4a8e3818c5b1d059b40bd02bc7cede05c Author: Brooks Davis AuthorDate: 2024-08-06 18:21:33 +0000 Commit: Brooks Davis CommitDate: 2024-08-06 18:21:33 +0000 sys/sys/mman.h: ignore b5c95c93fdd4 in blame --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 13f8bde24bce..4764192494f0 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -8,6 +8,8 @@ # # This file is sorted in git log order (newest commits first). +# whitespace fixes in sys/mman.h +b5c95c93fdd47c0764219b8bf293ce54369caf27 # sort OptionalObsoleteFiles.inc blocks c90d0600ee000e7874a55e3015953bd670574093 2b3bf27da41f1481b2025445c6adf27f0d50de99 From nobody Tue Aug 6 19:18:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wdjkp4sgCz5STq9; Tue, 06 Aug 2024 19:18: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wdjkp4FjVz4K8J; Tue, 6 Aug 2024 19:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722971890; 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=gaODOj1WPCzjlI1maVYB5ehnYJYcBNHSJYkZRlW+15k=; b=jsRGXKFVyC62Icx9ou05sQ52pLH7gNbCLeZwnI2whpxKvr2a3HjAlmfqa8tNQW6rcwNU++ RqrsP+iCoia7h4IoRHFY8xR1C/9DqP+FtBZ4AEByLUjJ7Z0VChKav38VnHJufV3GaWfkIk oH3diLnfS96AEoOlIF/AEM14jVDRf0X+w1XmcgcWUS6UeAgx7dY09w925uGBj8sSOmqJE2 EEJJT7qdj3GMXo7oEErYrUflMSpx9gLy9U368ZArMj5TBBFbFTqafh9kBzczuJN/51tBOE kxyUeksFTFsOayx1SoGA/9SlsvIND6JdDXg1DJPTs4+F8FC+lXmEE1tszl9tFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722971890; a=rsa-sha256; cv=none; b=lMXaJBU70qDbohhiWVNlvRlleN5Pz77A4EDHl3xdgrrpnw3XjBaQbnJWHBpITj446zc/88 E1S1yxNcFE1X1/jZ6TFTSxiY7ypuVz2CEyJOsE1QchviaUSpmQrfYNFivJTuGZf/njUU3V pRssjMfArUJYxeMQB8ONaZ3yVlK59EMsWj/aV8zZAvaD/5jHKS6DpXdZZUJ8IFatLmq9S2 v5UDD/AMTqRZuc9TtUTIw/iouZWpvM+FKy6DFql/sh82sN0Tst6teVOLO9/BvQx9qETaGc tRkq19yhSnfIhPGgmeDvMqpoKhq6pB40Ocy6dKfL6MRIdVoipV/zVmDN8bkr0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722971890; 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=gaODOj1WPCzjlI1maVYB5ehnYJYcBNHSJYkZRlW+15k=; b=J058x7/ikIP+oNW2wO8I21vHbPd9+X5S9nKZbdv+qBltS2UjMtWjliGYix4lXjk2xEo4+M Sx1zI2U+hyShyUGZUKOm2L9lNBXOpIVZHCFp8RUT+JDAm/Ou71ZknZZp1Bf/O5B/uHunxK dL/02SuPlxPGFjueV7SypsMEZSf0IlnxdcfFkzFgvoBORfueI+xkunenLUJyHoD5aRIEmq X1KfBUKnUh0X+1DfC1ivsqAe70NDlxXNVznDth/OtVbDupLtEgj5NH24mBTtuol4zd6dRr xj657LYTjIWqh5esUJXf3RQFlmQjz+8zASWSuQ56UB1B6MygdaFNumGTo0Nmrg== 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 4Wdjkp3tBGzKLh; Tue, 6 Aug 2024 19:18: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 476JIAhv046773; Tue, 6 Aug 2024 19:18:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476JIAn2046770; Tue, 6 Aug 2024 19:18:10 GMT (envelope-from git) Date: Tue, 6 Aug 2024 19:18:10 GMT Message-Id: <202408061918.476JIAn2046770@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 2739a6845031 - main - sshd: remove blacklist call from grace_alarm_timer List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2739a6845031e69be7c03461a9335d8bbb9f59bd Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2739a6845031e69be7c03461a9335d8bbb9f59bd commit 2739a6845031e69be7c03461a9335d8bbb9f59bd Author: Ed Maste AuthorDate: 2024-08-01 00:04:46 +0000 Commit: Ed Maste CommitDate: 2024-08-06 19:14:00 +0000 sshd: remove blacklist call from grace_alarm_timer Under certain circumstances it may call log(3), which is not async- signal-safe. For now just remove the blacklist integration from this path, which means that blacklistd will not detect and firewall hosts that establish a connection but do nothing further. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46203 --- crypto/openssh/sshd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/crypto/openssh/sshd.c b/crypto/openssh/sshd.c index 0c83e0ea468e..889f2056bc75 100644 --- a/crypto/openssh/sshd.c +++ b/crypto/openssh/sshd.c @@ -377,8 +377,6 @@ grace_alarm_handler(int sig) kill(0, SIGTERM); } - BLACKLIST_NOTIFY(the_active_state, BLACKLIST_AUTH_FAIL, "ssh"); - /* Log error and exit. */ sigdie("Timeout before authentication for %s port %d", ssh_remote_ipaddr(the_active_state), From nobody Tue Aug 6 19:36:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wdk8D29sCz5SWxJ; Tue, 06 Aug 2024 19:36: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wdk8D1Kt0z4LjS; Tue, 6 Aug 2024 19:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722973004; 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=CrUgcXXkE7c9RDpBFTpG+dWQS/8MknWIXRZakJTq9NE=; b=q02PZGXcslNPi3Jt10KcTKJeZy0wlHf+YJRwa+NA+b+H93w/p2n7waJKVOh72ayzrofvzG p+MoCiuGZiEOdDHNWIhxhj5j4mYhhdMfW3c/ftd8Plskc4RGzfoFHU3kn+jxHIy0K6TrtK rMSQ6WFsWHLpZfxlVMbW3HZPj5fHHcGc7gyGe+6Ju3KfRppp8tOpc5leC2FZBiTpntm13R Iak/lWwMstD/cVB7NkYO9b+PV4EeqWkCNQktyD8AiIpDOacE+BXix0i+E9p1u8FJ19+/U3 7KC3nZpYr3dJgNzmZpuZU3b07ZRd5tDnm32BQuzUQ40MwArk43abIDIbyrWoZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722973004; a=rsa-sha256; cv=none; b=i7V6+m9VlyQDZLlH1kl4jAwyfKQhYhNDWv80z8vsYL6hfQ3pwB3+Tmb4AgB+Zj6cde9n6j eVXlfZSfBBP4avj9VdMJUiFs8f4I/Ty6C2AsfFMmg3Sj+3E9wr0M9WA0u3uvta9xAVP8l9 4nSrTILRbDSBVt23INVrs2FVQdb2P8mUN48VUCKlP1GCXj2IjZkSylJuSdDExa/yvWPRwk 8VQlFIMWMgRsAXEHVu7Jc5GiojGv+u1AXXMycfycNvBuINObuV+zzpgkH7kVnY/xtxa6B8 S0/bNFGYMYrkE3rD6msOzI4EnEXdTtuC7mhWCP7B4Rs+c0ObaFUbzM9N7+dgTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722973004; 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=CrUgcXXkE7c9RDpBFTpG+dWQS/8MknWIXRZakJTq9NE=; b=EwpPd1tOn+ucB59x60JLvw5lQHZD3NWWaNnJJSVH5unWJ0sy8oC/MkdtwWBQYJZ8MGUMBi WrIFINDF7edgELcifzub2pPHvznnDEwraRvN1sCwDdHUqb7bSIT1V+ySp8L2+2izHestCU LGZRyF4kfcGxXGpTF5d2M68slYu2zVcmEEGCPWJOb86RgsyEDeCDSG7dHn3pu/IhmipV8c pZC9TCQghFIcoy+jAmccMpEKap3ZdqDu0XDY/Zr5kG26ecAtR0M/uEbWSKKrwgM410dcLD 0TW/WfJhNLNA/SB4nCVQMPHM9cNxmZg8juHx7tvnMQuQROaG57ZXKQYPLjF39g== 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 4Wdk8D0t4KzKrQ; Tue, 6 Aug 2024 19:36: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 476JaiIp079405; Tue, 6 Aug 2024 19:36:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476JaiwS079402; Tue, 6 Aug 2024 19:36:44 GMT (envelope-from git) Date: Tue, 6 Aug 2024 19:36:44 GMT Message-Id: <202408061936.476JaiwS079402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 3d3bae9b9538 - main - sshd: bump VersionAddendum for 2739a6845031 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d3bae9b95388169d396adc8007585699c5a23e0 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3d3bae9b95388169d396adc8007585699c5a23e0 commit 3d3bae9b95388169d396adc8007585699c5a23e0 Author: Ed Maste AuthorDate: 2024-08-06 19:22:53 +0000 Commit: Ed Maste CommitDate: 2024-08-06 19:23:33 +0000 sshd: bump VersionAddendum for 2739a6845031 Reported by: markj Fixes: 2739a6845031 ("sshd: remove blacklist call from grace_alarm_...") Sponsored by: The FreeBSD Foundation --- crypto/openssh/sshd_config | 2 +- crypto/openssh/sshd_config.5 | 2 +- crypto/openssh/version.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/openssh/sshd_config b/crypto/openssh/sshd_config index a06f8fcc13d1..7f559775e3b3 100644 --- a/crypto/openssh/sshd_config +++ b/crypto/openssh/sshd_config @@ -105,7 +105,7 @@ AuthorizedKeysFile .ssh/authorized_keys #PermitTunnel no #ChrootDirectory none #UseBlacklist no -#VersionAddendum FreeBSD-20240318 +#VersionAddendum FreeBSD-20240806 # no default banner path #Banner none diff --git a/crypto/openssh/sshd_config.5 b/crypto/openssh/sshd_config.5 index 0715b1f9d581..4de510ac8795 100644 --- a/crypto/openssh/sshd_config.5 +++ b/crypto/openssh/sshd_config.5 @@ -1944,7 +1944,7 @@ The default is Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default is -.Qq FreeBSD-20240318 . +.Qq FreeBSD-20240806 . The value .Cm none may be used to disable this. diff --git a/crypto/openssh/version.h b/crypto/openssh/version.h index 836b5650b247..82be0be8498f 100644 --- a/crypto/openssh/version.h +++ b/crypto/openssh/version.h @@ -5,4 +5,4 @@ #define SSH_PORTABLE "p1" #define SSH_RELEASE SSH_VERSION SSH_PORTABLE -#define SSH_VERSION_FREEBSD "FreeBSD-20240701" +#define SSH_VERSION_FREEBSD "FreeBSD-20240806" From nobody Tue Aug 6 21:27:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wdmbf2gZtz5ShSY; Tue, 06 Aug 2024 21:27: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wdmbf27Mzz4Zw5; Tue, 6 Aug 2024 21:27:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722979630; 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=WYsTUcWMtkLaTQp/VDEkLy45U7t5XmhtBBrhSbisgws=; b=DnRT2Cl4ly/5FbT13qeX3/RZNr1dDVyrtOy0MHCzU5jUdrVYwp6HoZVsKo0dDrgeFfoyOn dwpSuCB3Kk8O+Iaqn9JmtuKVgdzpLnbiwvpsZP6UFrugDEbB1SQENVj+YVZzLlhRcNxWpA dvVUgofU7a/5hpbMUerDtPEAszyjOZds+/7XtjNO0muowjxwvoz2W/sKvCCjsgVr8w5Elg UR9zzsf6pCURe73SQ5fhOydZemNe6AHAZ+Fe4v50slsoILkIOfze9EyUTlxnujLHrV5E9c onAQf8ag9GumXLMMCww14BAnEZ8QVj7233rVztu3xR9Tz0EkatXu+UErPDrsUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722979630; a=rsa-sha256; cv=none; b=NVB/eX4rlB+iHk5CH6vtJj+174OnK7rVdJEgxCkry5bcRiOnRn0yxxKjhGlSvjOnKX9YKz jcw+9L4Va0xDmaFwuqbgiQkT8xULxcBWmALkXRF2a+S62SQoHah+LXqsGOkfbS+z8KyKAM nWxCdQ8S6Brrhu4+j3uyT0S2ILHA8pNxJwCUbeJeFIfA3y6CNZCMe1gg/8HOYFaRAVqCFu krC6H1N2vA4nuOFguqUAMJFGhaOmmP+00880XtwnzDVrkGVHSnN+7Ep/7dT+xEvryNwMWD G19EvIMZgW3aulIbI7uDNrN4GGGeXAnm+RrjgkRf9oC57vuEmZ6+k35b36lPjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722979630; 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=WYsTUcWMtkLaTQp/VDEkLy45U7t5XmhtBBrhSbisgws=; b=x3WtPyxlc0Uza20Cq9qhjyLU0C2i9BmWH7SeEjhNyOM44rzL7izCnc7Cl1EXcis/8nE8SD DaOGgXlACEL/vszCKEYlpAZs5riGgHEDt4Tt3aU9isW6l/2LDl9wA3qniCJyE9sYTxj1ms OZvtZF3kqev61YH3d0N2pPSXKY0LmLXVnFxggApaqZGtOMgClGn8RhzN5CM1KCtV+JQqNI +zed9pz7CKeBaSpXZDRRQfsRP6fXK6am7IHTFoWDFD+K2CfKxTgVvDcm41qkzVE1yBJoiZ yrmms5uWdlMdSvl/BCN6zW1JVVxSSgM+KVnvyVpK/INlBX5OZy3cqTKcocxTdg== 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 4Wdmbf1MFPzNF8; Tue, 6 Aug 2024 21:27: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 476LRAjC067868; Tue, 6 Aug 2024 21:27:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476LRAsH067865; Tue, 6 Aug 2024 21:27:10 GMT (envelope-from git) Date: Tue, 6 Aug 2024 21:27:10 GMT Message-Id: <202408062127.476LRAsH067865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 093d9b46f472 - main - ddb: update printing of t_flags and tflags2 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 093d9b46f4720392e53c171eaabfd7a6a8101170 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=093d9b46f4720392e53c171eaabfd7a6a8101170 commit 093d9b46f4720392e53c171eaabfd7a6a8101170 Author: Michael Tuexen AuthorDate: 2024-08-05 09:17:30 +0000 Commit: Michael Tuexen CommitDate: 2024-08-05 09:17:30 +0000 ddb: update printing of t_flags and tflags2 Update the ddb printing of t_flags and t_flags2 to the current state of definitions in tcp_var.h. Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46222 --- sys/netinet/tcp_usrreq.c | 92 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 2ff7737a573b..8326c67cf085 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -2876,6 +2876,14 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_PREVVALID", comma ? ", " : ""); comma = 1; } + if (t_flags & TF_WAKESOR) { + db_printf("%sTF_WAKESOR", comma ? ", " : ""); + comma = 1; + } + if (t_flags & TF_GPUTINPROG) { + db_printf("%sTF_GPUTINPROG", comma ? ", " : ""); + comma = 1; + } if (t_flags & TF_MORETOCOME) { db_printf("%sTF_MORETOCOME", comma ? ", " : ""); comma = 1; @@ -2896,18 +2904,10 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_FASTRECOVERY", comma ? ", " : ""); comma = 1; } - if (t_flags & TF_CONGRECOVERY) { - db_printf("%sTF_CONGRECOVERY", comma ? ", " : ""); - comma = 1; - } if (t_flags & TF_WASFRECOVERY) { db_printf("%sTF_WASFRECOVERY", comma ? ", " : ""); comma = 1; } - if (t_flags & TF_WASCRECOVERY) { - db_printf("%sTF_WASCRECOVERY", comma ? ", " : ""); - comma = 1; - } if (t_flags & TF_SIGNATURE) { db_printf("%sTF_SIGNATURE", comma ? ", " : ""); comma = 1; @@ -2920,6 +2920,30 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_TSO", comma ? ", " : ""); comma = 1; } + if (t_flags & TF_TOE) { + db_printf("%sTF_TOE", comma ? ", " : ""); + comma = 1; + } + if (t_flags & TF_CLOSED) { + db_printf("%sTF_CLOSED", comma ? ", " : ""); + comma = 1; + } + if (t_flags & TF_SENTSYN) { + db_printf("%sTF_SENTSYN", comma ? ", " : ""); + comma = 1; + } + if (t_flags & TF_LRD) { + db_printf("%sTF_LRD", comma ? ", " : ""); + comma = 1; + } + if (t_flags & TF_CONGRECOVERY) { + db_printf("%sTF_CONGRECOVERY", comma ? ", " : ""); + comma = 1; + } + if (t_flags & TF_WASCRECOVERY) { + db_printf("%sTF_WASCRECOVERY", comma ? ", " : ""); + comma = 1; + } if (t_flags & TF_FASTOPEN) { db_printf("%sTF_FASTOPEN", comma ? ", " : ""); comma = 1; @@ -2968,10 +2992,62 @@ db_print_tflags2(u_int t_flags2) db_printf("%sTF2_ACE_PERMIT", comma ? ", " : ""); comma = 1; } + if (t_flags2 & TF2_HPTS_CPU_SET) { + db_printf("%sTF2_HPTS_CPU_SET", comma ? ", " : ""); + comma = 1; + } if (t_flags2 & TF2_FBYTES_COMPLETE) { db_printf("%sTF2_FBYTES_COMPLETE", comma ? ", " : ""); comma = 1; } + if (t_flags2 & TF2_ECN_USE_ECT1) { + db_printf("%sTF2_ECN_USE_ECT1", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_TCP_ACCOUNTING) { + db_printf("%sTF2_TCP_ACCOUNTING", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_HPTS_CALLS) { + db_printf("%sTF2_HPTS_CALLS", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_MBUF_L_ACKS) { + db_printf("%sTF2_MBUF_L_ACKS", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_MBUF_ACKCMP) { + db_printf("%sTF2_MBUF_ACKCMP", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_SUPPORTS_MBUFQ) { + db_printf("%sTF2_SUPPORTS_MBUFQ", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_MBUF_QUEUE_READY) { + db_printf("%sTF2_MBUF_QUEUE_READY", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_DONT_SACK_QUEUE) { + db_printf("%sTF2_DONT_SACK_QUEUE", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_CANNOT_DO_ECN) { + db_printf("%sTF2_CANNOT_DO_ECN", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_PROC_SACK_PROHIBIT) { + db_printf("%sTF2_PROC_SACK_PROHIBIT", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_IPSEC_TSO) { + db_printf("%sTF2_IPSEC_TSO", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_NO_ISS_CHECK) { + db_printf("%sTF2_NO_ISS_CHECK", comma ? ", " : ""); + comma = 1; + } } static void From nobody Tue Aug 6 23:30:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdqKw14D5z5S8P2; Tue, 06 Aug 2024 23:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdqKw0W3tz4mV0; Tue, 6 Aug 2024 23:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987028; 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=wOQ59n7MkKwQFHSJm1unAn0QvhQkvzx+3eKELbBmtHU=; b=IexS3mzFcEJ4MKu7e56/QYDBtEhMfOW7zF1JyC1O88MRJc7n5qBSpdTLLP1Qyq6DFIiwB8 fwMQSh0SDzqEb38wClISLEB874VqrFvUj6NROE+q1+qopV8CxoWVneNaDhwLDY5Sz7iz7r V6wb4rpMqfmtDvUQbeuvcHFvKUxJ4vfdgC2ccOdoVCkJ/d6M9ssUymaQ1sm/JX3ZG6b9Y2 jZDKQVlG25uW1AmyWyunbwtu017ND+gvU2jhOimLTF5qfC6x4PocecxtVY5sf4AAn2eZ0U tZtyWD9OcgUV0zoKBwv142GRjMHmndoo/+QkjMUWRWJKXmFwT2CRaB4fIjHxBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987028; a=rsa-sha256; cv=none; b=ENsOqjD+yITlF0KX1af22pmlyjOgZ6C/fv1Ld/CugWdAwxET1FIelqkpModGyc6ckWr7/h HEH9BtN0/RIz0Y+qcAiVLbpBNy6K3qd6FyTzet9c6K17ifWD5oo3dxkQYn05wW+iqGnfR0 uk2k+CxpAmVXwaFXsqM75EVD4syNJhqZrhbAn+oyjWyXKlIhifbJejW0SvuFvb7q8uqBgP B2h9lkPsxf/onJCS9/kLBsWNZVtQjbzl6oAvVLSmFIsIiL/kh6/sIHH+u2firLm+PSNA6n QjX73l0uONu0PgK9jAV6omOAPoIrozGmbtaqGE07Bv4FEaLzXXmhFIg2sqNvPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987028; 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=wOQ59n7MkKwQFHSJm1unAn0QvhQkvzx+3eKELbBmtHU=; b=iscg8IHxmYwiwzY3MGK3zLzc2KcrxvnsTX6oShtcQmTIX1jfLDiEpYerLddjiB90W9VC8u OILn/S3Y5zDnK0FwQ8JFT+HPHCp7WZR32TdiL7ZfkhAWlTlIoHyoumNZP6p18T0LRotxuX qeqb00ylVqTWoc6mEgc0rL6eVTV55bdp1GWSd1VcsoYrOLEz36eVYP6FfuyAuEhsDausaB Py1whN/TSiwu1SvuJtf/6cnTAE8wOBzafh+i3aZ/K+7nt5WbJzfZ2vjd7solRA7Fe2T0Xv 90de0RNUUri/+9yzOQ7R1S9qiGnIHdGnTkeOxhn9GqgEYQBeNEjemeS4sz+gfQ== 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 4WdqKw00SbzRTW; Tue, 6 Aug 2024 23:30: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 476NURBN080791; Tue, 6 Aug 2024 23:30:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476NURrx080788; Tue, 6 Aug 2024 23:30:27 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:30:27 GMT Message-Id: <202408062330.476NURrx080788@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7ee781e2bfc2 - main - loader: Document that WITH_BEARSSL may need other tweaks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ee781e2bfc2558060dec95564414a0bff4415c1 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ee781e2bfc2558060dec95564414a0bff4415c1 commit 7ee781e2bfc2558060dec95564414a0bff4415c1 Author: Warner Losh AuthorDate: 2024-08-05 21:16:37 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:22:36 +0000 loader: Document that WITH_BEARSSL may need other tweaks /boot/loader is right up aginst the 500k limit we have to make sure everything works in a wide variety of environments. However, adding WITH_BEARSSL can push it over the edge since we are so close to the limit with it enabled. One may also need to increase LOADERSIZE when enabling it. It's often safe to go much higher, especially when you don't plan on using pxeldr. Document this trade off here. MFC After: 3 days Sponsored by: Netflix Reviewed by: sjg, markj Differential Revision: https://reviews.freebsd.org/D46211 --- tools/build/options/WITH_BEARSSL | 19 +++++++++++++++++++ tools/build/options/WITH_LOADER_VERIEXEC | 2 ++ 2 files changed, 21 insertions(+) diff --git a/tools/build/options/WITH_BEARSSL b/tools/build/options/WITH_BEARSSL index 6a4447d723ed..9dcebbf1ae30 100644 --- a/tools/build/options/WITH_BEARSSL +++ b/tools/build/options/WITH_BEARSSL @@ -8,3 +8,22 @@ This library is currently only used to perform signature verification and related operations for Verified Exec and .Xr loader 8 . +.Pp +Due to size constraints, one may need to set +.Va LOADERSIZE +larger than the +default 500000, although often loader is under the 500k limit even with +this option. +Setting +.Va LOADERSIZE +larger than 500000 may cause +.Xr pxeboot 8 +to be too large to work. +Careful testing of the loader in the target environment when built with a larger +limit to establish safe limits is critical because different BIOS environments +reserve differing amounts of the low 640k space, making a precise limit for +everybody impossible. +.Pp +See also +.Va WITH_LOADER_PXEBOOT +for other considerations. diff --git a/tools/build/options/WITH_LOADER_VERIEXEC b/tools/build/options/WITH_LOADER_VERIEXEC index a50ff9a317e6..d784df968949 100644 --- a/tools/build/options/WITH_LOADER_VERIEXEC +++ b/tools/build/options/WITH_LOADER_VERIEXEC @@ -4,3 +4,5 @@ with support for verification similar to Verified Exec. .Pp Depends on .Va WITH_BEARSSL . +May require a larger +.Va LOADERSIZE . From nobody Tue Aug 6 23:30:28 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdqKx1cFFz5S8Yx; Tue, 06 Aug 2024 23:30:29 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdqKx1190z4mQ1; Tue, 6 Aug 2024 23:30:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987029; 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=NL/u5B/lqaQQgEPDkQEkqaoN7benN/pglHxjMtH4AM8=; b=OvCz0Ws7cwOqvtVagWWoKUGLm7kVBz0GQPC/gfSv5ZDOXGT2J32vcuafTVfEzxtaC6polK QIDBWDDHwlnCTu7Q5WXW7fcrmRNPrj2LwEE/OF+weWmG2XZ4LSsfMNeKJ7bjIDrB3jyLzk hju/FvEd9xiZiDkSwl2u+pl7rEanqZ9hmVrmWvm7r56zK051qiqoFkbCfoidQH6366fbuJ TN9+x7dOS/I0wZzIvczBYQ8N/9fK3ZGO2ezUN6gpbs2el9uLjxZFQZ9ivcBx0/3v5dT1/N bZTn+uJE/Qmk/Oe8ozLT0bxkzWmsbN624MT6PRFKSksHWp+QX0gy4UvhOVumAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987029; a=rsa-sha256; cv=none; b=nbr6T31tGUDdZixXIetM3dYkSFMra3mvqXg6XQIivoS/60EF1L12sIDDxIKioMAwKA8P+x NsgHqPC/fUaKLUOMTa73Q/ThdY4hhJ0YdXChwuYoFf5S0EsUxTb0P97ZLPEV0I1NS6/EUB zRSWwmsPHWuXIZcj4gNfqO2nX6nysS3J6KzMMwp9YFun7mw4V6jjyC6UsNpLHU7jhYf0zX DwvLes7STbC8RZ8LKwy7fRrRT8eEU1poay5vEP7PacoisMWKTcken3b9pcO+NMrijXDJ16 xK7HjfhrGExChumiDzEe3u0P35Sgn+3R2g067F2T+hQHyp/umokl1ocn7XKuAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987029; 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=NL/u5B/lqaQQgEPDkQEkqaoN7benN/pglHxjMtH4AM8=; b=tNGdmIw7Pbn1BAxpXq2yIVZcYba2oXUh5+qTZt9/RzolzkLkgtncnP68hFdwgiVUlRg+ha VDK4kRHYX9XyYWD4WxZa+kvxbJ45fhh6fzA2XYVtP4YZSkryGv4uhE+nNyRBUmrf1Eh2au AYKAdLaNxPSM+ZicRcYBprh4XgdYZ7ARW/WelQHL1cZnRQVpC+5wTFoGpe2VoCH4GR2OHs MQbtnLnseeftsAKhuB6MjwK5dN168UOnrGGLXXCzBbi09Hm9qojETedA7GhLwbKl3qgaCK 8ss1Okkmcv4AXp1UFLXMIJ42C1K9Byhgbo8JIqmWbSORh6SUFRVd/fxXiQKv6Q== 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 4WdqKx0dYlzRht; Tue, 6 Aug 2024 23:30: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 476NUS24080834; Tue, 6 Aug 2024 23:30:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476NUSJl080831; Tue, 6 Aug 2024 23:30:28 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:30:28 GMT Message-Id: <202408062330.476NUSJl080831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 20d35d581785 - main - loader: Add WITH/WITHOUT_LOADER_PXEBOOT build option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20d35d5817851df3a6d20e75df2e14a192b94940 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=20d35d5817851df3a6d20e75df2e14a192b94940 commit 20d35d5817851df3a6d20e75df2e14a192b94940 Author: Warner Losh AuthorDate: 2024-08-05 21:19:21 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:22:36 +0000 loader: Add WITH/WITHOUT_LOADER_PXEBOOT build option Make it possible to disable pxeboot. This loader will fail to build when it's too large. When /boot/loader needs to be larger like that, this options will disable a component whose build will fail. It is an explicit option rather than implicit when things are too large to force the user to make the explicit tradeoffs rather than wonder why they have a stale pxeboot or other odd failure mode. MFC After: 3 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D46212 --- share/mk/src.opts.mk | 1 + stand/i386/Makefile | 2 +- tools/build/options/WITHOUT_LOADER_PXEBOOT | 10 ++++++++++ tools/build/options/WITH_LOADER_PXEBOOT | 25 +++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index d7e246d10396..c10598246639 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -130,6 +130,7 @@ __DEFAULT_YES_OPTIONS = \ LOADER_KBOOT \ LOADER_LUA \ LOADER_OFW \ + LOADER_PXEBOOT \ LOADER_UBOOT \ LOCALES \ LOCATE \ diff --git a/stand/i386/Makefile b/stand/i386/Makefile index a08e956ef4f9..f9aedcc3a008 100644 --- a/stand/i386/Makefile +++ b/stand/i386/Makefile @@ -16,7 +16,7 @@ SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.yes+= loader_simp # special boot programs, 'self-extracting boot2+loader' -SUBDIR.yes+= pxeldr +SUBDIR.${MK_LOADER_PXEBOOT}+= pxeldr SUBDIR.${MK_LOADER_ZFS}+= zfsboot gptzfsboot diff --git a/tools/build/options/WITHOUT_LOADER_PXEBOOT b/tools/build/options/WITHOUT_LOADER_PXEBOOT new file mode 100644 index 000000000000..e6b09381884e --- /dev/null +++ b/tools/build/options/WITHOUT_LOADER_PXEBOOT @@ -0,0 +1,10 @@ +Do not build pxeboot on i386/amd64. +When the pxeboot is too large, or unneeded, it may be disabled with this option. +See +.Va WITH_LOADER_PXEBOOT +for how to adjust the defaults when you need both a larger +.Pa /boot/loader +and +.Pa /boot/pxeboot +.Pp +This option only has an effect on x86. diff --git a/tools/build/options/WITH_LOADER_PXEBOOT b/tools/build/options/WITH_LOADER_PXEBOOT new file mode 100644 index 000000000000..01d4a0b86a66 --- /dev/null +++ b/tools/build/options/WITH_LOADER_PXEBOOT @@ -0,0 +1,25 @@ +Build pxeboot on i386/amd64. +The PXE Boot loader package needs more space than we may have in the boot loader. +If you need to increase +.Va LOADERSIZE +beyond 500000, then building +.Xr pxeboot 8 +will fail. +To allow a larger +.Va LOADERSIZE +for some environments, it may be necessary to disable pxeboot builds or adjust +its defaults. +You can set the default loader for pxeboot to use independently of the system +default by setting +.Va PXEBOOT_DEFAULT_INTERP +to one of +.Dq lua , +.Dq 4th , +or +.Dq simp . +The limit on the size of the loader used for +.Xr pxeboot 8 +can be set independently with +.Va PXEBOOTSIZE . +.Pp +This option only has an effect on x86. From nobody Tue Aug 6 23:30:30 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdqKy3Rswz5S8Sm; Tue, 06 Aug 2024 23:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdqKy21h3z4m9X; Tue, 6 Aug 2024 23:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987030; 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=Spwqf3ZxdWBZJAMmBo6pIU0nqsQd7DOvY8xA/YK7W5M=; b=ES/dC/WMR5iB61oGVTyAK5d9OdExA60D0l8X1+3dxZyg1k6rEKXqE2sQLbG/N6hXusunN+ Bh5oI2Gtf6x9yJclOY1quWIRQnbX9pYxIEumEKBUSRF/f4Y3RiakM3TR1k6ONx2x6A5yb9 7TPG6dBFFb8CxUj8CLnakOjIK4UkNYOOlu6Dm+qzkPXNmi/9B5yY4WZeMgDf58/LjbvU7j C+2/nyMPZ6277ndi1/PP0IaQKT+N9UlFLlFnDI4OGz10khiv5AqzPlCkcTlehdafYy3Qat TBuroP4cBEa3LLdcLjaPUx0xSupDVNdwb9pvdg+4cId3qqdlY250FphtvuG+aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987030; a=rsa-sha256; cv=none; b=Tk5HRFhTaY93EshtFGZd/TnULMwiAv3xIcS7vwrO1EKYwf1tNkB0NvCwTN7Xs0nXhW4q1o AklGJVmgXjeXyRAq0eBwpI01xyQyw7/QA2ffCKH7q05vkgCQkdHMLyd0t8mVEimIh7MRL7 p82dN2lHFxq+n8Tb5NQiIFJCwTTzG0OCjeV0sSeNNcMrAqhzw+rzI67SJBJ3dJmppQ2Z5C ImnLEqWiLl4ohqEzZxv6b/0AThaN0JUnwf64afSxr+hu9GET8t6jjE/SuEgJatfzrjS8et OU5/uqZ8ARpskvVRVXYqPydMXeA4ND+uBhxLPAOQGzlzthR7RLi4P0cqTPqiGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987030; 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=Spwqf3ZxdWBZJAMmBo6pIU0nqsQd7DOvY8xA/YK7W5M=; b=rYS/5Z+Go61g2Etm1fBnHMSQa3bwSc5//d+0puzshcLf9S4Pz0VW2Xs3HeQPv/fdk85yJ2 dx/r11UqSujGlvMUQdYvKap4yK0/DBOBLObBfM9b3uc73039AxkmjYhtwRhTvYNosjLm// lhZgOpV4EbuLwnmZvGfbWA4Oe7swYCDMKo5s9hLivOGW1PbJ8NjKmw02bvegWZvHvUoWmq aIG+1FbGUpaLdIHl7D79xJSzKb/d9epe5sBWzdUIqrhCCzllUkIDtDyjwSFq1TnVFFS2cQ olSepJkb2teHDTW0AxMAZAzVkgxB/vSf4nKnrfDOrAgXhXDT8BbwJAgR/mi28w== 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 4WdqKy1HbQzRQw; Tue, 6 Aug 2024 23:30: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 476NUU7F080885; Tue, 6 Aug 2024 23:30:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476NUUmQ080882; Tue, 6 Aug 2024 23:30:30 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:30:30 GMT Message-Id: <202408062330.476NUUmQ080882@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f4762e9135d1 - main - pxeboot: Allow a different default loader for pxeboot List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4762e9135d181f5d4f2a9d688ff803ee53ad808 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4762e9135d181f5d4f2a9d688ff803ee53ad808 commit f4762e9135d181f5d4f2a9d688ff803ee53ad808 Author: Warner Losh AuthorDate: 2024-08-05 21:19:29 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:22:36 +0000 pxeboot: Allow a different default loader for pxeboot Sometimes you need / want a different boot loader than loader_lua for pkeldr. Provide an option to get either the 4th one or the simp one. MFC After: 3 days Sponsored by: Netflix Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46213 --- stand/i386/Makefile | 7 ++++++- stand/i386/pxeldr/Makefile | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/stand/i386/Makefile b/stand/i386/Makefile index f9aedcc3a008..768496598575 100644 --- a/stand/i386/Makefile +++ b/stand/i386/Makefile @@ -20,6 +20,11 @@ SUBDIR.${MK_LOADER_PXEBOOT}+= pxeldr SUBDIR.${MK_LOADER_ZFS}+= zfsboot gptzfsboot -SUBDIR_DEPEND_pxeldr+= loader_${LOADER_DEFAULT_INTERP} +.if defined(PXEBOOT_DEFAULT_INTERP) +L=${PXEBOOT_DEFAULT_INTERP} +.else +L=${LOADER_DEFAULT_INTERP} +.endif +SUBDIR_DEPEND_pxeldr+= loader_${L} .include diff --git a/stand/i386/pxeldr/Makefile b/stand/i386/pxeldr/Makefile index a303aff413a8..bec2a27af47a 100644 --- a/stand/i386/pxeldr/Makefile +++ b/stand/i386/pxeldr/Makefile @@ -22,7 +22,11 @@ CFLAGS+=-DALWAYS_SERIAL CFLAGS+=-I${BOOTSRC}/i386/common +.if defined(PXEBOOT_DEFAULT_INTERP) +L=${PXEBOOT_DEFAULT_INTERP} +.else L=${LOADER_DEFAULT_INTERP} +.endif LOADERBIN= ${BOOTOBJ}/i386/loader_${L}/loader_${L}.bin CLEANFILES+= ${BOOT}.tmp From nobody Tue Aug 6 23:30:31 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdqKz4GpLz5S8Yy; Tue, 06 Aug 2024 23:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdqKz2GQhz4mVH; Tue, 6 Aug 2024 23:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987031; 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=P3U//pV7t5XnGOaO2gUaQjA48lLQwaedNPJRi0vfRc0=; b=Y8oJaQpUxv4tqOopY6qzHXWb3wqfqnSZcxB0LhU+oE56hPQbPQSGmZAdhEi1EVZA+5ZkmY fkDBhBpPfGIV9EsfYi9JfMpzNgeutl+Rfy2y2QRtTBu0MVxXknH9cgj+LraN1iSNJQSJiA 51ARJfDIngiQntYXO4x1kZPngH5G3eKDupiGf/TatlWLIKirgB4zSVpyV6uGyumTMCizV/ fcGS9NP15XBvjzE6HbLY9i85Pw28k6vTsIfdcPUCLVyw6ShuwPuoGOekYOc34M0YNSc67B HZ2x0VvL0rs9AY1ALV9d5oJBX8UcCxef93ZoVy4N9/+uMOtgfRbWCO2Wp2LTyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987031; a=rsa-sha256; cv=none; b=EtN4uuR3GzeyIPmz8WfDr30myIaGcum5P3mWrUyYwKjMyLJtoMGwKX9kPobSe0rneKK2tO SzJIGqUVc0kQO0X/hDURUXRWE5ocGm40DGNNx9vBd/jqh+I4vqTcGx8J0cU+v05yRslSgV xshWMddKbwxxxmN4C7RNn1vxpoVYx2CaPArl2YrPkoOZROlLCBXLZ+sQ+/kosJL07p9doU qHS0YsKeOfviHtJtXe9d4niVrj0mARVxzVRe5JTcXFFc0JB/zmC5CiXz5RhViVDpvaefpe CWpY8BXWZiNyG80CoV7o7J/f4KuUdgMxeaiZCPuQEqDcytmQPfuv9xiRV/qorw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987031; 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=P3U//pV7t5XnGOaO2gUaQjA48lLQwaedNPJRi0vfRc0=; b=uAkV9vQ/KdZFWWHopL0kEAp4QN6MXDTG/VSZe44+w9q7BmZVFLSzPJ5Kr9awxOu6Kd9LRY 7oXSO9fZeDZdTMwaFEypSS9ec/5qOskfB/yVr5xfMAdFOkbcK5HgIDO2RuoHfG/L/borBE FxcYVHvUlRm6knt67LLwq03fjNp4gGWZJmWyHT5qp00ozcknakgfdEsnJdfR5EDiaA6jG6 IS+uavk7D1Piq/L+Crui+F+4wAxx18UDLvzsKDfzdpf80Vjc8uZy5/GUhQGNE7lsb494C9 k0dxsKTp95sf0cwN2ATQ6hMo9ZkrpupPJFxOSvlb3k1yzi3yrPdSY4shEzE5iA== 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 4WdqKz1tT4zRhv; Tue, 6 Aug 2024 23:30: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 476NUVIo081026; Tue, 6 Aug 2024 23:30:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476NUVR6081013; Tue, 6 Aug 2024 23:30:31 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:30:31 GMT Message-Id: <202408062330.476NUVR6081013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e1a6d93155ce - main - pxeboot: Enforce a 500k limit here List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1a6d93155cea7fbb038dee671ecf005c4846fd3 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e1a6d93155cea7fbb038dee671ecf005c4846fd3 commit e1a6d93155cea7fbb038dee671ecf005c4846fd3 Author: Warner Losh AuthorDate: 2024-08-05 21:19:36 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:22:36 +0000 pxeboot: Enforce a 500k limit here Have a separate PXEBOOTSIZE variable that acts much like LOADERSIZE variable to limit the size of the loader used for pxeldr. This allows people to override it independently of LOADERSIZE, which they may need to set larger for other reasons. Combined with PXEBOOT_DEFAULT_INTERP, you can build a larger lua loader, while still being able to build pxeldr with the 4th one, for example. MFC After: 3 days Sponsored by: Netflix Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46214 --- stand/i386/pxeldr/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stand/i386/pxeldr/Makefile b/stand/i386/pxeldr/Makefile index bec2a27af47a..715a13f19e6f 100644 --- a/stand/i386/pxeldr/Makefile +++ b/stand/i386/pxeldr/Makefile @@ -28,6 +28,12 @@ L=${PXEBOOT_DEFAULT_INTERP} L=${LOADER_DEFAULT_INTERP} .endif LOADERBIN= ${BOOTOBJ}/i386/loader_${L}/loader_${L}.bin +# pxeboot runs in an environment where there's 500k or less of space available +# due to space for packet buffers, network drivers, etc. While some environments +# may have a bit more, the limit of 500,000 (488k) provides enough margin to +# work in a huge array of environments. Larger values may work for specific +# environments. +PXEBOOTSIZE?=500000 CLEANFILES+= ${BOOT}.tmp @@ -43,6 +49,8 @@ CLEANFILES+= ${LOADER} # Note: pxeldr.S assumes a.out and will require changes for ELF if the output # format is changed to ELF. ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN} + @set -- `ls -l ${LOADERBIN}` ; x=$$((${PXEBOOTSIZE}-$$5)); \ + echo "$$x bytes available"; test $$x -ge 0 btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADERBIN} From nobody Tue Aug 6 23:30:32 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdqL05Ffjz5S8WN; Tue, 06 Aug 2024 23:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdqL030mBz4mjd; Tue, 6 Aug 2024 23:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987032; 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=hXB6UZrl1ndSYWFvV/9oAWKDYVaLPf54V+qHK/AfB1k=; b=lkAOMr0SrS01X3hEflKODhPII24iyr80WDmCCf5DFZOjrcyy5C9nwTo+hZatZSF/Vpbapx 6xzIgP6V08NgBKR1VVFIyEW/UTh5N+3qvXhoHt+2b0yRRrVhNPUqN3w6g0lZDUZQhvE6fE xzifm1egsXks+VpdrPPi0SFtf5AgbXZvdnH36Pe11DoYGru499444WyNZ3qTeKZCyqcZsY RYKEDC23CeZ9RjFCgYuySbcCEaAZFblmnxxTtK+yS8QvNFEyw2x30C9dg64asltLE6XjmR Dzyotzyz95rBOeYPmcC2bEzAQ69p4ySiFY9WV731UeHx7/fAVTSwF56RiMMnlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987032; a=rsa-sha256; cv=none; b=VQlP5ysOxTwvTcvGUNkk237P9T/tzpagKPAu9o71SWPxf27EfErUL9xIOirRX6gE7Wk7Lx vVf+zmVBjs03788xgjIuO+P9Vu60EK4voYxomkXPZH0C/GFWYdoyBmH7s2Brnv70d3dInS tM8prv5YXm4HaRhN2f0sX6xxcUZXxuZ4jsCKZrPuUg4r/WMzuveLVzO1O10DhaMk04YqnF bH2GWvYtlyTwVcnzbJ2slwsfU2A8JEDEse8EuOl6VXpT5Iiz8ddlnGzNa/QY+U5zAspDS9 T3BUTiCGguXMQkys5Css6ycwGFufzgC8g0WMmLOraXbtNqR/4VgcPpTrUZ64Jw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987032; 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=hXB6UZrl1ndSYWFvV/9oAWKDYVaLPf54V+qHK/AfB1k=; b=KQuSv9UXMTvoA2ZDYR9It1vJC8E6QckhETPiF+vUuy0Om9PaPhOBJfxKM3SPpu6Yooorvm HN2iiVlz4FEVSpp5ACfAIH+9bR1YYFgDFxUSSPEpSsThl0cA64VP0eqCOm0Ad6hD2FwtjJ DR9jX4mluqVQYVfdN4bEbRLtaw+4Jnme4a3OyauTDewV3jQfB+mhD0m1muh7WxtU3ISFvq lK96gaZnwxN17MJdFrrZjlZ5qLHGQzM6fTNYxLKaQPWe/Xx1rdAb+EfIq8/4q/j3jwr2KK NN8n3kz5xCfx8TLJrMHupDdTP0GNH2hYQpyu3KlIJ+xLlulEFuiauggO4rbwuw== 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 4WdqL02VhlzQnn; Tue, 6 Aug 2024 23:30: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 476NUWQj081902; Tue, 6 Aug 2024 23:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476NUWsZ081899; Tue, 6 Aug 2024 23:30:32 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:30:32 GMT Message-Id: <202408062330.476NUWsZ081899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ddcd3b606c9d - main - tsc: Fix comment. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddcd3b606c9dfbc361c4067b6ff2c9af961a81a6 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ddcd3b606c9dfbc361c4067b6ff2c9af961a81a6 commit ddcd3b606c9dfbc361c4067b6ff2c9af961a81a6 Author: Warner Losh AuthorDate: 2024-08-06 23:21:33 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:22:36 +0000 tsc: Fix comment. We do the calibration in tsc_calibrate(), not tsc_calib(). Sponsored by: Netflix --- sys/x86/x86/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 4edaa37d9b54..a1a5d8140b14 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -420,7 +420,7 @@ probe_tsc_freq_late(void) } else { /* * Calibrate against a timecounter or the 8254 PIT. This - * estimate will be refined later in tsc_calib(). + * estimate will be refined later in tsc_calibrate(). */ tsc_freq_tc(&tsc_freq); if (bootverbose) From nobody Tue Aug 6 23:35:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdqS41Mx7z5S8sp for ; Tue, 06 Aug 2024 23:35:48 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 4WdqS34gx5z4p7l for ; Tue, 6 Aug 2024 23:35:47 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-36bb2047bf4so631844f8f.2 for ; Tue, 06 Aug 2024 16:35:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722987346; x=1723592146; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6qWahXMh70rKGWkCfEJis9fvLl8RLixQcSh4kcqOVfU=; b=eJlqDu+ueYzlEFtrAvXA8Pd0P8S9y64FarNR12GevtCcSUMyHreGpIpmRmNNkPDs6u x/rk941D2BYb3wbpsWadQwOE+3hCz9Hvy1hQ08o2bRSu7/dQtbptHfSSvqVOl67989p9 XiSTdA+vm3WvsTLCm1iyvFeWPMAisHzN0DFHji0s3XLQhhvSMZ7s5h9VD+CbjiUAQuZK 38RvyXk2Q3tolGaiTBW/veS/N7y5+F8bLdkY/8ORKD188B6QugWJd/VT9KS8xq5b18by m4fv9gQYneZ06WhjQMraE8CqaDcu2ZayTXPhNXG/XgxxLoHRGDY+zRpqvXQGsxEiVzaU 2CCA== X-Forwarded-Encrypted: i=1; AJvYcCVa4mLqtcRqTgYM8f93OhnjfZ+mgUAc9phdk55n1I148UM7Wy9lS5Zi3KLB+3vajO7LnM/dwkRkuzpgaFsF6mrLUR+ddsyMbsUtvLM+cUS9cw== X-Gm-Message-State: AOJu0YwZrVgNj60lHtiqbMBbOqxeRehA7/RUEnjAbHXlUp+XfFTHIBHK 8ZplxYBV/DjhJ/Aag0jq0fjPgNNODpZ7sMxhnMIxFsrRTTi/jL1ZzYd3QEJk7muM1hDHRZqu1BL p X-Google-Smtp-Source: AGHT+IHrJ5PTfs/J5gtizmK6cma9cNdHz8w3cOi3Z8a2W9OMTtOt5rDuVY41m3vCJuvm3yzhYVJibQ== X-Received: by 2002:adf:e98a:0:b0:368:3751:de3 with SMTP id ffacd0b85a97d-36bbc10d051mr10405598f8f.31.1722987345287; Tue, 06 Aug 2024 16:35:45 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd169697sm14181576f8f.107.2024.08.06.16.35.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2024 16:35:44 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: git: 7ee781e2bfc2 - main - loader: Document that WITH_BEARSSL may need other tweaks From: Jessica Clarke In-Reply-To: <202408062330.476NURrx080788@gitrepo.freebsd.org> Date: Wed, 7 Aug 2024 00:35:34 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <71670C64-CE80-47B1-809D-AFACA9C3E8FF@freebsd.org> References: <202408062330.476NURrx080788@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3776.700.51) 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] X-Rspamd-Queue-Id: 4WdqS34gx5z4p7l On 7 Aug 2024, at 00:30, Warner Losh wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D7ee781e2bfc2558060dec95564414a0b= ff4415c1 >=20 > commit 7ee781e2bfc2558060dec95564414a0bff4415c1 > Author: Warner Losh > AuthorDate: 2024-08-05 21:16:37 +0000 > Commit: Warner Losh > CommitDate: 2024-08-06 23:22:36 +0000 >=20 > loader: Document that WITH_BEARSSL may need other tweaks >=20 > /boot/loader is right up aginst the 500k limit we have to make sure > everything works in a wide variety of environments. However, adding > WITH_BEARSSL can push it over the edge since we are so close to the > limit with it enabled. One may also need to increase LOADERSIZE = when > enabling it. It's often safe to go much higher, especially when you > don't plan on using pxeldr. Document this trade off here. Can you please mention i386/amd64/x86/whatever and BIOS up front in the descriptions here? As it stands it reads like a lot of historic FreeBSD documentation that assumes you=E2=80=99re dealing with x86 + BIOS. Jess > MFC After: 3 days > Sponsored by: Netflix > Reviewed by: sjg, markj > Differential Revision: https://reviews.freebsd.org/D46211 > --- > tools/build/options/WITH_BEARSSL | 19 +++++++++++++++++++ > tools/build/options/WITH_LOADER_VERIEXEC | 2 ++ > 2 files changed, 21 insertions(+) >=20 > diff --git a/tools/build/options/WITH_BEARSSL = b/tools/build/options/WITH_BEARSSL > index 6a4447d723ed..9dcebbf1ae30 100644 > --- a/tools/build/options/WITH_BEARSSL > +++ b/tools/build/options/WITH_BEARSSL > @@ -8,3 +8,22 @@ This library is currently only used to perform > signature verification and related operations > for Verified Exec and > .Xr loader 8 . > +.Pp > +Due to size constraints, one may need to set > +.Va LOADERSIZE > +larger than the > +default 500000, although often loader is under the 500k limit even = with > +this option. > +Setting > +.Va LOADERSIZE > +larger than 500000 may cause > +.Xr pxeboot 8 > +to be too large to work. > +Careful testing of the loader in the target environment when built = with a larger > +limit to establish safe limits is critical because different BIOS = environments > +reserve differing amounts of the low 640k space, making a precise = limit for > +everybody impossible. > +.Pp > +See also > +.Va WITH_LOADER_PXEBOOT > +for other considerations. > diff --git a/tools/build/options/WITH_LOADER_VERIEXEC = b/tools/build/options/WITH_LOADER_VERIEXEC > index a50ff9a317e6..d784df968949 100644 > --- a/tools/build/options/WITH_LOADER_VERIEXEC > +++ b/tools/build/options/WITH_LOADER_VERIEXEC > @@ -4,3 +4,5 @@ with support for verification similar to Verified = Exec. > .Pp > Depends on > .Va WITH_BEARSSL . > +May require a larger > +.Va LOADERSIZE . From nobody Tue Aug 6 23:42:45 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wdqc611Dgz5S9Z7; Tue, 06 Aug 2024 23:42:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wdqc603jDz4q17; Tue, 6 Aug 2024 23:42:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987766; 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=Zum/stwZsx3Rs9RlH0gptauDnwQ2HATaULh/38Pss9s=; b=LDbhbupi4lWSoCd2Jc6M2EG3wUZz3eX23a5+AF6I+TPyDjD2wqK22uJJOLQnA1LUji8I2H VDO0KWLP4petX8R35zDhcauJzjn3hbRu5znB8a63w/PNZu7as0Cd0Ddk7vZOrw+Zg+Dcr+ 9CTx8AUZQAZ2VEdmUoyYHKCfTqwY/0uZqVcoFV81nzEnM7KDLzXqTYBw8G94ZWGJHuG71N wbCxOilvuiTb60ZCm+elK8psUDLqlMae7Z25XeDdF96eNzN5nJsC7oWbLB9/xoMnRYY11P i3eTwF8KzIE8kWrQeA5AXKlbiJd2W0+8T/z2m1WWkKexTNLX5zFah1vNGShv5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987766; a=rsa-sha256; cv=none; b=yTZcg62UVxLKHWMoyGVWcMC+GLnJ/mNPWMyzW41LIZmcr0BKNLKNxr9lKIyO9kRSiwOcP/ Z9JzLpxiik2aHV9jIaeQJyLfMev3OQ/aBW9Lc9jmBuEjxVMpCpzA88PULLS6fpmsJ0Ui6i jCWSxeBGfb6UVkWHn1s8wpPuHITIYYTfxec3cBM9a240SkkPp4aUerVX7UJvmC6jYSIOn1 38JufmZoRk3cTNknwlzNRUReKTkLeDdl1JrVt68bDlzF8lnAA6M1dtDYkltZVPlFpnk1QG kfCfa6G1HrBGzr/VgdMtKjMS1AzzQ0Ni9AraYeXXy+R65CcYDDbhiUBPCdFgeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987766; 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=Zum/stwZsx3Rs9RlH0gptauDnwQ2HATaULh/38Pss9s=; b=m7GbRwttebDbYFs4qvubMqklBt/CPWtiKyjsE4j1WUCpiIaSiXmZHkzP3OvXjOizItCkzu nK1I9eLwkd9NBIYv/vNigFZsQErRDTiJRYHw1B6jsl+RLVFP6QBTVkn7twoifHTDvpKvVc e5XSa6xYJJ1zsD9ONnogM+IXVV6xs1NrdifIf64GrybZQH84Pb693mlcK/hti30WTfv9xx PtKSCcgD5pCVP9TG61sHh9ZM+jn+Pq0HMTJtD8dlLoYQZO1Qj7UsuHZyQ1LCJNpuPM/Zgq loxnD6QR9vK2NkeWKJ7CNm6G3Wbyd9PamyunFSrle8lM0yV93mHfppuRkt3A8A== 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 4Wdqc56mQmzSFK; Tue, 6 Aug 2024 23:42: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 476NgjYN004550; Tue, 6 Aug 2024 23:42:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476NgjD3004547; Tue, 6 Aug 2024 23:42:45 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:42:45 GMT Message-Id: <202408062342.476NgjD3004547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: bf4f27e85aa6 - main - options: Make it clearer some x86 / BIOS only things List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf4f27e85aa62e459fb4cde9ebd51e32bdac7910 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bf4f27e85aa62e459fb4cde9ebd51e32bdac7910 commit bf4f27e85aa62e459fb4cde9ebd51e32bdac7910 Author: Warner Losh AuthorDate: 2024-08-06 23:39:10 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:39:10 +0000 options: Make it clearer some x86 / BIOS only things Suggested by: jrtc27 Sponsored by: Netflix --- tools/build/options/WITH_BEARSSL | 2 +- tools/build/options/WITH_LOADER_PXEBOOT | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/options/WITH_BEARSSL b/tools/build/options/WITH_BEARSSL index 9dcebbf1ae30..ff443a20586a 100644 --- a/tools/build/options/WITH_BEARSSL +++ b/tools/build/options/WITH_BEARSSL @@ -9,7 +9,7 @@ signature verification and related operations for Verified Exec and .Xr loader 8 . .Pp -Due to size constraints, one may need to set +Due to size constraints in the BIOS environment on x86, one may need to set .Va LOADERSIZE larger than the default 500000, although often loader is under the 500k limit even with diff --git a/tools/build/options/WITH_LOADER_PXEBOOT b/tools/build/options/WITH_LOADER_PXEBOOT index 01d4a0b86a66..37cf1fa254ec 100644 --- a/tools/build/options/WITH_LOADER_PXEBOOT +++ b/tools/build/options/WITH_LOADER_PXEBOOT @@ -1,4 +1,4 @@ -Build pxeboot on i386/amd64. +Build pxeboot on i386/amd64 for BIOS booting. The PXE Boot loader package needs more space than we may have in the boot loader. If you need to increase .Va LOADERSIZE From nobody Tue Aug 6 23:42:46 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wdqc7357Pz5S9HR; Tue, 06 Aug 2024 23:42: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wdqc70gf2z4qBg; Tue, 6 Aug 2024 23:42:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987767; 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=QU6+ygjs4w5PCWcDn52DUPL2AhiOl1VU0WMionAlPkU=; b=d7RJY1MRK2wIH9zFz15QJcZNUBvPD/MRTuyCbzAFoRHqWAYOoX1wQ7cgDBZeZ8HtUHhm8N pGTY9nhrjjtP/PuPZfrOElnRYaJaQf9QlJO7uo1VDqcZ2JzQiETWA6jG9PEOT11lQ0OOun C7GvlhLrHLDxRHwKKqMGwa/p6Sm/rSoRKo4flm13ZuErdFz4LIw+6+LBgrlJDpqAaqQ+SS 4H5ljWesQMwP5gy914fJxkpNyvu/pLvDveq0pfN0Kb2ct2FoX62qae9f1TYbhPSfyk4LbI ovs7Xb8NpGfTTkZkPnSKiY9Kgs0AHd8hxX7e2oSIwXXEVoUEl9OT5HxaTEbRyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722987767; a=rsa-sha256; cv=none; b=FSF0ElHRM8EROa8q/E6rx8vJ7+YZaf0+K5cvc7VxhItf7IQ18jRZI9fk7OxoMmRbqPq78t MoWvxyrwG3aOcwtakxM3IFij9mgIvHpZQP+IZ4XFC9/pAoxwHF57oRiQf8atRv5pUrW/ix TrM20+Jcx7GhjwxNLftrSNfJhsEqT+ufwH+dSu2wGyKlYuwzrD1I9v+yfLPxc5V3AqEXDR 5q90js3HJ55VOgyycub9kT2fw1s9FZWu05fe/hdE9WJaCCvdbrjDPVh+ZM7yNQ5bO15s4T rPmOZQWawNMNdWM20XrPv+XtieNNjXRHHOYQSCcOdS0F5BqIojxtc+s5uqrXeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722987767; 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=QU6+ygjs4w5PCWcDn52DUPL2AhiOl1VU0WMionAlPkU=; b=GLxHBnRURnJ9dNB/uWqljlic7v4hRXvwpHK1jJJo5VY1s3HBasJC4VNkcTATXeVsPhEW2z p8wpyoq1+8JB7Ro5UlfLNb0gBLCVLIjVdvGW80wZ+o3VGCMw/9Y0Lr5gL6KCJcIcy4SIHd USMXKu2RTIKtbju8Lq49wc53IJ7yX75l4ffGbmE+lnOpSvkPb2sd0jKwR64OncUgie14RB xO9UfEO30VZ3y7baO8cNz+tT2H/Az31oVZ98NaunqxADC26sipCJqTId13/O2EgJbMxFIq Ped5miurnpsfvZ/Cb3v1hMwVq61I6zX9OWCnbj80dMdmJaoMhZYs/XRI9Lf5pg== 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 4Wdqc70H0ZzRkP; Tue, 6 Aug 2024 23:42: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 476Ngkrv004590; Tue, 6 Aug 2024 23:42:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 476Ngk02004587; Tue, 6 Aug 2024 23:42:46 GMT (envelope-from git) Date: Tue, 6 Aug 2024 23:42:46 GMT Message-Id: <202408062342.476Ngk02004587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9ed58aa60fd9 - main - src.conf.5: Regen after ddcd3b606c9d List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ed58aa60fd9cfcc7b6d9f4efa3a0631da393fc9 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9ed58aa60fd9cfcc7b6d9f4efa3a0631da393fc9 commit 9ed58aa60fd9cfcc7b6d9f4efa3a0631da393fc9 Author: Warner Losh AuthorDate: 2024-08-06 23:42:52 +0000 Commit: Warner Losh CommitDate: 2024-08-06 23:42:52 +0000 src.conf.5: Regen after ddcd3b606c9d Sponsored by: Netflix --- share/man/man5/src.conf.5 | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index a12a2a8cb9f4..200ce8211e17 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd July 29, 2024 +.Dd August 6, 2024 .Dt SRC.CONF 5 .Os .Sh NAME @@ -158,6 +158,25 @@ This library is currently only used to perform signature verification and related operations for Verified Exec and .Xr loader 8 . +.Pp +Due to size constraints in the BIOS environment on x86, one may need to set +.Va LOADERSIZE +larger than the +default 500000, although often loader is under the 500k limit even with +this option. +Setting +.Va LOADERSIZE +larger than 500000 may cause +.Xr pxeboot 8 +to be too large to work. +Careful testing of the loader in the target environment when built with a larger +limit to establish safe limits is critical because different BIOS environments +reserve differing amounts of the low 640k space, making a precise limit for +everybody impossible. +.Pp +See also +.Va WITH_LOADER_PXEBOOT +for other considerations. When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1041,6 +1060,17 @@ Build openfirmware bootloader components. .Pp This is a default setting on powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpc64le. +.It Va WITHOUT_LOADER_PXEBOOT +Do not build pxeboot on i386/amd64. +When the pxeboot is too large, or unneeded, it may be disabled with this option. +See +.Va WITH_LOADER_PXEBOOT +for how to adjust the defaults when you need both a larger +.Pa /boot/loader +and +.Pa /boot/pxeboot +.Pp +This option only has an effect on x86. .It Va WITHOUT_LOADER_UBOOT Disable building of ubldr. .Pp @@ -1062,6 +1092,8 @@ with support for verification similar to Verified Exec. .Pp Depends on .Va WITH_BEARSSL . +May require a larger +.Va LOADERSIZE . When set, these options are also in effect: .Pp .Bl -inset -compact From nobody Wed Aug 7 08:44:11 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wf3cq6f4mz5SxXC; Wed, 07 Aug 2024 08:44: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wf3cq5wB1z4KkS; Wed, 7 Aug 2024 08:44:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723020251; 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=KcqdEPuqsiYZwxDQqxSOwn20QD0BITIBKXuQ6QhKN5g=; b=yFWNjkMNA+vpqVyOLLY0/sJwF24GdacqRUyA2uyS5Gfg/szlR6JuW1Qq9W0nDqGpNpTtxM iX+C958lk/7qqrdJ80HBDHhrcv3U+0wjLXFbFOS3rzAePX4OxD7BQirurlqyI3FY0Ye+RZ 4liCfBKZ1RB1dI+mNf6aWp8wvV60v/beGwigImJsEXU/kWzrU5k2H0L2f+dBGkPhVRybDG 8uXJlTffVhhew17w36fQFbaQf+wRM3vJ2mAMIOMvss9tfFy7J52eZq2mfjZKnr4fk1t8TX akBlaUKaPE0nJIJzy8Uj5wG24eOpRWyaNXXmU0MXIblBthkbOKnIptxt3F6AWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723020251; a=rsa-sha256; cv=none; b=iLgwVGHdTtDQOr7Q/zAvel3jE3RH0d3Ib5hropuUx0kJYZfBvEaoPsDJrb/cvwc+f/gdWK RsSjz3qJL4ZxShTxBSAmHAHhBcFHSSPgz/9etPMRADP34gBntT0kA/dKDlJL6+KdvXV+2X zSJtC6zMsJPe3ZpI0bXZShQm3xpxXUjzLjG8nQN2YoJ+TqALKqp4Pou+wZkGVCo18UlEaw dhVKyDsuxyyag2+i6/78/hAoclkizT5NrVS1w7mjiQypvQec9M1dW6WW4VuPXmyMeNt112 IcNrqHTSXt/ndAxws365zyGzDXpPA8D5UXcmpCAor5Y1XApocf7TFYAGn8vvtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723020251; 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=KcqdEPuqsiYZwxDQqxSOwn20QD0BITIBKXuQ6QhKN5g=; b=TBmm2GI7D2TLFo0dyJCjPLkI1p8GL1qcxaRq+hqASzClUYimwRESJU+UKCA8of4M1+OHMH 3Lg5EKA2U0QbF2jKHoZNv9SFEnHyEaQX03tu5JpwKHFM9w+YKYEk++HI+EfPV3blPecFRl 7Ym1tUnbkMd7Y35E6qT0NSCdvIGhNDzNgujSjMEhgfG9EtygzTrtKg9iXTrq30I+Zu+MWh l3X8f69MXtMyn3tTPn4dNS3/fRL3fJNQ0F/q8WwxkOgpk3L2zxls0fSY0EcFzoqdIZ/hwb fHcqIlyv+y8VxriNpt7t1tUt/jBc8yWD1G4IcpUFg6CO3QpOXJMqWXlEuzRIpw== 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 4Wf3cq5WStzkcP; Wed, 7 Aug 2024 08:44: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 4778iBs4026058; Wed, 7 Aug 2024 08:44:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4778iB9w026055; Wed, 7 Aug 2024 08:44:11 GMT (envelope-from git) Date: Wed, 7 Aug 2024 08:44:11 GMT Message-Id: <202408070844.4778iB9w026055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: e413e15c1ad5 - main - swap_pager_freespace: fix freed count List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e413e15c1ad5ba6dde8d2747c3c505cc39746c80 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=e413e15c1ad5ba6dde8d2747c3c505cc39746c80 commit e413e15c1ad5ba6dde8d2747c3c505cc39746c80 Author: Doug Moore AuthorDate: 2024-08-07 08:37:18 +0000 Commit: Doug Moore CommitDate: 2024-08-07 08:37:18 +0000 swap_pager_freespace: fix freed count Function swp_pager_meta_transfer uses 'pindex' as the start address of the swblk in calculating which page to lookup in order to count freed pages. However, the lookup for a swblk at 'pindex' or greater may produce one greater than 'pindex', given by sb->p, and that's the value that should be used to compute a page adddress. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46234 --- sys/vm/swap_pager.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 9df1521858c1..59d947c71279 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2201,10 +2201,9 @@ swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject, VM_OBJECT_WLOCK(srcobject); } if (moved != NULL) { - if (m != NULL && m->pindex != pindex + i - 1) - m = NULL; - m = m != NULL ? vm_page_next(m) : - vm_page_lookup(srcobject, pindex + i); + m = (m != NULL && m->pindex == sb->p + i - 1) ? + vm_page_next(m) : + vm_page_lookup(srcobject, sb->p + i); if (m == NULL || vm_page_none_valid(m)) mc++; } From nobody Wed Aug 7 09:56:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wf5D173YTz5T3jy; Wed, 07 Aug 2024 09:56:17 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wf5D16Npdz4Q9G; Wed, 7 Aug 2024 09:56:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723024577; 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=XMtkufqljiyBqJPOWj8jnFp1IkRY2hGxhEvyFCB/d8w=; b=bNcnN1wkb0V33B+Vif84bJFOl4IyPLXAFw6x9KgNs11Zu7Eo0SfvRf6E0gs7fGHvrushFD LPUO9qBGzkUThsq5s/hJnFpYGO+7oIT01dGtEogpBhZ/t1EdQ2klAn2KnIBeQDGkB+ebUR XNKq6/ockvzVX96hdCpDn9GLva7Xxbz23avp0QRQtg0Y9U/KDWTGu4L7vuKDrrV6qq/VPL ZSUdmF9KJbgzroJ9g0BvZ0PAM9/Dzzd/k9t5A2q4HUKehNibv2d36aoY+7eznXRU5Gcffe SmjBmD7LXuDBLUwQ/2YRu1SJcaI6jC0sEopwP/oB62HAo1eN8EldviO/eFYueQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723024577; a=rsa-sha256; cv=none; b=wpD+fLF7uRtYfR3+UGTY2Q6sxHstQYJ3PRqU13d6+uuCtYznQig9MOufTgOtvvAxYmYiyd hoitBIx2EAZNv/y8ERZhvsMM4iz74KVV9GlOUVlsayBnEfaBBJ64g2aW0TcXx2JyRxPY21 +9VD7v76Z5t/yPtHHrZZXXgLuhZ+cexree3ZKCKJf8Aoo5pCVyur/adC0AeupreejcA58j IYg+bOZfr3hdyOI0KGjSlen2D6SKO4slPbCJzEpcb5yjbJFgQ9woxSRAE+YivLS/UVoh5T ruoDp/GrZJ3S/+t3SvUD9pVtVvd6aR+yXmDzSb9dDQk0Kse2VcUIqDFlaUHTdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723024577; 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=XMtkufqljiyBqJPOWj8jnFp1IkRY2hGxhEvyFCB/d8w=; b=bOKcezjAyCixDGOekEQbRPGRO2z5FWeXHmNwiHqZwosCosgNhqGzkLBhJOfpNkfmuGiZTQ sUfsRvVjZQa/FXDb7H6FH5cffD8wsxBC2FrjtfCFycRp+AYZaK/yeZxptKN77rejiiPAE7 HHyL0CbAfLpQ5QEz4uyVUPrLzxhK9vJHW7+ZdcgagQpViKerEJBMXHX6tfN7l5vj6c/vAi 3SVtyGAXDUNv3QnUDXAT78tYpSaNgTDy+ljUCHnHrmePYhzG4dwvBVGlwBwCCyJEdRT+hx qgwyL6znKVv7ePw7vcd0PRtRlqnjgQECZo+d8W4oai/4c5lIrj3R/DyeeDC5IQ== 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 4Wf5D15yl8zlmn; Wed, 7 Aug 2024 09:56: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 4779uH2k044310; Wed, 7 Aug 2024 09:56:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4779uHUZ044307; Wed, 7 Aug 2024 09:56:17 GMT (envelope-from git) Date: Wed, 7 Aug 2024 09:56:17 GMT Message-Id: <202408070956.4779uHUZ044307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 10ac6c48a3e4 - main - msun/ld80/e_powl.c: add const qualifiers to the static immutable values List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10ac6c48a3e4ec6bb6f09d9c93e6ce5eb3381251 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=10ac6c48a3e4ec6bb6f09d9c93e6ce5eb3381251 commit 10ac6c48a3e4ec6bb6f09d9c93e6ce5eb3381251 Author: Konstantin Belousov AuthorDate: 2024-08-06 14:49:09 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-07 08:46:48 +0000 msun/ld80/e_powl.c: add const qualifiers to the static immutable values Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46237 --- lib/msun/ld80/e_powl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/msun/ld80/e_powl.c b/lib/msun/ld80/e_powl.c index b028d3cb7ff2..34978b964559 100644 --- a/lib/msun/ld80/e_powl.c +++ b/lib/msun/ld80/e_powl.c @@ -23,10 +23,10 @@ * P[0] x^n + P[1] x^(n-1) + ... + P[n] */ static inline long double -__polevll(long double x, long double *PP, int n) +__polevll(long double x, const long double *PP, int n) { long double y; - long double *P; + const long double *P; P = PP; y = *P++; @@ -42,10 +42,10 @@ __polevll(long double x, long double *PP, int n) * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] */ static inline long double -__p1evll(long double x, long double *PP, int n) +__p1evll(long double x, const long double *PP, int n) { long double y; - long double *P; + const long double *P; P = PP; n -= 1; @@ -126,13 +126,13 @@ __p1evll(long double x, long double *PP, int n) /* log(1+x) = x - .5x^2 + x^3 * P(z)/Q(z) * on the domain 2^(-1/32) - 1 <= x <= 2^(1/32) - 1 */ -static long double P[] = { +static const long double P[] = { 8.3319510773868690346226E-4L, 4.9000050881978028599627E-1L, 1.7500123722550302671919E0L, 1.4000100839971580279335E0L, }; -static long double Q[] = { +static const long double Q[] = { /* 1.0000000000000000000000E0L,*/ 5.2500282295834889175431E0L, 8.4000598057587009834666E0L, @@ -141,7 +141,7 @@ static long double Q[] = { /* A[i] = 2^(-i/32), rounded to IEEE long double precision. * If i is even, A[i] + B[i/2] gives additional accuracy. */ -static long double A[33] = { +static const long double A[33] = { 1.0000000000000000000000E0L, 9.7857206208770013448287E-1L, 9.5760328069857364691013E-1L, @@ -176,7 +176,7 @@ static long double A[33] = { 5.1094857432705833910408E-1L, 5.0000000000000000000000E-1L, }; -static long double B[17] = { +static const long double B[17] = { 0.0000000000000000000000E0L, 2.6176170809902549338711E-20L, -1.0126791927256478897086E-20L, @@ -199,7 +199,7 @@ static long double B[17] = { /* 2^x = 1 + x P(x), * on the interval -1/32 <= x <= 0 */ -static long double R[] = { +static const long double R[] = { 1.5089970579127659901157E-5L, 1.5402715328927013076125E-4L, 1.3333556028915671091390E-3L, From nobody Wed Aug 7 09:56:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wf5D30gWtz5T31g; Wed, 07 Aug 2024 09:56: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wf5D270t6z4Q9H; Wed, 7 Aug 2024 09:56:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723024579; 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=/wMlIZo21uqpTUneoel3Q1E5NtdJKqZZqeHruKJ0BFI=; b=xL+0DFTcrs25ZTUpWH5WrshgBSISU2bn4UudyXF5OsrujtducMZeIwo9UicsaDqwRfdt6j WDk6mEcrfWeh0Aop8KiSFyYw7Mu/pUyxfW/wnFz61L8U2ie7rdZFdZHFw6RV0cav6Qli+p ML2QxBcON7dEm2MghZrNy/wa7iN1+9mWWKPVXhtIB7qqCBS/IGmMgtmuKCn+YDA8JFwNNi D3XQD/n9br893XOZE7WqW5Qgy4v+peQlQPDRlbWVjJ7dWiSr+uayMBubzMsIp12w6Q9Ih1 /WvjqIXK/2soK1/8QblkYtO3tgpC7dMheb68NjZVBwkqbetK9krfqHlSxROrdw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723024579; a=rsa-sha256; cv=none; b=FDzxU44d67oyxfUqLJGjzvvmu/BY2quCTcNittl+YLXchdExeUqWQCTZHwGtdTOAW1HU7q b9FT5y/KrO2V8JI4XHSPXwu09ql/JRcDcWwp0EMJN+dB+op27IJbL0m2et2Sptj77HM19K MEwtg2iPrnEaFVG+EOZLTol9xTaZxPUbGRGEdD0zBeHblmw8JdB6XuDbSuJaDPM+XqX6oW /VekAlRLJF0Nyyzw9EaGvVjSver5vLDyI2JN1wlQ3lXiDgV27CiG77rycphvt7QK5wn6BN gsJubY7caNbG2JlKmqsk7PsmODDyCWvWWYdsLaM7l+RYapi4OI+z64yyTYoO2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723024579; 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=/wMlIZo21uqpTUneoel3Q1E5NtdJKqZZqeHruKJ0BFI=; b=GZwKg7qfkRmCxnRODHzMx/vyTXfsxxUqEQdRfY+vgw9wJXeuBXWRSWVNVRjVBuR2YjPiKi hTGBUEnZZeheNtNuwVl1xfYcvSQ1b1WDtt+uSOF//ZBqMH6GtU8utERkP0hdcbFO21+mBr 1rrrKXRYbuNnX5MMXhIygwVVpTLwEknnxD2g94dasT8wpCvobwV/Su9t18ne6ELhpTFN09 Fn3xWpwQ6U2Mwk2whVvas5n3KcnKSV+JpRUE/jZoB/HBrNpfajUrqJEdRTeXm3nKU/Hu5a TPd4TFAxsH0F0HwOfJ6P3+Wd4a92Ffztm1mXo/TRpRUy2J1q9j+VhAVLEh4IOw== 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 4Wf5D26bpnzlh6; Wed, 7 Aug 2024 09:56: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 4779uIv6044364; Wed, 7 Aug 2024 09:56:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4779uIqf044361; Wed, 7 Aug 2024 09:56:18 GMT (envelope-from git) Date: Wed, 7 Aug 2024 09:56:18 GMT Message-Id: <202408070956.4779uIqf044361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0c00dbfeb0c8 - main - msun/ld80/e_powl.c: make powl() thread-safe by making static variables thread-local List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c00dbfeb0c814c3a87a4d490db3692c1f9441e9 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0c00dbfeb0c814c3a87a4d490db3692c1f9441e9 commit 0c00dbfeb0c814c3a87a4d490db3692c1f9441e9 Author: Konstantin Belousov AuthorDate: 2024-08-06 14:50:57 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-07 08:46:48 +0000 msun/ld80/e_powl.c: make powl() thread-safe by making static variables thread-local Reported and tested by: Paul Zimmermann Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46237 --- lib/msun/ld80/e_powl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/ld80/e_powl.c b/lib/msun/ld80/e_powl.c index 34978b964559..d04d77a5ee98 100644 --- a/lib/msun/ld80/e_powl.c +++ b/lib/msun/ld80/e_powl.c @@ -230,13 +230,13 @@ static const long double R[] = { static const long double MAXLOGL = 1.1356523406294143949492E4L; static const long double MINLOGL = -1.13994985314888605586758E4L; static const long double LOGE2L = 6.9314718055994530941723E-1L; -static volatile long double z; -static long double w, W, Wa, Wb, ya, yb, u; +static _Thread_local volatile long double z; +static _Thread_local long double w, W, Wa, Wb, ya, yb, u; static const long double huge = 0x1p10000L; #if 0 /* XXX Prevent gcc from erroneously constant folding this. */ static const long double twom10000 = 0x1p-10000L; #else -static volatile long double twom10000 = 0x1p-10000L; +static _Thread_local volatile long double twom10000 = 0x1p-10000L; #endif static long double reducl( long double ); From nobody Wed Aug 7 13:41:25 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfBCn2m3rz5S96d; Wed, 07 Aug 2024 13:41: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfBCn2Bckz4h0P; Wed, 7 Aug 2024 13:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723038085; 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=OLcZdkdLHM4ZITxwhiE/9OEW+oFcaguqg1T5MB2Tv/w=; b=v3wCYktqU32EpvlEdcLbzfQcNrBkd0aKygRttf6qc55yOq0LtiQITSlftuSvzU8qFJuB+7 yunyB3FDRmJXrKZUubCZcruEzCrt0m46vh3K80/IHnBExOqNIpSF065q02y4mj3iBln+I+ B5i3023I4K5vRZ9v1ZlQKcJK8/z9d5GY3kifU8JSFve50HvVs5ZI710Z49rRgk+Qok6cdM BPaYZQ/FIc0TBnfDcaSegYLABmALxpVwatM/P0+5cgHzlI3c1aztSPUZOgJ6XuEp9IWNcc YBNkCDnfA9ldfgWKBneOEdPxB0qkj2QPqDHN+S7tNDsflU8O7jMn1NS8/unnKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723038085; a=rsa-sha256; cv=none; b=x1ja7Nr/qb/8/vkwWvq3v4TufuP/UTdaAc6kIOHPGSW3Lz8KZsj2nPVT/4WziMvEA3D7kS ujp2lTe9Xdq8EbdK8DTO++6yZlKXihGzKa0ubMT75hkLzT+wSppawM3NOzlokBWhhE9y5U qeAHYkk8NxnIF6Z7NAxevTaqQOLPw2VgHvlov9g+q91wVxnQW2WqX+GcFw6SfPLfxLfElm xDx7b6by9uoHQF6WYOHYfaBKqPnCQcVaO0BxA763bUIBAG8l6deYOawM1/X7hxlP9rl/g+ zBIWfmi7ObEsfT+ITeEH9qiHzUCJlry3W6nY+9gmGLIsYOLOLkiYyC46rtNjEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723038085; 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=OLcZdkdLHM4ZITxwhiE/9OEW+oFcaguqg1T5MB2Tv/w=; b=hzBu9lrsta6FcmOKlmGosFNVdvArLcULrIuov0PARnU27Pm7xaIrm37q2QZ5U/wFN1t/Ec GfGiacsgTP9+Px2wM2JDit8eZZS5SuDKDImRqzQ9YbVtqpoKb+5j1XxzWwMd1LOks+03fS pBiy1cMQ36DYAGd5mOE4+QwgYPBPSvtHptpVvulhieqmcX1+pNO88IHmryIbV+9gAMEUxs lJFmL7dKmARh0dwgoqk8A+Y8wYt79YQgdWLIzb+JRmhrmltYAFVsvRBDO0MFnzcoCujQoB egE76QjJGG4eYxlTlyay13PFjERbv0cUFlMIFXl53AP8r9lfKN/LAER046mCmw== 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 4WfBCn1ppSzsr7; Wed, 7 Aug 2024 13:41: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 477DfPpR030527; Wed, 7 Aug 2024 13:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477DfPU0030524; Wed, 7 Aug 2024 13:41:25 GMT (envelope-from git) Date: Wed, 7 Aug 2024 13:41:25 GMT Message-Id: <202408071341.477DfPU0030524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 166b7573b522 - main - ktrace: Fix an inverted privilege check List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 166b7573b5220aadf8b02a85933c9651b909b309 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=166b7573b5220aadf8b02a85933c9651b909b309 commit 166b7573b5220aadf8b02a85933c9651b909b309 Author: Mark Johnston AuthorDate: 2024-08-07 13:38:54 +0000 Commit: Mark Johnston CommitDate: 2024-08-07 13:41:17 +0000 ktrace: Fix an inverted privilege check Approved by: so Security: FreeBSD-24:06.ktrace Security: CVE-2024-6760 Fixes: 1762f674ccb5 ("ktrace: pack all ktrace parameters into allocated structure ktr_io_params") --- sys/kern/kern_ktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 142aa790a908..868885898d0c 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -591,7 +591,7 @@ ktrprocexec(struct proc *p) PROC_LOCK_ASSERT(p, MA_OWNED); kiop = p->p_ktrioparms; - if (kiop == NULL || priv_check_cred(kiop->cr, PRIV_DEBUG_DIFFCRED)) + if (kiop == NULL || priv_check_cred(kiop->cr, PRIV_DEBUG_DIFFCRED) == 0) return (NULL); mtx_lock(&ktrace_mtx); From nobody Wed Aug 7 14:07:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfBnf48hyz5SC1F; Wed, 07 Aug 2024 14:07: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfBnf3dK5z4sBK; Wed, 7 Aug 2024 14:07:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723039638; 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=gH5/X5AAk3b8ov7o7ncrRRiumfykykIZdd8n3j0kkLU=; b=aZ2zY9qiV+YthK5moTYYx+bDzpQYTCJOm/igUWcjLarFN9tbrZ1CV423IQXTUV6tk39uI3 e0g9B/+Ii6We8uqDFq41riryPlmV0X1Hsdp4GHI5c3BwymkYyUlc6DQUThp6Fi6LFjT63k TBfrNCscqQZejrsScO2cx/Y0U3an0aYrh3pIGqgsrwMgwnx/jmq8jOOTHEzJx7yPfTddt2 a5OrfSiNxOcWJLBZR1EAXq+CSeiA420dVBhztMhA/y4v99foAMXyw56uN2+7w9zglvfE55 tn/AIiK1Uo4ZQTMglGPHK3mVvwNM6wa22rSyC8M2w4Y2gR/svdidOW4RDsLJdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723039638; a=rsa-sha256; cv=none; b=JoYI4Cl+FGQSbxzKbJj/fUyPSFzesxAH6pcSu/UNtoA/T7abOGznkoVN0U5aswnd/2Y9fW F9qCac5/4Vo8aIO47uvj+ZiZPB2NQPq5TuGGlVL4uORngAXiO9rGXj1xz6MLvrcSfPMoMx Mx70YYcyyuphwGH2oVE41yFxHsTs6TpnNmEjbVgsBK4aIEbXB43MYeN6k5sr730l53lQL5 vm9R5O0xcKcJwyXOPWP2sQvfPlPMU1hgy+3nkJk56kRpazLwxikFLvSUX0KN4c8CdNU6gt BxipaeJsWFnngTMimEdttPESFkzr1NSowTOb3V0j3UroeeUMe2PhYM1q6eE/Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723039638; 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=gH5/X5AAk3b8ov7o7ncrRRiumfykykIZdd8n3j0kkLU=; b=fMzQJ09AJKPQglCnvtH2vO1G3w1BzvXYnEmjRdu/ZDMkjk1Nl3Xf9To15Jpib0eEeqDrtV z7zppxMZqQpig5TwzLCGJlUx6TLII2i1shoSGCYrBb8XT4eLHCAUJqhSKtnJBlDj1sfGyF gncFwMjqhq1ARXo6Afjd7InqergYyUZ7xWF1ygOluiDO3gtQ7YqGEJp6Yz2FZ+nyTk6rBc LwuM6KnB7LEOFhbnKUzNq9f7+Iqb91PLeEYJmdio5jHmjNKRqqDy/L4zosBKrWmxgrz0K3 HnqMNEeEyZEpRUci2wlHewVE2O3cr6LLbIVQmgHyCEd4Xy8igOAnF87Fe1BkOQ== 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 4WfBnf3DK6ztLR; Wed, 7 Aug 2024 14:07: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 477E7Inu070419; Wed, 7 Aug 2024 14:07:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477E7IiN070416; Wed, 7 Aug 2024 14:07:18 GMT (envelope-from git) Date: Wed, 7 Aug 2024 14:07:18 GMT Message-Id: <202408071407.477E7IiN070416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Morozovsky Subject: git: 2c2916a3ec38 - main - mailer.conf for sendmail: remove duplicate word. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c2916a3ec3805ff7815633c0bf90c4339016821 Auto-Submitted: auto-generated The branch main has been updated by marck: URL: https://cgit.FreeBSD.org/src/commit/?id=2c2916a3ec3805ff7815633c0bf90c4339016821 commit 2c2916a3ec3805ff7815633c0bf90c4339016821 Author: Dmitry Morozovsky AuthorDate: 2024-08-07 14:03:12 +0000 Commit: Dmitry Morozovsky CommitDate: 2024-08-07 14:03:12 +0000 mailer.conf for sendmail: remove duplicate word. MFC after: 3 days --- etc/mail/mailer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/mail/mailer.conf b/etc/mail/mailer.conf index 7947855fd2f7..f86403a9a68b 100644 --- a/etc/mail/mailer.conf +++ b/etc/mail/mailer.conf @@ -1,7 +1,7 @@ # # Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail # -# If dma(8) is installed, an example mailer.conf that uses dma(8) instead can +# If dma(8) is installed, an example mailer.conf that uses dma(8) instead # can be found in /usr/share/examples/dma. # sendmail /usr/libexec/sendmail/sendmail From nobody Wed Aug 7 14:37:13 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfCS95yhwz5SFXd; Wed, 07 Aug 2024 14:37: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfCS95n6pz3ynC; Wed, 7 Aug 2024 14:37:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723041433; 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=KJZJ7Qk3RJChKI06i+rA8l6ey/lVyUd2GnVow2J0eFw=; b=rymLIIMCs7R/Y/2chwHWyCV84Wq39wu5PfeFOOB08H4G9Ddl+fHVk5k3Q8wIPN4RWkXq1R LRggmE/pSZD7mT/qp3tv7/pg9ohbtAAXk7Dtj9Zh9pWyy6qBI7yTj4SUBmSCfovFmHH4d+ BKCWugRDph8e3MlLusHNXlFRCRzZk0WLfSGAZ3n9x/zt5vjbQrP1vkzjAcVxUzkNbg8vhN wrRj+Y23oiN9IUtbzvMFc84hoyOqZ8jSUg1kQ5v1i1z01G/RgKIvkMfrULCl3el/WsPKK7 coweF36bspa/EZLyY71cnJJnjxvP4FH5wfOAIU/DMdZ9mCfHV0x++QBBIP0lBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723041433; a=rsa-sha256; cv=none; b=O8gRKNwRPnapNZP8tBx893i+daxHzdC8C/4lBoSaXZkCSCUCl1YRWJNW5xJ7xd5llxSEMW VD74QvEt60jDkUAMqEtE7py0xGb4g+XnIdP3jq0C8DEYkr8A+Z35wRrEb/Sw3Yqe8DP8O6 f4POKavroo2BAVx02/s/R1LK2roPptHP3Ir7ZP0/qPPVs/UPp6Kx6wE2R1zhHvFyM2KIrx ntJIv0GuYhH0WS2iMsCcEQxSJdES7iOwTyUvX7uFEcFVG7dvLZmtof63Hv+ZyYLugKkP7q J4xejU6N/S8Kj0y1zCTHJVem3RsBGpnXGTK1X3XwZB0hZV/UMn55muzVHhhojw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723041433; 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=KJZJ7Qk3RJChKI06i+rA8l6ey/lVyUd2GnVow2J0eFw=; b=Cfq8Zz5gM5AxmgHCVx3W2GIfEv6FRESZ/KEUhtVQPqPwtrDOi70tgtTorqgCI3Deiz6h40 8u9c5vjl9Fs+s+KXfqacv/WuVwNK7V9BZe1hUWk04Khm0k1CoJA2Zdxdh0OVswgUhFcXnU hrmdiClefoC4cRlDhSrl3dw/sgFGxcc4WJ7Dm+tgaoboBbHECzLV0WpnbZpOiL67zgoGou iOic62JnUJQuhSJ3uD2ZUA16z0CtD7Z0LgKOskUN+7Uuj+QFXtU+IEvO+CaQGnV4Busvsm 5fZ8uBLER5rl/oyYq3Phy1kLzb+h5M1zuSOfi51WMO69VEBSo8zDKgI1CkdR1A== 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 4WfCS95Nb5zv7k; Wed, 7 Aug 2024 14:37: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 477EbDKI020535; Wed, 7 Aug 2024 14:37:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477EbDCr020532; Wed, 7 Aug 2024 14:37:13 GMT (envelope-from git) Date: Wed, 7 Aug 2024 14:37:13 GMT Message-Id: <202408071437.477EbDCr020532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 969876fcee57 - main - ctld: parse config file independently of getting kernel info List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 969876fcee57ea1cb1c7b4d2ee757793cbfbe353 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=969876fcee57ea1cb1c7b4d2ee757793cbfbe353 commit 969876fcee57ea1cb1c7b4d2ee757793cbfbe353 Author: Alan Somers AuthorDate: 2024-06-10 23:48:49 +0000 Commit: Alan Somers CommitDate: 2024-08-07 14:36:52 +0000 ctld: parse config file independently of getting kernel info Separate the parsing of the config file from the reading of kernel port information. This has three benefits: * Separation of concerns makes future changes easier. * Allows the config file to be read earlier, which is necessary for fixing PR 271460. * Reduces total line count, by eliminating duplication between parse.y (for traditional config file) and uclparse.c (for UCL config file). MFC after: 2 weeks Sponsored by: Axcient Reviewed by: mav Pull Request: https://github.com/freebsd/freebsd-src/pull/1287 --- usr.sbin/ctld/ctld.c | 99 +++++++++++++++++++++++++++++++++++++----------- usr.sbin/ctld/ctld.h | 25 ++++++++---- usr.sbin/ctld/kernel.c | 6 +-- usr.sbin/ctld/parse.y | 37 +----------------- usr.sbin/ctld/uclparse.c | 37 ++---------------- 5 files changed, 100 insertions(+), 104 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index bf2791040125..805648f0465f 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -98,7 +98,6 @@ conf_new(void) TAILQ_INIT(&conf->conf_auth_groups); TAILQ_INIT(&conf->conf_ports); TAILQ_INIT(&conf->conf_portal_groups); - TAILQ_INIT(&conf->conf_pports); TAILQ_INIT(&conf->conf_isns); conf->conf_isns_period = 900; @@ -117,7 +116,6 @@ conf_delete(struct conf *conf) struct target *targ, *tmp; struct auth_group *ag, *cagtmp; struct portal_group *pg, *cpgtmp; - struct pport *pp, *pptmp; struct isns *is, *istmp; assert(conf->conf_pidfh == NULL); @@ -130,8 +128,6 @@ conf_delete(struct conf *conf) auth_group_delete(ag); TAILQ_FOREACH_SAFE(pg, &conf->conf_portal_groups, pg_next, cpgtmp) portal_group_delete(pg); - TAILQ_FOREACH_SAFE(pp, &conf->conf_pports, pp_next, pptmp) - pport_delete(pp); TAILQ_FOREACH_SAFE(is, &conf->conf_isns, i_next, istmp) isns_delete(is); assert(TAILQ_EMPTY(&conf->conf_ports)); @@ -1177,27 +1173,27 @@ valid_iscsi_name(const char *name) } struct pport * -pport_new(struct conf *conf, const char *name, uint32_t ctl_port) +pport_new(struct kports *kports, const char *name, uint32_t ctl_port) { struct pport *pp; pp = calloc(1, sizeof(*pp)); if (pp == NULL) log_err(1, "calloc"); - pp->pp_conf = conf; + pp->pp_kports = kports; pp->pp_name = checked_strdup(name); pp->pp_ctl_port = ctl_port; TAILQ_INIT(&pp->pp_ports); - TAILQ_INSERT_TAIL(&conf->conf_pports, pp, pp_next); + TAILQ_INSERT_TAIL(&kports->pports, pp, pp_next); return (pp); } struct pport * -pport_find(const struct conf *conf, const char *name) +pport_find(const struct kports *kports, const char *name) { struct pport *pp; - TAILQ_FOREACH(pp, &conf->conf_pports, pp_next) { + TAILQ_FOREACH(pp, &kports->pports, pp_next) { if (strcasecmp(pp->pp_name, name) == 0) return (pp); } @@ -1205,11 +1201,11 @@ pport_find(const struct conf *conf, const char *name) } struct pport * -pport_copy(struct pport *pp, struct conf *conf) +pport_copy(struct pport *pp, struct kports *kports) { struct pport *ppnew; - ppnew = pport_new(conf, pp->pp_name, pp->pp_ctl_port); + ppnew = pport_new(kports, pp->pp_name, pp->pp_ctl_port); return (ppnew); } @@ -1220,7 +1216,7 @@ pport_delete(struct pport *pp) TAILQ_FOREACH_SAFE(port, &pp->pp_ports, p_ts, tport) port_delete(port); - TAILQ_REMOVE(&pp->pp_conf->conf_pports, pp, pp_next); + TAILQ_REMOVE(&pp->pp_kports->pports, pp, pp_next); free(pp->pp_name); free(pp); } @@ -1255,7 +1251,8 @@ port_new(struct conf *conf, struct target *target, struct portal_group *pg) } struct port * -port_new_ioctl(struct conf *conf, struct target *target, int pp, int vp) +port_new_ioctl(struct conf *conf, struct kports *kports, struct target *target, + int pp, int vp) { struct pport *pport; struct port *port; @@ -1269,7 +1266,7 @@ port_new_ioctl(struct conf *conf, struct target *target, int pp, int vp) return (NULL); } - pport = pport_find(conf, pname); + pport = pport_find(kports, pname); if (pport != NULL) { free(pname); return (port_new_pp(conf, target, pport)); @@ -1424,6 +1421,7 @@ target_delete(struct target *targ) port_delete(port); TAILQ_REMOVE(&targ->t_conf->conf_targets, targ, t_next); + free(targ->t_pport); free(targ->t_name); free(targ->t_redirection); free(targ); @@ -2686,21 +2684,17 @@ check_perms(const char *path) } static struct conf * -conf_new_from_file(const char *path, struct conf *oldconf, bool ucl) +conf_new_from_file(const char *path, bool ucl) { struct conf *conf; struct auth_group *ag; struct portal_group *pg; - struct pport *pp; int error; log_debugx("obtaining configuration from %s", path); conf = conf_new(); - TAILQ_FOREACH(pp, &oldconf->conf_pports, pp_next) - pport_copy(pp, conf); - ag = auth_group_new(conf, "default"); assert(ag != NULL); @@ -2755,9 +2749,60 @@ conf_new_from_file(const char *path, struct conf *oldconf, bool ucl) return (conf); } +/* + * If the config file specifies physical ports for any target, associate them + * with the config file. If necessary, create them. + */ +static int +new_pports_from_conf(struct conf *conf, struct kports *kports) +{ + struct target *targ; + struct pport *pp; + struct port *tp; + int ret, i_pp, i_vp; + + TAILQ_FOREACH(targ, &conf->conf_targets, t_next) { + if (!targ->t_pport) + continue; + + ret = sscanf(targ->t_pport, "ioctl/%d/%d", &i_pp, &i_vp); + if (ret > 0) { + tp = port_new_ioctl(conf, kports, targ, i_pp, i_vp); + if (tp == NULL) { + log_warnx("can't create new ioctl port " + "for target \"%s\"", targ->t_name); + return (1); + } + + continue; + } + + pp = pport_find(kports, targ->t_pport); + if (pp == NULL) { + log_warnx("unknown port \"%s\" for target \"%s\"", + targ->t_pport, targ->t_name); + return (1); + } + if (!TAILQ_EMPTY(&pp->pp_ports)) { + log_warnx("can't link port \"%s\" to target \"%s\", " + "port already linked to some target", + targ->t_pport, targ->t_name); + return (1); + } + tp = port_new_pp(conf, targ, pp); + if (tp == NULL) { + log_warnx("can't link port \"%s\" to target \"%s\"", + targ->t_pport, targ->t_name); + return (1); + } + } + return (0); +} + int main(int argc, char **argv) { + struct kports kports; struct conf *oldconf, *newconf, *tmpconf; struct isns *newns; const char *config_path = DEFAULT_CONFIG_PATH; @@ -2800,8 +2845,9 @@ main(int argc, char **argv) log_init(debug); kernel_init(); - oldconf = conf_new_from_kernel(); - newconf = conf_new_from_file(config_path, oldconf, use_ucl); + TAILQ_INIT(&kports.pports); + oldconf = conf_new_from_kernel(&kports); + newconf = conf_new_from_file(config_path, use_ucl); if (newconf == NULL) log_errx(1, "configuration error; exiting"); @@ -2814,6 +2860,9 @@ main(int argc, char **argv) newconf->conf_debug = debug; } + if (new_pports_from_conf(newconf, &kports)) + log_errx(1, "Error associating physical ports; exiting"); + error = conf_apply(oldconf, newconf); if (error != 0) log_errx(1, "failed to apply configuration; exiting"); @@ -2841,17 +2890,21 @@ main(int argc, char **argv) if (sighup_received) { sighup_received = false; log_debugx("received SIGHUP, reloading configuration"); - tmpconf = conf_new_from_file(config_path, newconf, - use_ucl); + tmpconf = conf_new_from_file(config_path, use_ucl); if (tmpconf == NULL) { log_warnx("configuration error, " "continuing with old configuration"); + } else if (new_pports_from_conf(tmpconf, &kports)) { + log_warnx("Error associating physical ports, " + "continuing with old configuration"); + conf_delete(tmpconf); } else { if (debug > 0) tmpconf->conf_debug = debug; oldconf = newconf; newconf = tmpconf; + error = conf_apply(oldconf, newconf); if (error != 0) log_warnx("failed to reload " diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index bcc3c1956dc4..e1bab1a8e3b8 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -131,10 +131,11 @@ struct portal_group { uint16_t pg_tag; }; +/* Ports created by the kernel. Perhaps the "p" means "physical" ? */ struct pport { TAILQ_ENTRY(pport) pp_next; TAILQ_HEAD(, port) pp_ports; - struct conf *pp_conf; + struct kports *pp_kports; char *pp_name; uint32_t pp_ctl_port; @@ -190,6 +191,8 @@ struct target { char *t_name; char *t_alias; char *t_redirection; + /* Name of this target's physical port, if any, i.e. "isp0" */ + char *t_pport; }; struct isns { @@ -206,7 +209,6 @@ struct conf { TAILQ_HEAD(, auth_group) conf_auth_groups; TAILQ_HEAD(, port) conf_ports; TAILQ_HEAD(, portal_group) conf_portal_groups; - TAILQ_HEAD(, pport) conf_pports; TAILQ_HEAD(, isns) conf_isns; int conf_isns_period; int conf_isns_timeout; @@ -224,6 +226,11 @@ struct conf { bool conf_kernel_port_on; }; +/* Physical ports exposed by the kernel */ +struct kports { + TAILQ_HEAD(, pport) pports; +}; + #define CONN_SESSION_TYPE_NONE 0 #define CONN_SESSION_TYPE_DISCOVERY 1 #define CONN_SESSION_TYPE_NORMAL 2 @@ -247,11 +254,11 @@ struct ctld_connection { struct chap *conn_chap; }; -int parse_conf(struct conf *conf, const char *path); +int parse_conf(struct conf *newconf, const char *path); int uclparse_conf(struct conf *conf, const char *path); struct conf *conf_new(void); -struct conf *conf_new_from_kernel(void); +struct conf *conf_new_from_kernel(struct kports *kports); void conf_delete(struct conf *conf); int conf_verify(struct conf *conf); @@ -305,15 +312,17 @@ void isns_register(struct isns *isns, struct isns *oldisns); void isns_check(struct isns *isns); void isns_deregister(struct isns *isns); -struct pport *pport_new(struct conf *conf, const char *name, +struct pport *pport_new(struct kports *kports, const char *name, uint32_t ctl_port); -struct pport *pport_find(const struct conf *conf, const char *name); -struct pport *pport_copy(struct pport *pport, struct conf *conf); +struct pport *pport_find(const struct kports *kports, + const char *name); +struct pport *pport_copy(struct pport *pp, struct kports *kports); void pport_delete(struct pport *pport); struct port *port_new(struct conf *conf, struct target *target, struct portal_group *pg); -struct port *port_new_ioctl(struct conf *conf, struct target *target, +struct port *port_new_ioctl(struct conf *conf, + struct kports *kports, struct target *target, int pp, int vp); struct port *port_new_pp(struct conf *conf, struct target *target, struct pport *pp); diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index ae455e7815f7..eed9f13d42fa 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -414,7 +414,7 @@ cctl_char_handler(void *user_data, const XML_Char *str, int len) } struct conf * -conf_new_from_kernel(void) +conf_new_from_kernel(struct kports *kports) { struct conf *conf = NULL; struct target *targ; @@ -559,13 +559,13 @@ retry_port: if (port->cfiscsi_target == NULL) { log_debugx("CTL port %u \"%s\" wasn't managed by ctld; ", port->port_id, name); - pp = pport_find(conf, name); + pp = pport_find(kports, name); if (pp == NULL) { #if 0 log_debugx("found new kernel port %u \"%s\"", port->port_id, name); #endif - pp = pport_new(conf, name, port->port_id); + pp = pport_new(kports, name, port->port_id); if (pp == NULL) { log_warnx("pport_new failed"); continue; diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y index 8909df2a8345..d8274b623d3a 100644 --- a/usr.sbin/ctld/parse.y +++ b/usr.sbin/ctld/parse.y @@ -832,42 +832,7 @@ target_portal_group: PORTAL_GROUP STR STR target_port: PORT STR { - struct pport *pp; - struct port *tp; - int ret, i_pp, i_vp = 0; - - ret = sscanf($2, "ioctl/%d/%d", &i_pp, &i_vp); - if (ret > 0) { - tp = port_new_ioctl(conf, target, i_pp, i_vp); - if (tp == NULL) { - log_warnx("can't create new ioctl port for " - "target \"%s\"", target->t_name); - free($2); - return (1); - } - } else { - pp = pport_find(conf, $2); - if (pp == NULL) { - log_warnx("unknown port \"%s\" for target \"%s\"", - $2, target->t_name); - free($2); - return (1); - } - if (!TAILQ_EMPTY(&pp->pp_ports)) { - log_warnx("can't link port \"%s\" to target \"%s\", " - "port already linked to some target", - $2, target->t_name); - free($2); - return (1); - } - tp = port_new_pp(conf, target, pp); - if (tp == NULL) { - log_warnx("can't link port \"%s\" to target \"%s\"", - $2, target->t_name); - free($2); - return (1); - } - } + target->t_pport = strdup($2); free($2); } diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index 8bd1ca88d166..e9e42bdf953e 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -853,41 +853,10 @@ uclparse_target(const char *name, const ucl_object_t *top) } if (!strcmp(key, "port")) { - struct pport *pp; - struct port *tp; - const char *value = ucl_object_tostring(obj); - int ret, i_pp, i_vp = 0; - - ret = sscanf(value, "ioctl/%d/%d", &i_pp, &i_vp); - if (ret > 0) { - tp = port_new_ioctl(conf, target, i_pp, i_vp); - if (tp == NULL) { - log_warnx("can't create new ioctl port " - "for target \"%s\"", target->t_name); - return (1); - } + const char *value; - continue; - } - - pp = pport_find(conf, value); - if (pp == NULL) { - log_warnx("unknown port \"%s\" for target \"%s\"", - value, target->t_name); - return (1); - } - if (!TAILQ_EMPTY(&pp->pp_ports)) { - log_warnx("can't link port \"%s\" to target \"%s\", " - "port already linked to some target", - value, target->t_name); - return (1); - } - tp = port_new_pp(conf, target, pp); - if (tp == NULL) { - log_warnx("can't link port \"%s\" to target \"%s\"", - value, target->t_name); - return (1); - } + value = ucl_object_tostring(obj); + target->t_pport = strdup(value); } if (!strcmp(key, "redirect")) { From nobody Wed Aug 7 15:53:54 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfF8g1Xpmz5SXXg; Wed, 07 Aug 2024 15:53: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfF8g10wkz4tGs; Wed, 7 Aug 2024 15:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723046035; 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=z8mYE0jGbSNs9sVvvH+eDf3r3w1RcTX+++NYdWWiIyM=; b=GZPvW1ANVZMynHidTQYYP/xJrASIvq0iVsYc8OziM9ocyCuSlRs/ATFSuQ55xd8xhWEvCd Pd0SWXLlNHiFRg+7HvXShGm8bRnpY2zM051sVygorSi0JLlIgAu2gYc+bK4dMwRd+UHS5/ Y6R7BNnpm2Ij47mw/g2CAprRWWtz6xUdKXczJ7I1zhBHQTwef7u7H0TnaZBJZBRxARtJv1 IfkasIe2CjYlS7sZuZFA7fi5bjGmV5ph0MnxvsvOsmQtup4S7l5f4ApMoW0jU1rInV/CsK 7z4vmQ9IzyDFZQjK3CKXMSgdEgjgRUungF93eq/oDeSC6RKkPvPC2+phh6ewhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723046035; a=rsa-sha256; cv=none; b=Dj1XHxDMKyjrf/MBVVX0CXBiuEaK8F2ABkJSOW+14qqqjqN4RsiG/8AUz6LjFy1Rta3b7O aQsWuXkgVO9HNloU0DaNz/gu0gLhyXUV8SDyusPC8y8bfMQaNRvI1cx91leTJqu7/4EIyP pCCs5iagYgh+XSEm82QaFqJpr5qVFKTlh9EeEWok8iHrQznleL3sxByYZ2ednO9A86VIra Y8ygqL4xO9A23iehGiMMs8sjhT2Am+QTLixeDhOS9rJV5ZxOzqbc+dOIdhPvg67SjSkSox fjb/8W6np/50y1NaDUbP6K9gV8kccmO3hyuOSppV4TdCSS3hCvQXHeT1+2PvsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723046035; 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=z8mYE0jGbSNs9sVvvH+eDf3r3w1RcTX+++NYdWWiIyM=; b=C9/+cpGRViyNVsWp8GThbizHL1hWO2HCh/IQZ9FkY6DwaIA3dq8vndgPlKdA1nVSCQJr6Z oCq2xSCIndQ6+E3ugFXU4cPPfWdfeYLTlSTYKmL2dM6YjAJyzf4dfKpcTIjp7A4EAFRMZQ Mk/FhUSrm4r4NyY+tTr5fttQ5X/GM0sSbNzHWLK78Ai9fsohtxDWdQPUICdoTosj8XBBUL UU1ngMSDGVNk7XdNLCzZF5VFtr8FF2ljhYQkSDETbY4d+Qf855U1DKzJxsED6tp7VOEA02 2G6Mnm517/lGIAgoS9R6ACzCgP6BCr/WnOp3uERKbFDS7rYEG8Au/dl1ti+gtw== 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 4WfF8g0c5nzwwW; Wed, 7 Aug 2024 15:53: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 477FrsYr056901; Wed, 7 Aug 2024 15:53:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477FrsZJ056898; Wed, 7 Aug 2024 15:53:54 GMT (envelope-from git) Date: Wed, 7 Aug 2024 15:53:54 GMT Message-Id: <202408071553.477FrsZJ056898@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3852a5a22650 - main - ktrace tests: Add a test case for handling of exec+setuid binaries List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3852a5a226509551e72c13bce443707f80e863ce Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3852a5a226509551e72c13bce443707f80e863ce commit 3852a5a226509551e72c13bce443707f80e863ce Author: Mark Johnston AuthorDate: 2024-08-07 15:53:37 +0000 Commit: Mark Johnston CommitDate: 2024-08-07 15:53:37 +0000 ktrace tests: Add a test case for handling of exec+setuid binaries MFC after: 1 week --- tests/sys/kern/ktrace_test.c | 133 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 116 insertions(+), 17 deletions(-) diff --git a/tests/sys/kern/ktrace_test.c b/tests/sys/kern/ktrace_test.c index 9d4c2dbdcd74..dfd60b73a5cd 100644 --- a/tests/sys/kern/ktrace_test.c +++ b/tests/sys/kern/ktrace_test.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,16 @@ child_fail_require(const char *file, int line, const char *fmt, ...) _exit(32); } +static void * +xmalloc(size_t size) +{ + void *p; + + p = malloc(size); + ATF_REQUIRE(p != NULL); + return (p); +} + /* * Determine sysdecode ABI based on proc's ABI in sv_flags. */ @@ -105,36 +116,47 @@ syscallabi(u_int sv_flags) return (SYSDECODE_ABI_UNKNOWN); } -/* - * Start tracing capability violations and notify child that it can execute. - * Return @numv capability violations from child in @v. - */ -static void -cap_trace_child(int cpid, struct ktr_cap_fail *v, int numv) +static int +trace_child(int cpid, int facility, int status) { - struct ktr_header header; - int error, fd, i; + int error, fd; ATF_REQUIRE((fd = open("ktrace.out", O_RDONLY | O_CREAT | O_TRUNC, 0600)) != -1); - ATF_REQUIRE(ktrace("ktrace.out", KTROP_SET, - KTRFAC_CAPFAIL, cpid) != -1); + ATF_REQUIRE_MSG(ktrace("ktrace.out", KTROP_SET, facility, cpid) != -1, + "ktrace failed: %s", strerror(errno)); /* Notify child that we've starting tracing. */ ATF_REQUIRE(kill(cpid, SIGUSR1) != -1); /* Wait for child to raise violation and exit. */ ATF_REQUIRE(waitpid(cpid, &error, 0) != -1); ATF_REQUIRE(WIFEXITED(error)); - ATF_REQUIRE_EQ(WEXITSTATUS(error), 0); + ATF_REQUIRE_EQ(WEXITSTATUS(error), status); + return (fd); +} + +/* + * Start tracing capability violations and notify child that it can execute. + * Return @numv capability violations from child in @v. + */ +static void +cap_trace_child(pid_t cpid, struct ktr_cap_fail *v, int numv) +{ + struct ktr_header header; + ssize_t n; + int fd; + + fd = trace_child(cpid, KTRFAC_CAPFAIL, 0); + /* Read ktrace header and ensure violation occurred. */ - for (i = 0; i < numv; ++i) { - ATF_REQUIRE((error = read(fd, &header, sizeof(header))) != -1); - ATF_REQUIRE_EQ(error, sizeof(header)); + for (int i = 0; i < numv; ++i) { + ATF_REQUIRE((n = read(fd, &header, sizeof(header))) != -1); + ATF_REQUIRE_EQ(n, sizeof(header)); ATF_REQUIRE_EQ(header.ktr_len, sizeof(*v)); ATF_REQUIRE_EQ(header.ktr_pid, cpid); /* Read the capability violation. */ - ATF_REQUIRE((error = read(fd, v + i, + ATF_REQUIRE((n = read(fd, v + i, sizeof(*v))) != -1); - ATF_REQUIRE_EQ(error, sizeof(*v)); + ATF_REQUIRE_EQ(n, sizeof(*v)); } ATF_REQUIRE(close(fd) != -1); } @@ -301,7 +323,11 @@ ATF_TC_BODY(ktrace__cap_signal, tc) * Test if opening a socket with a restricted protocol is reported * as a protocol violation. */ -ATF_TC_WITHOUT_HEAD(ktrace__cap_proto); +ATF_TC(ktrace__cap_proto); +ATF_TC_HEAD(ktrace__cap_proto, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} ATF_TC_BODY(ktrace__cap_proto, tc) { struct ktr_cap_fail violation; @@ -507,6 +533,78 @@ ATF_TC_BODY(ktrace__cap_shm_open, tc) ATF_REQUIRE_STREQ(violation.cap_data.cap_path, "/ktrace_shm"); } +/* + * Make sure that ktrace is disabled upon exec of a setuid binary. + */ +ATF_TC(ktrace__setuid_exec); +ATF_TC_HEAD(ktrace__setuid_exec, tc) +{ + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(ktrace__setuid_exec, tc) +{ + struct ktr_header header; + struct ktr_syscall *syscall; + sigset_t set = { }; + off_t off, off1; + ssize_t n; + pid_t pid; + int error, fd; + + /* Block SIGUSR1 so child does not terminate. */ + ATF_REQUIRE(sigaddset(&set, SIGUSR1) != -1); + ATF_REQUIRE(sigprocmask(SIG_BLOCK, &set, NULL) != -1); + + ATF_REQUIRE((pid = fork()) != -1); + if (pid == 0) { + /* Wait until ktrace has started. */ + CHILD_REQUIRE(sigwait(&set, &error) != -1); + CHILD_REQUIRE_EQ(error, SIGUSR1); + + execve("/usr/bin/su", (char *[]){ "su", "whoami", NULL }, NULL); + _exit(0); + } + + fd = trace_child(pid, KTRFAC_SYSCALL, 1); + + n = read(fd, &header, sizeof(header)); + ATF_REQUIRE(n >= 0); + ATF_REQUIRE_EQ((size_t)n, sizeof(header)); + ATF_REQUIRE_EQ(header.ktr_pid, pid); + ATF_REQUIRE(header.ktr_len >= (int)sizeof(*syscall)); + + syscall = xmalloc(header.ktr_len); + n = read(fd, syscall, header.ktr_len); + ATF_REQUIRE(n >= 0); + ATF_REQUIRE_EQ(n, header.ktr_len); + if (syscall->ktr_code == SYS_sigwait) { + free(syscall); + + /* Skip the sigwait() syscall. */ + n = read(fd, &header, sizeof(header)); + ATF_REQUIRE(n >= 0); + ATF_REQUIRE_EQ((size_t)n, sizeof(header)); + ATF_REQUIRE_EQ(header.ktr_pid, pid); + ATF_REQUIRE(header.ktr_len >= (int)sizeof(*syscall)); + + syscall = xmalloc(header.ktr_len); + n = read(fd, syscall, header.ktr_len); + ATF_REQUIRE(n >= 0); + ATF_REQUIRE_EQ(n, header.ktr_len); + } + ATF_REQUIRE_EQ(syscall->ktr_code, SYS_execve); + free(syscall); + + /* su is setuid root, so this should have been the last entry. */ + off = lseek(fd, 0, SEEK_CUR); + ATF_REQUIRE(off != -1); + off1 = lseek(fd, 0, SEEK_END); + ATF_REQUIRE(off1 != -1); + ATF_REQUIRE_EQ(off, off1); + + ATF_REQUIRE(close(fd) == 0); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, ktrace__cap_not_capable); @@ -518,5 +616,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ktrace__cap_namei); ATF_TP_ADD_TC(tp, ktrace__cap_cpuset); ATF_TP_ADD_TC(tp, ktrace__cap_shm_open); + ATF_TP_ADD_TC(tp, ktrace__setuid_exec); return (atf_no_error()); } From nobody Wed Aug 7 16:08:38 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfFTf4tZFz5SbTP; Wed, 07 Aug 2024 16:08: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfFTf4MHsz3wnX; Wed, 7 Aug 2024 16:08:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723046918; 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=sKj44WiKAgthLZIuhnTnlZwU68FJXn7wnfhnCyaoxQs=; b=xQtpgCHsrE2Rv0TqtZa3bxPzQva98wG70Z1WsZJgWxWTwT0nkn3OYsNgx8pDkHJ9o74G2d b0mqk9FpPdbChuFow6zTydn9l2TO+4l8rvJdHFfOIGi7Zy7wkA2ThtYBq0YLg66l3MkEtB Q4XOKpUapfSUryIlmxmuUKdj+N8tf+//DR+EsOO+rXsHFVDZB7rxbLt5+uxiRNdsEAiKEP AH+iPZcFR3f4WaDWObmraNAViYahdvmgeOBf9cs0dKtnPXKPX03z6062zMbRcYJCY9kj0h h3UFkXqZbIwX4cRUqOqQIGlqnvd6lyyyRmc0039+uhWluOOnSbZJ1FDIZCHNdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723046918; a=rsa-sha256; cv=none; b=bWMgciedR/MGO0u8YJMV1LcgURsP7g9yK0efaKu29BkP+DtmdH1UoG9oy0rCeO5ryB9DwD PvP59wdMbvaZBJSHKrpmQfxas/LroNjsauL9G4VaNw2WD8jHMUcWCPLu4cxd4c4gJFx4di 7twq5xkP66w3wWZSESXnBW8v7ouB7bY24B29Tmw/yzf4YEy7o0Ee0LhPwHtxPF9Wuki0Gl JejBrCJb0gnRebw8bFJLY7Uq99G//+ZHh9xuEzOg9vkQJwqL6SD9rsld6QBjwGNeZorUqo Wudwqcfhu2WWIVIQt5KcMH8aq849Mdsjty2d9XGSRcPtVObFnxt7lZxKihYzLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723046918; 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=sKj44WiKAgthLZIuhnTnlZwU68FJXn7wnfhnCyaoxQs=; b=A6/ETt7zqY7+qcWC79vbvTgjSqe5ZQs0shNmU53aWrmLezWm3RMv1y4hHdiYdka0SX1wpX qgXWPSXUUKMprCORjLJCPhDOWVduC4mT9Q2hp5UJgV0KGtO2ITmrpQ/0dHI8qDEQnOaF1J y3pkEaqjxISwQoJbM4H5pf10gvMWSzSrC7oaXg4rtpPfm4mvMNqeNQ1NLGnqDh3IsoysNh KO7RsdzOLqg/ql6CRmSHv7kRoUOhSvgaXGlySOUB5UB3pIjWqS+AZJH6ZJ9iIMACyeSi5H ASWi9ECmivWSLubtgSLaFtrfkT2vzTIdiGT2N08rH+s4qfFSto4lgq0Y4vvdlw== 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 4WfFTf3yNVzxRh; Wed, 7 Aug 2024 16:08: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 477G8chG075517; Wed, 7 Aug 2024 16:08:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477G8ch5075514; Wed, 7 Aug 2024 16:08:38 GMT (envelope-from git) Date: Wed, 7 Aug 2024 16:08:38 GMT Message-Id: <202408071608.477G8ch5075514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5132e16e1fd9 - main - libc tests: Rename the quick_exit test file, fix style List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5132e16e1fd987d88798fc9dbb7a10ae3413e86f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5132e16e1fd987d88798fc9dbb7a10ae3413e86f commit 5132e16e1fd987d88798fc9dbb7a10ae3413e86f Author: Mark Johnston AuthorDate: 2024-07-29 14:37:47 +0000 Commit: Mark Johnston CommitDate: 2024-08-07 16:05:16 +0000 libc tests: Rename the quick_exit test file, fix style Call it libc_exit_test instead of exit_test because the NetBSD test suite already has a file with the latter name. This is in preparation for adding other exit()-related tests. MFC after: 2 weeks --- ObsoleteFiles.inc | 3 +++ lib/libc/tests/stdlib/Makefile | 2 +- .../stdlib/{quick_exit_test.c => libc_exit_test.c} | 18 +++++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f6984b49711c..afd22301a39c 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20240729: rename quick_exit_test to libc_exit_test +OLD_FILES+=usr/tests/lib/libc/stdlib/quick_exit_test + # 20240729: retire ifaddr_byindex OLD_FILES+=usr/share/man/man9/ifaddr_byindex.9.gz diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index cf1a204cfb4a..29cf895006d1 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -3,6 +3,7 @@ ATF_TESTS_C+= clearenv_test ATF_TESTS_C+= dynthr_test ATF_TESTS_C+= heapsort_test +ATF_TESTS_C+= libc_exit_test ATF_TESTS_C+= mergesort_test ATF_TESTS_C+= qsort_test .if ${COMPILER_TYPE} == "clang" @@ -11,7 +12,6 @@ ATF_TESTS_C+= qsort_b_test ATF_TESTS_C+= qsort_r_compat_test ATF_TESTS_C+= qsort_r_test ATF_TESTS_C+= qsort_s_test -ATF_TESTS_C+= quick_exit_test ATF_TESTS_C+= set_constraint_handler_s_test ATF_TESTS_C+= strfmon_test ATF_TESTS_C+= tsearch_test diff --git a/lib/libc/tests/stdlib/quick_exit_test.c b/lib/libc/tests/stdlib/libc_exit_test.c similarity index 83% rename from lib/libc/tests/stdlib/quick_exit_test.c rename to lib/libc/tests/stdlib/libc_exit_test.c index 9feed8a6fa63..c47d03d1d598 100644 --- a/lib/libc/tests/stdlib/quick_exit_test.c +++ b/lib/libc/tests/stdlib/libc_exit_test.c @@ -12,32 +12,36 @@ #include -static void func_a(void) +static void +func_a(void) { if (write(STDOUT_FILENO, "a", 1) != 1) _Exit(1); } -static void func_b(void) +static void +func_b(void) { if (write(STDOUT_FILENO, "b", 1) != 1) _Exit(1); } -static void func_c(void) +static void +func_c(void) { if (write(STDOUT_FILENO, "c", 1) != 1) _Exit(1); } -static void child(void) +static void +child(void) { - // this will be received by the parent + /* this will be received by the parent */ printf("hello, "); fflush(stdout); - // this won't, because quick_exit() does not flush + /* this won't, because quick_exit() does not flush */ printf("world"); - // these will be called in reverse order, producing "abc" + /* these will be called in reverse order, producing "abc" */ if (at_quick_exit(func_c) != 0 || at_quick_exit(func_b) != 0 || at_quick_exit(func_a) != 0) From nobody Wed Aug 7 16:08:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfFTg64pmz5SbRL; Wed, 07 Aug 2024 16:08:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfFTg5Rd1z3x3L; Wed, 7 Aug 2024 16:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723046919; 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=pS5xo6IRe9S3SECgr33JmyZGvlbP4sYQMFJmeKBe5sE=; b=s4o6CMh4fcJwlHQqmpX8blZ4oWaowA9fx4EpDvbVicPJsQuylunYz2UPG3OG3g9zKF/eIt cglR8tTUa73HPcZlvoShAu8SNrqEymu7zSP8A4w/96CjyxQBMG9Sj7n5mm2+kuDmu4wiNE NpCKpgiVQ0CFTKC/MBXI5KcVftSdnEoneq8/lqp0mmwUsVnIm7RSWQx5JZiKM8cjKdeDFB y3lZgY1HymttsAjNfEQgEx+m3qA2DDirWm3rPA0rNIRgJwomIOTEbnSmh1mPrv89lLw5dK 3eBYZNBIjPt/QFtwxotjAtU7UOwkG2pPFSxzLUb5RA79LCqMrR5f+y2FDh3Vbg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723046919; a=rsa-sha256; cv=none; b=Dh1RL6O3KcZPtXfWPE8kYksuKTi4/4aIuCOoo4quyanZOknc63tGHSf+JHrNupM/NnY28C hZizrq09CiLqnpFAdX2xwq6H5qzL0mdnrgi68NdYrRE2bY1C24O4j4IgDNDucmDYZrf9Lh lMGzzKILShZ4jCf0U325Esw4B88AQG83pAHdia2WLEVm/uZtOObzIOp7dzO0cpyVXgGwcw X421FcM2QyEtfRynLehDpcT50IE4usuytiPiEMeP4u1E0pe1vffrWEIXXrZUWpjyQoVs53 syZpbw30kmYWg9yusvCe00tulurPT1l92pXpQvBXW4H/riuHCybcQOhRE+9Ufg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723046919; 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=pS5xo6IRe9S3SECgr33JmyZGvlbP4sYQMFJmeKBe5sE=; b=upHW6C9QZ7zOUGrVIoyw8P//p8ay65E/YtoU3k8UvHf+32X3FXGpiathQD9NYiXWvDgQ8T MT+dnaXuh3x83mbO1jLyOq4aszxLiNj8G7wORVwFb4cuz6R/dUrPnc9T38GI8kOzlDifz1 2noOvz5477FWde47ogmJj/V74AmO7LMoB7HGfoz6bdiWvfZh8lcdHhPdiWVsuL+jcqRsaS 5Ibnsn94ILYVhs7mvAG6JkhP4ValNWMTTu+y3Z1AY3peIjx+n8aDwB4w8H+YqY52pGQh+3 Kl0m7Lyk2IrTXKzLvvrYSJdsLam4o0RwwQZ758Wrab0rEzFhsoS2ywMskqPzZQ== 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 4WfFTg4m0tzwnH; Wed, 7 Aug 2024 16:08: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 477G8dJX075571; Wed, 7 Aug 2024 16:08:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477G8dXJ075568; Wed, 7 Aug 2024 16:08:39 GMT (envelope-from git) Date: Wed, 7 Aug 2024 16:08:39 GMT Message-Id: <202408071608.477G8dXJ075568@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c0946aee5b2a - main - libc tests: Add some test cases for recursive exiting List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0946aee5b2ab6c9bb2e8281a1f625914ed2fec8 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c0946aee5b2ab6c9bb2e8281a1f625914ed2fec8 commit c0946aee5b2ab6c9bb2e8281a1f625914ed2fec8 Author: Mark Johnston AuthorDate: 2024-08-07 16:06:11 +0000 Commit: Mark Johnston CommitDate: 2024-08-07 16:06:11 +0000 libc tests: Add some test cases for recursive exiting Derived from tests posted by kib in D46108. I made one of them use a pthread barrier instead of sleeping. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46176 --- lib/libc/tests/stdlib/Makefile | 1 + lib/libc/tests/stdlib/libc_exit_test.c | 69 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index 29cf895006d1..6f57b8014a1e 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -75,6 +75,7 @@ LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR} LIBADD.${t}+= netbsd util .endfor +LIBADD.libc_exit_test+= pthread LIBADD.strtod_test+= m SUBDIR+= dynthr_mod diff --git a/lib/libc/tests/stdlib/libc_exit_test.c b/lib/libc/tests/stdlib/libc_exit_test.c index c47d03d1d598..12965261bdb3 100644 --- a/lib/libc/tests/stdlib/libc_exit_test.c +++ b/lib/libc/tests/stdlib/libc_exit_test.c @@ -6,6 +6,7 @@ #include +#include #include #include #include @@ -78,8 +79,76 @@ ATF_TC_BODY(quick_exit, tc) ATF_CHECK_STREQ("hello, abc", buf); } +static void +myatexit1(void) +{ + exit(12); +} + +ATF_TC_WITHOUT_HEAD(recursive_exit1); +ATF_TC_BODY(recursive_exit1, tc) +{ + pid_t pid; + int wstatus; + + pid = fork(); + if (pid == 0) { + atexit(myatexit1); + exit(1); + } + ATF_REQUIRE_MSG(pid > 0, + "expect fork() to succeed"); + ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0), + "expect to collect child process"); + ATF_CHECK(WIFEXITED(wstatus)); + ATF_CHECK_EQ(WEXITSTATUS(wstatus), 12); +} + +static pthread_barrier_t barrier; + +static void +myatexit2(void) +{ + pthread_barrier_wait(&barrier); + exit(12); +} + +static void * +mythreadexit(void *arg) +{ + pthread_barrier_wait(&barrier); + exit(15); +} + +ATF_TC_WITHOUT_HEAD(recursive_exit2); +ATF_TC_BODY(recursive_exit2, tc) +{ + pid_t pid; + int wstatus; + + pid = fork(); + if (pid == 0) { + pthread_t thr; + + atexit(myatexit2); + + pthread_barrier_init(&barrier, NULL, 2); + pthread_create(&thr, NULL, mythreadexit, NULL); + + exit(1); + } + ATF_REQUIRE_MSG(pid > 0, + "expect fork() to succeed"); + ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0), + "expect to collect child process"); + ATF_CHECK(WIFEXITED(wstatus)); + ATF_CHECK_EQ(WEXITSTATUS(wstatus), 12); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, quick_exit); + ATF_TP_ADD_TC(tp, recursive_exit1); + ATF_TP_ADD_TC(tp, recursive_exit2); return (atf_no_error()); } From nobody Wed Aug 7 17:45:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfHdB0psgz5Sxl0; Wed, 07 Aug 2024 17:45: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfHdB00zqz4G7R; Wed, 7 Aug 2024 17:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723052718; 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=0jgZt7v4CF3mscd9WUiggIhQrBejNqm4r92YwepsqJQ=; b=bOKG08SZMPqOs4lmnbmhZTQH115SzK39tmn7JC12khfMzBX6Ge68xHvJxy5/LXwT3O1uKl d0LvTSjH8xllMuT4npgj3wDk+QqcPY6ZWOJ6ho3MDG1QXX6JEfGMs3YofZcwfSnS2dM91P whlJvXq1EoQsBnxxny/QkAEPNvRjRf2nc6ZSJ6T4HahhazofVbOmAug3B72+8afumUCs5J EnlqsRhiCOjmvQdeqzDP58Rm7GAeU4PxNeYMCdfx4sfRwdvefwIYMFUbDRDMiNhfO1dOSu 6hX8uLPrcozIBd4zoxl++YbNJsgGSvjTaiBXDc8oyj04POdCI2vcbJma+kMVCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723052718; a=rsa-sha256; cv=none; b=nrYPq9XteNdwZohUrSpjT4kMrbFt0wRxR9TLbGVmtsqBWtclzj0+UE/KI45JJqDVKT6/YS /33eLqgCP1ZCcIqA3RDYnaEwtf9lPdxCPSW9dZ3sextUuIyOTx7Ig0K/wrAe31TxFZJ3/4 M0Yj+xeFxiUnjDXD8VJlf0Z4hGV0GgG8DBg3rRrDyZ7QyyrejwrnXHwrl2tuqs+LVBqWeb 85FCz3BWK/+NkYykBTrdFEoXbN/LbsYilB1HTgJxgovrJT8cGtE5YDU3XHiMzQZy2utyOV 4/n+EPxmUyfHXxsZQkGj/H10BjnsK+0TmM45zI0nQjVW+s1FiquqNjF60bKYuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723052718; 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=0jgZt7v4CF3mscd9WUiggIhQrBejNqm4r92YwepsqJQ=; b=gMNfEW1fVRlgaoC6yD4kFh6dhH6OKymTpa1GekepO+UKBUMXDspM2ZidE42YEzVvm946EC ZxaKaCJfnl0zlORZ2TOxZYM4kPowVv+2uAofSXlNtE1BkAEg4vwO5kURpmYM1+1xXZploB yd3gu54RRZAtyzT8kx43eSZgup+8YfPrPdksAYGkoP0qwGM06s6rd0E91Dn8l9wetWh/R8 bfwqPJsc5MO0Z8JPpSdOlObVASQfX45uCZ4CwIeeo1ZHID7onqk6+KQnXJc/4SMS2KP4LZ O1E0ldO2x7g0xBmlvvvppxYWzpx/2CoYZpQcGeaxjE/al7U8FzLGbgdBupE0XQ== 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 4WfHd96kYyz10gh; Wed, 7 Aug 2024 17:45: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 477HjHhC044248; Wed, 7 Aug 2024 17:45:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477HjHeP044245; Wed, 7 Aug 2024 17:45:17 GMT (envelope-from git) Date: Wed, 7 Aug 2024 17:45:17 GMT Message-Id: <202408071745.477HjHeP044245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: b3bc746cf3d0 - main - tcp: minor cleanup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3bc746cf3d02e76fc49e9c5677726293ede402f Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b3bc746cf3d02e76fc49e9c5677726293ede402f commit b3bc746cf3d02e76fc49e9c5677726293ede402f Author: Michael Tuexen AuthorDate: 2024-08-07 17:43:07 +0000 Commit: Michael Tuexen CommitDate: 2024-08-07 17:43:07 +0000 tcp: minor cleanup The vnet component of struct tcp_syncache is only used if VIMAGE is defined. No functional change intended. Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46240 --- sys/netinet/tcp_syncache.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/tcp_syncache.h b/sys/netinet/tcp_syncache.h index 9f3beebf16af..e6485f42c0e4 100644 --- a/sys/netinet/tcp_syncache.h +++ b/sys/netinet/tcp_syncache.h @@ -127,7 +127,9 @@ struct tcp_syncache { u_int cache_limit; u_int rexmt_limit; uint32_t hash_secret; +#ifdef VIMAGE struct vnet *vnet; +#endif struct syncookie_secret secret; struct mtx pause_mtx; struct callout pause_co; From nobody Wed Aug 7 18:28:26 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfJZy1sbyz5SNr6; Wed, 07 Aug 2024 18:28: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfJZy1gVSz4M8C; Wed, 7 Aug 2024 18:28:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723055306; 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=7pNiMlKS63dLeAHZ88RWZZ3Pi2gDyaIrFaTWfQ4wpqc=; b=KvVxhiyXR200F33IB/ExwltA15tzmE7LdQ0UxrTl1KwtZqCtcaF1RC3RM8c1KI2LCvtJPx 6v0IhBNK1neZQhdYQv7WIqQayMyd17hk7O1dW/WF2fmkeXrn77xAaoJghFV8PlDVUhH2E9 E1qmylbGdp7iVDo70UbB3pxLin7YsFEMttM80sXHtmQo8bhucZ27B67vVq0tmb3uhkjaJJ Po7dXiXV3cTIE3OZ7fO+DLFMifNRECDlxMyavkCXzZjiHLyyko+D0pcmtvuwsUl/Ac5cjw lXgxqmb7ILiOTEpixqH3BxTO67IkdUgS2A8/oB9KrpinNd2s3BstARkLurzD5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723055306; a=rsa-sha256; cv=none; b=yMlqOyyJIVU4l8cwQvieXKbdsCPWoIHF4xLgzM+xFJkY/ot7NDS+rqd1nqIKDtLYmh8SlZ mJ0rsGiYI20c5HDE9qETdIPJ476ZKf87HJ0j09nXGf/N5ZGUg/hk5yJIMjK1M2kDhB9t7k OVYhIGnodwtPrfyrNDFSIBwxuFfERQsWIFiQzBS1aQ14GzQMzSvHi8dB4OxAwwl+a7QenW Vxk0sO+jRqV+h+MhRucNEy35cEDB9Ds7BkpOX49WvIpDNB2HT3cPdvulu5UAFrVCpqSBic hedU2N+Q3diuK8gmqEAhAmO/ZCgxCU0MJ1dnuW0KjNej9pfE8Ddssw+Mp2Uw2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723055306; 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=7pNiMlKS63dLeAHZ88RWZZ3Pi2gDyaIrFaTWfQ4wpqc=; b=sMvOr7bS86ORSjXVQaQN9zSbY7PonXaOqOonAS75RMkFsQdDMrK4A+qND3zjYx3mFb+3Jv zaNb9Rki95L1YfANlT91cH4JwH86MAfE4WEek8/G4IlYHAVcGUR8n2oIhmZ03acwXLBliR DaIiJ5t8aH6psufFSsomKHhA6XZCfrJ/njGTULO0z4bqilMkHEZUGMldlbMIwlFc1q46yn CuuChcmKCTI6hT4fp6qfJ+4DULrhk3DCmT5rlsfFTCuNoVOZantqraI4ykw/AjLBl+nUBM HRMf+H4ck87YkEZto8XjruqAM+m/7bo5DR1ltKreq+Tmas/pIbJVRMi6aFwxFw== 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 4WfJZy1Gmxz11yB; Wed, 7 Aug 2024 18:28: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 477ISQLv012535; Wed, 7 Aug 2024 18:28:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477ISQEw012532; Wed, 7 Aug 2024 18:28:26 GMT (envelope-from git) Date: Wed, 7 Aug 2024 18:28:26 GMT Message-Id: <202408071828.477ISQEw012532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: c349e881cf52 - main - rack, bbr: cleanup ack throttling List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c349e881cf52e51ab063c098bd9b99db487b6377 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=c349e881cf52e51ab063c098bd9b99db487b6377 commit c349e881cf52e51ab063c098bd9b99db487b6377 Author: Michael Tuexen AuthorDate: 2024-08-07 18:25:53 +0000 Commit: Michael Tuexen CommitDate: 2024-08-07 18:25:53 +0000 rack, bbr: cleanup ack throttling Use the variable in the TCPCB, not the one in the stack specific data structure. This simplifies the code and brings the functionality to BBR without any change. Reviewed by: Peter Lei, cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46068 --- sys/netinet/tcp_stacks/rack.c | 77 ++++++---------------------- sys/netinet/tcp_stacks/rack_bbr_common.c | 88 +++++++++----------------------- sys/netinet/tcp_stacks/rack_bbr_common.h | 19 +++---- sys/netinet/tcp_stacks/tcp_rack.h | 2 - 4 files changed, 47 insertions(+), 139 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index ec0c6f500946..9749574fe037 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12504,17 +12504,13 @@ rack_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so, else TCPSTAT_INC(tcps_rcvacktooold); /* Send challenge ACK. */ - __ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt); + ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val); rack->r_wanted_output = 1; return (1); } } if (SEQ_GT(th->th_ack, tp->snd_max)) { - __ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt); + ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val); rack->r_wanted_output = 1; return (1); } @@ -13795,9 +13791,7 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so, ctf_calc_rwin(so, tp); if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); if ((thflags & TH_ACK) && (SEQ_LEQ(th->th_ack, tp->snd_una) || SEQ_GT(th->th_ack, tp->snd_max))) { @@ -13852,9 +13846,7 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so, ctf_do_dropwithreset(m, tp, th, BANDLIM_RST_OPENPORT, tlen); return (1); } - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -14043,9 +14035,7 @@ rack_do_established(struct mbuf *m, struct tcphdr *th, struct socket *so, if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); /* * RFC5961 Section 4.2 Send challenge ACK for any SYN in @@ -14064,9 +14054,7 @@ rack_do_established(struct mbuf *m, struct tcphdr *th, struct socket *so, if (ctf_ts_check(m, th, tp, tlen, thflags, &ret_val)) return (ret_val); } - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -14139,15 +14127,11 @@ rack_do_close_wait(struct mbuf *m, struct tcphdr *th, struct socket *so, { int32_t ret_val = 0; int32_t orig_tlen = tlen; - struct tcp_rack *rack; - rack = (struct tcp_rack *)tp->t_fb_ptr; ctf_calc_rwin(so, tp); if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); /* * RFC5961 Section 4.2 Send challenge ACK for any SYN in * synchronized state. @@ -14165,9 +14149,7 @@ rack_do_close_wait(struct mbuf *m, struct tcphdr *th, struct socket *so, if (ctf_ts_check(m, th, tp, tlen, thflags, &ret_val)) return (ret_val); } - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -14269,16 +14251,12 @@ rack_do_fin_wait_1(struct mbuf *m, struct tcphdr *th, struct socket *so, int32_t ret_val = 0; int32_t orig_tlen = tlen; int32_t ourfinisacked = 0; - struct tcp_rack *rack; - rack = (struct tcp_rack *)tp->t_fb_ptr; ctf_calc_rwin(so, tp); if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); /* * RFC5961 Section 4.2 Send challenge ACK for any SYN in * synchronized state. @@ -14296,9 +14274,7 @@ rack_do_fin_wait_1(struct mbuf *m, struct tcphdr *th, struct socket *so, if (ctf_ts_check(m, th, tp, tlen, thflags, &ret_val)) return (ret_val); } - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -14397,16 +14373,12 @@ rack_do_closing(struct mbuf *m, struct tcphdr *th, struct socket *so, int32_t ret_val = 0; int32_t orig_tlen = tlen; int32_t ourfinisacked = 0; - struct tcp_rack *rack; - rack = (struct tcp_rack *)tp->t_fb_ptr; ctf_calc_rwin(so, tp); if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); /* * RFC5961 Section 4.2 Send challenge ACK for any SYN in * synchronized state. @@ -14424,9 +14396,7 @@ rack_do_closing(struct mbuf *m, struct tcphdr *th, struct socket *so, if (ctf_ts_check(m, th, tp, tlen, thflags, &ret_val)) return (ret_val); } - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -14504,16 +14474,12 @@ rack_do_lastack(struct mbuf *m, struct tcphdr *th, struct socket *so, int32_t ret_val = 0; int32_t orig_tlen; int32_t ourfinisacked = 0; - struct tcp_rack *rack; - rack = (struct tcp_rack *)tp->t_fb_ptr; ctf_calc_rwin(so, tp); if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); /* * RFC5961 Section 4.2 Send challenge ACK for any SYN in * synchronized state. @@ -14532,9 +14498,7 @@ rack_do_lastack(struct mbuf *m, struct tcphdr *th, struct socket *so, return (ret_val); } orig_tlen = tlen; - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -14612,17 +14576,13 @@ rack_do_fin_wait_2(struct mbuf *m, struct tcphdr *th, struct socket *so, int32_t ret_val = 0; int32_t orig_tlen = tlen; int32_t ourfinisacked = 0; - struct tcp_rack *rack; - rack = (struct tcp_rack *)tp->t_fb_ptr; ctf_calc_rwin(so, tp); /* Reset receive buffer auto scaling when not in bulk receive mode. */ if ((thflags & TH_RST) || (tp->t_fin_is_rst && (thflags & TH_FIN))) - return (__ctf_process_rst(m, th, so, tp, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)); + return (ctf_process_rst(m, th, so, tp)); /* * RFC5961 Section 4.2 Send challenge ACK for any SYN in * synchronized state. @@ -14640,9 +14600,7 @@ rack_do_fin_wait_2(struct mbuf *m, struct tcphdr *th, struct socket *so, if (ctf_ts_check(m, th, tp, tlen, thflags, &ret_val)) return (ret_val); } - if (_ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val, - &rack->r_ctl.challenge_ack_ts, - &rack->r_ctl.challenge_ack_cnt)) { + if (ctf_drop_checks(to, m, th, tp, &tlen, &thflags, &drop_hdrlen, &ret_val)) { return (ret_val); } /* @@ -15547,7 +15505,6 @@ rack_init(struct tcpcb *tp, void **ptr) rack->r_ctl.rc_lower_rtt_us_cts = us_cts; rack->r_ctl.rc_time_of_last_probertt = us_cts; rack->r_ctl.rc_went_idle_time = us_cts; - rack->r_ctl.challenge_ack_ts = tcp_ts_getticks() - (V_tcp_ack_war_time_window + 1); rack->r_ctl.rc_time_probertt_starts = 0; rack->r_ctl.gp_rnd_thresh = rack_rnd_cnt_req & 0xff; @@ -16702,7 +16659,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb * ack is beyond the largest seq we sent. */ if ((tp->t_flags & TF_ACKNOW) == 0) { - ctf_ack_war_checks(tp, &rack->r_ctl.challenge_ack_ts, &rack->r_ctl.challenge_ack_cnt); + ctf_ack_war_checks(tp); if (tp->t_flags && TF_ACKNOW) rack->r_wanted_output = 1; } diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index b218f449475f..150298f8413f 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -532,28 +532,19 @@ ctf_do_dropwithreset(struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, } void -ctf_ack_war_checks(struct tcpcb *tp, uint32_t *ts, uint32_t *cnt) +ctf_ack_war_checks(struct tcpcb *tp) { - if ((ts != NULL) && (cnt != NULL) && - (V_tcp_ack_war_time_window > 0) && - (V_tcp_ack_war_cnt > 0)) { - /* We are possibly doing ack war prevention */ - uint32_t cts; - - /* - * We use a msec tick here which gives us - * roughly 49 days. We don't need the - * precision of a microsecond timestamp which - * would only give us hours. - */ - cts = tcp_ts_getticks(); - if (TSTMP_LT((*ts), cts)) { - /* Timestamp is in the past */ - *cnt = 0; - *ts = (cts + V_tcp_ack_war_time_window); + sbintime_t now; + + if ((V_tcp_ack_war_time_window > 0) && (V_tcp_ack_war_cnt > 0)) { + now = getsbinuptime(); + if (tp->t_challenge_ack_end < now) { + tp->t_challenge_ack_cnt = 0; + tp->t_challenge_ack_end = now + + V_tcp_ack_war_time_window * SBT_1MS; } - if (*cnt < V_tcp_ack_war_cnt) { - *cnt = (*cnt + 1); + if (tp->t_challenge_ack_cnt < V_tcp_ack_war_cnt) { + tp->t_challenge_ack_cnt++; tp->t_flags |= TF_ACKNOW; } else tp->t_flags &= ~TF_ACKNOW; @@ -568,10 +559,9 @@ ctf_ack_war_checks(struct tcpcb *tp, uint32_t *ts, uint32_t *cnt) * TCB is still valid and locked. */ int -_ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, - struct tcpcb *tp, int32_t *tlenp, - int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val, - uint32_t *ts, uint32_t *cnt) +ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, + struct tcpcb *tp, int32_t *tlenp, + int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val) { int32_t todrop; int32_t thflags; @@ -605,7 +595,7 @@ _ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, * Send an ACK to resynchronize and drop any data. * But keep on processing for RST or ACK. */ - ctf_ack_war_checks(tp, ts, cnt); + ctf_ack_war_checks(tp); todrop = tlen; KMOD_TCPSTAT_INC(tcps_rcvduppack); KMOD_TCPSTAT_ADD(tcps_rcvdupbyte, todrop); @@ -621,7 +611,7 @@ _ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, * ACK now, as the next in-sequence segment * will clear the DSACK block again */ - ctf_ack_war_checks(tp, ts, cnt); + ctf_ack_war_checks(tp); if (tp->t_flags & TF_ACKNOW) tcp_update_sack_list(tp, th->th_seq, th->th_seq + todrop); @@ -653,10 +643,10 @@ _ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, * ack. */ if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) { - ctf_ack_war_checks(tp, ts, cnt); + ctf_ack_war_checks(tp); KMOD_TCPSTAT_INC(tcps_rcvwinprobe); } else { - __ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val, ts, cnt); + ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val); return (1); } } else @@ -677,7 +667,7 @@ _ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, * and valid. */ void -__ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32_t thflags, int32_t tlen, int32_t *ret_val, uint32_t *ts, uint32_t *cnt) +ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32_t thflags, int32_t tlen, int32_t *ret_val) { /* * Generate an ACK dropping incoming segment if it occupies sequence @@ -701,7 +691,7 @@ __ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32 return; } else *ret_val = 0; - ctf_ack_war_checks(tp, ts, cnt); + ctf_ack_war_checks(tp); if (m) m_freem(m); } @@ -720,8 +710,8 @@ ctf_do_drop(struct mbuf *m, struct tcpcb *tp) } int -__ctf_process_rst(struct mbuf *m, struct tcphdr *th, struct socket *so, - struct tcpcb *tp, uint32_t *ts, uint32_t *cnt) +ctf_process_rst(struct mbuf *m, struct tcphdr *th, struct socket *so, + struct tcpcb *tp) { /* * RFC5961 Section 3.2 @@ -768,40 +758,8 @@ __ctf_process_rst(struct mbuf *m, struct tcphdr *th, struct socket *so, dropped = 1; ctf_do_drop(m, tp); } else { - int send_challenge; - KMOD_TCPSTAT_INC(tcps_badrst); - if ((ts != NULL) && (cnt != NULL) && - (V_tcp_ack_war_time_window > 0) && - (V_tcp_ack_war_cnt > 0)) { - /* We are possibly preventing an ack-rst war prevention */ - uint32_t cts; - - /* - * We use a msec tick here which gives us - * roughly 49 days. We don't need the - * precision of a microsecond timestamp which - * would only give us hours. - */ - cts = tcp_ts_getticks(); - if (TSTMP_LT((*ts), cts)) { - /* Timestamp is in the past */ - *cnt = 0; - *ts = (cts + V_tcp_ack_war_time_window); - } - if (*cnt < V_tcp_ack_war_cnt) { - *cnt = (*cnt + 1); - send_challenge = 1; - } else - send_challenge = 0; - } else - send_challenge = 1; - if (send_challenge) { - /* Send challenge ACK. */ - tcp_respond(tp, mtod(m, void *), th, m, - tp->rcv_nxt, tp->snd_nxt, TH_ACK); - tp->last_ack_sent = tp->rcv_nxt; - } + tcp_send_challenge_ack(tp, th, m); } } else { m_freem(m); diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.h b/sys/netinet/tcp_stacks/rack_bbr_common.h index 9e5fbe675a3a..6a8a056d89b0 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.h +++ b/sys/netinet/tcp_stacks/rack_bbr_common.h @@ -89,19 +89,15 @@ int ctf_do_queued_segments(struct tcpcb *tp, int have_pkt); uint32_t ctf_outstanding(struct tcpcb *tp); uint32_t ctf_flight_size(struct tcpcb *tp, uint32_t rc_sacked); int -_ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, +ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, int32_t *tlenp, - int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val, - uint32_t *ts, uint32_t *cnt); -void ctf_ack_war_checks(struct tcpcb *tp, uint32_t *ts, uint32_t *cnt); -#define ctf_drop_checks(a, b, c, d, e, f, g, h) _ctf_drop_checks(a, b, c, d, e, f, g, h, NULL, NULL) + int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val); +void ctf_ack_war_checks(struct tcpcb *tp); void -__ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, +ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, int32_t thflags, int32_t tlen, - int32_t *ret_val, uint32_t *ts, uint32_t *cnt); - -#define ctf_do_dropafterack(a, b, c, d, e, f) __ctf_do_dropafterack(a, b, c, d, e, f, NULL, NULL) + int32_t *ret_val); void ctf_do_dropwithreset(struct mbuf *m, struct tcpcb *tp, @@ -110,9 +106,8 @@ void ctf_do_drop(struct mbuf *m, struct tcpcb *tp); int -__ctf_process_rst(struct mbuf *m, struct tcphdr *th, - struct socket *so, struct tcpcb *tp, uint32_t *ts, uint32_t *cnt); -#define ctf_process_rst(m, t, s, p) __ctf_process_rst(m, t, s, p, NULL, NULL) +ctf_process_rst(struct mbuf *m, struct tcphdr *th, + struct socket *so, struct tcpcb *tp); void ctf_challenge_ack(struct mbuf *m, struct tcphdr *th, diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index ae766272bf30..a64791a9887b 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -553,8 +553,6 @@ struct rack_control { uint32_t rc_last_timeout_snduna; uint32_t last_tlp_acked_start; uint32_t last_tlp_acked_end; - uint32_t challenge_ack_ts; - uint32_t challenge_ack_cnt; uint32_t rc_min_to; /* Socket option value Lock(a) */ uint32_t rc_pkt_delay; /* Socket option value Lock(a) */ uint32_t persist_lost_ends; From nobody Wed Aug 7 19:27:32 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfKv83vn2z5SbHy; Wed, 07 Aug 2024 19:27: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfKv83JH8z4VbX; Wed, 7 Aug 2024 19:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723058852; 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=EdfAYfwL42odZsX5pUYqIQuJNVxywnd92Td3m/DyZ8I=; b=e0nfqNnHTvqhpm9pD+8SSC9adgHCE8rb6T+0fyd/ZQ+9jqjSdahWn93hNM3VMi6HtidUvy BXttVlmuasSj2TIiYFgqckggfwFVxd+mBBrQ/REpVF6I4VM+fdOKpsO6VW9YX/lz4SbeLE Sdi1ODM24qJFbbEALUf6kq8ZbPYX2sa/r6rOYmIKIS0f5xyEYN6OOSAnqYJa/k8N/KUjE0 uUvZao5gyGOvKcVuxZJFx4y7UTFXWQ7o8mumIA/4w58yN4up1+xYiGb189Ms55ZB59X5RZ ZxQFDbwoR9dTkVkHzq4VBsvL9Xl7OluuWupsn9Dt/6daPqDbKpiMOHYrBeWesg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723058852; a=rsa-sha256; cv=none; b=khPCPwrWjJpcwOe/V7K3v4+0twpgDTGWDNWL0a4GQM0r6/rOcmOUeXU1XF0rnf3xK9jdAN 3Ndndf2ABA8hWhlQS15yNm5CiIkRNEmXqJHhtUEq43Gsft4NUB4oytmaUiPGDf5CAV0nxl 5a2NPeKrcGXpKzp6oWeUWKw73A6UVDyP0A1Li3YBK/BtJOFK/e2RVPw7mvcmb12Llmgwuw 1I/qG0wybHD8RGE/zO9zrtGbBcvbbiAXuU6dU05AISCXLW/Ww7+4mqodPwcQKmdTOPzW9Y eCOtu7jPZWTOftPqXN62XDOeRPYAOBk1gnJSkI/bC/1lXYqNNaJpH8mcUpXH9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723058852; 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=EdfAYfwL42odZsX5pUYqIQuJNVxywnd92Td3m/DyZ8I=; b=TvdI8o592mP0j7XTXjQXK69qbeNUcnOhykYDEnYuSYiPTCGeadvr8hJF5SVfzppRyOr5pL 3xlgGbMoEnkYv0NFixO7//4hDUIrskjc0j9Y8SCEXr4kpkEGVNx/2Wiq9TNgcdpcMxW03+ EFB8N+pgNgWeOOU/HTK9Hrg00xum8YLVKq9WDroE0I2IEhXdmQxNPfDxJobDowX32Yyi9r obNsRFY7KNLJG/IoZbyXByZIhi+/diADaO4l9Ph2jJxW58oErU5bsFQcbgEIw5e5FAw9LC nAgOAHYBh5kIkV+x5CM7NL8odSf1DpNMRS+KFF0bvwcFNbCtVoZpEhCr0o86JQ== 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 4WfKv82bm2z12T6; Wed, 7 Aug 2024 19:27: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 477JRWm5015302; Wed, 7 Aug 2024 19:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477JRWEg015299; Wed, 7 Aug 2024 19:27:32 GMT (envelope-from git) Date: Wed, 7 Aug 2024 19:27:32 GMT Message-Id: <202408071927.477JRWEg015299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a9e4753b4fe2 - main - bhyve: Optionally put vCPUs back in the debug state after resuming List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9e4753b4fe20d81263f61c4b7e4383739924898 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a9e4753b4fe20d81263f61c4b7e4383739924898 commit a9e4753b4fe20d81263f61c4b7e4383739924898 Author: Mark Johnston AuthorDate: 2024-08-07 19:27:23 +0000 Commit: Mark Johnston CommitDate: 2024-08-07 19:27:23 +0000 bhyve: Optionally put vCPUs back in the debug state after resuming When the gdb stub is configured to pause guest execution upon boot (i.e., the "w" flag is passed to -G), vCPUs end up suspended in two senses: first, suspended by the GDB stub (marked in the vcpus_suspended set), and suspended by the kernel (because fbsdrun_addcpu() suspends APs before spawning their vCPU threads). When the guest is resumed by the debugger, vCPUs are unsuspended in both senses, but this is not correct for APs. Hack around this problem by re-suspending vCPUs after the debugger resumes guest execution, if they were suspended beforehand. Reviewed by: corvink, jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D46196 --- usr.sbin/bhyve/gdb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 7c04b0017c80..983e7deb61c9 100644 --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -938,8 +938,28 @@ gdb_cpu_add(struct vcpu *vcpu) * executing the first instruction. */ if (!CPU_EMPTY(&vcpus_suspended)) { + cpuset_t suspended; + int error; + + error = vm_debug_cpus(ctx, &suspended); + assert(error == 0); + CPU_SET(vcpuid, &vcpus_suspended); _gdb_cpu_suspend(vcpu, false); + + /* + * In general, APs are started in a suspended mode such that + * they exit with VM_EXITCODE_DEBUG until the BSP starts them. + * In particular, this refers to the kernel's view of the vCPU + * state rather than our own. If the debugger resumes guest + * execution, vCPUs will be unsuspended from the kernel's point + * of view, so we should restore the previous state before + * continuing. + */ + if (CPU_ISSET(vcpuid, &suspended)) { + error = vm_suspend_cpu(vcpu); + assert(error == 0); + } } pthread_mutex_unlock(&gdb_lock); } From nobody Wed Aug 7 20:41:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WfMX518Tmz5Sq5N; Wed, 07 Aug 2024 20:41: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfMX50PZnz4dXM; Wed, 7 Aug 2024 20:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723063269; 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=HLajyiJl7zDcYEaX74cdOnboMOViM6Q/dnFDbiXpPI8=; b=B54X8Vpy66uS3m5cU3vasls+17ssTtGxWFBLQi/z6Zg0erKaKC5LS94FGyNWdsmWnwM6Id 4j7imeRLhPLOxa6lKCAau5Hd4YBgKOYuHCQRcMlasw7viwK1O4c1nMcEdUVgl5yp8OpNwr dn+GBiEDOeJ5fbkjhgp13+NKWBYVBZd6KeqGPh+I7LwyzLsmT+3UJhswYGW9p5464w1BDl h5+PfbYF4tn6S9H0vKgfEKIQGx70MQt4Mx+65+rm9YhymlbzUgl6O5rnQR9LU0/b3NivtZ qcDhx7R4+mRUFXbO2buhVthdP5lJQFjsVTP81dLm2C0MLS9rvOsWlH71/jWYFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723063269; a=rsa-sha256; cv=none; b=aG+82EBn51C9FxCKb/3IBCMOhrQ0VLT77ewcuX3rFivWkWmup2a3ojv/fWXmpgCdOVHQ1H 7KBvYL0QUHeMzHgSo/Y0WJ4FDRm/eayzlcdGQy+Kw9pGTHkx+Nnk3Eth2z+za6JfNOyBm+ 9P65uZ2jFq6fBCzEeniAwT7rOYmnqMG8jvmjuIF2vd7L5wnN9IlCqtqwqgjOpRqGHP2mb3 c+Gg6uwNIXK9Z/bUzf7DPuoCWJE6SFAv1xQ2QHXrf/CEgv8vULUZtiJ/ZRCWnEON8V3jw7 lYd0GwalARoCkXe+PVXHXLCb4s3a6WryYNrdzAS3ytFlh3hPzpJr2AX8JMZacQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723063269; 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=HLajyiJl7zDcYEaX74cdOnboMOViM6Q/dnFDbiXpPI8=; b=UKvrSlU7OnWD1rVfHyJo6RAAGo/O+JKPMlDD8vvQObxl830wLsBm8F+mlDMkrrwIGmhnuV 963HKB2sV6wQ+YkS+0KxZ5l/xvXd2tGxaNuD5MMcPJuIgM/VXOipP+DxJsArjJX9BcQ8yE FiS9HzmJaPwZqA7atjozW8HnH4feaoqDSsVaZCx1C67zAxVqHQctIRiVKo1ufTUD0Xf9nN 01hDNkFqVXrZU06oMrT66+wBv+TsrRRWDOZTsGqzmvrbsf4rSaT6M9OogfPhaYNN1zahQe BreFnsbw5fbcaefV1DdP/5EvaAVqeQvTC4n8TWq91uHixZtCCf/D+iis/bgbGA== 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 4WfMX500xpz14xZ; Wed, 7 Aug 2024 20:41: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 477Kf8Fo041620; Wed, 7 Aug 2024 20:41:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 477Kf8mZ041617; Wed, 7 Aug 2024 20:41:08 GMT (envelope-from git) Date: Wed, 7 Aug 2024 20:41:08 GMT Message-Id: <202408072041.477Kf8mZ041617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: c89d94ad5d95 - main - LinuxKPI: update linuxkpi_video to Linux 6.6 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c89d94ad5d95fd15e891b2723caae8a6104ee153 Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c89d94ad5d95fd15e891b2723caae8a6104ee153 commit c89d94ad5d95fd15e891b2723caae8a6104ee153 Author: Vladimir Kondratyev AuthorDate: 2024-08-07 20:38:38 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-08-07 20:38:38 +0000 LinuxKPI: update linuxkpi_video to Linux 6.6 disable hdmi_audio_infoframe_pack_for_dp function for now as it depends on not imported yet drm sources and is not used by drm-kmod. Reviewed by: manu Sponsored by: Serenity CyberSecurity, LLC Differential Revision: https://reviews.freebsd.org/D46224 --- .../linuxkpi/common/include/linux/aperture.h | 16 ++-- sys/compat/linuxkpi/common/include/linux/hdmi.h | 13 +++- sys/compat/linuxkpi/common/include/video/cmdline.h | 44 +++++++++++ sys/compat/linuxkpi/common/src/linux_aperture.c | 86 ++++++++++++++-------- sys/compat/linuxkpi/common/src/linux_cmdline.c | 63 ++++++++++++++++ sys/compat/linuxkpi/common/src/linux_hdmi.c | 86 +++++++++++++++++----- sys/modules/linuxkpi_video/Makefile | 1 + 7 files changed, 250 insertions(+), 59 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/aperture.h b/sys/compat/linuxkpi/common/include/linux/aperture.h index e0387ed0225d..7eced3cc3cb1 100644 --- a/sys/compat/linuxkpi/common/include/linux/aperture.h +++ b/sys/compat/linuxkpi/common/include/linux/aperture.h @@ -16,7 +16,9 @@ int devm_aperture_acquire_for_platform_device(struct platform_device *pdev, resource_size_t size); int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, - bool primary, const char *name); + const char *name); + +int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev); int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name); #else @@ -28,7 +30,12 @@ static inline int devm_aperture_acquire_for_platform_device(struct platform_devi } static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, - bool primary, const char *name) + const char *name) +{ + return 0; +} + +static inline int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev) { return 0; } @@ -41,7 +48,6 @@ static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, /** * aperture_remove_all_conflicting_devices - remove all existing framebuffers - * @primary: also kick vga16fb if present; only relevant for VGA devices * @name: a descriptive name of the requesting driver * * This function removes all graphics device drivers. Use this function on systems @@ -50,9 +56,9 @@ static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, * Returns: * 0 on success, or a negative errno code otherwise */ -static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name) +static inline int aperture_remove_all_conflicting_devices(const char *name) { - return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name); + return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name); } #endif diff --git a/sys/compat/linuxkpi/common/include/linux/hdmi.h b/sys/compat/linuxkpi/common/include/linux/hdmi.h index c8ec982ff498..e07578167d69 100644 --- a/sys/compat/linuxkpi/common/include/linux/hdmi.h +++ b/sys/compat/linuxkpi/common/include/linux/hdmi.h @@ -170,19 +170,19 @@ struct hdmi_avi_infoframe { enum hdmi_infoframe_type type; unsigned char version; unsigned char length; + bool itc; + unsigned char pixel_repeat; enum hdmi_colorspace colorspace; enum hdmi_scan_mode scan_mode; enum hdmi_colorimetry colorimetry; enum hdmi_picture_aspect picture_aspect; enum hdmi_active_aspect active_aspect; - bool itc; enum hdmi_extended_colorimetry extended_colorimetry; enum hdmi_quantization_range quantization_range; enum hdmi_nups nups; unsigned char video_code; enum hdmi_ycc_quantization_range ycc_quantization_range; enum hdmi_content_type content_type; - unsigned char pixel_repeat; unsigned short top_bar; unsigned short bottom_bar; unsigned short left_bar; @@ -336,7 +336,14 @@ ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, void *buffer, size_t size); ssize_t hdmi_audio_infoframe_pack_only(const struct hdmi_audio_infoframe *frame, void *buffer, size_t size); -int hdmi_audio_infoframe_check(struct hdmi_audio_infoframe *frame); +int hdmi_audio_infoframe_check(const struct hdmi_audio_infoframe *frame); + +#ifdef __linux__ +struct dp_sdp; +ssize_t +hdmi_audio_infoframe_pack_for_dp(const struct hdmi_audio_infoframe *frame, + struct dp_sdp *sdp, u8 dp_version); +#endif enum hdmi_3d_structure { HDMI_3D_STRUCTURE_INVALID = -1, diff --git a/sys/compat/linuxkpi/common/include/video/cmdline.h b/sys/compat/linuxkpi/common/include/video/cmdline.h new file mode 100644 index 000000000000..eaa9a998fda2 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/video/cmdline.h @@ -0,0 +1,44 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Serenity Cyber Security, LLC. + * + * 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 _VIDEO_CMDLINE_H_ +#define _VIDEO_CMDLINE_H_ + +#include + +#define CONFIG_VIDEO_CMDLINE + +#if defined(CONFIG_VIDEO_CMDLINE) +const char *video_get_options(const char *name); +#else +static inline const char * +video_get_options(const char *name) +{ + return (NULL); +} +#endif +#endif /* _VIDEO_CMDLINE_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_aperture.c b/sys/compat/linuxkpi/common/src/linux_aperture.c index 15a56839fa9c..21c7041fc851 100644 --- a/sys/compat/linuxkpi/common/src/linux_aperture.c +++ b/sys/compat/linuxkpi/common/src/linux_aperture.c @@ -20,7 +20,7 @@ * driver can be active at any given time. Many systems load a generic * graphics drivers, such as EFI-GOP or VESA, early during the boot process. * During later boot stages, they replace the generic driver with a dedicated, - * hardware-specific driver. To take over the device the dedicated driver + * hardware-specific driver. To take over the device, the dedicated driver * first has to remove the generic driver. Aperture functions manage * ownership of framebuffer memory and hand-over between drivers. * @@ -43,7 +43,7 @@ * base = mem->start; * size = resource_size(mem); * - * ret = aperture_remove_conflicting_devices(base, size, false, "example"); + * ret = aperture_remove_conflicting_devices(base, size, "example"); * if (ret) * return ret; * @@ -76,7 +76,7 @@ * generic EFI or VESA drivers, have to register themselves as owners of their * framebuffer apertures. Ownership of the framebuffer memory is achieved * by calling devm_aperture_acquire_for_platform_device(). If successful, the - * driveris the owner of the framebuffer range. The function fails if the + * driver is the owner of the framebuffer range. The function fails if the * framebuffer is already owned by another driver. See below for an example. * * .. code-block:: c @@ -126,7 +126,7 @@ * et al for the registered framebuffer range, the aperture helpers call * platform_device_unregister() and the generic driver unloads itself. The * generic driver also has to provide a remove function to make this work. - * Once hot unplugged fro mhardware, it may not access the device's + * Once hot unplugged from hardware, it may not access the device's * registers, framebuffer memory, ROM, etc afterwards. */ @@ -203,7 +203,7 @@ static void aperture_detach_platform_device(struct device *dev) /* * Remove the device from the device hierarchy. This is the right thing - * to do for firmware-based DRM drivers, such as EFI, VESA or VGA. After + * to do for firmware-based fb drivers, such as EFI, VESA or VGA. After * the new driver takes over the hardware, the firmware device's state * will be lost. * @@ -274,7 +274,6 @@ static void aperture_detach_devices(resource_size_t base, resource_size_t size) * aperture_remove_conflicting_devices - remove devices in the given range * @base: the aperture's base address in physical memory * @size: aperture size in bytes - * @primary: also kick vga16fb if present; only relevant for VGA devices * @name: a descriptive name of the requesting driver * * This function removes devices that own apertures within @base and @size. @@ -283,7 +282,7 @@ static void aperture_detach_devices(resource_size_t base, resource_size_t size) * 0 on success, or a negative errno code otherwise */ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, - bool primary, const char *name) + const char *name) { /* * If a driver asked to unregister a platform device registered by @@ -300,18 +299,45 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si aperture_detach_devices(base, size); - /* - * If this is the primary adapter, there could be a VGA device - * that consumes the VGA framebuffer I/O range. Remove this device - * as well. - */ - if (primary) - aperture_detach_devices(VGA_FB_PHYS_BASE, VGA_FB_PHYS_SIZE); - return 0; } EXPORT_SYMBOL(aperture_remove_conflicting_devices); +/** + * __aperture_remove_legacy_vga_devices - remove legacy VGA devices of a PCI devices + * @pdev: PCI device + * + * This function removes VGA devices provided by @pdev, such as a VGA + * framebuffer or a console. This is useful if you have a VGA-compatible + * PCI graphics device with framebuffers in non-BAR locations. Drivers + * should acquire ownership of those memory areas and afterwards call + * this helper to release remaining VGA devices. + * + * If your hardware has its framebuffers accessible via PCI BARS, use + * aperture_remove_conflicting_pci_devices() instead. The function will + * release any VGA devices automatically. + * + * WARNING: Apparently we must remove graphics drivers before calling + * this helper. Otherwise the vga fbdev driver falls over if + * we have vgacon configured. + * + * Returns: + * 0 on success, or a negative errno code otherwise + */ +int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev) +{ + /* VGA framebuffer */ + aperture_detach_devices(VGA_FB_PHYS_BASE, VGA_FB_PHYS_SIZE); + + /* VGA textmode console */ +#ifdef __linux__ + return vga_remove_vgacon(pdev); +#elif defined(__FreeBSD__) + return 0; +#endif +} +EXPORT_SYMBOL(__aperture_remove_legacy_vga_devices); + /** * aperture_remove_conflicting_pci_devices - remove existing framebuffers for PCI devices * @pdev: PCI device @@ -328,14 +354,14 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na { bool primary = false; resource_size_t base, size; - int bar, ret; + int bar, ret = 0; -#ifdef CONFIG_X86 #ifdef __linux__ - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#elif defined(__FreeBSD__) - primary = NULL; -#endif + if (pdev == vga_default_device()) + primary = true; + + if (primary) + sysfb_disable(); #endif for (bar = 0; bar < PCI_STD_NUM_BARS; ++bar) { @@ -344,22 +370,18 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na base = pci_resource_start(pdev, bar); size = pci_resource_len(pdev, bar); - ret = aperture_remove_conflicting_devices(base, size, primary, name); - if (ret) - return ret; + aperture_detach_devices(base, size); } /* - * WARNING: Apparently we must kick fbdev drivers before vgacon, - * otherwise the vga fbdev driver falls over. + * If this is the primary adapter, there could be a VGA device + * that consumes the VGA framebuffer I/O range. Remove this + * device as well. */ -#ifdef __linux__ - ret = vga_remove_vgacon(pdev); - if (ret) - return ret; -#endif + if (primary) + ret = __aperture_remove_legacy_vga_devices(pdev); - return 0; + return ret; } EXPORT_SYMBOL(aperture_remove_conflicting_pci_devices); diff --git a/sys/compat/linuxkpi/common/src/linux_cmdline.c b/sys/compat/linuxkpi/common/src/linux_cmdline.c new file mode 100644 index 000000000000..0cfa1d56ee6a --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_cmdline.c @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2022 Beckhoff Automation GmbH & Co. KG + * + * 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. + * + */ + +#include +#include + +#include