From nobody Mon Oct 25 00:37:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A51171823E1F; Mon, 25 Oct 2021 00:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hcwyf38dfz4YPb; Mon, 25 Oct 2021 00:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4CBE71EEF1; Mon, 25 Oct 2021 00:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19P0bUJf033359; Mon, 25 Oct 2021 00:37:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19P0bUj4033358; Mon, 25 Oct 2021 00:37:30 GMT (envelope-from git) Date: Mon, 25 Oct 2021 00:37:30 GMT Message-Id: <202110250037.19P0bUj4033358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 7a789031139e - stable/13 - lorder: process read-only data symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7a789031139eef4626f7d751a2d24a58d1693c98 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7a789031139eef4626f7d751a2d24a58d1693c98 commit 7a789031139eef4626f7d751a2d24a58d1693c98 Author: Ed Maste AuthorDate: 2021-10-18 21:19:53 +0000 Commit: Ed Maste CommitDate: 2021-10-25 00:37:05 +0000 lorder: process read-only data symbols Previously they were skipped. lorder(1) serves no functional purpose today but we might as well address this longstanding bug while it is still in the tree. PR: 133860 MFC after: 1 week Submitted by: John Hein (cherry picked from commit e1d6d6f9249d37c10a0df68024c7dacebdc7bf98) --- usr.bin/lorder/lorder.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/lorder/lorder.sh b/usr.bin/lorder/lorder.sh index 390b0b7fe845..676f8995fc92 100644 --- a/usr.bin/lorder/lorder.sh +++ b/usr.bin/lorder/lorder.sh @@ -57,14 +57,14 @@ for i in $*; do echo $i $i done -# if the line has " [TDW] " it's a globally defined symbol, put it +# if the line has " [RTDW] " it's a globally defined symbol, put it # into the symbol file. # # if the line has " U " it's a globally undefined symbol, put it into # the reference file. ${NM} ${NMFLAGS} -go $* | sed " - / [TDW] / { - s/:.* [TDW] / / + / [RTDW] / { + s/:.* [RTDW] / / w $S d } From nobody Mon Oct 25 00:38:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4CDBC18242AF; Mon, 25 Oct 2021 00:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcwzY1bF9z4Ywt; Mon, 25 Oct 2021 00:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 17BED1F4A3; Mon, 25 Oct 2021 00:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19P0cHT9033555; Mon, 25 Oct 2021 00:38:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19P0cGYH033554; Mon, 25 Oct 2021 00:38:16 GMT (envelope-from git) Date: Mon, 25 Oct 2021 00:38:16 GMT Message-Id: <202110250038.19P0cGYH033554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 28a6e1beea0e - stable/12 - lorder: process read-only data symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 28a6e1beea0e179a5a52b338b8ea44a0766fd968 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=28a6e1beea0e179a5a52b338b8ea44a0766fd968 commit 28a6e1beea0e179a5a52b338b8ea44a0766fd968 Author: Ed Maste AuthorDate: 2021-10-18 21:19:53 +0000 Commit: Ed Maste CommitDate: 2021-10-25 00:37:56 +0000 lorder: process read-only data symbols Previously they were skipped. lorder(1) serves no functional purpose today but we might as well address this longstanding bug while it is still in the tree. PR: 133860 MFC after: 1 week Submitted by: John Hein (cherry picked from commit e1d6d6f9249d37c10a0df68024c7dacebdc7bf98) --- usr.bin/lorder/lorder.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/lorder/lorder.sh b/usr.bin/lorder/lorder.sh index 390b0b7fe845..676f8995fc92 100644 --- a/usr.bin/lorder/lorder.sh +++ b/usr.bin/lorder/lorder.sh @@ -57,14 +57,14 @@ for i in $*; do echo $i $i done -# if the line has " [TDW] " it's a globally defined symbol, put it +# if the line has " [RTDW] " it's a globally defined symbol, put it # into the symbol file. # # if the line has " U " it's a globally undefined symbol, put it into # the reference file. ${NM} ${NMFLAGS} -go $* | sed " - / [TDW] / { - s/:.* [TDW] / / + / [RTDW] / { + s/:.* [RTDW] / / w $S d } From nobody Mon Oct 25 01:10:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8170F180ADA9; Mon, 25 Oct 2021 01:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hcxh93JP0z4j5l; Mon, 25 Oct 2021 01:10:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4F90D1F8B4; Mon, 25 Oct 2021 01:10:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19P1A1kg075024; Mon, 25 Oct 2021 01:10:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19P1A15K075009; Mon, 25 Oct 2021 01:10:01 GMT (envelope-from git) Date: Mon, 25 Oct 2021 01:10:01 GMT Message-Id: <202110250110.19P1A15K075009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: ed325e2ec2dc - stable/13 - contrib/tzdata: correct DST in Palestine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed325e2ec2dc6e65d1999ec288993e86050ece37 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=ed325e2ec2dc6e65d1999ec288993e86050ece37 commit ed325e2ec2dc6e65d1999ec288993e86050ece37 Author: Philip Paeps AuthorDate: 2021-10-25 01:09:01 +0000 Commit: Philip Paeps CommitDate: 2021-10-25 01:09:01 +0000 contrib/tzdata: correct DST in Palestine Direct commit to stable/13. Merge the corrected DST transition date from tzdata 2021e. This corrects future timestamps in Palestine. --- contrib/tzdata/asia | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index 27d944946b56..ea59f5270b51 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -3388,11 +3388,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. # http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 -# From Tim Parenti (2020-10-20): -# Predict future fall transitions at 01:00 on the Saturday preceding October's -# last Sunday (i.e., Sat>=24). This is consistent with our predictions since -# 2016, although the time of the change differed slightly in 2019. - # From Pierre Cashon (2020-10-20): # The summer time this year started on March 28 at 00:00. # https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ @@ -3405,6 +3400,17 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # For now, guess spring-ahead transitions are at 00:00 on the Saturday # preceding March's last Sunday (i.e., Sat>=24). +# From P Chan (2021-10-18): +# http://wafa.ps/Pages/Details/34701 +# Palestine winter time will start from midnight 2021-10-29 (Thursday-Friday). +# +# From Heba Hemad, Palestine Ministry of Telecom & IT (2021-10-20): +# ... winter time will begin in Palestine from Friday 10-29, 01:00 AM +# by 60 minutes backwards. +# +# From Paul Eggert (2021-10-20): +# Guess future fall transitions on October's last Friday at 01:00. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3440,7 +3446,8 @@ Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - Rule Palestine 2019 only - Mar 29 0:00 1:00 S Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S -Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - +Rule Palestine 2020 only - Oct 24 1:00 0 - +Rule Palestine 2021 max - Oct lastFri 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct From nobody Mon Oct 25 01:10:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B48A8180B15C; Mon, 25 Oct 2021 01:10:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcxhQ4gMRz4j91; Mon, 25 Oct 2021 01:10:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 77D431FA8D; Mon, 25 Oct 2021 01:10:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19P1AEgj078676; Mon, 25 Oct 2021 01:10:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19P1AESY078670; Mon, 25 Oct 2021 01:10:14 GMT (envelope-from git) Date: Mon, 25 Oct 2021 01:10:14 GMT Message-Id: <202110250110.19P1AESY078670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 89e293e5dcb4 - stable/12 - contrib/tzdata: correct DST in Palestine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 89e293e5dcb42e1fd312aab79d045c3eaa017bb6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=89e293e5dcb42e1fd312aab79d045c3eaa017bb6 commit 89e293e5dcb42e1fd312aab79d045c3eaa017bb6 Author: Philip Paeps AuthorDate: 2021-10-25 01:09:08 +0000 Commit: Philip Paeps CommitDate: 2021-10-25 01:09:08 +0000 contrib/tzdata: correct DST in Palestine Direct commit to stable/12. Merge the corrected DST transition date from tzdata 2021e. This corrects future timestamps in Palestine. --- contrib/tzdata/asia | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index 27d944946b56..ea59f5270b51 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -3388,11 +3388,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. # http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 -# From Tim Parenti (2020-10-20): -# Predict future fall transitions at 01:00 on the Saturday preceding October's -# last Sunday (i.e., Sat>=24). This is consistent with our predictions since -# 2016, although the time of the change differed slightly in 2019. - # From Pierre Cashon (2020-10-20): # The summer time this year started on March 28 at 00:00. # https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ @@ -3405,6 +3400,17 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # For now, guess spring-ahead transitions are at 00:00 on the Saturday # preceding March's last Sunday (i.e., Sat>=24). +# From P Chan (2021-10-18): +# http://wafa.ps/Pages/Details/34701 +# Palestine winter time will start from midnight 2021-10-29 (Thursday-Friday). +# +# From Heba Hemad, Palestine Ministry of Telecom & IT (2021-10-20): +# ... winter time will begin in Palestine from Friday 10-29, 01:00 AM +# by 60 minutes backwards. +# +# From Paul Eggert (2021-10-20): +# Guess future fall transitions on October's last Friday at 01:00. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3440,7 +3446,8 @@ Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - Rule Palestine 2019 only - Mar 29 0:00 1:00 S Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S -Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - +Rule Palestine 2020 only - Oct 24 1:00 0 - +Rule Palestine 2021 max - Oct lastFri 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct From nobody Mon Oct 25 01:10:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 66F99180B3C5; Mon, 25 Oct 2021 01:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hcxhg05rdz4jRW; Mon, 25 Oct 2021 01:10:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B0A901F74F; Mon, 25 Oct 2021 01:10:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19P1AQob082228; Mon, 25 Oct 2021 01:10:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19P1AQ4F082227; Mon, 25 Oct 2021 01:10:26 GMT (envelope-from git) Date: Mon, 25 Oct 2021 01:10:26 GMT Message-Id: <202110250110.19P1AQ4F082227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 2517b11885ab - stable/11 - contrib/tzdata: correct DST in Palestine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 2517b11885abe80ed6f4496dd8316335718f24e0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/11 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=2517b11885abe80ed6f4496dd8316335718f24e0 commit 2517b11885abe80ed6f4496dd8316335718f24e0 Author: Philip Paeps AuthorDate: 2021-10-25 01:09:15 +0000 Commit: Philip Paeps CommitDate: 2021-10-25 01:09:15 +0000 contrib/tzdata: correct DST in Palestine Direct commit to stable/11. Merge the corrected DST transition date from tzdata 2021e. This corrects future timestamps in Palestine. --- contrib/tzdata/asia | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index 27d944946b56..ea59f5270b51 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -3388,11 +3388,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. # http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 -# From Tim Parenti (2020-10-20): -# Predict future fall transitions at 01:00 on the Saturday preceding October's -# last Sunday (i.e., Sat>=24). This is consistent with our predictions since -# 2016, although the time of the change differed slightly in 2019. - # From Pierre Cashon (2020-10-20): # The summer time this year started on March 28 at 00:00. # https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ @@ -3405,6 +3400,17 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # For now, guess spring-ahead transitions are at 00:00 on the Saturday # preceding March's last Sunday (i.e., Sat>=24). +# From P Chan (2021-10-18): +# http://wafa.ps/Pages/Details/34701 +# Palestine winter time will start from midnight 2021-10-29 (Thursday-Friday). +# +# From Heba Hemad, Palestine Ministry of Telecom & IT (2021-10-20): +# ... winter time will begin in Palestine from Friday 10-29, 01:00 AM +# by 60 minutes backwards. +# +# From Paul Eggert (2021-10-20): +# Guess future fall transitions on October's last Friday at 01:00. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3440,7 +3446,8 @@ Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - Rule Palestine 2019 only - Mar 29 0:00 1:00 S Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S -Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - +Rule Palestine 2020 only - Oct 24 1:00 0 - +Rule Palestine 2021 max - Oct lastFri 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct From nobody Mon Oct 25 01:17:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C625F180F2D1; Mon, 25 Oct 2021 01:17: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcxrR5GT4z4lnP; Mon, 25 Oct 2021 01:17:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8AC1E1F8D7; Mon, 25 Oct 2021 01:17:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19P1HBrb087414; Mon, 25 Oct 2021 01:17:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19P1HBh3087413; Mon, 25 Oct 2021 01:17:11 GMT (envelope-from git) Date: Mon, 25 Oct 2021 01:17:11 GMT Message-Id: <202110250117.19P1HBh3087413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 30ae8267b920 - releng/12.3 - contrib/tzdata: correct DST in Palestine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 30ae8267b9209789612492fd7dee538bf863ff0b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=30ae8267b9209789612492fd7dee538bf863ff0b commit 30ae8267b9209789612492fd7dee538bf863ff0b Author: Philip Paeps AuthorDate: 2021-10-25 01:09:08 +0000 Commit: Philip Paeps CommitDate: 2021-10-25 01:12:50 +0000 contrib/tzdata: correct DST in Palestine Direct commit to stable/12. Merge the corrected DST transition date from tzdata 2021e. This corrects future timestamps in Palestine. Approved by: re (blanket) (cherry picked from commit 89e293e5dcb42e1fd312aab79d045c3eaa017bb6) --- contrib/tzdata/asia | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index 27d944946b56..ea59f5270b51 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -3388,11 +3388,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. # http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 -# From Tim Parenti (2020-10-20): -# Predict future fall transitions at 01:00 on the Saturday preceding October's -# last Sunday (i.e., Sat>=24). This is consistent with our predictions since -# 2016, although the time of the change differed slightly in 2019. - # From Pierre Cashon (2020-10-20): # The summer time this year started on March 28 at 00:00. # https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ @@ -3405,6 +3400,17 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # For now, guess spring-ahead transitions are at 00:00 on the Saturday # preceding March's last Sunday (i.e., Sat>=24). +# From P Chan (2021-10-18): +# http://wafa.ps/Pages/Details/34701 +# Palestine winter time will start from midnight 2021-10-29 (Thursday-Friday). +# +# From Heba Hemad, Palestine Ministry of Telecom & IT (2021-10-20): +# ... winter time will begin in Palestine from Friday 10-29, 01:00 AM +# by 60 minutes backwards. +# +# From Paul Eggert (2021-10-20): +# Guess future fall transitions on October's last Friday at 01:00. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3440,7 +3446,8 @@ Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - Rule Palestine 2019 only - Mar 29 0:00 1:00 S Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S -Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - +Rule Palestine 2020 only - Oct 24 1:00 0 - +Rule Palestine 2021 max - Oct lastFri 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct From nobody Mon Oct 25 12:47:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A24A81804E31; Mon, 25 Oct 2021 12:47: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdF9D4C13z3CQ9; Mon, 25 Oct 2021 12:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6C648F84; Mon, 25 Oct 2021 12:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PCliu7007280; Mon, 25 Oct 2021 12:47:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PCliBU007279; Mon, 25 Oct 2021 12:47:44 GMT (envelope-from git) Date: Mon, 25 Oct 2021 12:47:44 GMT Message-Id: <202110251247.19PCliBU007279@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6341e6af62b3 - stable/13 - x86: Remove some leftover APM support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6341e6af62b3453aa87afe7679417cc5606bfccc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6341e6af62b3453aa87afe7679417cc5606bfccc commit 6341e6af62b3453aa87afe7679417cc5606bfccc Author: Mark Johnston AuthorDate: 2021-10-16 13:46:43 +0000 Commit: Mark Johnston CommitDate: 2021-10-25 12:46:19 +0000 x86: Remove some leftover APM support This is obsolete since commit 8c576a279ed5 ("Remove APM BIOS support"). Reviewed by: imp, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 06ebadc5f555fd7fa6f869af1e5daf834b1bb04e) --- sys/x86/x86/tsc.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 0ebcea895cd3..fabc980e2231 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -583,23 +582,6 @@ init_TSC_tc(void) */ max_freq = UINT_MAX; - /* - * We can not use the TSC if we support APM. Precise timekeeping - * on an APM'ed machine is at best a fools pursuit, since - * any and all of the time spent in various SMM code can't - * be reliably accounted for. Reading the RTC is your only - * source of reliable time info. The i8254 loses too, of course, - * but we need to have some kind of time... - * We don't know at this point whether APM is going to be used - * or not, nor when it might be activated. Play it safe. - */ - if (power_pm_get_type() == POWER_PM_TYPE_APM) { - tsc_timecounter.tc_quality = -1000; - if (bootverbose) - printf("TSC timecounter disabled: APM enabled.\n"); - goto init; - } - /* * Intel CPUs without a C-state invariant TSC can stop the TSC * in either C2 or C3. Disable use of C2 and C3 while using @@ -635,7 +617,6 @@ init_TSC_tc(void) tsc_timecounter.tc_quality = 1000; max_freq >>= tsc_shift; -init: for (shift = 0; shift <= 31 && (tsc_freq >> shift) > max_freq; shift++) ; From nobody Mon Oct 25 12:47:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D55131805001; Mon, 25 Oct 2021 12:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdF9F54ddz3CKR; Mon, 25 Oct 2021 12:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8E977F85; Mon, 25 Oct 2021 12:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PCljUS007304; Mon, 25 Oct 2021 12:47:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PCljwK007303; Mon, 25 Oct 2021 12:47:45 GMT (envelope-from git) Date: Mon, 25 Oct 2021 12:47:45 GMT Message-Id: <202110251247.19PCljwK007303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 66e63d0cad4d - stable/13 - amd64: Zero the PML5 PTI page when initializing a pmap List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 66e63d0cad4d92cca747a2f62517ca34a126bef2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=66e63d0cad4d92cca747a2f62517ca34a126bef2 commit 66e63d0cad4d92cca747a2f62517ca34a126bef2 Author: Mark Johnston AuthorDate: 2021-10-18 13:29:20 +0000 Commit: Mark Johnston CommitDate: 2021-10-25 12:46:43 +0000 amd64: Zero the PML5 PTI page when initializing a pmap The root page is not zeroed at allocation time since with 4-level tables each entry is copied from a template. However, with 5-level tables only a single entry is filled, so the rest need to be cleared. Reported by: alc Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit b0423d0f5eec89bd6c11c32649603031e3dbbfe1) --- sys/amd64/amd64/pmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 83f2a4c88bf7..43ed0f7b7411 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4186,6 +4186,7 @@ pmap_pinit_pml5_pti(vm_page_t pml5pgu) pml5_entry_t *pm_pml5u; pm_pml5u = (pml5_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pml5pgu)); + pagezero(pm_pml5u); /* * Add pml5 entry at top of KVA pointing to existing pml4 pti From nobody Mon Oct 25 12:47:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3808E1805010; Mon, 25 Oct 2021 12:47: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdF9G681Mz3CSj; Mon, 25 Oct 2021 12:47:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AB49AF4D; Mon, 25 Oct 2021 12:47:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PClkVk007328; Mon, 25 Oct 2021 12:47:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PClku1007327; Mon, 25 Oct 2021 12:47:46 GMT (envelope-from git) Date: Mon, 25 Oct 2021 12:47:46 GMT Message-Id: <202110251247.19PClku1007327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d84e0dd2f4e1 - stable/13 - safexcel: Set the context record unconditionally List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d84e0dd2f4e1865f8f99c208cedf9f3e07202d4d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d84e0dd2f4e1865f8f99c208cedf9f3e07202d4d commit d84e0dd2f4e1865f8f99c208cedf9f3e07202d4d Author: Mark Johnston AuthorDate: 2021-10-18 13:40:47 +0000 Commit: Mark Johnston CommitDate: 2021-10-25 12:46:55 +0000 safexcel: Set the context record unconditionally The condition added in commit 5bdb8b273aaf excludes plain SHA transforms, so for such sessions crypto operations would return incorrect results. Fixes: 5bdb8b273aaf ("safexcel: Maintain per-session context records") Sponsored by: The FreeBSD Foundation (cherry picked from commit 36e4dcf47d45bbb87875ee4a9f5cc26a72a9f048) --- sys/dev/safexcel/safexcel.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 807040a7a1d8..6095787330c1 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -2520,15 +2520,12 @@ safexcel_newsession(device_t dev, crypto_session_t cses, if (csp->csp_auth_mlen != 0) sess->digestlen = csp->csp_auth_mlen; - if ((csp->csp_cipher_alg == 0 || csp->csp_cipher_key != NULL) && - (csp->csp_auth_alg == 0 || csp->csp_auth_key != NULL)) { - sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, - CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, - sess); - sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, - CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, - sess); - } + sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, + CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); + sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, + CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); return (0); } From nobody Mon Oct 25 13:32:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F63D181A19A; Mon, 25 Oct 2021 13:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdG8c73QJz3RGc; Mon, 25 Oct 2021 13:32:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D27AC157C; Mon, 25 Oct 2021 13:32:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDWGrO073502; Mon, 25 Oct 2021 13:32:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDWG3x073501; Mon, 25 Oct 2021 13:32:16 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:32:16 GMT Message-Id: <202110251332.19PDWG3x073501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 2d81ecfcbba8 - stable/13 - wpa: Reconnect ndis_events build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2d81ecfcbba8f838241671b3733cdc66f03dfe98 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=2d81ecfcbba8f838241671b3733cdc66f03dfe98 commit 2d81ecfcbba8f838241671b3733cdc66f03dfe98 Author: Cy Schubert AuthorDate: 2021-10-22 21:12:39 +0000 Commit: Cy Schubert CommitDate: 2021-10-25 13:29:45 +0000 wpa: Reconnect ndis_events build ndis_events build was disconnected by the MFC of 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3. Reconnect it. This is a direct commit to stable/13. Reported by: Scott Allendorf Fixes: 13f32ff71eeb7213bb9f34bdfa88c7ccecf451bc --- usr.sbin/wpa/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/wpa/Makefile b/usr.sbin/wpa/Makefile index fe8fb60b1dc2..18fc45c24e20 100644 --- a/usr.sbin/wpa/Makefile +++ b/usr.sbin/wpa/Makefile @@ -6,6 +6,7 @@ SUBDIR= src .WAIT \ wpa_passphrase \ hostapd \ hostapd_cli \ + ndis_events SUBDIR_PARALLEL= From nobody Mon Oct 25 13:33:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5A0EF181A90C; Mon, 25 Oct 2021 13:33: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdG9y1zGJz3hWW; Mon, 25 Oct 2021 13:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 240B218C3; Mon, 25 Oct 2021 13:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDXQmj073731; Mon, 25 Oct 2021 13:33:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDXQjW073730; Mon, 25 Oct 2021 13:33:26 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:33:26 GMT Message-Id: <202110251333.19PDXQjW073730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: e1e40109d9c2 - stable/12 - wpa: Reconnect ndis_events build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e1e40109d9c29ccda5e5ee53a4e669cc4d589874 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=e1e40109d9c29ccda5e5ee53a4e669cc4d589874 commit e1e40109d9c29ccda5e5ee53a4e669cc4d589874 Author: Cy Schubert AuthorDate: 2021-10-22 21:35:07 +0000 Commit: Cy Schubert CommitDate: 2021-10-25 13:31:03 +0000 wpa: Reconnect ndis_events build ndis_events build was disconnected by the MFC of 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3. Reconnect it. This is a direct commit to stable/12. Reported by: scott-allendorf@uiowa.edu> Fixes: 5654815fd3604e024eefdcb34904d3a7c883e8c5 --- usr.sbin/wpa/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/wpa/Makefile b/usr.sbin/wpa/Makefile index fe8fb60b1dc2..18fc45c24e20 100644 --- a/usr.sbin/wpa/Makefile +++ b/usr.sbin/wpa/Makefile @@ -6,6 +6,7 @@ SUBDIR= src .WAIT \ wpa_passphrase \ hostapd \ hostapd_cli \ + ndis_events SUBDIR_PARALLEL= From nobody Mon Oct 25 13:54:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3DAA21802EDB; Mon, 25 Oct 2021 13:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdGfd1DScz3nKQ; Mon, 25 Oct 2021 13:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 09FBA1E84; Mon, 25 Oct 2021 13:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDsmBM000491; Mon, 25 Oct 2021 13:54:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDsmdx000490; Mon, 25 Oct 2021 13:54:48 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:54:48 GMT Message-Id: <202110251354.19PDsmdx000490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 2b2cef987353 - stable/13 - Add the arm64 table attributes and use them List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b2cef987353d5867462b3dd6aa87db6e09fe693 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2b2cef987353d5867462b3dd6aa87db6e09fe693 commit 2b2cef987353d5867462b3dd6aa87db6e09fe693 Author: Andrew Turner AuthorDate: 2021-09-23 15:00:55 +0000 Commit: Andrew Turner CommitDate: 2021-10-25 13:46:44 +0000 Add the arm64 table attributes and use them Add the table page table attributes on arm64 and use them to add restrictions to the block and page entries below them. This ensures we are unable to increase the permissions in these last level entries without also changing them in the upper levels. Use the attributes to ensure the kernel can't execute from userspace memory and vice versa, userspace has no access to read or write kernel memory, and that the DMAP region is non-executable. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32081 (cherry picked from commit f6de51d3e0315891f6ea9d12340b98336df409b7) --- sys/arm64/arm64/locore.S | 1 + sys/arm64/arm64/pmap.c | 25 +++++++++++++++++++------ sys/arm64/include/pte.h | 9 +++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index ae844c8ff473..06dcfd11404b 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -532,6 +532,7 @@ LENTRY(link_l0_pagetable) /* Build the L0 block entry */ mov x12, #L0_TABLE + orr x12, x12, #(TATTR_UXN_TABLE | TATTR_AP_TABLE_NO_EL0) /* Only use the output address bits */ lsr x9, x9, #PAGE_SHIFT diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 1ae6d87dee51..cdd1ed49fc7d 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -789,7 +789,8 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, freemempos += PAGE_SIZE; pmap_store(&pagetable_dmap[l1_slot], - (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); + (l2_pa & ~Ln_TABLE_MASK) | + TATTR_PXN_TABLE | L1_TABLE); memset(l2, 0, PAGE_SIZE); } @@ -1873,14 +1874,26 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ if (ptepindex >= (NUL2E + NUL1E)) { - pd_entry_t *l0; + pd_entry_t *l0p, l0e; vm_pindex_t l0index; l0index = ptepindex - (NUL2E + NUL1E); - l0 = &pmap->pm_l0[l0index]; - KASSERT((pmap_load(l0) & ATTR_DESCR_VALID) == 0, - ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0))); - pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); + l0p = &pmap->pm_l0[l0index]; + KASSERT((pmap_load(l0p) & ATTR_DESCR_VALID) == 0, + ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0p))); + l0e = VM_PAGE_TO_PHYS(m) | L0_TABLE; + + /* + * Mark all kernel memory as not accessible from userspace + * and userspace memory as not executable from the kernel. + * This has been done for the bootstrap L0 entries in + * locore.S. + */ + if (pmap == kernel_pmap) + l0e |= TATTR_UXN_TABLE | TATTR_AP_TABLE_NO_EL0; + else + l0e |= TATTR_PXN_TABLE; + pmap_store(l0p, l0e); } else if (ptepindex >= NUL2E) { vm_pindex_t l0index, l1index; pd_entry_t *l0, *l1; diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h index b3bec720e9f9..6b816464c167 100644 --- a/sys/arm64/include/pte.h +++ b/sys/arm64/include/pte.h @@ -38,6 +38,15 @@ typedef uint64_t pd_entry_t; /* page directory entry */ typedef uint64_t pt_entry_t; /* page table entry */ #endif +/* Table attributes */ +#define TATTR_MASK UINT64_C(0xfff8000000000000) +#define TATTR_AP_TABLE_MASK (3UL << 61) +#define TATTR_AP_TABLE_RO (2UL << 61) +#define TATTR_AP_TABLE_NO_EL0 (1UL << 61) +#define TATTR_UXN_TABLE (1UL << 60) +#define TATTR_PXN_TABLE (1UL << 59) +/* Bits 58:51 are ignored */ + /* Block and Page attributes */ #define ATTR_MASK_H UINT64_C(0xfffc000000000000) #define ATTR_MASK_L UINT64_C(0x0000000000000fff) From nobody Mon Oct 25 13:54:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A63681802EDE; Mon, 25 Oct 2021 13:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdGff3vL1z3mvh; Mon, 25 Oct 2021 13:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4D98F1E85; Mon, 25 Oct 2021 13:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDsoGH000515; Mon, 25 Oct 2021 13:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDsoxw000514; Mon, 25 Oct 2021 13:54:50 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:54:50 GMT Message-Id: <202110251354.19PDsoxw000514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: dafad94bdb0d - stable/13 - Also print symbols when printing arm64 registers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dafad94bdb0d74e4b9bc642afee33f75df8958b2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dafad94bdb0d74e4b9bc642afee33f75df8958b2 commit dafad94bdb0d74e4b9bc642afee33f75df8958b2 Author: Andrew Turner AuthorDate: 2021-09-23 10:32:16 +0000 Commit: Andrew Turner CommitDate: 2021-10-25 13:46:44 +0000 Also print symbols when printing arm64 registers When printing arm64 registers because of an exception in the kernel also print the symbol and offset. This can be used to track down why the exception occured without needing external tools. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32077 (cherry picked from commit 7ec86b66099124a9c2c88613507a10979cb8b191) --- sys/arm64/arm64/trap.c | 58 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 34e3b08b4e75..a8e016d6bb61 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -25,6 +25,8 @@ * */ +#include "opt_ddb.h" + #include __FBSDID("$FreeBSD$"); @@ -68,7 +70,8 @@ __FBSDID("$FreeBSD$"); #endif #ifdef DDB -#include +#include +#include #endif /* Called from exception.S */ @@ -78,6 +81,7 @@ void do_el0_error(struct trapframe *); void do_serror(struct trapframe *); void unhandled_exception(struct trapframe *); +static void print_gp_register(const char *name, uint64_t value); static void print_registers(struct trapframe *frame); int (*dtrace_invop_jump_addr)(struct trapframe *); @@ -206,7 +210,7 @@ align_abort(struct thread *td, struct trapframe *frame, uint64_t esr, { if (!lower) { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Misaligned access from kernel space!"); } @@ -232,7 +236,7 @@ external_abort(struct thread *td, struct trapframe *frame, uint64_t esr, } print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); panic("Unhandled EL%d external data abort", lower ? 0: 1); } @@ -302,7 +306,7 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL, "Kernel page fault") != 0) { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("data abort in critical section or under mutex"); } @@ -335,7 +339,7 @@ bad_far: printf("Fatal data abort:\n"); print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); #ifdef KDB @@ -356,18 +360,44 @@ bad_far: userret(td, frame); } +static void +print_gp_register(const char *name, uint64_t value) +{ +#if defined(DDB) + c_db_sym_t sym; + const char *sym_name; + db_expr_t sym_value; + db_expr_t offset; +#endif + + printf(" %s: %16lx", name, value); +#if defined(DDB) + /* If this looks like a kernel address try to find the symbol */ + if (value >= VM_MIN_KERNEL_ADDRESS) { + sym = db_search_symbol(value, DB_STGY_ANY, &offset); + if (sym != C_DB_SYM_NULL) { + db_symbol_values(sym, &sym_name, &sym_value); + printf(" (%s + %lx)", sym_name, offset); + } + } +#endif + printf("\n"); +} + static void print_registers(struct trapframe *frame) { + char name[4]; u_int reg; for (reg = 0; reg < nitems(frame->tf_x); reg++) { - printf(" %sx%d: %16lx\n", (reg < 10) ? " " : "", reg, - frame->tf_x[reg]); + snprintf(name, sizeof(name), "%sx%d", (reg < 10) ? " " : "", + reg); + print_gp_register(name, frame->tf_x[reg]); } printf(" sp: %16lx\n", frame->tf_sp); - printf(" lr: %16lx\n", frame->tf_lr); - printf(" elr: %16lx\n", frame->tf_elr); + print_gp_register(" lr", frame->tf_lr); + print_gp_register("elr", frame->tf_lr); printf("spsr: %8x\n", frame->tf_spsr); } @@ -422,7 +452,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) abort_handlers[dfsc](td, frame, esr, far, 0); } else { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled EL1 %s abort: %x", exception == EXCP_INSN_ABORT ? "instruction" : @@ -457,7 +487,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) /* FALLTHROUGH */ default: print_registers(frame); - printf(" far: %16lx\n", READ_SPECIALREG(far_el1)); + print_gp_register("far", READ_SPECIALREG(far_el1)); panic("Unknown kernel exception %x esr_el1 %lx", exception, esr); } @@ -528,7 +558,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame) abort_handlers[dfsc](td, frame, esr, far, 1); else { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled EL0 %s abort: %x", exception == EXCP_INSN_ABORT_L ? "instruction" : @@ -608,7 +638,7 @@ do_serror(struct trapframe *frame) esr = frame->tf_esr; print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled System Error"); } @@ -622,7 +652,7 @@ unhandled_exception(struct trapframe *frame) esr = frame->tf_esr; print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled exception"); } From nobody Mon Oct 25 13:54:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DC4871802F34; Mon, 25 Oct 2021 13:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdGfg4VxSz3n3d; Mon, 25 Oct 2021 13:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 542651E86; Mon, 25 Oct 2021 13:54:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDsp0R000539; Mon, 25 Oct 2021 13:54:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDspFQ000538; Mon, 25 Oct 2021 13:54:51 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:54:51 GMT Message-Id: <202110251354.19PDspFQ000538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: f803dd1e24ea - stable/13 - Add pmap_change_prot on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f803dd1e24eaa37bb0fd6395fb5312265f94f9f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f803dd1e24eaa37bb0fd6395fb5312265f94f9f5 commit f803dd1e24eaa37bb0fd6395fb5312265f94f9f5 Author: Andrew Turner AuthorDate: 2021-09-20 16:49:18 +0000 Commit: Andrew Turner CommitDate: 2021-10-25 13:46:44 +0000 Add pmap_change_prot on arm64 Support changing the protection of preloaded kernel modules by implementing pmap_change_prot on arm64 and calling it from preload_protect. Reviewed by: alc (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32026 (cherry picked from commit a85ce4ad7272ffa4b4649b0ed463341b743e815f) --- sys/arm64/arm64/pmap.c | 94 +++++++++++++++++++++++++++++++++++++++++------- sys/arm64/include/pmap.h | 1 + sys/kern/link_elf.c | 2 +- 3 files changed, 83 insertions(+), 14 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index cdd1ed49fc7d..3fa3a4b62711 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -382,7 +382,8 @@ static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, static void pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte); static bool pmap_activate_int(pmap_t pmap); static void pmap_alloc_asid(pmap_t pmap); -static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode); +static int pmap_change_props_locked(vm_offset_t va, vm_size_t size, + vm_prot_t prot, int mode); static pt_entry_t *pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va); static pt_entry_t *pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, struct rwlock **lockp); @@ -6127,17 +6128,41 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) int error; PMAP_LOCK(kernel_pmap); - error = pmap_change_attr_locked(va, size, mode); + error = pmap_change_props_locked(va, size, PROT_NONE, mode); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + +/* + * Changes the specified virtual address range's protections to those + * specified by "prot". Like pmap_change_attr(), protections for aliases + * in the direct map are updated as well. Protections on aliasing mappings may + * be a subset of the requested protections; for example, mappings in the direct + * map are never executable. + */ +int +pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot) +{ + int error; + + /* Only supported within the kernel map. */ + if (va < VM_MIN_KERNEL_ADDRESS) + return (EINVAL); + + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked(va, size, prot, -1); PMAP_UNLOCK(kernel_pmap); return (error); } static int -pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) +pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, + int mode) { vm_offset_t base, offset, tmpva; pt_entry_t l3, *pte, *newpte; - int lvl; + pt_entry_t bits, mask; + int lvl, rv; PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED); base = trunc_page(va); @@ -6148,12 +6173,44 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) !(base >= VM_MIN_KERNEL_ADDRESS && base < VM_MAX_KERNEL_ADDRESS)) return (EINVAL); + bits = 0; + mask = 0; + if (mode != -1) { + bits = ATTR_S1_IDX(mode); + mask = ATTR_S1_IDX_MASK; + if (mode == VM_MEMATTR_DEVICE) { + mask |= ATTR_S1_XN; + bits |= ATTR_S1_XN; + } + } + if (prot != VM_PROT_NONE) { + /* Don't mark the DMAP as executable. It never is on arm64. */ + if (VIRT_IN_DMAP(base)) { + prot &= ~VM_PROT_EXECUTE; + /* + * XXX Mark the DMAP as writable for now. We rely + * on this in ddb & dtrace to insert breakpoint + * instructions. + */ + prot |= VM_PROT_WRITE; + } + + if ((prot & VM_PROT_WRITE) == 0) { + bits |= ATTR_S1_AP(ATTR_S1_AP_RO); + } + if ((prot & VM_PROT_EXECUTE) == 0) { + bits |= ATTR_S1_PXN; + } + bits |= ATTR_S1_UXN; + mask |= ATTR_S1_AP_MASK | ATTR_S1_XN; + } + for (tmpva = base; tmpva < base + size; ) { pte = pmap_pte(kernel_pmap, tmpva, &lvl); if (pte == NULL) return (EINVAL); - if ((pmap_load(pte) & ATTR_S1_IDX_MASK) == ATTR_S1_IDX(mode)) { + if ((pmap_load(pte) & mask) == bits) { /* * We already have the correct attribute, * ignore this entry. @@ -6194,14 +6251,23 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) case 3: /* Update the entry */ l3 = pmap_load(pte); - l3 &= ~ATTR_S1_IDX_MASK; - l3 |= ATTR_S1_IDX(mode); - if (mode == VM_MEMATTR_DEVICE) - l3 |= ATTR_S1_XN; + l3 &= ~mask; + l3 |= bits; pmap_update_entry(kernel_pmap, pte, l3, tmpva, PAGE_SIZE); + if (!VIRT_IN_DMAP(tmpva)) { + /* + * Keep the DMAP memory in sync. + */ + rv = pmap_change_props_locked( + PHYS_TO_DMAP(l3 & ~ATTR_MASK), + L3_SIZE, prot, mode); + if (rv != 0) + return (rv); + } + /* * If moving to a non-cacheable entry flush * the cache. @@ -6363,12 +6429,14 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, /* * If the page table page is missing and the mapping * is for a kernel address, the mapping must belong to - * the direct map. Page table pages are preallocated - * for every other part of the kernel address space, - * so the direct map region is the only part of the + * either the direct map or the early kernel memory. + * Page table pages are preallocated for every other + * part of the kernel address space, so the direct map + * region and early kernel memory are the only parts of the * kernel address space that must be handled here. */ - KASSERT(!ADDR_IS_KERNEL(va) || VIRT_IN_DMAP(va), + KASSERT(!ADDR_IS_KERNEL(va) || VIRT_IN_DMAP(va) || + (va >= VM_MIN_KERNEL_ADDRESS && va < kernel_vm_end), ("pmap_demote_l2: No saved mpte for va %#lx", va)); /* diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index da739bb765e8..11a0388ab350 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -167,6 +167,7 @@ extern vm_offset_t virtual_end; void pmap_activate_vm(pmap_t); void pmap_bootstrap(vm_offset_t, vm_offset_t, vm_paddr_t, vm_size_t); int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); +int pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot); void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode); void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); bool pmap_klookup(vm_offset_t va, vm_paddr_t *pa); diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index ea21bf447a55..2faaa003380a 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -769,7 +769,7 @@ parse_vnet(elf_file_t ef) static int preload_protect(elf_file_t ef, vm_prot_t prot) { -#ifdef __amd64__ +#if defined(__aarch64__) || defined(__amd64__) Elf_Ehdr *hdr; Elf_Phdr *phdr, *phlimit; vm_prot_t nprot; From nobody Mon Oct 25 13:54:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C967B1802F49; Mon, 25 Oct 2021 13:54:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdGfj2hZyz3nKd; Mon, 25 Oct 2021 13:54:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7C79D1E87; Mon, 25 Oct 2021 13:54:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDsqb7000563; Mon, 25 Oct 2021 13:54:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDsqVj000562; Mon, 25 Oct 2021 13:54:52 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:54:52 GMT Message-Id: <202110251354.19PDsqVj000562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 39dbb494404f - stable/13 - Only demote when needed in the arm64 pmap_change_props_locked List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 39dbb494404f511422a97274d5b55fae6ef4a6e2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=39dbb494404f511422a97274d5b55fae6ef4a6e2 commit 39dbb494404f511422a97274d5b55fae6ef4a6e2 Author: Andrew Turner AuthorDate: 2021-10-06 16:38:22 +0000 Commit: Andrew Turner CommitDate: 2021-10-25 13:46:44 +0000 Only demote when needed in the arm64 pmap_change_props_locked When changing page table properties there is no need to demote a level 1 or level 2 block if we are changing the entire memory range the block is mapping. In this case just change the block directly. Reported by: alc, kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32339 (cherry picked from commit 806a88e742002b0e82a4ea06f8e147f627947c2c) --- sys/arm64/arm64/pmap.c | 76 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 3fa3a4b62711..176762b9bfff 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -6160,7 +6160,8 @@ pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, int mode) { vm_offset_t base, offset, tmpva; - pt_entry_t l3, *pte, *newpte; + vm_size_t pte_size; + pt_entry_t pte, *ptep, *newpte; pt_entry_t bits, mask; int lvl, rv; @@ -6206,11 +6207,11 @@ pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, } for (tmpva = base; tmpva < base + size; ) { - pte = pmap_pte(kernel_pmap, tmpva, &lvl); - if (pte == NULL) + ptep = pmap_pte(kernel_pmap, tmpva, &lvl); + if (ptep == NULL) return (EINVAL); - if ((pmap_load(pte) & mask) == bits) { + if ((pmap_load(ptep) & mask) == bits) { /* * We already have the correct attribute, * ignore this entry. @@ -6237,47 +6238,60 @@ pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, default: panic("Invalid DMAP table level: %d\n", lvl); case 1: - newpte = pmap_demote_l1(kernel_pmap, pte, + if ((tmpva & L1_OFFSET) == 0 && + (base + size - tmpva) >= L1_SIZE) { + pte_size = L1_SIZE; + break; + } + newpte = pmap_demote_l1(kernel_pmap, ptep, tmpva & ~L1_OFFSET); if (newpte == NULL) return (EINVAL); - pte = pmap_l1_to_l2(pte, tmpva); + ptep = pmap_l1_to_l2(ptep, tmpva); + /* FALLTHROUGH */ case 2: - newpte = pmap_demote_l2(kernel_pmap, pte, + if ((tmpva & L2_OFFSET) == 0 && + (base + size - tmpva) >= L2_SIZE) { + pte_size = L2_SIZE; + break; + } + newpte = pmap_demote_l2(kernel_pmap, ptep, tmpva); if (newpte == NULL) return (EINVAL); - pte = pmap_l2_to_l3(pte, tmpva); + ptep = pmap_l2_to_l3(ptep, tmpva); + /* FALLTHROUGH */ case 3: - /* Update the entry */ - l3 = pmap_load(pte); - l3 &= ~mask; - l3 |= bits; + pte_size = PAGE_SIZE; + break; + } - pmap_update_entry(kernel_pmap, pte, l3, tmpva, - PAGE_SIZE); + /* Update the entry */ + pte = pmap_load(ptep); + pte &= ~mask; + pte |= bits; - if (!VIRT_IN_DMAP(tmpva)) { - /* - * Keep the DMAP memory in sync. - */ - rv = pmap_change_props_locked( - PHYS_TO_DMAP(l3 & ~ATTR_MASK), - L3_SIZE, prot, mode); - if (rv != 0) - return (rv); - } + pmap_update_entry(kernel_pmap, ptep, pte, tmpva, + pte_size); + if (!VIRT_IN_DMAP(tmpva)) { /* - * If moving to a non-cacheable entry flush - * the cache. + * Keep the DMAP memory in sync. */ - if (mode == VM_MEMATTR_UNCACHEABLE) - cpu_dcache_wbinv_range(tmpva, L3_SIZE); - - break; + rv = pmap_change_props_locked( + PHYS_TO_DMAP(pte & ~ATTR_MASK), pte_size, + prot, mode); + if (rv != 0) + return (rv); } - tmpva += PAGE_SIZE; + + /* + * If moving to a non-cacheable entry flush + * the cache. + */ + if (mode == VM_MEMATTR_UNCACHEABLE) + cpu_dcache_wbinv_range(tmpva, pte_size); + tmpva += pte_size; } } From nobody Mon Oct 25 13:54:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 241B31803236; Mon, 25 Oct 2021 13:54:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdGfk6MRKz3nKk; Mon, 25 Oct 2021 13:54:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9506D1E88; Mon, 25 Oct 2021 13:54:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PDsrnU000588; Mon, 25 Oct 2021 13:54:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PDsrtg000587; Mon, 25 Oct 2021 13:54:53 GMT (envelope-from git) Date: Mon, 25 Oct 2021 13:54:53 GMT Message-Id: <202110251354.19PDsrtg000587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 3a98aae1e5a6 - stable/13 - Teach the readelf about arm64 gnu properties List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a98aae1e5a66831ee98198068f4847749178a94 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3a98aae1e5a66831ee98198068f4847749178a94 commit 3a98aae1e5a66831ee98198068f4847749178a94 Author: Andrew Turner AuthorDate: 2021-09-17 15:54:31 +0000 Commit: Andrew Turner CommitDate: 2021-10-25 13:46:44 +0000 Teach the readelf about arm64 gnu properties On arm64 binaries can be tagged as using BTI or PAC. Add support to decode these to the elftoolchain readelf. To simplify the code use a table based method to find the flag description table. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32315 (cherry picked from commit aacbf3fb8482226fcdf6a19af1011f9d65c20f2a) --- contrib/elftoolchain/readelf/readelf.c | 69 +++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index d5f9205e354d..f33519112eb4 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -229,6 +229,12 @@ struct flag_desc { const char *desc; }; +struct flag_desc_list { + uint32_t type; + const char *desc_str; + struct flag_desc *desc; +}; + struct mips_option { uint64_t flag; const char *desc; @@ -3539,15 +3545,50 @@ dump_gnu_hash(struct readelf *re, struct section *s) free(bl); } +static struct flag_desc gnu_property_aarch64_feature_1_and_bits[] = { + { GNU_PROPERTY_AARCH64_FEATURE_1_BTI, "BTI" }, + { GNU_PROPERTY_AARCH64_FEATURE_1_PAC, "PAC" }, + { 0, NULL } +}; + +static struct flag_desc_list gnu_property_aarch64[] = { + { + GNU_PROPERTY_AARCH64_FEATURE_1_AND, + "AArch64 features", + gnu_property_aarch64_feature_1_and_bits + }, + { 0, NULL, NULL } +}; + static struct flag_desc gnu_property_x86_feature_1_and_bits[] = { { GNU_PROPERTY_X86_FEATURE_1_IBT, "IBT" }, { GNU_PROPERTY_X86_FEATURE_1_SHSTK, "SHSTK" }, { 0, NULL } }; +static struct flag_desc_list gnu_property_x86[] = { + { + GNU_PROPERTY_X86_FEATURE_1_AND, + "x64 features", + gnu_property_x86_feature_1_and_bits + }, + { 0, NULL, NULL } +}; + +static struct { + unsigned int emachine; + struct flag_desc_list *flag_list; +} gnu_property_archs[] = { + { EM_AARCH64, gnu_property_aarch64 }, + { EM_X86_64, gnu_property_x86 }, + { 0, NULL } +}; + static void dump_gnu_property_type_0(struct readelf *re, const char *buf, size_t sz) { + struct flag_desc_list *desc_list; + struct flag_desc *desc; size_t i; uint32_t type, prop_sz; @@ -3566,19 +3607,35 @@ dump_gnu_property_type_0(struct readelf *re, const char *buf, size_t sz) if (type >= GNU_PROPERTY_LOPROC && type <= GNU_PROPERTY_HIPROC) { - if (re->ehdr.e_machine != EM_X86_64) { + desc_list = NULL; + for (i = 0; gnu_property_archs[i].flag_list != NULL; + i++) { + if (gnu_property_archs[i].emachine == + re->ehdr.e_machine) { + desc_list = + gnu_property_archs[i].flag_list; + break; + } + } + if (desc_list == NULL) { printf("machine type %x unknown\n", re->ehdr.e_machine); goto unknown; } - switch (type) { - case GNU_PROPERTY_X86_FEATURE_1_AND: - printf("x86 features:"); + + desc = NULL; + for (i = 0; desc_list[i].desc != NULL; i++) { + if (desc_list[i].type == type) { + desc = desc_list[i].desc; + break; + } + } + if (desc != NULL) { + printf("%s:", desc_list[i].desc_str); if (prop_sz != 4) goto bad; - dump_flags(gnu_property_x86_feature_1_and_bits, + dump_flags(desc, *(const uint32_t *)(const void *)buf); - break; } } From nobody Mon Oct 25 15:58:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5143E1816C80; Mon, 25 Oct 2021 15:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdKPn1DkFz3JFM; Mon, 25 Oct 2021 15:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0A49039DF; Mon, 25 Oct 2021 15:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PFwqcb061317; Mon, 25 Oct 2021 15:58:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PFwqha061316; Mon, 25 Oct 2021 15:58:52 GMT (envelope-from git) Date: Mon, 25 Oct 2021 15:58:52 GMT Message-Id: <202110251558.19PFwqha061316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: dcb72294601a - stable/13 - camcontrol(8): Clean up references to removed symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dcb72294601aea71c41780d8ba2c4766136d72fc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dcb72294601aea71c41780d8ba2c4766136d72fc commit dcb72294601aea71c41780d8ba2c4766136d72fc Author: Felix Johnson AuthorDate: 2021-10-20 04:32:54 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-25 15:58:27 +0000 camcontrol(8): Clean up references to removed symbols Patch the manpage to remove references to devq_openings and devq_queued. Document the allocated tag that has been added in the same commit. The relevant code change was committed as r271588 (959ec2581b23aefebb3bae26c527c1b25834a9e3) by mav@. PR: 223651 Reported by: Bertrand Petit (cherry picked from commit d4cf7dc0df289ad0e16b5b40b076311c71e663dc) --- sbin/camcontrol/camcontrol.8 | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index cf7aec25022d..3f6ec9a0d20d 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 2019 +.Dd October 20, 2021 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -1085,18 +1085,8 @@ to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB: This is the amount of capacity for transactions queued to a given device. .It dev_active This is the number of transactions currently queued to a device. -.It devq_openings -This is the kernel queue space for transactions. -This count usually mirrors -dev_openings except during error recovery operations when -the device queue is frozen (device is not allowed to receive -commands), the number of dev_openings is reduced, or transaction -replay is occurring. -.It devq_queued -This is the number of transactions waiting in the kernel queue for capacity -on the device. -This number is usually zero unless error recovery is in -progress. +.It allocated +This is the number of CCBs allocated for the device. .It held The held count is the number of CCBs held by peripheral drivers that have either just been completed or are about to be released to the transport From nobody Mon Oct 25 16:13:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CF7121826335; Mon, 25 Oct 2021 16:13: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdKkd30zCz3mWH; Mon, 25 Oct 2021 16:13:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 03FD83BF9; Mon, 25 Oct 2021 16:13:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PGDSTr097840; Mon, 25 Oct 2021 16:13:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PGDSuD097839; Mon, 25 Oct 2021 16:13:28 GMT (envelope-from git) Date: Mon, 25 Oct 2021 16:13:28 GMT Message-Id: <202110251613.19PGDSuD097839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b382b78503b5 - main - LinuxKPI: add kstrtou8() and kstrtou8_from_user() to kernel.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b382b78503b56ad6b787b995b46418db27adaa61 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b382b78503b56ad6b787b995b46418db27adaa61 commit b382b78503b56ad6b787b995b46418db27adaa61 Author: Bjoern A. Zeeb AuthorDate: 2021-10-22 11:04:36 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 16:10:48 +0000 LinuxKPI: add kstrtou8() and kstrtou8_from_user() to kernel.h Analogous to the other sized version of kstrto[u]() and kstrtobool_from_user() add the "u8" versions needed by a driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32598 --- sys/compat/linuxkpi/common/include/linux/kernel.h | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 852603f75f8b..6cbd95c4ac64 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -393,6 +393,24 @@ kstrtouint(const char *cp, unsigned int base, unsigned int *res) return (0); } +static inline int +kstrtou8(const char *cp, unsigned int base, u8 *res) +{ + char *end; + unsigned long temp; + + *res = temp = strtoul(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (u8)temp) + return (-ERANGE); + return (0); +} + static inline int kstrtou16(const char *cp, unsigned int base, u16 *res) { @@ -484,6 +502,21 @@ kstrtobool_from_user(const char __user *s, size_t count, bool *res) return (kstrtobool(buf, res)); } +static inline int +kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, + u8 *p) +{ + char buf[8] = {}; + + if (count > (sizeof(buf) - 1)) + count = (sizeof(buf) - 1); + + if (copy_from_user(buf, s, count)) + return (-EFAULT); + + return (kstrtou8(buf, base, p)); +} + #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) From nobody Mon Oct 25 16:14:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B9E38182774F; Mon, 25 Oct 2021 16:14:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdKmF3bDBz3p1T; Mon, 25 Oct 2021 16:14:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 115663BFC; Mon, 25 Oct 2021 16:14:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PGEq4t098157; Mon, 25 Oct 2021 16:14:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PGEqKj098156; Mon, 25 Oct 2021 16:14:52 GMT (envelope-from git) Date: Mon, 25 Oct 2021 16:14:52 GMT Message-Id: <202110251614.19PGEqKj098156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a5e2a27dca4b - main - LinuxKPI: add strreplace() to string.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5e2a27dca4bd5f4795b42ac598d4fff1c3a6eae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a5e2a27dca4bd5f4795b42ac598d4fff1c3a6eae commit a5e2a27dca4bd5f4795b42ac598d4fff1c3a6eae Author: Bjoern A. Zeeb AuthorDate: 2021-10-22 11:00:36 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 16:12:10 +0000 LinuxKPI: add strreplace() to string.h Add strreplace() needed by a driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32597 --- sys/compat/linuxkpi/common/include/linux/string.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 659a48d93596..a757464bf02b 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -167,6 +167,19 @@ str_has_prefix(const char *str, const char *prefix) return (strncmp(str, prefix, len) == 0 ? len : 0); } +static inline char * +strreplace(char *str, char old, char new) +{ + char *p; + + p = strchrnul(str, old); + while (p != NULL && *p != '\0') { + *p = new; + p = strchrnul(str, old); + } + return (p); +} + static inline ssize_t strscpy(char* dst, const char* src, size_t len) { From nobody Mon Oct 25 17:28:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD383180D83C; Mon, 25 Oct 2021 17:28: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMPc5N2lz3GrV; Mon, 25 Oct 2021 17:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 94EA74EB2; Mon, 25 Oct 2021 17:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHSqF6091292; Mon, 25 Oct 2021 17:28:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHSqfn091291; Mon, 25 Oct 2021 17:28:52 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:28:52 GMT Message-Id: <202110251728.19PHSqfn091291@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: 9ef7df022a46 - main - hyperv: Register hyperv_timecounter later during boot List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ef7df022a467776aa616b92fe5783e4261e84c6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9ef7df022a467776aa616b92fe5783e4261e84c6 commit 9ef7df022a467776aa616b92fe5783e4261e84c6 Author: Mark Johnston AuthorDate: 2021-10-25 17:08:38 +0000 Commit: Mark Johnston CommitDate: 2021-10-25 17:25:01 +0000 hyperv: Register hyperv_timecounter later during boot Previously the MSR-based timecounter was registered during SI_SUB_HYPERVISOR, i.e., very early during boot, and before SI_SUB_LOCK. After commit 621fd9dcb2d8 this triggers a panic since the timecounter list lock is not yet initialized. The hyperv timecounter does not need to be registered so early, so defer that to SI_SUB_DRIVERS, at the same time the hyperv TSC timecounter is registered. Reported by: whu Approved by: whu Fixes: 621fd9dcb2d8 ("timecounter: Lock the timecounter list") MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/hyperv/vmbus/hyperv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c index 5bb38fde8241..2c413664cd07 100644 --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -247,6 +247,13 @@ hyperv_init(void *dummy __unused) /* Set guest id */ wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); +} +SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, + NULL); + +static void +hyperv_tc_init(void *arg __unused) +{ if (hyperv_features & CPUID_HV_MSR_TIME_REFCNT) { /* Register Hyper-V timecounter */ tc_init(&hyperv_timecounter); @@ -258,8 +265,7 @@ hyperv_init(void *dummy __unused) hyperv_tc64 = hyperv_tc64_rdmsr; } } -SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, - NULL); +SYSINIT(hyperv_tc_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, hyperv_tc_init, NULL); static void hypercall_memfree(void) From nobody Mon Oct 25 17:34:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BA8FF1810A96; Mon, 25 Oct 2021 17:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMWg4yHPz3JRb; Mon, 25 Oct 2021 17:34:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 89B0E50AF; Mon, 25 Oct 2021 17:34:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHY7sS004348; Mon, 25 Oct 2021 17:34:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHY7Ix004347; Mon, 25 Oct 2021 17:34:07 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:34:07 GMT Message-Id: <202110251734.19PHY7Ix004347@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: 1b610624fdc8 - main - vm_object_list: split sysctl handler in separate function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b610624fdc851f54871f7ee4d67642f5879096f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1b610624fdc851f54871f7ee4d67642f5879096f commit 1b610624fdc851f54871f7ee4d67642f5879096f Author: Konstantin Belousov AuthorDate: 2021-07-13 10:23:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 17:34:01 +0000 vm_object_list: split sysctl handler in separate function Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31163 --- sys/vm/vm_object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 9bd3f416ff94..533d1e37318e 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2471,7 +2471,7 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) } static int -sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) +vm_object_list_handler(struct sysctl_req *req) { struct kinfo_vmobject *kvo; char *fullpath, *freepath; @@ -2588,6 +2588,13 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) free(kvo, M_TEMP); return (error); } + +static int +sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) +{ + return (vm_object_list_handler(req)); +} + SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_object_list, "S,kinfo_vmobject", "List of VM objects"); From nobody Mon Oct 25 17:34:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 107471810971; Mon, 25 Oct 2021 17:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMWh6c3Lz3JP2; Mon, 25 Oct 2021 17:34:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AF28350B0; Mon, 25 Oct 2021 17:34:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHY8PH004372; Mon, 25 Oct 2021 17:34:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHY8OD004371; Mon, 25 Oct 2021 17:34:08 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:34:08 GMT Message-Id: <202110251734.19PHY8OD004371@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: 42812ccc969f - main - Add vm.swap_objects sysctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42812ccc969f174b3e5827c1c320b1738a1e0985 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42812ccc969f174b3e5827c1c320b1738a1e0985 commit 42812ccc969f174b3e5827c1c320b1738a1e0985 Author: Konstantin Belousov AuthorDate: 2021-07-13 10:27:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 17:34:01 +0000 Add vm.swap_objects sysctl Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31163 --- sys/vm/vm_object.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 533d1e37318e..addcf5f2c686 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2471,7 +2471,7 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) } static int -vm_object_list_handler(struct sysctl_req *req) +vm_object_list_handler(struct sysctl_req *req, bool swap_only) { struct kinfo_vmobject *kvo; char *fullpath, *freepath; @@ -2509,10 +2509,12 @@ vm_object_list_handler(struct sysctl_req *req) */ mtx_lock(&vm_object_list_mtx); TAILQ_FOREACH(obj, &vm_object_list, object_list) { - if (obj->type == OBJT_DEAD) + if (obj->type == OBJT_DEAD || + (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) continue; VM_OBJECT_RLOCK(obj); - if (obj->type == OBJT_DEAD) { + if (obj->type == OBJT_DEAD || + (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) { VM_OBJECT_RUNLOCK(obj); continue; } @@ -2592,13 +2594,31 @@ vm_object_list_handler(struct sysctl_req *req) static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { - return (vm_object_list_handler(req)); + return (vm_object_list_handler(req, false)); } SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_object_list, "S,kinfo_vmobject", "List of VM objects"); +static int +sysctl_vm_object_list_swap(SYSCTL_HANDLER_ARGS) +{ + return (vm_object_list_handler(req, true)); +} + +/* + * This sysctl returns list of the anonymous or swap objects. Intent + * is to provide stripped optimized list useful to analyze swap use. + * Since technically non-swap (default) objects participate in the + * shadow chains, and are converted to swap type as needed by swap + * pager, we must report them. + */ +SYSCTL_PROC(_vm, OID_AUTO, swap_objects, + CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, + sysctl_vm_object_list_swap, "S,kinfo_vmobject", + "List of swap VM objects"); + #include "opt_ddb.h" #ifdef DDB #include From nobody Mon Oct 25 17:34:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6E5AB1810977; Mon, 25 Oct 2021 17:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMWk02Jmz3Jm4; Mon, 25 Oct 2021 17:34:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C966451F6; Mon, 25 Oct 2021 17:34:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHY92o004396; Mon, 25 Oct 2021 17:34:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHY9Oc004395; Mon, 25 Oct 2021 17:34:09 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:34:09 GMT Message-Id: <202110251734.19PHY9Oc004395@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: 7738118e9a29 - main - vm.objects_swap: disable reporting some information List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7738118e9a298a205b37c256245fd8449acccb0c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7738118e9a298a205b37c256245fd8449acccb0c commit 7738118e9a298a205b37c256245fd8449acccb0c Author: Konstantin Belousov AuthorDate: 2021-07-13 10:34:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 17:34:01 +0000 vm.objects_swap: disable reporting some information For making the call faster, do not count active/inactive object queues, and do not report vnode info if any (for tmpfs). Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31163 --- sys/vm/vm_object.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index addcf5f2c686..9462e8753afb 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2526,20 +2526,22 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) kvo->kvo_memattr = obj->memattr; kvo->kvo_active = 0; kvo->kvo_inactive = 0; - TAILQ_FOREACH(m, &obj->memq, listq) { - /* - * A page may belong to the object but be - * dequeued and set to PQ_NONE while the - * object lock is not held. This makes the - * reads of m->queue below racy, and we do not - * count pages set to PQ_NONE. However, this - * sysctl is only meant to give an - * approximation of the system anyway. - */ - if (m->a.queue == PQ_ACTIVE) - kvo->kvo_active++; - else if (m->a.queue == PQ_INACTIVE) - kvo->kvo_inactive++; + if (!swap_only) { + TAILQ_FOREACH(m, &obj->memq, listq) { + /* + * A page may belong to the object but be + * dequeued and set to PQ_NONE while the + * object lock is not held. This makes the + * reads of m->queue below racy, and we do not + * count pages set to PQ_NONE. However, this + * sysctl is only meant to give an + * approximation of the system anyway. + */ + if (m->a.queue == PQ_ACTIVE) + kvo->kvo_active++; + else if (m->a.queue == PQ_INACTIVE) + kvo->kvo_inactive++; + } } kvo->kvo_vn_fileid = 0; @@ -2547,7 +2549,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) kvo->kvo_vn_fsid_freebsd11 = 0; freepath = NULL; fullpath = ""; - kvo->kvo_type = vm_object_kvme_type(obj, &vp); + vp = NULL; + kvo->kvo_type = vm_object_kvme_type(obj, swap_only ? NULL : &vp); if (vp != NULL) { vref(vp); } else if ((obj->flags & OBJ_ANON) != 0) { From nobody Mon Oct 25 17:34:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AAA521810D81; Mon, 25 Oct 2021 17:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMWl1yxXz3JRt; Mon, 25 Oct 2021 17:34:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 059EC50B1; Mon, 25 Oct 2021 17:34:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHYA9x004420; Mon, 25 Oct 2021 17:34:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHYAOb004419; Mon, 25 Oct 2021 17:34:10 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:34:10 GMT Message-Id: <202110251734.19PHYAOb004419@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: 350fc36b4cf8 - main - sysctl vm.objects: yield if hog List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 350fc36b4cf896cbfce657a6dab600b26367a34a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=350fc36b4cf896cbfce657a6dab600b26367a34a commit 350fc36b4cf896cbfce657a6dab600b26367a34a Author: Konstantin Belousov AuthorDate: 2021-05-07 22:13:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 17:34:02 +0000 sysctl vm.objects: yield if hog Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31163 --- sys/vm/vm_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 9462e8753afb..5bbe7faed50b 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2585,6 +2585,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) kvo->kvo_structsize = roundup(kvo->kvo_structsize, sizeof(uint64_t)); error = SYSCTL_OUT(req, kvo, kvo->kvo_structsize); + maybe_yield(); mtx_lock(&vm_object_list_mtx); if (error) break; From nobody Mon Oct 25 17:47:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 967C918179D3; Mon, 25 Oct 2021 17:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdMqc3sXmz3PDk; Mon, 25 Oct 2021 17:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 64E865490; Mon, 25 Oct 2021 17:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PHluLe017806; Mon, 25 Oct 2021 17:47:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PHlugL017805; Mon, 25 Oct 2021 17:47:56 GMT (envelope-from git) Date: Mon, 25 Oct 2021 17:47:56 GMT Message-Id: <202110251747.19PHlugL017805@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: 40ddde6ef9f3 - main - rtld: Print currently configured search path for libraries for -v List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40ddde6ef9f38fd238fd1d84d77750f96c96a157 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=40ddde6ef9f38fd238fd1d84d77750f96c96a157 commit 40ddde6ef9f38fd238fd1d84d77750f96c96a157 Author: Konstantin Belousov AuthorDate: 2021-10-25 16:16:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 17:41:53 +0000 rtld: Print currently configured search path for libraries for -v Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8b1f84c6901a..05afe5f42c3e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -466,6 +466,13 @@ rtld_init_env_vars(char **env) rtld_init_env_vars_for_prefix(env, ld_env_prefix); } +static void +set_ld_elf_hints_path(void) +{ + if (ld_elf_hints_path == NULL || strlen(ld_elf_hints_path) == 0) + ld_elf_hints_path = ld_elf_hints_default; +} + /* * Main entry point for dynamic linking. The first argument is the * stack pointer. The stack is expected to be laid out as described @@ -723,9 +730,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); ld_utrace = ld_get_env_var(LD_UTRACE); - if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0) - ld_elf_hints_path = ld_elf_hints_default; - + set_ld_elf_hints_path(); if (ld_debug != NULL && *ld_debug != '\0') debug = 1; dbg("%s is initialized, base address = %p", __progname, @@ -5972,16 +5977,23 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, mib[1] = HW_MACHINE; sz = sizeof(machine); sysctl(mib, nitems(mib), machine, &sz, NULL, 0); + ld_elf_hints_path = ld_get_env_var( + LD_ELF_HINTS_PATH); + set_ld_elf_hints_path(); rtld_printf( "FreeBSD ld-elf.so.1 %s\n" "FreeBSD_version %d\n" "Default lib path %s\n" + "Hints lib path %s\n" "Env prefix %s\n" + "Default hint file %s\n" "Hint file %s\n" "libmap file %s\n", machine, __FreeBSD_version, ld_standard_library_path, + gethints(false), ld_env_prefix, ld_elf_hints_default, + ld_elf_hints_path, ld_path_libmap_conf); _exit(0); } else { From nobody Mon Oct 25 18:17:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 338801824C89; Mon, 25 Oct 2021 18:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdNVF334Tz3ngl; Mon, 25 Oct 2021 18:17:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 490A652EF; Mon, 25 Oct 2021 18:17:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PIHvQB058431; Mon, 25 Oct 2021 18:17:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PIHvuF058430; Mon, 25 Oct 2021 18:17:57 GMT (envelope-from git) Date: Mon, 25 Oct 2021 18:17:57 GMT Message-Id: <202110251817.19PIHvuF058430@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d89c820b0da1 - main - Remove div_ctlinput(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d89c820b0da17992d4ccd8a075c1b81382cef1a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d89c820b0da17992d4ccd8a075c1b81382cef1a9 commit d89c820b0da17992d4ccd8a075c1b81382cef1a9 Author: Gleb Smirnoff AuthorDate: 2021-10-22 23:21:10 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-25 18:16:49 +0000 Remove div_ctlinput(). This function does nothing since 97d8d152c28b. It was introduced in 252f24a2cf40 with a sidenote "may not be needed". Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D32608 --- sys/netinet/ip_divert.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 4141386a6a2d..c30550b1c4db 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -687,18 +687,6 @@ div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, return div_output(so, m, (struct sockaddr_in *)nam, control); } -static void -div_ctlinput(int cmd, struct sockaddr *sa, void *vip) -{ - struct in_addr faddr; - - faddr = ((struct sockaddr_in *)sa)->sin_addr; - if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY) - return; - if (PRC_IS_REDIRECT(cmd)) - return; -} - static int div_pcblist(SYSCTL_HANDLER_ARGS) { @@ -791,7 +779,6 @@ struct protosw div_protosw = { .pr_protocol = IPPROTO_DIVERT, .pr_flags = PR_ATOMIC|PR_ADDR, .pr_input = div_input, - .pr_ctlinput = div_ctlinput, .pr_ctloutput = ip_ctloutput, .pr_init = div_init, .pr_usrreqs = &div_usrreqs From nobody Mon Oct 25 18:17:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C46621824BC8; Mon, 25 Oct 2021 18:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdNVG4jYXz3npp; Mon, 25 Oct 2021 18:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 747E45AA5; Mon, 25 Oct 2021 18:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PIHwYN058455; Mon, 25 Oct 2021 18:17:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PIHwcN058454; Mon, 25 Oct 2021 18:17:58 GMT (envelope-from git) Date: Mon, 25 Oct 2021 18:17:58 GMT Message-Id: <202110251817.19PIHwcN058454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: f2d266f3b081 - main - Don't run ip_ctloutput() for divert socket. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2d266f3b0815a364289320385f94c3f87dc3c40 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=f2d266f3b0815a364289320385f94c3f87dc3c40 commit f2d266f3b0815a364289320385f94c3f87dc3c40 Author: Gleb Smirnoff AuthorDate: 2021-10-22 23:24:56 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-25 18:16:59 +0000 Don't run ip_ctloutput() for divert socket. It was here since divert(4) was introduced, probably just came with a protocol definition boilerplate. There is no useful socket option that can be set or get for a divert socket. Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D32608 --- sys/netinet/ip_divert.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index c30550b1c4db..e156b77f44c7 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -779,7 +779,6 @@ struct protosw div_protosw = { .pr_protocol = IPPROTO_DIVERT, .pr_flags = PR_ATOMIC|PR_ADDR, .pr_input = div_input, - .pr_ctloutput = ip_ctloutput, .pr_init = div_init, .pr_usrreqs = &div_usrreqs }; From nobody Mon Oct 25 18:43:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8DC08182D2BA; Mon, 25 Oct 2021 18:43: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdP3H3X6Wz3vLk; Mon, 25 Oct 2021 18:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 58BFD5CB3; Mon, 25 Oct 2021 18:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PIh7Pv097565; Mon, 25 Oct 2021 18:43:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PIh7Va097564; Mon, 25 Oct 2021 18:43:07 GMT (envelope-from git) Date: Mon, 25 Oct 2021 18:43:07 GMT Message-Id: <202110251843.19PIh7Va097564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e2493f4912ca - main - arm: fix a typo in nvidia/drm2/tegra_bo.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2493f4912cabd1d04be88fd17139a64bf2a2622 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e2493f4912cabd1d04be88fd17139a64bf2a2622 commit e2493f4912cabd1d04be88fd17139a64bf2a2622 Author: Mateusz Guzik AuthorDate: 2021-10-25 18:42:10 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-25 18:42:10 +0000 arm: fix a typo in nvidia/drm2/tegra_bo.c Unbreaks building TEGRA124 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/arm/nvidia/drm2/tegra_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/nvidia/drm2/tegra_bo.c b/sys/arm/nvidia/drm2/tegra_bo.c index be5177973f4f..ba614d014564 100644 --- a/sys/arm/nvidia/drm2/tegra_bo.c +++ b/sys/arm/nvidia/drm2/tegra_bo.c @@ -105,7 +105,7 @@ tegra_bo_alloc_contig(size_t npages, u_long alignment, vm_memattr_t memattr, boundary = 0; tries = 0; retry: - m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRE | VM_ALLOC_ZERO, npages, + m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO, npages, low, high, alignment, boundary, memattr); if (m == NULL) { if (tries < 3) { From nobody Mon Oct 25 20:07:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0083A1827FC3; Mon, 25 Oct 2021 20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdQws6Sr6z4mMK; Mon, 25 Oct 2021 20:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BEF2A6D57; Mon, 25 Oct 2021 20:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PK7f2N004926; Mon, 25 Oct 2021 20:07:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PK7fHU004925; Mon, 25 Oct 2021 20:07:41 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:07:41 GMT Message-Id: <202110252007.19PK7fHU004925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: ea14af2d3c40 - main - Inline critical enter/exit for "tied" kernel modules List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea14af2d3c407c42ac36f73fc6d5a1db0433b436 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ea14af2d3c407c42ac36f73fc6d5a1db0433b436 commit ea14af2d3c407c42ac36f73fc6d5a1db0433b436 Author: Mateusz Guzik AuthorDate: 2021-10-25 17:29:46 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-25 20:07:06 +0000 Inline critical enter/exit for "tied" kernel modules Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/sys/systm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 17c110a957c9..497e09f86488 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -273,7 +273,7 @@ void tablefull(const char *); extern int (*lkpi_alloc_current)(struct thread *, int); int linux_alloc_current_noop(struct thread *, int); -#if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET) +#if (defined(KLD_MODULE) && !defined(KLD_TIED)) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET) #define critical_enter() critical_enter_KBI() #define critical_exit() critical_exit_KBI() #else From nobody Mon Oct 25 20:15:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8F8FA180BB2C; Mon, 25 Oct 2021 20:15:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdR5Q2LjLz4pn3; Mon, 25 Oct 2021 20:15:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 303B56CD4; Mon, 25 Oct 2021 20:15:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKF6u3017713; Mon, 25 Oct 2021 20:15:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKF6Hk017712; Mon, 25 Oct 2021 20:15:06 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:15:06 GMT Message-Id: <202110252015.19PKF6Hk017712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 9d593d5a76f2 - main - mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d593d5a76f22a315d7c6ab99e5e76003ec2b3f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9d593d5a76f22a315d7c6ab99e5e76003ec2b3f5 commit 9d593d5a76f22a315d7c6ab99e5e76003ec2b3f5 Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 16:18:11 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:12:32 +0000 mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv() netdev_priv() is a LinuxKPI function which was used with the old ifnet linux/netdevice.h implementation which was not adaptable to modern Linux drviers unless rewriting them for ifnet in first place which defeats the purpose. Rename the netdev_priv() calls in mlx4 to mlx4_netdev_priv() returning the ifnet softc to avoid conflicting symbol names with different implementations in the future. MFC after: 3 days Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D32640 --- sys/dev/mlx4/mlx4_en/en.h | 13 ++++++++++--- sys/dev/mlx4/mlx4_en/mlx4_en_main.c | 2 +- sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 34 +++++++++++++++++----------------- sys/dev/mlx4/mlx4_en/mlx4_en_port.c | 8 ++++---- sys/dev/mlx4/mlx4_en/mlx4_en_rx.c | 6 +++--- sys/dev/mlx4/mlx4_en/mlx4_en_tx.c | 16 ++++++++-------- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 2 +- 7 files changed, 44 insertions(+), 37 deletions(-) diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index 4a8b4fbd5fd4..440b9a340221 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -39,13 +39,20 @@ #include #include #include -#include #include #include #ifdef CONFIG_MLX4_EN_DCB #include #endif +#include +#include + +#include +#include +#include +#include + #include #include #include @@ -655,7 +662,7 @@ struct mlx4_mac_entry { }; static inline void * -netdev_priv(const struct ifnet *dev) +mlx4_netdev_priv(const struct ifnet *dev) { return (dev->if_softc); } @@ -710,7 +717,7 @@ static inline bool mlx4_en_cq_lock_poll(struct mlx4_en_cq *cq) spin_lock_bh(&cq->poll_lock); if ((cq->state & MLX4_CQ_LOCKED)) { struct ifnet *dev = cq->dev; - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring]; cq->state |= MLX4_EN_CQ_STATE_POLL_YIELD; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_main.c b/sys/dev/mlx4/mlx4_en/mlx4_en_main.c index fe3adfe9c162..e328fb228982 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_main.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_main.c @@ -119,7 +119,7 @@ static void mlx4_en_event(struct mlx4_dev *dev, void *endev_ptr, case MLX4_DEV_EVENT_PORT_DOWN: if (!mdev->pndev[port]) return; - priv = netdev_priv(mdev->pndev[port]); + priv = mlx4_netdev_priv(mdev->pndev[port]); /* To prevent races, we poll the link state in a separate task rather than changing it here */ priv->link_state = event; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c index 672affcce623..14289cb20e13 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c @@ -65,7 +65,7 @@ static int mlx4_en_low_latency_recv(struct napi_struct *napi) { struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); struct ifnet *dev = cq->dev; - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring]; int done; @@ -291,7 +291,7 @@ static int mlx4_en_filter_rfs(struct ifnet *net_dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id) { - struct mlx4_en_priv *priv = netdev_priv(net_dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(net_dev); struct mlx4_en_filter *filter; const struct iphdr *ip; const __be16 *ports; @@ -402,7 +402,7 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv) static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int err; int idx; @@ -429,7 +429,7 @@ static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid) static void mlx4_en_vlan_rx_kill_vid(void *arg, struct ifnet *dev, u16 vid) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int err; @@ -608,7 +608,7 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv) static void mlx4_en_clear_uclist(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_addr_list *tmp, *uc_to_del; list_for_each_entry_safe(uc_to_del, tmp, &priv->uc_list, list) { @@ -637,7 +637,7 @@ static u_int mlx4_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) static void mlx4_en_cache_uclist(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); mlx4_en_clear_uclist(dev); if_foreach_lladdr(dev, mlx4_copy_addr, priv); @@ -645,7 +645,7 @@ static void mlx4_en_cache_uclist(struct ifnet *dev) static void mlx4_en_clear_mclist(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_addr_list *tmp, *mc_to_del; list_for_each_entry_safe(mc_to_del, tmp, &priv->mc_list, list) { @@ -673,7 +673,7 @@ static u_int mlx4_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) static void mlx4_en_cache_mclist(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); mlx4_en_clear_mclist(dev); if_foreach_llmaddr(dev, mlx4_copy_maddr, priv); @@ -730,7 +730,7 @@ static void update_addr_list_flags(struct mlx4_en_priv *priv, static void mlx4_en_set_rx_mode(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); if (!priv->port_up) return; @@ -1260,7 +1260,7 @@ static void mlx4_en_linkstate(struct work_struct *work) int mlx4_en_start_port(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_cq *cq; struct mlx4_en_tx_ring *tx_ring; @@ -1453,7 +1453,7 @@ cq_err: void mlx4_en_stop_port(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_addr_list *addr_list, *tmp; int i; @@ -1603,7 +1603,7 @@ reset: static void mlx4_en_clear_stats(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int i; @@ -1762,7 +1762,7 @@ struct en_port_attribute en_port_attr_##_name = __ATTR(_name, _mode, _show, _sto void mlx4_en_destroy_netdev(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); @@ -1817,7 +1817,7 @@ void mlx4_en_destroy_netdev(struct ifnet *dev) static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int err = 0; @@ -2353,7 +2353,7 @@ out: static int mlx4_en_set_ring_size(struct ifnet *dev, int rx_size, int tx_size) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int port_up = 0; int err = 0; @@ -2427,7 +2427,7 @@ static int mlx4_en_set_tx_ring_size(SYSCTL_HANDLER_ARGS) static int mlx4_en_get_module_info(struct ifnet *dev, struct ethtool_modinfo *modinfo) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int ret; u8 data[4]; @@ -2475,7 +2475,7 @@ static int mlx4_en_get_module_eeprom(struct ifnet *dev, struct ethtool_eeprom *ee, u8 *data) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int offset = ee->offset; int i = 0, ret; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c index 9a0edac109f4..2e19130b9e96 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c @@ -74,7 +74,7 @@ int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv) int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port) { struct mlx4_en_query_port_context *qport_context; - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct mlx4_en_priv *priv = mlx4_netdev_priv(mdev->pndev[port]); struct mlx4_en_port_state *state = &priv->port_state; struct mlx4_cmd_mailbox *mailbox; int err; @@ -151,7 +151,7 @@ static u64 en_stats_adder(__be64 *start, __be64 *next, int num) static void mlx4_en_fold_software_stats(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; u64 packets, bytes; int i; @@ -188,7 +188,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; struct ifnet *dev = mdev->pndev[port]; - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox; u64 in_mod = reset << 8 | port; @@ -436,7 +436,7 @@ out: int mlx4_en_get_vport_stats(struct mlx4_en_dev *mdev, u8 port) { - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct mlx4_en_priv *priv = mlx4_netdev_priv(mdev->pndev[port]); struct mlx4_counter tmp_vport_stats; struct mlx4_en_vf_stats *vf_stats = &priv->vf_stats; int err, i, counter_index; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c index 8e7c410d1c55..56e8711c6599 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c @@ -340,7 +340,7 @@ void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev) void mlx4_en_calc_rx_buf(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + MLX4_NET_IP_ALIGN; @@ -737,7 +737,7 @@ mlx4_en_rss_hash(__be16 status, int udp_rss) #define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor)) int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_cqe *cqe; struct mlx4_en_rx_ring *ring = priv->rx_ring[cq->ring]; struct mlx4_en_rx_mbuf *mb_list; @@ -880,7 +880,7 @@ static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget) void mlx4_en_rx_irq(struct mlx4_cq *mcq) { struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq); - struct mlx4_en_priv *priv = netdev_priv(cq->dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev); int done; // Shoot one within the irq context diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c index f3a41a15f8b6..34af99ae0340 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c @@ -310,7 +310,7 @@ done: int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); int cnt = 0; /* Skip last polled descriptor */ @@ -347,7 +347,7 @@ mlx4_en_tx_ring_is_full(struct mlx4_en_tx_ring *ring) static int mlx4_en_process_tx_cq(struct ifnet *dev, struct mlx4_en_cq *cq) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_cq *mcq = &cq->mcq; struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring]; struct mlx4_cqe *cqe; @@ -423,7 +423,7 @@ static int mlx4_en_process_tx_cq(struct ifnet *dev, void mlx4_en_tx_irq(struct mlx4_cq *mcq) { struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq); - struct mlx4_en_priv *priv = netdev_priv(cq->dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev); struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring]; if (priv->port_up == 0 || !spin_trylock(&ring->comp_lock)) @@ -436,7 +436,7 @@ void mlx4_en_tx_irq(struct mlx4_cq *mcq) void mlx4_en_poll_tx_cq(unsigned long data) { struct mlx4_en_cq *cq = (struct mlx4_en_cq *) data; - struct mlx4_en_priv *priv = netdev_priv(cq->dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev); struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring]; u32 inflight; @@ -606,7 +606,7 @@ SYSINIT(hashrandom_init, SI_SUB_RANDOM, SI_ORDER_ANY, &hashrandom_init, NULL); u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); u32 rings_p_up = priv->num_tx_rings_p_up; u32 up = 0; u32 queue_index; @@ -929,7 +929,7 @@ tx_drop: static int mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb) { - struct mlx4_en_priv *priv = netdev_priv(ifp); + struct mlx4_en_priv *priv = mlx4_netdev_priv(ifp); struct mlx4_en_tx_ring *ring = priv->tx_ring[tx_ind]; int err = 0; @@ -954,7 +954,7 @@ mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb) int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_tx_ring *ring; int i, err = 0; @@ -994,7 +994,7 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) void mlx4_en_qflush(struct ifnet *dev) { - struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); if (priv->port_up == 0) return; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index f9ac3121199a..b8a61c87f827 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -148,7 +148,7 @@ static struct ifnet *mlx4_ib_get_netdev(struct ib_device *device, u8 port_num) if (upper) { struct ifnet *active; - active = bond_option_active_slave_get_rcu(netdev_priv(upper)); + active = bond_option_active_slave_get_rcu(mlx4_netdev_priv(upper)); if (active) dev = active; } From nobody Mon Oct 25 20:17:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A6230180C5BC; Mon, 25 Oct 2021 20:17: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdR7x48zkz4qHp; Mon, 25 Oct 2021 20:17:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6C7506CD5; Mon, 25 Oct 2021 20:17:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKHH5E017998; Mon, 25 Oct 2021 20:17:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKHHjg017997; Mon, 25 Oct 2021 20:17:17 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:17:17 GMT Message-Id: <202110252017.19PKHHjg017997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 41dee251ee9e - main - LinuxKPI: add simple_open() to fs.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41dee251ee9ead2e5c7a33b1457db5742c584354 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=41dee251ee9ead2e5c7a33b1457db5742c584354 commit 41dee251ee9ead2e5c7a33b1457db5742c584354 Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 16:44:18 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:14:42 +0000 LinuxKPI: add simple_open() to fs.h Add a dummy simple_open() to fs.h as we have for other (unsupported) functions. This is needed by a wireless driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32642 --- sys/compat/linuxkpi/common/include/linux/fs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h index eaf806b6732c..f1892352d598 100644 --- a/sys/compat/linuxkpi/common/include/linux/fs.h +++ b/sys/compat/linuxkpi/common/include/linux/fs.h @@ -245,6 +245,12 @@ nonseekable_open(struct inode *inode, struct file *filp) return 0; } +static inline int +simple_open(struct inode *inode, struct file *filp) +{ + return 0; +} + extern unsigned int linux_iminor(struct inode *); #define iminor(...) linux_iminor(__VA_ARGS__) From nobody Mon Oct 25 20:18:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AC0A3180E28C; Mon, 25 Oct 2021 20:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdR9s4SM3z4rBK; Mon, 25 Oct 2021 20:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7040D6CD8; Mon, 25 Oct 2021 20:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKIvrC018215; Mon, 25 Oct 2021 20:18:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKIvO4018214; Mon, 25 Oct 2021 20:18:57 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:18:57 GMT Message-Id: <202110252018.19PKIvO4018214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 490f9d8f0e7c - main - LinuxKPI: add netdev_features.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 490f9d8f0e7ce8c5b268fcd0806c5e00214eb5a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=490f9d8f0e7ce8c5b268fcd0806c5e00214eb5a7 commit 490f9d8f0e7ce8c5b268fcd0806c5e00214eb5a7 Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 16:50:27 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:16:23 +0000 LinuxKPI: add netdev_features.h Add netdev_features.h as a spearate file from the future netdevice.h implementation to avoid include problems with a future skbuff.h. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32643 --- .../common/include/linux/netdev_features.h | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/netdev_features.h b/sys/compat/linuxkpi/common/include/linux/netdev_features.h new file mode 100644 index 000000000000..a4901f4d48c3 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/netdev_features.h @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * 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 + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + * + * $FreeBSD$ + */ +#ifndef __LKPI_LINUX_NETDEV_FEATURES_H_ +#define __LKPI_LINUX_NETDEV_FEATURES_H_ + +#include +#include + +typedef uint32_t netdev_features_t; + +#define NETIF_F_HIGHDMA BIT(0) +#define NETIF_F_SG BIT(1) +#define NETIF_F_IP_CSUM BIT(2) +#define NETIF_F_IPV6_CSUM BIT(3) +#define NETIF_F_TSO BIT(4) +#define NETIF_F_TSO6 BIT(5) +#define NETIF_F_RXCSUM BIT(6) + +#define NETIF_F_CSUM_MASK (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM) + +#endif /* __LKPI_LINUX_NETDEV_FEATURES_H_ */ From nobody Mon Oct 25 20:20:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2B89D180FEA5; Mon, 25 Oct 2021 20:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdRCX0pCBz4s6q; Mon, 25 Oct 2021 20:20:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E4EFE7489; Mon, 25 Oct 2021 20:20:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKKN3r026629; Mon, 25 Oct 2021 20:20:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKKNb5026628; Mon, 25 Oct 2021 20:20:23 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:20:23 GMT Message-Id: <202110252020.19PKKNb5026628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ed5600f5329f - main - LinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed5600f5329fad8b167bed0a5ae8a5f60d12258e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ed5600f5329fad8b167bed0a5ae8a5f60d12258e commit ed5600f5329fad8b167bed0a5ae8a5f60d12258e Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 17:06:09 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:17:56 +0000 LinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*() Make the struct pci_dev argument to the pci_{read,write}_config*() functions "const" to match the Linux definition as some drivers try to pass in a const argument which we currently fail to honor. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32644 --- sys/compat/linuxkpi/common/include/linux/pci.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 2bac82de2af5..5903a402c52e 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -692,7 +692,7 @@ pci_disable_link_state(struct pci_dev *pdev, uint32_t flags) } static inline int -pci_read_config_byte(struct pci_dev *pdev, int where, u8 *val) +pci_read_config_byte(const struct pci_dev *pdev, int where, u8 *val) { *val = (u8)pci_read_config(pdev->dev.bsddev, where, 1); @@ -700,7 +700,7 @@ pci_read_config_byte(struct pci_dev *pdev, int where, u8 *val) } static inline int -pci_read_config_word(struct pci_dev *pdev, int where, u16 *val) +pci_read_config_word(const struct pci_dev *pdev, int where, u16 *val) { *val = (u16)pci_read_config(pdev->dev.bsddev, where, 2); @@ -708,7 +708,7 @@ pci_read_config_word(struct pci_dev *pdev, int where, u16 *val) } static inline int -pci_read_config_dword(struct pci_dev *pdev, int where, u32 *val) +pci_read_config_dword(const struct pci_dev *pdev, int where, u32 *val) { *val = (u32)pci_read_config(pdev->dev.bsddev, where, 4); @@ -716,7 +716,7 @@ pci_read_config_dword(struct pci_dev *pdev, int where, u32 *val) } static inline int -pci_write_config_byte(struct pci_dev *pdev, int where, u8 val) +pci_write_config_byte(const struct pci_dev *pdev, int where, u8 val) { pci_write_config(pdev->dev.bsddev, where, val, 1); @@ -724,7 +724,7 @@ pci_write_config_byte(struct pci_dev *pdev, int where, u8 val) } static inline int -pci_write_config_word(struct pci_dev *pdev, int where, u16 val) +pci_write_config_word(const struct pci_dev *pdev, int where, u16 val) { pci_write_config(pdev->dev.bsddev, where, val, 2); @@ -732,7 +732,7 @@ pci_write_config_word(struct pci_dev *pdev, int where, u16 val) } static inline int -pci_write_config_dword(struct pci_dev *pdev, int where, u32 val) +pci_write_config_dword(const struct pci_dev *pdev, int where, u32 val) { pci_write_config(pdev->dev.bsddev, where, val, 4); From nobody Mon Oct 25 20:22:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1E10418104FA; Mon, 25 Oct 2021 20:22:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdRFR0PHHz4srX; Mon, 25 Oct 2021 20:22:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E19B07344; Mon, 25 Oct 2021 20:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKM2Am030751; Mon, 25 Oct 2021 20:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKM21e030750; Mon, 25 Oct 2021 20:22:02 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:22:02 GMT Message-Id: <202110252022.19PKM21e030750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: cf899348420c - main - LinuxKPI: pci.h / linux_pci.c rename pci_driver field List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf899348420ce8839e32ddc30247b5d1c2b384f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=cf899348420ce8839e32ddc30247b5d1c2b384f4 commit cf899348420ce8839e32ddc30247b5d1c2b384f4 Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 17:15:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:19:24 +0000 LinuxKPI: pci.h / linux_pci.c rename pci_driver field Rename the struct pci_driver {} field got the list_head from links to node as a driver is actually initialsing this to {} which seems questionable but it will at least make us match the Linux structure field name. MFC after: 3 days Reviewed by: manu, hselasky Differential Revision: https://reviews.freebsd.org/D32645 --- sys/compat/linuxkpi/common/include/linux/pci.h | 2 +- sys/compat/linuxkpi/common/src/linux_pci.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 5903a402c52e..1b4f55c2a2e5 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -193,7 +193,7 @@ typedef int pci_power_t; struct pci_dev; struct pci_driver { - struct list_head links; + struct list_head node; char *name; const struct pci_device_id *id_table; int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 780ba38d18dd..db94bc08239e 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -242,7 +242,7 @@ linux_pci_find(device_t dev, const struct pci_device_id **idp) subdevice = pci_get_subdevice(dev); spin_lock(&pci_lock); - list_for_each_entry(pdrv, &pci_drivers, links) { + list_for_each_entry(pdrv, &pci_drivers, node) { for (id = pdrv->id_table; id->vendor != 0; id++) { if (vendor == id->vendor && (PCI_ANY_ID == id->device || device == id->device) && @@ -640,7 +640,7 @@ _linux_pci_register_driver(struct pci_driver *pdrv, devclass_t dc) linux_set_current(curthread); spin_lock(&pci_lock); - list_add(&pdrv->links, &pci_drivers); + list_add(&pdrv->node, &pci_drivers); spin_unlock(&pci_lock); pdrv->bsddriver.name = pdrv->name; pdrv->bsddriver.methods = pci_methods; @@ -734,7 +734,7 @@ linux_pci_unregister_driver(struct pci_driver *pdrv) bus = devclass_find("pci"); spin_lock(&pci_lock); - list_del(&pdrv->links); + list_del(&pdrv->node); spin_unlock(&pci_lock); mtx_lock(&Giant); if (bus != NULL) @@ -750,7 +750,7 @@ linux_pci_unregister_drm_driver(struct pci_driver *pdrv) bus = devclass_find("vgapci"); spin_lock(&pci_lock); - list_del(&pdrv->links); + list_del(&pdrv->node); spin_unlock(&pci_lock); mtx_lock(&Giant); if (bus != NULL) From nobody Mon Oct 25 20:23:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 56A4B1810E10; Mon, 25 Oct 2021 20:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdRH51zmsz4tQx; Mon, 25 Oct 2021 20:23:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 195567570; Mon, 25 Oct 2021 20:23:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKNTBP031789; Mon, 25 Oct 2021 20:23:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKNSRO031788; Mon, 25 Oct 2021 20:23:28 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:23:28 GMT Message-Id: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 548ada00e54a - main - LinuxKPI: add bcd.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 548ada00e54a9e7745d041b1ec7f68f3bd493365 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=548ada00e54a9e7745d041b1ec7f68f3bd493365 commit 548ada00e54a9e7745d041b1ec7f68f3bd493365 Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 18:14:08 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:20:53 +0000 LinuxKPI: add bcd.h Add bcd2bin() as linuxkpi_bcd2bin(). Libkern does provide a bcd2bin() which cannot be used leaving us with a conflict (see comment in file). Fortunately this is only seen in one driver so far and it seems easier to drop this in and change a single line in the driver than to add this inline in the driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32647 --- sys/compat/linuxkpi/common/include/linux/bcd.h | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bcd.h b/sys/compat/linuxkpi/common/include/linux/bcd.h new file mode 100644 index 000000000000..57fcb4c6bd98 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/bcd.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Bjoern A. Zeeb + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _LINUXKPI_LINUX_BCD_H +#define _LINUXKPI_LINUX_BCD_H + +#include + +/* + * We could use libkern, but we need the argument truncating. + * + * This leaves us with a duplicate symbol with conflicting types + * so we cannot simply re-define as libkern.h gets included in + * too many places directly or indirectly. This means for now + * drivers will have to be adjusted to call linuxkpi_bcd2bin(). + */ +static inline uint8_t linuxkpi_bcd2bin(uint8_t x) +{ + + return (x & 0x0f) + (x >> 4) * 10; +} + +#if 0 +#define bcd2bin(_x) linuxkpi_bcd2bin(_x) +#endif + +#endif /* _LINUXKPI_LINUX_BCD_H */ From nobody Mon Oct 25 20:25:49 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E7FBE1812A0B; Mon, 25 Oct 2021 20:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdRKn6DkDz4vKc; Mon, 25 Oct 2021 20:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B70BD7358; Mon, 25 Oct 2021 20:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKPnSP032074; Mon, 25 Oct 2021 20:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKPnps032073; Mon, 25 Oct 2021 20:25:49 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:25:49 GMT Message-Id: <202110252025.19PKPnps032073@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: fc79cf4fea72 - main - iscsid: set max_recv_data_segment_length to what we advertise List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc79cf4fea7221fa62d480648f05e30f7df73f92 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=fc79cf4fea7221fa62d480648f05e30f7df73f92 commit fc79cf4fea7221fa62d480648f05e30f7df73f92 Author: Ed Maste AuthorDate: 2021-10-21 15:09:58 +0000 Commit: Ed Maste CommitDate: 2021-10-25 20:25:15 +0000 iscsid: set max_recv_data_segment_length to what we advertise Previously we updated the conection's conn_max_recv_data_segment_length only when we received a response containing MaxRecvDataSegmentLength from the target. If the target did not send MaxRecvDataSegmentLength then we left conn_max_recv_data_segment_length at the default (i.e., 8192). A target could then send more data than that defult (up to our advertised maximum), and we would drop the connection. RFC 7143 specifies that MaxRecvDataSegmentLength is Declarative, not negotiated. Just set conn_max_recv_data_segment_length to our advertised value in login_negotiate(). PR: 259355 Reviewed by: mav MFC after: 1 week Fixes: a15fbc904a4d ("Alike to r312190 decouple iSCSI...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32605 --- usr.sbin/iscsid/login.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/iscsid/login.c b/usr.sbin/iscsid/login.c index 864695dcbdb5..3f0020ef140b 100644 --- a/usr.sbin/iscsid/login.c +++ b/usr.sbin/iscsid/login.c @@ -403,9 +403,6 @@ login_negotiate_key(struct connection *conn, const char *name, tmp = isl->isl_max_send_data_segment_length; } conn->conn_max_send_data_segment_length = tmp; - /* We received target's limit, that means it accepted our's. */ - conn->conn_max_recv_data_segment_length = - isl->isl_max_recv_data_segment_length; } else if (strcmp(name, "MaxBurstLength") == 0) { tmp = strtoul(value, NULL, 10); if (tmp <= 0) @@ -538,6 +535,9 @@ login_negotiate(struct connection *conn) isl->isl_max_recv_data_segment_length); } + conn->conn_max_recv_data_segment_length = + isl->isl_max_recv_data_segment_length; + keys_add(request_keys, "DefaultTime2Wait", "0"); keys_add(request_keys, "DefaultTime2Retain", "0"); keys_add(request_keys, "ErrorRecoveryLevel", "0"); From nobody Mon Oct 25 20:28:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 18DAE181442F; Mon, 25 Oct 2021 20:28:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdRNZ0FBdz3C3f; Mon, 25 Oct 2021 20:28:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DCA546CF8; Mon, 25 Oct 2021 20:28:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKSDb3032414; Mon, 25 Oct 2021 20:28:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKSDBB032413; Mon, 25 Oct 2021 20:28:13 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:28:13 GMT Message-Id: <202110252028.19PKSDBB032413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c5eec7b57c39 - main - LinuxKPI: module.h add MODULE_SUPPORTED_DEVICE() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5eec7b57c39b1dc4a63fea115a93d8d1628ff08 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c5eec7b57c39b1dc4a63fea115a93d8d1628ff08 commit c5eec7b57c39b1dc4a63fea115a93d8d1628ff08 Author: Bjoern A. Zeeb AuthorDate: 2021-10-25 16:39:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-25 20:26:01 +0000 LinuxKPI: module.h add MODULE_SUPPORTED_DEVICE() Add a dummy MODULE_SUPPORTED_DEVICE define as we do for other MODULE_* macros. This is needed by a wireless driver. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32641 --- sys/compat/linuxkpi/common/include/linux/module.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/module.h b/sys/compat/linuxkpi/common/include/linux/module.h index cd5366bc52d0..2a4fdc5a11a9 100644 --- a/sys/compat/linuxkpi/common/include/linux/module.h +++ b/sys/compat/linuxkpi/common/include/linux/module.h @@ -50,6 +50,7 @@ #define MODULE_LICENSE(name) #define MODULE_INFO(tag, info) #define MODULE_FIRMWARE(firmware) +#define MODULE_SUPPORTED_DEVICE(name) #define THIS_MODULE ((struct module *)0) From nobody Mon Oct 25 20:53:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 40BFD181EA4D; Mon, 25 Oct 2021 20:53: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdRyH1PfXz3KRC; Mon, 25 Oct 2021 20:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 06F707E1E; Mon, 25 Oct 2021 20:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PKrwxw071058; Mon, 25 Oct 2021 20:53:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PKrwZD071057; Mon, 25 Oct 2021 20:53:58 GMT (envelope-from git) Date: Mon, 25 Oct 2021 20:53:58 GMT Message-Id: <202110252053.19PKrwZD071057@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: b15b0535968e - main - tcp: allow new reno functions to be called from other CC modules List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b15b0535968e6c09694c922d0d173956085426d3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b15b0535968e6c09694c922d0d173956085426d3 commit b15b0535968e6c09694c922d0d173956085426d3 Author: Michael Tuexen AuthorDate: 2021-10-25 20:48:36 +0000 Commit: Michael Tuexen CommitDate: 2021-10-25 20:53:49 +0000 tcp: allow new reno functions to be called from other CC modules Some new reno functions use the internal data, but are also called from functions of other CC modules. Ensure that in this case, the internal data is not accessed. Reported by: syzbot+1d219ea351caa5109d4b@syzkaller.appspotmail.com Reported by: syzbot+b08144f8cad9c67258c5@syzkaller.appspotmail.com Reviewed by: rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D32649 --- sys/netinet/cc/cc_newreno.c | 47 ++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index 23d2b273f6aa..b7ffd28d1270 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -167,12 +167,11 @@ newreno_log_hystart_event(struct cc_var *ccv, struct newreno *nreno, uint8_t mod } } -static int +static int newreno_cb_init(struct cc_var *ccv) { struct newreno *nreno; - ccv->cc_data = NULL; ccv->cc_data = malloc(sizeof(struct newreno), M_NEWRENO, M_NOWAIT); if (ccv->cc_data == NULL) return (ENOMEM); @@ -210,7 +209,13 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) { struct newreno *nreno; - nreno = (struct newreno *)ccv->cc_data; + /* + * Other TCP congestion controls use newreno_ack_received(), but + * with their own private cc_data. Make sure the cc_data is used + * correctly. + */ + nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; + if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && (ccv->flags & CCF_CWND_LIMITED)) { u_int cw = CCV(ccv, snd_cwnd); @@ -244,7 +249,8 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) * avoid capping cwnd. */ if (cw > CCV(ccv, snd_ssthresh)) { - if (nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) { + if ((nreno != NULL) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS)) { /* * We have slipped into CA with * CSS active. Deactivate all. @@ -278,7 +284,8 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) abc_val = ccv->labc; else abc_val = V_tcp_abc_l_var; - if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ALLOWED) && + if ((nreno != NULL) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_ALLOWED) && (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) && ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) == 0)) { /* @@ -316,7 +323,8 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) incr = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg)); /* Only if Hystart is enabled will the flag get set */ - if (nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) { + if ((nreno != NULL) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS)) { incr /= hystart_css_growth_div; newreno_log_hystart_event(ccv, nreno, 3, incr); } @@ -334,7 +342,12 @@ newreno_after_idle(struct cc_var *ccv) struct newreno *nreno; uint32_t rw; - nreno = (struct newreno *)ccv->cc_data; + /* + * Other TCP congestion controls use newreno_after_idle(), but + * with their own private cc_data. Make sure the cc_data is used + * correctly. + */ + nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; /* * If we've been idle for more than one retransmit timeout the old * congestion window is no longer current and we have to reduce it to @@ -358,7 +371,8 @@ newreno_after_idle(struct cc_var *ccv) CCV(ccv, snd_cwnd)-(CCV(ccv, snd_cwnd)>>2)); CCV(ccv, snd_cwnd) = min(rw, CCV(ccv, snd_cwnd)); - if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) == 0) { + if ((nreno != NULL) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) == 0) { if (CCV(ccv, snd_cwnd) <= (hystart_lowcwnd * tcp_fixed_maxseg(ccv->ccvc.tcp))) { /* * Re-enable hystart if our cwnd has fallen below @@ -382,9 +396,14 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) cwin = CCV(ccv, snd_cwnd); mss = tcp_fixed_maxseg(ccv->ccvc.tcp); - nreno = (struct newreno *) ccv->cc_data; - beta = nreno->beta; - beta_ecn = nreno->beta_ecn; + /* + * Other TCP congestion controls use newreno_cong_signal(), but + * with their own private cc_data. Make sure the cc_data is used + * correctly. + */ + nreno = (CC_ALGO(ccv->ccvc.tcp) == &newreno_cc_algo) ? ccv->cc_data : NULL; + beta = (nreno == NULL) ? V_newreno_beta : nreno->beta;; + beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; /* * Note that we only change the backoff for ECN if the * global sysctl V_cc_do_abe is set the stack itself @@ -407,7 +426,8 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) switch (type) { case CC_NDUPACK: - if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { + if ((nreno != NULL) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED)) { /* Make sure the flags are all off we had a loss */ nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; @@ -425,7 +445,8 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) } break; case CC_ECN: - if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { + if ((nreno != NULL) && + (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED)) { /* Make sure the flags are all off we had a loss */ nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; From nobody Mon Oct 25 21:02:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 518B5182196F for ; Mon, 25 Oct 2021 21:02:40 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2c.ore.mailhop.org (outbound2c.ore.mailhop.org [54.186.10.118]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdS8J0STzz3M83 for ; Mon, 25 Oct 2021 21:02:39 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1635195753; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=uXgCpctblJz5O3W5CKiOVswP2ku0zTtbVfgJHjWcjHuHSoW0KEeyZqs7LBUoFYEUU6UWAcLCT+4/+ ZBT33hy+7CZWCRKYWyPnh4mne3lnzXkIUpUdncKKRYswREgH9QtHo4yYNOzE1IDVjiLF6jJ3nAmT7q zudaH3IFT6unssKIWSkR1DaOwABGYrx0S0KBTaXsZOr17it/DtPo+7fGJi5Qe5K7Wrg/PLneWO+IdW mlhzK6sfEgGHQtj+fPa9Vwuc7oBIpB/JKDOv+zmhIB5el97hyefg3EvCat8j16EgeZXvTaJewHiKqD uEz8M7efEUyflgOO88bJwd+oPsucIqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=/rvx8eP5CN/8a8fmEuL4XbEUhiQRbJALZauTtSc9xE8=; b=M0Yp1swrnnwVia9nqMZDzPvdcRDwl/GZ1HOuccAQQHskvoowy4xLd0x3jcyVcndmtrM8Nzxlzdnz/ Z2cGdpS+B8yN9vNVq4FRQigYsG1BmdHDvzjGQp5GVnTSO0qtIwN5V8GxBeAvwXyr1l7Aa69Vqgsj92 UDCx9bxQAFwujvhpkvLtbHEd2YbTpegbpvr453v/qhTkUy7UWGkSSptwXDuSiUw3FniAG9DEjHHh9g KgELGssSvTXKDWGPxwAbjujLu672UzFBY0RgJfh5IS3HKZxLCRYKnVl9yX267yHuhOzYMttph6nGTl zEDL1YVrXOl15kbEcCxKa7FbmPXOc9g== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=/rvx8eP5CN/8a8fmEuL4XbEUhiQRbJALZauTtSc9xE8=; b=WnSRGQGPJxoFVnNOEmDroU0JLinoeW0LMB3Qk6967b98JVYHkkVFDIm2O9Y0OdHJPWMCAGQ7I5vbo Go2YY0yk3miyKmsioh1tbFamuhVMK3j1YAYGU7AR4+gSwsuACToQ7qrakjfhbFb2IhYVC6dFcBVeis W4ipq3jDYaN3FyRh+cl57VcQWvGbpfjPN1zlp399PUXjrI3NQxf+farnY4bxGQNY4wE2cCqFHCawty EP8FuPzEKf4nRJgtB/XlFM6oSFpNlCYc+TLs4HIWcRCpwN4THSIKuoROXyQ7fug77vr3aQ5KMVmJkG qd2NJryMlEd5mD2exUnDM4FwXWDqiHQ== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: de912d67-35d6-11ec-a67c-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id de912d67-35d6-11ec-a67c-89389772cfc7; Mon, 25 Oct 2021 21:02:32 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19PL2Vx6097716; Mon, 25 Oct 2021 15:02:31 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <832a2403091df094d6f7ab471aef0694adebb939.camel@freebsd.org> Subject: Re: git: 548ada00e54a - main - LinuxKPI: add bcd.h From: Ian Lepore To: "Bjoern A. Zeeb" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Mon, 25 Oct 2021 15:02:31 -0600 In-Reply-To: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> References: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HdS8J0STzz3M83 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Mon, 2021-10-25 at 20:23 +0000, Bjoern A. Zeeb wrote: > The branch main has been updated by bz: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=548ada00e54a9e7745d041b1ec7f68f3bd493365 > > commit 548ada00e54a9e7745d041b1ec7f68f3bd493365 > Author:     Bjoern A. Zeeb > AuthorDate: 2021-10-25 18:14:08 +0000 > Commit:     Bjoern A. Zeeb > CommitDate: 2021-10-25 20:20:53 +0000 > >     LinuxKPI: add bcd.h >     >     Add bcd2bin() as linuxkpi_bcd2bin().  Libkern does provide a > bcd2bin() > > [...] > + * We could use libkern, but we need the argument truncating. > + * What does that mean, "we need the argument truncating"? It looks to me like the only functional difference between the linux implementation and ours is that for invalid bcd data (nybble values in the range 0xA - 0xF) the linux version returns a crazy result and our lookup table returns 0. I doubt our code relies on that. -- Ian From nobody Mon Oct 25 21:17:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B67591827084; Mon, 25 Oct 2021 21:17:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdST94g2Wz3QRH; Mon, 25 Oct 2021 21:17:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 66AF88D4D; Mon, 25 Oct 2021 21:17:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 8633F8D4A216; Mon, 25 Oct 2021 21:17:14 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 90F05E70849; Mon, 25 Oct 2021 21:17:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id tn_T4aZK_bRj; Mon, 25 Oct 2021 21:17:12 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 3D0FDE70847; Mon, 25 Oct 2021 21:17:12 +0000 (UTC) Date: Mon, 25 Oct 2021 21:17:11 +0000 (UTC) From: "Bjoern A. Zeeb" To: Ian Lepore cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 548ada00e54a - main - LinuxKPI: add bcd.h In-Reply-To: <832a2403091df094d6f7ab471aef0694adebb939.camel@freebsd.org> Message-ID: References: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> <832a2403091df094d6f7ab471aef0694adebb939.camel@freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1355922163-1635196632=:68830" X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1355922163-1635196632=:68830 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 25 Oct 2021, Ian Lepore wrote: > On Mon, 2021-10-25 at 20:23 +0000, Bjoern A. Zeeb wrote: >> The branch main has been updated by bz: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=548ada00e54a9e7745d041b1ec7f68f3bd493365 >> >> commit 548ada00e54a9e7745d041b1ec7f68f3bd493365 >> Author:     Bjoern A. Zeeb >> AuthorDate: 2021-10-25 18:14:08 +0000 >> Commit:     Bjoern A. Zeeb >> CommitDate: 2021-10-25 20:20:53 +0000 >> >>     LinuxKPI: add bcd.h >>     >>     Add bcd2bin() as linuxkpi_bcd2bin().  Libkern does provide a >> bcd2bin() >> >> [...] >> + * We could use libkern, but we need the argument truncating. >> + * > > > What does that mean, "we need the argument truncating"? This one takes an uint8_t as argument. If my memory serves me correctly the Linux driver code through macros passes in larger values 0xabcdxx which are truncated by the argument type. We take an int and then have a KASSERT() which doesn't work so well for these larger values. /bz -- Bjoern A. Zeeb r15:7 --0-1355922163-1635196632=:68830-- From nobody Mon Oct 25 21:26:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4221B182BCD0 for ; Mon, 25 Oct 2021 21:27:00 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5c.ore.mailhop.org (outbound5c.ore.mailhop.org [54.244.192.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdShM6Tnlz3k77 for ; Mon, 25 Oct 2021 21:26:59 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1635197213; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=tnQk8L4OsEtC1u9QHDICCqQSuaOPEn9uYE3S9QeBXW27laPSYkeZ2AEFBxJUTq4RyaYJjB8tcC8qR CJjaENjZGSlwUN/5rc+Q+uI5QVvAJW1SYYDsBJ4XuQB98PyNdNg4kn4WzNfpUfo06vf4iPCfsl9uJk LSodOkS4Z25u4QRx+/NQ2gmbwH2nWZzwGdRpIGyHmK7Vvuw3m/qiQP1pRUeFgK4WwinOWOKT4lNaDi YsyPsmB1Qa6I2OGe89BVB3iaU6/Jgu4gV9EVD2UgBWBNwP6nOZG+rPWy5FFFPXCuCRyYHw297wv845 m78qfLgz9lIxEjyuEUEsJ2DSjzb6Cug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=QV21owQ4ug0Hov0jVReRoF7b4Mgbce/2wFhgiHODKH4=; b=ByOEcmPIlNLOL00dildn31m36oMHA9zAlqERQiR+ZR/3iFab+jMhcOoJXbS2GB5VuAU715Osf4zvt AxMIzbpuAcciMuwdq4vlyBaaetcUShThl/89HP9ZWWXEjnjJCdoBXFoY4o6qArpWksi9reETxEX/Vu +gjR1Oo6a9eQL2yU6Cb/80Co2eMEZMLBQjy2pKsR2zlqMgtoW2hVhWakXj61+BOuY/p2x/nCoD/EC9 ILbPZBf00GAHMYLfklsZi7BCcyBHM00otVw678n9VpHRlZthSzezp58ZdMzgtsTRsvuIvj8qhRGw4g gybQVVHceRy79tQA6vWCBejk/W6/X6w== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=QV21owQ4ug0Hov0jVReRoF7b4Mgbce/2wFhgiHODKH4=; b=EwTBLu0Qx+f6P/TYrePDetIBMp4OuIbZkYCj1jIXZN8SWGXkLAX82ajDqCGY311X8Gpn6rYEPKyeX WMCPdCpP0ifSg1md60292YBXQ9+IY+QBUD43uZ7FeZaRrw0j+850GmaFYBC1VJ/UOVcYoEdt+Z8au6 i/XLacL7GJ+pAG73agweZ2iw9qr82APpo6+Ee7V/buuAJegNYceBu6/qWgMwH+e50D0vQn8uRnsak6 qaBlHXnS6P2mCM3VCxfIky4uoB/oCkE2rmYjoF1deqV56+elgPIg6KhJcFa3Vfly2env+lTg3TYMfP yvDApul/Fv+3gxhadx0pjoaPBktLNew== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: 44e8e02d-35da-11ec-9f98-bf9d68d023b6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 44e8e02d-35da-11ec-9f98-bf9d68d023b6; Mon, 25 Oct 2021 21:26:52 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19PLQpHV097789; Mon, 25 Oct 2021 15:26:51 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <845d99d8f7c189418b36a832017518c493af729b.camel@freebsd.org> Subject: Re: git: 548ada00e54a - main - LinuxKPI: add bcd.h From: Ian Lepore To: "Bjoern A. Zeeb" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Mon, 25 Oct 2021 15:26:51 -0600 In-Reply-To: References: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> <832a2403091df094d6f7ab471aef0694adebb939.camel@freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HdShM6Tnlz3k77 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Mon, 2021-10-25 at 21:17 +0000, Bjoern A. Zeeb wrote: > On Mon, 25 Oct 2021, Ian Lepore wrote: > > > On Mon, 2021-10-25 at 20:23 +0000, Bjoern A. Zeeb wrote: > > > The branch main has been updated by bz: > > > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=548ada00e54a9e7745d041b1ec7f68f3bd493365 > > > > > > commit 548ada00e54a9e7745d041b1ec7f68f3bd493365 > > > Author:     Bjoern A. Zeeb > > > AuthorDate: 2021-10-25 18:14:08 +0000 > > > Commit:     Bjoern A. Zeeb > > > CommitDate: 2021-10-25 20:20:53 +0000 > > > > > >     LinuxKPI: add bcd.h > > >     > > >     Add bcd2bin() as linuxkpi_bcd2bin().  Libkern does provide a > > > bcd2bin() > > > > > > [...] > > > + * We could use libkern, but we need the argument truncating. > > > + * > > > > > > What does that mean, "we need the argument truncating"? > > This one takes an uint8_t as argument. > > If my memory serves me correctly the Linux driver code through > macros passes in larger values 0xabcdxx which are truncated by > the argument type. > > We take an int and then have a KASSERT() which doesn't work so well > for these larger values. > > /bz > > -- > Bjoern A. Zeeb                                                     > r15:7 I had forgotten that we added a KASSERT a few years ago. But we don't expect linux to be relying on getting bad answers in response to bad inputs, do we? I wonder why we can't just change the prototype of our inline function from int to uint8_t and remove the >= 0 part from the assert? -- Ian From nobody Mon Oct 25 21:29:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 08607182C0EC; Mon, 25 Oct 2021 21:29:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdSl56rJdz3kCf; Mon, 25 Oct 2021 21:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB6BE104C1; Mon, 25 Oct 2021 21:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PLTLMP011818; Mon, 25 Oct 2021 21:29:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PLTLt5011817; Mon, 25 Oct 2021 21:29:21 GMT (envelope-from git) Date: Mon, 25 Oct 2021 21:29:21 GMT Message-Id: <202110252129.19PLTLt5011817@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: 179219ea046f - main - strip/objcopy: handle empty file as unknown List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 179219ea046f46927d6478d43431e8b541703539 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=179219ea046f46927d6478d43431e8b541703539 commit 179219ea046f46927d6478d43431e8b541703539 Author: Ed Maste AuthorDate: 2021-10-25 21:25:26 +0000 Commit: Ed Maste CommitDate: 2021-10-25 21:28:41 +0000 strip/objcopy: handle empty file as unknown Previously strip reported a somewhat cryptic error for empty files: strip: elf_begin() failed: Invalid argument Add a special case to treat empty files as with an unknown file format. This is consistent with llvm-strip. GNU strip produces no output which does not seem like useful behaviour (but it does exit with status 1). Reported by: andrew Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32648 --- contrib/elftoolchain/elfcopy/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c index 964d3358de60..264e702ef5af 100644 --- a/contrib/elftoolchain/elfcopy/main.c +++ b/contrib/elftoolchain/elfcopy/main.c @@ -738,6 +738,8 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) { cleanup_tempfile(tempfile); + if (fstat(ifd, &sb) == 0 && sb.st_size == 0) + errx(EXIT_FAILURE, "file format not recognized"); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); } From nobody Mon Oct 25 21:32:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5D203182D80F; Mon, 25 Oct 2021 21:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdSpJ6qQ7z3lQ8; Mon, 25 Oct 2021 21:32:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AAC9A105CD; Mon, 25 Oct 2021 21:32:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PLW8cs024303; Mon, 25 Oct 2021 21:32:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PLW83K024302; Mon, 25 Oct 2021 21:32:08 GMT (envelope-from git) Date: Mon, 25 Oct 2021 21:32:08 GMT Message-Id: <202110252132.19PLW83K024302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 37a1501ed3dc - stable/13 - nfscl: Fix NFS VOP_ALLOCATE for mounts without Allocate support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622 commit 37a1501ed3dc05b875e6cb5ba0cf9a163ed4f622 Author: Rick Macklem AuthorDate: 2021-10-10 21:27:52 +0000 Commit: Rick Macklem CommitDate: 2021-10-25 21:28:47 +0000 nfscl: Fix NFS VOP_ALLOCATE for mounts without Allocate support Without this patch, nfs_allocate() fell back on using vop_stdallocate() for NFS mounts without Allocate operation support. This was incorrect, since some file systems, such as ZFS, cannot do allocate via vop_stdallocate(), which uses writes to try and allocate blocks. Also, fix nfs_allocate() to return EINVAL when mounts cannot do Allocate, since that is the correct error for posix_fallocate(2). Note that Allocate is only supported by some NFSv4.2 servers. (cherry picked from commit 235891a1273d99b86784f935d2d6c554ce189559) --- sys/fs/nfsclient/nfs_clvnops.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 29b0cdce4bbc..8da0186c3c62 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3649,17 +3649,12 @@ nfs_allocate(struct vop_allocate_args *ap) mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_NOALLOCATE; mtx_unlock(&nmp->nm_mtx); + error = EINVAL; } } else { mtx_unlock(&nmp->nm_mtx); - error = EIO; + error = EINVAL; } - /* - * If the NFS server cannot perform the Allocate operation, just call - * vop_stdallocate() to perform it. - */ - if (error != 0) - error = vop_stdallocate(ap); if (attrflag != 0) { ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); if (error == 0 && ret != 0) From nobody Mon Oct 25 21:33:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8EFF2182EF76; Mon, 25 Oct 2021 21:33:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdSqj3NlQz3mt3; Mon, 25 Oct 2021 21:33:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 27D21917C; Mon, 25 Oct 2021 21:33:21 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id EF5408D4A179; Mon, 25 Oct 2021 21:33:18 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3D538E70848; Mon, 25 Oct 2021 21:33:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id IRb4mHUZiMb1; Mon, 25 Oct 2021 21:33:16 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id D569DE70847; Mon, 25 Oct 2021 21:33:15 +0000 (UTC) Date: Mon, 25 Oct 2021 21:33:14 +0000 (UTC) From: "Bjoern A. Zeeb" To: Ian Lepore cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 548ada00e54a - main - LinuxKPI: add bcd.h In-Reply-To: <845d99d8f7c189418b36a832017518c493af729b.camel@freebsd.org> Message-ID: References: <202110252023.19PKNSRO031788@gitrepo.freebsd.org> <832a2403091df094d6f7ab471aef0694adebb939.camel@freebsd.org> <845d99d8f7c189418b36a832017518c493af729b.camel@freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1547604112-1635197595=:68830" X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1547604112-1635197595=:68830 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 25 Oct 2021, Ian Lepore wrote: > On Mon, 2021-10-25 at 21:17 +0000, Bjoern A. Zeeb wrote: >> On Mon, 25 Oct 2021, Ian Lepore wrote: >> >>> On Mon, 2021-10-25 at 20:23 +0000, Bjoern A. Zeeb wrote: >>>> The branch main has been updated by bz: >>>> >>>> URL: >>>> https://cgit.FreeBSD.org/src/commit/?id=548ada00e54a9e7745d041b1ec7f68f3bd493365 >>>> >>>> commit 548ada00e54a9e7745d041b1ec7f68f3bd493365 >>>> Author:     Bjoern A. Zeeb >>>> AuthorDate: 2021-10-25 18:14:08 +0000 >>>> Commit:     Bjoern A. Zeeb >>>> CommitDate: 2021-10-25 20:20:53 +0000 >>>> >>>>     LinuxKPI: add bcd.h >>>>     >>>>     Add bcd2bin() as linuxkpi_bcd2bin().  Libkern does provide a >>>> bcd2bin() >>>> >>>> [...] >>>> + * We could use libkern, but we need the argument truncating. >>>> + * >>> >>> >>> What does that mean, "we need the argument truncating"? >> >> This one takes an uint8_t as argument. >> >> If my memory serves me correctly the Linux driver code through >> macros passes in larger values 0xabcdxx which are truncated by >> the argument type. >> >> We take an int and then have a KASSERT() which doesn't work so well >> for these larger values. >> >> /bz >> >> -- >> Bjoern A. Zeeb                                                     >> r15:7 > > I had forgotten that we added a KASSERT a few years ago. But we don't > expect linux to be relying on getting bad answers in response to bad > inputs, do we? > > I wonder why we can't just change the prototype of our inline function > from int to uint8_t and remove the >= 0 part from the assert? I wonder why the int arguments were there the first time now that you made me look again. Be my guest to change it and I'll happily reduce this file to the #include line. /bz -- Bjoern A. Zeeb r15:7 --0-1547604112-1635197595=:68830-- From nobody Mon Oct 25 21:36:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DD447182FADB; Mon, 25 Oct 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdSvS5tzKz3nMQ; Mon, 25 Oct 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A61E4107CF; Mon, 25 Oct 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PLaa5l024766; Mon, 25 Oct 2021 21:36:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PLaa8Q024765; Mon, 25 Oct 2021 21:36:36 GMT (envelope-from git) Date: Mon, 25 Oct 2021 21:36:36 GMT Message-Id: <202110252136.19PLaa8Q024765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b575f97c831e - stable/13 - nfsd: Disable the NFSv4.2 Allocate operation by default List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b575f97c831eccc4f9e8cbd707f9f58df37440c5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b575f97c831eccc4f9e8cbd707f9f58df37440c5 commit b575f97c831eccc4f9e8cbd707f9f58df37440c5 Author: Rick Macklem AuthorDate: 2021-10-11 01:46:02 +0000 Commit: Rick Macklem CommitDate: 2021-10-25 21:32:42 +0000 nfsd: Disable the NFSv4.2 Allocate operation by default Some exported file systems, such as ZFS ones, cannot do VOP_ALLOCATE(). Since an NFSv4.2 server must either support the Allocate operation for all file systems or not support it at all, define a sysctl called vfs.nfsd.enable_v42allocate to enable the Allocate operation. This sysctl is false by default and can only be set true if all exported file systems (or all DSs for a pNFS server) can perform VOP_ALLOCATE(). Unfortunately, there is no way to know if a ZFS file system will be exported once the nfsd is operational, even if there are none exported when the nfsd is started up, so enabling Allocate must be done manually for a server configuration. This problem was detected during a recent NFSv4 interoperability testing event held by the IETF working group. (cherry picked from commit dfe887b7d2265a5c6e0132cc03e006eb68223177) --- sys/fs/nfsserver/nfs_nfsdserv.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index ab02df2c4a46..7ca766c99069 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -91,6 +91,14 @@ SYSCTL_STRING(_vfs_nfsd, OID_AUTO, owner_major, CTLFLAG_RWTUN, static uint64_t nfsrv_owner_minor; SYSCTL_U64(_vfs_nfsd, OID_AUTO, owner_minor, CTLFLAG_RWTUN, &nfsrv_owner_minor, 0, "Server owner minor"); +/* + * Only enable this if all your exported file systems + * (or pNFS DSs for the pNFS case) support VOP_ALLOCATE. + */ +static bool nfsrv_doallocate = false; +SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, enable_v42allocate, CTLFLAG_RW, + &nfsrv_doallocate, 0, + "Enable NFSv4.2 Allocate operation"); /* * This list defines the GSS mechanisms supported. @@ -5324,6 +5332,16 @@ nfsrvd_allocate(struct nfsrv_descript *nd, __unused int isdgram, nfsquad_t clientid; nfsattrbit_t attrbits; + if (!nfsrv_doallocate) { + /* + * If any exported file system, such as a ZFS one, cannot + * do VOP_ALLOCATE(), this operation cannot be supported + * for NFSv4.2. This cannot be done 'per filesystem', but + * must be for the entire nfsd NFSv4.2 service. + */ + nd->nd_repstat = NFSERR_NOTSUPP; + goto nfsmout; + } gotproxystateid = 0; NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER); stp->ls_flags = (NFSLCK_CHECK | NFSLCK_WRITEACCESS); @@ -5390,9 +5408,13 @@ nfsrvd_allocate(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, NULL, clientid, &stateid, exp, nd, curthread); + NFSD_DEBUG(4, "nfsrvd_allocate: off=%jd len=%jd stat=%d\n", + (intmax_t)off, (intmax_t)len, nd->nd_repstat); if (nd->nd_repstat == 0) nd->nd_repstat = nfsvno_allocate(vp, off, len, nd->nd_cred, curthread); + NFSD_DEBUG(4, "nfsrvd_allocate: aft nfsvno_allocate=%d\n", + nd->nd_repstat); vput(vp); NFSEXITCODE2(0, nd); return (0); From nobody Mon Oct 25 23:20:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CAC401825529 for ; Mon, 25 Oct 2021 23:20:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdWCs5NwPz3kcQ; Mon, 25 Oct 2021 23:20:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9AE7912010; Mon, 25 Oct 2021 23:20:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PNKvlv082501; Mon, 25 Oct 2021 23:20:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PNKvTY082500; Mon, 25 Oct 2021 23:20:57 GMT (envelope-from git) Date: Mon, 25 Oct 2021 23:20:57 GMT Message-Id: <202110252320.19PNKvTY082500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: "Danilo G. Baio" Subject: git: 67e3b6882593 - internal/admin - Revert "Remove joel from src/access.doc" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dbaio X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 67e3b688259350d60be58c63f1e7dd99f9d39f74 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by dbaio (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=67e3b688259350d60be58c63f1e7dd99f9d39f74 commit 67e3b688259350d60be58c63f1e7dd99f9d39f74 Author: Danilo G. Baio AuthorDate: 2021-10-25 23:19:14 +0000 Commit: Danilo G. Baio CommitDate: 2021-10-25 23:19:14 +0000 Revert "Remove joel from src/access.doc" This reverts commit b86842ad719f10adb24402867a105b62611a7568. joel's doc commit bit was reactivated. Approved by: core (implicit), doceng (implicit) --- access.doc | 1 + 1 file changed, 1 insertion(+) diff --git a/access.doc b/access.doc index a554482e659c..16aaaaa4a174 100644 --- a/access.doc +++ b/access.doc @@ -18,3 +18,4 @@ # type of commits. # blackend +joel From nobody Tue Oct 26 02:06:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5C799181B905; Tue, 26 Oct 2021 02:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdZtx21dpz3GZF; Tue, 26 Oct 2021 02:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 26A6314226; Tue, 26 Oct 2021 02:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q26XNG000728; Tue, 26 Oct 2021 02:06:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q26XZm000727; Tue, 26 Oct 2021 02:06:33 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:06:33 GMT Message-Id: <202110260206.19Q26XZm000727@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: dce5f3abed71 - main - [LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dce5f3abed7181cc533ca5ed3de44517775e78dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dce5f3abed7181cc533ca5ed3de44517775e78dd commit dce5f3abed7181cc533ca5ed3de44517775e78dd Author: Steve Kargl AuthorDate: 2021-10-25 13:13:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-25 23:50:20 +0000 [LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl] Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle trignometric functions cospi, sinpi, and tanpi. The attached patch implements cospi[fl], sinpi[fl], and tanpi[fl]. Limited testing on the cospi and sinpi reveal a max ULP less than 0.89; while tanpi is more problematic with a max ULP less than 2.01 in the interval [0,0.5]. The algorithms used in these functions are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c. Note. I no longer have access to a system with ld128 and adequate support to compile and test the ld128 implementations of these functions. Given the almost complete lack of input from others on improvements to libm, I doubt that anyone cares. If someone does care, the ld128 files contain a number of FIXME comments, and in particular, while the polynomial coefficients are given I did not update the polynomial algorithms to properly use the coefficients. PR: 218514 MFC after: 2 weeks --- lib/msun/Makefile | 14 +++- lib/msun/Symbol.map | 13 ++++ lib/msun/ld128/k_cospil.h | 42 +++++++++++ lib/msun/ld128/k_sinpil.h | 42 +++++++++++ lib/msun/ld128/s_cospil.c | 109 ++++++++++++++++++++++++++++ lib/msun/ld128/s_sinpil.c | 118 +++++++++++++++++++++++++++++++ lib/msun/ld128/s_tanpil.c | 120 +++++++++++++++++++++++++++++++ lib/msun/ld80/k_cospil.h | 42 +++++++++++ lib/msun/ld80/k_sinpil.h | 42 +++++++++++ lib/msun/ld80/s_cospil.c | 129 +++++++++++++++++++++++++++++++++ lib/msun/ld80/s_sinpil.c | 140 ++++++++++++++++++++++++++++++++++++ lib/msun/ld80/s_tanpil.c | 139 ++++++++++++++++++++++++++++++++++++ lib/msun/man/cospi.3 | 111 +++++++++++++++++++++++++++++ lib/msun/man/sinpi.3 | 102 +++++++++++++++++++++++++++ lib/msun/man/tanpi.3 | 106 ++++++++++++++++++++++++++++ lib/msun/src/k_cospi.h | 44 ++++++++++++ lib/msun/src/k_sinpi.h | 43 +++++++++++ lib/msun/src/math.h | 9 +++ lib/msun/src/s_cospi.c | 151 +++++++++++++++++++++++++++++++++++++++ lib/msun/src/s_cospif.c | 109 ++++++++++++++++++++++++++++ lib/msun/src/s_sinpi.c | 168 +++++++++++++++++++++++++++++++++++++++++++ lib/msun/src/s_sinpif.c | 122 ++++++++++++++++++++++++++++++++ lib/msun/src/s_tanpi.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++ lib/msun/src/s_tanpif.c | 114 ++++++++++++++++++++++++++++++ 24 files changed, 2203 insertions(+), 2 deletions(-) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 7107aad56aa7..dcee5572f949 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -126,6 +126,12 @@ COMMON_SRCS+= catrigl.c \ # See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067 .if ${COMPILER_TYPE} == "gcc" CFLAGS.e_powl.c+= -Wno-error=overflow + +# IEEE-754 2008 and ISO/IEC TS 18661-4 half-cycle trignometric functions +COMMON_SRCS+= s_cospi.c s_cospif.c s_cospil.c \ + s_sinpi.c s_sinpif.c s_sinpil.c \ + s_tanpi.c s_tanpif.c s_tanpil.c + .endif .endif @@ -154,7 +160,8 @@ INCS+= fenv.h math.h MAN= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 \ ceil.3 cacos.3 ccos.3 ccosh.3 cexp.3 \ - cimag.3 clog.3 copysign.3 cos.3 cosh.3 cpow.3 csqrt.3 erf.3 \ + cimag.3 clog.3 copysign.3 cos.3 cosh.3 cospi.3 \ + cpow.3 csqrt.3 erf.3 \ exp.3 fabs.3 fdim.3 \ feclearexcept.3 feenableexcept.3 fegetenv.3 \ fegetround.3 fenv.3 floor.3 \ @@ -162,7 +169,7 @@ MAN= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 \ lgamma.3 log.3 lrint.3 lround.3 math.3 nan.3 \ nextafter.3 remainder.3 rint.3 \ round.3 scalbn.3 signbit.3 sin.3 sincos.3 \ - sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 \ + sinh.3 sinpi.3 sqrt.3 tan.3 tanh.3 tanpi.3 trunc.3 \ complex.3 MLINKS+=acos.3 acosf.3 acos.3 acosl.3 @@ -192,6 +199,7 @@ MLINKS+=clog.3 clogf.3 clog.3 clogl.3 MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3 MLINKS+=cos.3 cosf.3 cos.3 cosl.3 MLINKS+=cosh.3 coshf.3 cosh.3 coshl.3 +MLINKS+=cospi.3 cospif.3 cospi.3 cospil.3 MLINKS+=cpow.3 cpowf.3 cpow.3 cpowl.3 MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 erf.3 erfl.3 erf.3 erfcl.3 @@ -244,10 +252,12 @@ MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3 MLINKS+=sin.3 sinf.3 sin.3 sinl.3 MLINKS+=sincos.3 sincosf.3 sin.3 sincosl.3 MLINKS+=sinh.3 sinhf.3 sinh.3 sinhl.3 +MLINKS+=sinpi.3 sinpif.3 sinpi.3 sinpil.3 MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 sqrtf.3 \ sqrt.3 sqrtl.3 MLINKS+=tan.3 tanf.3 tan.3 tanl.3 MLINKS+=tanh.3 tanhf.3 tanh.3 tanhl.3 +MLINKS+=tanpi.3 tanpif.3 tanpi.3 tanpil.3 MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3 .include diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index 51deded732f0..7229e7ef31fd 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -304,3 +304,16 @@ FBSD_1.5 { sincosf; sincosl; }; + +/* First added in 14.0-CURRENT */ +FBSD_1.7 { + cospi; + cospif; + cospil; + sinpi; + sinpif; + sinpil; + tanpi; + tanpif; + tanpil; +}; diff --git a/lib/msun/ld128/k_cospil.h b/lib/msun/ld128/k_cospil.h new file mode 100644 index 000000000000..592f19229532 --- /dev/null +++ b/lib/msun/ld128/k_cospil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_cospi.c for implementation details. + */ + +static inline long double +__kernel_cospil(long double x) +{ + long double hi, lo; + + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_cosl(hi, lo)); +} diff --git a/lib/msun/ld128/k_sinpil.h b/lib/msun/ld128/k_sinpil.h new file mode 100644 index 000000000000..fa4e7d6336d7 --- /dev/null +++ b/lib/msun/ld128/k_sinpil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_sinpi.c for implementation details. + */ + +static inline long double +__kernel_sinpil(long double x) +{ + long double hi, lo; + + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_sinl(hi, lo, 1)); +} diff --git a/lib/msun/ld128/s_cospil.c b/lib/msun/ld128/s_cospil.c new file mode 100644 index 000000000000..b4bc50bb4d89 --- /dev/null +++ b/lib/msun/ld128/s_cospil.c @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_cospi.c for implementation details. + * + * FIXME: This has not been compiled nor has it been tested for accuracy. + * FIXME: This should use bit twiddling. + */ + +#include "math.h" +#include "math_private.h" + +/* + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi. + */ +static const long double +pi_hi = 3.14159265358979322702026593105983920e+00L, +pi_lo = 1.14423774522196636802434264184180742e-17L; + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +cospil(long double x) +{ + long double ax, c, xf; + uint32_t ix; + + ax = fabsl(x); + + if (ax < 1) { + if (ax < 0.25) { + if (ax < 0x1p-60) { + if ((int)x == 0) + return (1); + } + return (__kernel_cospil(ax)); + } + + if (ax < 0.5) + c = __kernel_sinpil(0.5 - ax); + else if (ax < 0.75) { + if (ax == 0.5) + return (0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + return (c); + } + + if (ax < 0x1p112) { + xf = floorl(ax); + ax -= xf; + if (x < 0.5) { + if (x < 0.25) + c = ax == 0 ? 1 : __kernel_cospil(ax); + else + c = __kernel_sinpil(0.5 - ax); + } else { + if (x < 0.75) { + if (ax == 0.5) + return (0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + } + + if (xf > 0x1p50) + xf -= 0x1p50; + if (xf > 0x1p30) + xf -= 0x1p30; + ix = (uint32_t)xf; + return (ix & 1 ? -c : c); + } + + if (isinf(x) || isnan(x)) + return (vzero / vzero); + + /* + * |x| >= 0x1p112 is always an even integer, so return 1. + */ + return (1); +} diff --git a/lib/msun/ld128/s_sinpil.c b/lib/msun/ld128/s_sinpil.c new file mode 100644 index 000000000000..39eed9b007bc --- /dev/null +++ b/lib/msun/ld128/s_sinpil.c @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_sinpi.c for implementation details. + * + * FIXME: This has not been compiled nor has it been tested for accuracy. + * FIXME: This should use bit twiddling. + */ + +#include "math.h" +#include "math_private.h" + +/* + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi. + */ +static const long double +pi_hi = 3.14159265358979322702026593105983920e+00L, +pi_lo = 1.14423774522196636802434264184180742e-17L; + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +sinpil(long double x) +{ + long double ax, hi, lo, s, xf, xhi, xlo; + uint32_t ix; + + ax = fabsl(x); + + if (ax < 1) { + if (ax < 0.25) { + if (ax < 0x1p-60) { + if (x == 0) + return (x); + hi = (double)x; + hi *= 0x1p113L; + lo = x * 0x1p113L - hi; + s = (pi_lo + pi_hi) * lo + pi_lo * lo + + pi_hi * hi; + return (s * 0x1p-113L); + } + + s = __kernel_sinpil(ax); + return (copysignl(s, x)); + } + + if (ax < 0.5) + s = __kernel_cospil(0.5 - ax); + else if (ax < 0.75) + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + return (copysignl(s, x)); + } + + if (ax < 0x1p112) { + xf = floorl(ax); + ax -= xf; + if (ax == 0) { + s = 0; + } else { + if (ax < 0.5) { + if (ax <= 0.25) + s = __kernel_sinpil(ax); + else + s = __kernel_cospil(0.5 - ax); + } else { + if (ax < 0.75) + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + } + + if (xf > 0x1p50) + xf -= 0x1p50; + if (xf > 0x1p30) + xf -= 0x1p30; + ix = (uint32_t)xf; + if (ix & 1) s = -s; + } + return (copysignl(s, x)); + } + + if (isinf(x) || isnan(x)) + return (vzero / vzero); + + /* + * |x| >= 0x1p112 is always an integer, so return +-0. + */ + return (copysignl(0, x)); +} diff --git a/lib/msun/ld128/s_tanpil.c b/lib/msun/ld128/s_tanpil.c new file mode 100644 index 000000000000..33a61cf3115d --- /dev/null +++ b/lib/msun/ld128/s_tanpil.c @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_tanpi.c for implementation details. + * + * FIXME: This has not been compiled nor has it been tested for accuracy. + * FIXME: This should use bit twiddling. + */ + +#include "math.h" +#include "math_private.h" + +/* + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi. + */ +static const long double +pi_hi = 3.14159265358979322702026593105983920e+00L, +pi_lo = 1.14423774522196636802434264184180742e-17L; + +static inline long double +__kernel_tanpi(long double x) +{ + long double hi, lo, t; + + if (x < 0.25) { + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + t = __kernel_tanl(hi, lo, -1); + } else if (x > 0.25) { + x = 0.5 - x; + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + t = - __kernel_tanl(hi, lo, 1); + } else + t = 1; + + return (t); +} + +volatile static const double vzero = 0; + +long double +tanpil(long double x) +{ + long double ax, hi, lo, xf; + uint32_t ix; + + ax = fabsl(ax); + + if (ax < 1) { + if (ax < 0.5) { + if (ax < 0x1p-60) { + if (x == 0) + return (x); + hi = (double)x; + hi *= 0x1p113L + lo = x * 0x1p113L - hi; + t = (pi_lo + pi_hi) * lo + pi_lo * lo + + pi_hi * hi; + return (t * 0x1p-113L); + } + t = __kernel_tanpil(ax); + } else if (ax == 0.5) + return ((ax - ax) / (ax - ax)); + else + t = -__kernel_tanpil(1 - ax); + return (copysignl(t, x)); + } + + if (ix < 0x1p112) { + xf = floorl(ax); + ax -= xf; + if (ax < 0.5) + t = ax == 0 ? 0 : __kernel_tanpil(ax); + else if (ax == 0.5) + return ((ax - ax) / (ax - ax)); + else + t = -__kernel_tanpil(1 - ax); + return (copysignl(t, x)); + } + + /* x = +-inf or nan. */ + if (isinf(x) || isnan(x)) + return (vzero / vzero); + + /* + * |x| >= 0x1p53 is always an integer, so return +-0. + */ + return (copysignl(0, x)); +} diff --git a/lib/msun/ld80/k_cospil.h b/lib/msun/ld80/k_cospil.h new file mode 100644 index 000000000000..6e13ef02aea2 --- /dev/null +++ b/lib/msun/ld80/k_cospil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_cospi.c for implementation details. + */ + +static inline long double +__kernel_cospil(long double x) +{ + long double hi, lo; + + hi = (float)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_cosl(hi, lo)); +} diff --git a/lib/msun/ld80/k_sinpil.h b/lib/msun/ld80/k_sinpil.h new file mode 100644 index 000000000000..00241b932e9e --- /dev/null +++ b/lib/msun/ld80/k_sinpil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_sinpi.c for implementation details. + */ + +static inline long double +__kernel_sinpil(long double x) +{ + long double hi, lo; + + hi = (float)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_sinl(hi, lo, 1)); +} diff --git a/lib/msun/ld80/s_cospil.c b/lib/msun/ld80/s_cospil.c new file mode 100644 index 000000000000..199479e9eaf9 --- /dev/null +++ b/lib/msun/ld80/s_cospil.c @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_cospi.c for implementation details. + */ + +#ifdef __i386__ +#include +#endif +#include + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +static const double +pi_hi = 3.1415926814079285e+00, /* 0x400921fb 0x58000000 */ +pi_lo =-2.7818135228334233e-08; /* 0xbe5dde97 0x3dcb3b3a */ + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +cospil(long double x) +{ + long double ax, c; + uint64_t lx, m; + uint32_t j0; + uint16_t hx, ix; + + EXTRACT_LDBL80_WORDS(hx, lx, x); + ix = hx & 0x7fff; + INSERT_LDBL80_WORDS(ax, ix, lx); + + ENTERI(); + + if (ix < 0x3fff) { /* |x| < 1 */ + if (ix < 0x3ffd) { /* |x| < 0.25 */ + if (ix < 0x3fdd) { /* |x| < 0x1p-34 */ + if ((int)x == 0) + RETURNI(1); + } + RETURNI(__kernel_cospil(ax)); + } + + if (ix < 0x3ffe) /* |x| < 0.5 */ + c = __kernel_sinpil(0.5 - ax); + else if (lx < 0xc000000000000000ull) { /* |x| < 0.75 */ + if (ax == 0.5) + RETURNI(0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + RETURNI(c); + } + + if (ix < 0x403e) { /* 1 <= |x| < 0x1p63 */ + /* Determine integer part of ax. */ + j0 = ix - 0x3fff + 1; + if (j0 < 32) { + lx = (lx >> 32) << 32; + lx &= ~(((lx << 32)-1) >> j0); + } else { + m = (uint64_t)-1 >> (j0 + 1); + if (lx & m) lx &= ~m; + } + INSERT_LDBL80_WORDS(x, ix, lx); + + ax -= x; + EXTRACT_LDBL80_WORDS(ix, lx, ax); + + if (ix < 0x3ffe) { /* |x| < 0.5 */ + if (ix < 0x3ffd) /* |x| < 0.25 */ + c = ix == 0 ? 1 : __kernel_cospil(ax); + else + c = __kernel_sinpil(0.5 - ax); + + } else { + if (lx < 0xc000000000000000ull) { /* |x| < 0.75 */ + if (ax == 0.5) + RETURNI(0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + } + + if (j0 > 40) + x -= 0x1p40; + if (j0 > 30) + x -= 0x1p30; + j0 = (uint32_t)x; + + RETURNI(j0 & 1 ? -c : c); + } + + if (ix >= 0x7fff) + RETURNI(vzero / vzero); + + /* + * |x| >= 0x1p63 is always an even integer, so return 1. + */ + RETURNI(1); +} diff --git a/lib/msun/ld80/s_sinpil.c b/lib/msun/ld80/s_sinpil.c new file mode 100644 index 000000000000..4cefa92352e1 --- /dev/null +++ b/lib/msun/ld80/s_sinpil.c @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_sinpi.c for implementation details. + */ + +#ifdef __i386__ +#include +#endif +#include + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +static const union IEEEl2bits +pi_hi_u = LD80C(0xc90fdaa200000000, 1, 3.14159265346825122833e+00L), +pi_lo_u = LD80C(0x85a308d313198a2e, -33, 1.21542010130123852029e-10L); +#define pi_hi (pi_hi_u.e) +#define pi_lo (pi_lo_u.e) + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +sinpil(long double x) +{ + long double ax, hi, lo, s; + uint64_t lx, m; + uint32_t j0; + uint16_t hx, ix; + + EXTRACT_LDBL80_WORDS(hx, lx, x); + ix = hx & 0x7fff; + INSERT_LDBL80_WORDS(ax, ix, lx); + + ENTERI(); + + if (ix < 0x3fff) { /* |x| < 1 */ + if (ix < 0x3ffd) { /* |x| < 0.25 */ + if (ix < 0x3fdd) { /* |x| < 0x1p-34 */ + if (x == 0) + RETURNI(x); + INSERT_LDBL80_WORDS(hi, hx, + lx & 0xffffffff00000000ull); + hi *= 0x1p63L; + lo = x * 0x1p63L - hi; + s = (pi_lo + pi_hi) * lo + pi_lo * hi + + pi_hi * hi; + RETURNI(s * 0x1p-63L); + } + s = __kernel_sinpil(ax); + RETURNI((hx & 0x8000) ? -s : s); + } + + if (ix < 0x3ffe) /* |x| < 0.5 */ + s = __kernel_cospil(0.5 - ax); + else if (lx < 0xc000000000000000ull) /* |x| < 0.75 */ + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + RETURNI((hx & 0x8000) ? -s : s); + } + + if (ix < 0x403e) { /* 1 <= |x| < 0x1p63 */ + /* Determine integer part of ax. */ + j0 = ix - 0x3fff + 1; + if (j0 < 32) { + lx = (lx >> 32) << 32; + lx &= ~(((lx << 32)-1) >> j0); + } else { + m = (uint64_t)-1 >> (j0 + 1); + if (lx & m) lx &= ~m; + } + INSERT_LDBL80_WORDS(x, ix, lx); + + ax -= x; + EXTRACT_LDBL80_WORDS(ix, lx, ax); + + if (ix == 0) { + s = 0; + } else { + if (ix < 0x3ffe) { /* |x| < 0.5 */ + if (ix < 0x3ffd) /* |x| < 0.25 */ + s = __kernel_sinpil(ax); + else + s = __kernel_cospil(0.5 - ax); + } else { + /* |x| < 0.75 */ + if (lx < 0xc000000000000000ull) + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + } + + if (j0 > 40) + x -= 0x1p40; + if (j0 > 30) + x -= 0x1p30; + j0 = (uint32_t)x; + if (j0 & 1) s = -s; + } + RETURNI((hx & 0x8000) ? -s : s); + } + + /* x = +-inf or nan. */ + if (ix >= 0x7fff) + RETURNI(vzero / vzero); + + /* + * |x| >= 0x1p63 is always an integer, so return +-0. + */ + RETURNI(copysignl(0, x)); +} diff --git a/lib/msun/ld80/s_tanpil.c b/lib/msun/ld80/s_tanpil.c new file mode 100644 index 000000000000..02451e562025 --- /dev/null +++ b/lib/msun/ld80/s_tanpil.c @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: *** 1464 LINES SKIPPED *** From nobody Tue Oct 26 02:14:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3CAB318202E4; Tue, 26 Oct 2021 02:14: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hdb4J6FCTz3KcH; Tue, 26 Oct 2021 02:14:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B6C3C14512; Tue, 26 Oct 2021 02:14:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2Eeo6013631; Tue, 26 Oct 2021 02:14:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2EeYR013630; Tue, 26 Oct 2021 02:14:40 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:14:40 GMT Message-Id: <202110260214.19Q2EeYR013630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 23024f004a4c - main - nfscl: Add a missing delegation lock release List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23024f004a4c5659bfcb0b08fac2211ae925ee58 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=23024f004a4c5659bfcb0b08fac2211ae925ee58 commit 23024f004a4c5659bfcb0b08fac2211ae925ee58 Author: Rick Macklem AuthorDate: 2021-10-26 02:09:14 +0000 Commit: Rick Macklem CommitDate: 2021-10-26 02:11:45 +0000 nfscl: Add a missing delegation lock release There was a case in nfscl_doiods() where the function would return without releasing the delegation shared lock, if it was aquired by the call to nfscl_getstateid(). This patch adds that release. I have never observed a failure due to this missing release, so I do not know if it ever happens in practice. However, since the pNFS client is not yet heavily used, it might be the case. Found by code inspection during a recent NFSv4 IETF working group testing event. MFC after: 2 week --- sys/fs/nfsclient/nfs_clrpcops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 35ce9be88405..dec70dc2ac06 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -6045,6 +6045,8 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, if (layp == NULL || rflp == NULL) { if (recalled != 0) { NFSFREECRED(newcred); + if (lckp != NULL) + nfscl_lockderef(lckp); nfscl_relref(nmp); return (EIO); } From nobody Tue Oct 26 02:37:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D67AD1827E43; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZ85Xr9z3Q3B; Tue, 26 Oct 2021 02:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9E0F214670; Tue, 26 Oct 2021 02:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2b4ZQ039864; Tue, 26 Oct 2021 02:37:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2b43x039863; Tue, 26 Oct 2021 02:37:04 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:04 GMT Message-Id: <202110260237.19Q2b43x039863@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1d72df1c3de3 - stable/13 - sys_procctl(2): remove sysproto and argused List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d72df1c3de3b21f17a1f8389cbfe81c3f7b36f7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1d72df1c3de3b21f17a1f8389cbfe81c3f7b36f7 commit 1d72df1c3de3b21f17a1f8389cbfe81c3f7b36f7 Author: Konstantin Belousov AuthorDate: 2021-10-15 18:55:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:26 +0000 sys_procctl(2): remove sysproto and argused (cherry picked from commit 31faa565edea908a8caf71cc6783066c02fd6844) --- sys/kern/kern_procctl.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 53626caa0fd9..eb36f0822938 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -656,15 +656,6 @@ wxmap_status(struct thread *td, struct proc *p, int *data) return (0); } -#ifndef _SYS_SYSPROTO_H_ -struct procctl_args { - idtype_t idtype; - id_t id; - int com; - void *data; -}; -#endif -/* ARGSUSED */ int sys_procctl(struct thread *td, struct procctl_args *uap) { From nobody Tue Oct 26 02:37:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 22AD51827DE7; Tue, 26 Oct 2021 02:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZ96pWBz3PvY; Tue, 26 Oct 2021 02:37:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C0A5214671; Tue, 26 Oct 2021 02:37:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2b5JN039888; Tue, 26 Oct 2021 02:37:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2b57h039887; Tue, 26 Oct 2021 02:37:05 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:05 GMT Message-Id: <202110260237.19Q2b57h039887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 19eec365999b - stable/13 - kern_procctl(): convert the function to be table-driven List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 19eec365999b65dd0e623212b7aedd17d87fca44 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=19eec365999b65dd0e623212b7aedd17d87fca44 commit 19eec365999b65dd0e623212b7aedd17d87fca44 Author: Konstantin Belousov AuthorDate: 2021-10-15 18:57:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:26 +0000 kern_procctl(): convert the function to be table-driven (cherry picked from commit 7ae879b14a2086df521c59c4a379d3a072e08bc6) --- sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index eb36f0822938..90c5e63c7219 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -656,6 +656,57 @@ wxmap_status(struct thread *td, struct proc *p, int *data) return (0); } +struct procctl_cmd_info { + int lock_tree; + bool one_proc : 1; +}; +static const struct procctl_cmd_info procctl_cmds_info[] = { + [PROC_SPROTECT] = + { .lock_tree = SA_SLOCKED, .one_proc = false, }, + [PROC_REAP_ACQUIRE] = + { .lock_tree = SA_XLOCKED, .one_proc = true, }, + [PROC_REAP_RELEASE] = + { .lock_tree = SA_XLOCKED, .one_proc = true, }, + [PROC_REAP_STATUS] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_REAP_GETPIDS] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_REAP_KILL] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_TRACE_CTL] = + { .lock_tree = SA_SLOCKED, .one_proc = false, }, + [PROC_TRACE_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_TRAPCAP_CTL] = + { .lock_tree = SA_SLOCKED, .one_proc = false, }, + [PROC_TRAPCAP_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PDEATHSIG_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PDEATHSIG_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_ASLR_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_ASLR_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PROTMAX_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_PROTMAX_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_STACKGAP_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_STACKGAP_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_NO_NEW_PRIVS_CTL] = + { .lock_tree = SA_SLOCKED, .one_proc = true, }, + [PROC_NO_NEW_PRIVS_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_WXMAP_CTL] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + [PROC_WXMAP_STATUS] = + { .lock_tree = SA_UNLOCKED, .one_proc = true, }, +}; + int sys_procctl(struct thread *td, struct procctl_args *uap) { @@ -812,33 +863,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) { struct pgrp *pg; struct proc *p; + const struct procctl_cmd_info *cmd_info; int error, first_error, ok; int signum; - bool tree_locked; - switch (com) { - case PROC_ASLR_CTL: - case PROC_ASLR_STATUS: - case PROC_PROTMAX_CTL: - case PROC_PROTMAX_STATUS: - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: - case PROC_REAP_STATUS: - case PROC_REAP_GETPIDS: - case PROC_REAP_KILL: - case PROC_STACKGAP_CTL: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_PDEATHSIG_CTL: - case PROC_PDEATHSIG_STATUS: - case PROC_NO_NEW_PRIVS_CTL: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_CTL: - case PROC_WXMAP_STATUS: - if (idtype != P_PID) - return (EINVAL); - } + MPASS(com > 0 && com < nitems(procctl_cmds_info)); + cmd_info = &procctl_cmds_info[com]; + if (idtype != P_PID && cmd_info->one_proc) + return (EINVAL); switch (com) { case PROC_PDEATHSIG_CTL: @@ -861,37 +893,13 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) return (0); } - switch (com) { - case PROC_SPROTECT: - case PROC_REAP_STATUS: - case PROC_REAP_GETPIDS: - case PROC_REAP_KILL: - case PROC_TRACE_CTL: - case PROC_TRAPCAP_CTL: - case PROC_NO_NEW_PRIVS_CTL: - sx_slock(&proctree_lock); - tree_locked = true; - break; - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: + switch (cmd_info->lock_tree) { + case SA_XLOCKED: sx_xlock(&proctree_lock); - tree_locked = true; break; - case PROC_ASLR_CTL: - case PROC_ASLR_STATUS: - case PROC_PROTMAX_CTL: - case PROC_PROTMAX_STATUS: - case PROC_STACKGAP_CTL: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_CTL: - case PROC_WXMAP_STATUS: - tree_locked = false; + case SA_SLOCKED: + sx_slock(&proctree_lock); break; - default: - return (EINVAL); } switch (idtype) { @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) error = EINVAL; break; } - if (tree_locked) - sx_unlock(&proctree_lock); + + switch (cmd_info->lock_tree) { + case SA_XLOCKED: + sx_xunlock(&proctree_lock); + break; + case SA_SLOCKED: + sx_sunlock(&proctree_lock); + break; + } return (error); } From nobody Tue Oct 26 02:37:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CEC121827E4F; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZC0YX8z3Pq1; Tue, 26 Oct 2021 02:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E130514A95; Tue, 26 Oct 2021 02:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2b657039912; Tue, 26 Oct 2021 02:37:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2b6Ox039911; Tue, 26 Oct 2021 02:37:06 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:06 GMT Message-Id: <202110260237.19Q2b6Ox039911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2e69ba48b97d - stable/13 - procctl(2): add consistent shortcut P_ID:0 as curproc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e69ba48b97dffa244a4d2d47382b6fbcf6e78f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2e69ba48b97dffa244a4d2d47382b6fbcf6e78f4 commit 2e69ba48b97dffa244a4d2d47382b6fbcf6e78f4 Author: Konstantin Belousov AuthorDate: 2021-10-15 19:01:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:26 +0000 procctl(2): add consistent shortcut P_ID:0 as curproc (cherry picked from commit f833ab9dd187328306fa1601330fbc8332392abe) --- lib/libc/sys/procctl.2 | 2 ++ sys/kern/kern_procctl.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 4308520b8974..9ceea00191e0 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -62,6 +62,8 @@ The following identifier types are supported: .It Dv P_PID Control the process with the process ID .Fa id . +.Fa id +zero is a shortcut for the calling process ID. .It Dv P_PGID Control processes belonging to the process group with the ID .Fa id . diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 90c5e63c7219..613fabc4ca34 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -904,12 +904,18 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) switch (idtype) { case P_PID: - p = pfind(id); - if (p == NULL) { - error = ESRCH; - break; + if (id == 0) { + p = td->td_proc; + error = 0; + PROC_LOCK(p); + } else { + p = pfind(id); + if (p == NULL) { + error = ESRCH; + break; + } + error = p_cansee(td, p); } - error = p_cansee(td, p); if (error == 0) error = kern_procctl_single(td, p, com, data); PROC_UNLOCK(p); From nobody Tue Oct 26 02:37:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 56B9B1827E5A; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZD49gqz3PyQ; Tue, 26 Oct 2021 02:37:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 186B314B0E; Tue, 26 Oct 2021 02:37:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2b7kH039936; Tue, 26 Oct 2021 02:37:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2b7jp039935; Tue, 26 Oct 2021 02:37:07 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:07 GMT Message-Id: <202110260237.19Q2b7jp039935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3c7f03c25fa8 - stable/13 - procctl: convert PDEATHSIG_CTL/STATUS to regular kern_procctl_single() cases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c7f03c25fa8b8c73838cf78c02b3a885888c5ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3c7f03c25fa8b8c73838cf78c02b3a885888c5ee commit 3c7f03c25fa8b8c73838cf78c02b3a885888c5ee Author: Konstantin Belousov AuthorDate: 2021-10-15 19:06:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:26 +0000 procctl: convert PDEATHSIG_CTL/STATUS to regular kern_procctl_single() cases (cherry picked from commit 34f39a8c0e2a4100837eb406ae24a7d6a357d696) --- sys/kern/kern_procctl.c | 114 +++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 613fabc4ca34..1e29429aacf2 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -656,55 +656,96 @@ wxmap_status(struct thread *td, struct proc *p, int *data) return (0); } +static int +pdeathsig_ctl(struct thread *td, struct proc *p, int data) +{ + if (p != td->td_proc || (data != 0 && !_SIG_VALID(data))) + return (EINVAL); + p->p_pdeathsig = data; + return (0); +} + +static int +pdeathsig_status(struct thread *td, struct proc *p, int *data) +{ + if (p != td->td_proc) + return (EINVAL); + *(int *)data = p->p_pdeathsig; + return (0); +} + struct procctl_cmd_info { int lock_tree; bool one_proc : 1; + bool esrch_is_einval : 1; }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = - { .lock_tree = SA_SLOCKED, .one_proc = false, }, + { .lock_tree = SA_SLOCKED, .one_proc = false, + .esrch_is_einval = false, }, [PROC_REAP_ACQUIRE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, }, + { .lock_tree = SA_XLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_RELEASE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, }, + { .lock_tree = SA_XLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_STATUS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_GETPIDS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_REAP_KILL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_TRACE_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, }, + { .lock_tree = SA_SLOCKED, .one_proc = false, + .esrch_is_einval = false, }, [PROC_TRACE_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_TRAPCAP_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, }, + { .lock_tree = SA_SLOCKED, .one_proc = false, + .esrch_is_einval = false, }, [PROC_TRAPCAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_PDEATHSIG_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = true, }, [PROC_PDEATHSIG_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = true, }, [PROC_ASLR_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_ASLR_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_PROTMAX_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_PROTMAX_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_STACKGAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_STACKGAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_NO_NEW_PRIVS_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, }, + { .lock_tree = SA_SLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_NO_NEW_PRIVS_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_WXMAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, [PROC_WXMAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, }, + { .lock_tree = SA_UNLOCKED, .one_proc = true, + .esrch_is_einval = false, }, }; int @@ -845,6 +886,10 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) return (trapcap_ctl(td, p, *(int *)data)); case PROC_TRAPCAP_STATUS: return (trapcap_status(td, p, data)); + case PROC_PDEATHSIG_CTL: + return (pdeathsig_ctl(td, p, *(int *)data)); + case PROC_PDEATHSIG_STATUS: + return (pdeathsig_status(td, p, data)); case PROC_NO_NEW_PRIVS_CTL: return (no_new_privs_ctl(td, p, *(int *)data)); case PROC_NO_NEW_PRIVS_STATUS: @@ -865,34 +910,12 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) struct proc *p; const struct procctl_cmd_info *cmd_info; int error, first_error, ok; - int signum; MPASS(com > 0 && com < nitems(procctl_cmds_info)); cmd_info = &procctl_cmds_info[com]; if (idtype != P_PID && cmd_info->one_proc) return (EINVAL); - switch (com) { - case PROC_PDEATHSIG_CTL: - signum = *(int *)data; - p = td->td_proc; - if ((id != 0 && id != p->p_pid) || - (signum != 0 && !_SIG_VALID(signum))) - return (EINVAL); - PROC_LOCK(p); - p->p_pdeathsig = signum; - PROC_UNLOCK(p); - return (0); - case PROC_PDEATHSIG_STATUS: - p = td->td_proc; - if (id != 0 && id != p->p_pid) - return (EINVAL); - PROC_LOCK(p); - *(int *)data = p->p_pdeathsig; - PROC_UNLOCK(p); - return (0); - } - switch (cmd_info->lock_tree) { case SA_XLOCKED: sx_xlock(&proctree_lock); @@ -911,7 +934,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) } else { p = pfind(id); if (p == NULL) { - error = ESRCH; + error = cmd_info->esrch_is_einval ? + EINVAL : ESRCH; break; } error = p_cansee(td, p); From nobody Tue Oct 26 02:37:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F2361827F4D; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZF402Tz3Q8M; Tue, 26 Oct 2021 02:37:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2BE5B14757; Tue, 26 Oct 2021 02:37:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2b9ZA039966; Tue, 26 Oct 2021 02:37:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2b9Tu039965; Tue, 26 Oct 2021 02:37:09 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:09 GMT Message-Id: <202110260237.19Q2b9Tu039965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 38506cebc1e0 - stable/13 - kern_procctl_single(): convert to use table data List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 38506cebc1e065281918f8614417b29c5b0de599 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=38506cebc1e065281918f8614417b29c5b0de599 commit 38506cebc1e065281918f8614417b29c5b0de599 Author: Konstantin Belousov AuthorDate: 2021-10-15 19:22:18 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:26 +0000 kern_procctl_single(): convert to use table data (cherry picked from commit 68dc5b381a29aaa418064324519105a8c2a4a080) --- sys/kern/kern_procctl.c | 220 +++++++++++++++++++++++++----------------------- 1 file changed, 114 insertions(+), 106 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 1e29429aacf2..06efcf0e8c74 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -102,10 +102,11 @@ protect_setchildren(struct thread *td, struct proc *top, int flags) } static int -protect_set(struct thread *td, struct proc *p, int flags) +protect_set(struct thread *td, struct proc *p, void *data) { - int error, ret; + int error, flags, ret; + flags = *(int *)data; switch (PPROT_OP(flags)) { case PPROT_SET: case PPROT_CLEAR: @@ -131,7 +132,7 @@ protect_set(struct thread *td, struct proc *p, int flags) } static int -reap_acquire(struct thread *td, struct proc *p) +reap_acquire(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); @@ -148,7 +149,7 @@ reap_acquire(struct thread *td, struct proc *p) } static int -reap_release(struct thread *td, struct proc *p) +reap_release(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); @@ -163,11 +164,12 @@ reap_release(struct thread *td, struct proc *p) } static int -reap_status(struct thread *td, struct proc *p, - struct procctl_reaper_status *rs) +reap_status(struct thread *td, struct proc *p, void *data) { struct proc *reap, *p2, *first_p; + struct procctl_reaper_status *rs; + rs = data; sx_assert(&proctree_lock, SX_LOCKED); bzero(rs, sizeof(*rs)); if ((p->p_treeflag & P_TREE_REAPER) == 0) { @@ -198,13 +200,15 @@ reap_status(struct thread *td, struct proc *p, } static int -reap_getpids(struct thread *td, struct proc *p, struct procctl_reaper_pids *rp) +reap_getpids(struct thread *td, struct proc *p, void *data) { struct proc *reap, *p2; struct procctl_reaper_pidinfo *pi, *pip; + struct procctl_reaper_pids *rp; u_int i, n; int error; + rp = data; sx_assert(&proctree_lock, SX_LOCKED); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; @@ -276,14 +280,16 @@ reap_kill_sched(struct reap_kill_tracker_head *tracker, struct proc *p2) } static int -reap_kill(struct thread *td, struct proc *p, struct procctl_reaper_kill *rk) +reap_kill(struct thread *td, struct proc *p, void *data) { struct proc *reap, *p2; ksiginfo_t ksi; struct reap_kill_tracker_head tracker; struct reap_kill_tracker *t; + struct procctl_reaper_kill *rk; int error; + rk = data; sx_assert(&proctree_lock, SX_LOCKED); if (IN_CAPABILITY_MODE(td)) return (ECAPMODE); @@ -336,10 +342,12 @@ reap_kill(struct thread *td, struct proc *p, struct procctl_reaper_kill *rk) } static int -trace_ctl(struct thread *td, struct proc *p, int state) +trace_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; /* * Ktrace changes p_traceflag from or to zero under the @@ -376,26 +384,30 @@ trace_ctl(struct thread *td, struct proc *p, int state) } static int -trace_status(struct thread *td, struct proc *p, int *data) +trace_status(struct thread *td, struct proc *p, void *data) { + int *status; + status = data; if ((p->p_flag2 & P2_NOTRACE) != 0) { KASSERT((p->p_flag & P_TRACED) == 0, ("%d traced but tracing disabled", p->p_pid)); - *data = -1; + *status = -1; } else if ((p->p_flag & P_TRACED) != 0) { - *data = p->p_pptr->p_pid; + *status = p->p_pptr->p_pid; } else { - *data = 0; + *status = 0; } return (0); } static int -trapcap_ctl(struct thread *td, struct proc *p, int state) +trapcap_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; switch (state) { case PROC_TRAPCAP_CTL_ENABLE: @@ -411,19 +423,23 @@ trapcap_ctl(struct thread *td, struct proc *p, int state) } static int -trapcap_status(struct thread *td, struct proc *p, int *data) +trapcap_status(struct thread *td, struct proc *p, void *data) { + int *status; - *data = (p->p_flag2 & P2_TRAPCAP) != 0 ? PROC_TRAPCAP_CTL_ENABLE : + status = data; + *status = (p->p_flag2 & P2_TRAPCAP) != 0 ? PROC_TRAPCAP_CTL_ENABLE : PROC_TRAPCAP_CTL_DISABLE; return (0); } static int -no_new_privs_ctl(struct thread *td, struct proc *p, int state) +no_new_privs_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; if (state != PROC_NO_NEW_PRIVS_ENABLE) return (EINVAL); @@ -432,18 +448,21 @@ no_new_privs_ctl(struct thread *td, struct proc *p, int state) } static int -no_new_privs_status(struct thread *td, struct proc *p, int *data) +no_new_privs_status(struct thread *td, struct proc *p, void *data) { - *data = (p->p_flag2 & P2_NO_NEW_PRIVS) != 0 ? + *(int *)data = (p->p_flag2 & P2_NO_NEW_PRIVS) != 0 ? PROC_NO_NEW_PRIVS_ENABLE : PROC_NO_NEW_PRIVS_DISABLE; return (0); } static int -protmax_ctl(struct thread *td, struct proc *p, int state) +protmax_ctl(struct thread *td, struct proc *p, void *data) { + int state; + PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; switch (state) { case PROC_PROTMAX_FORCE_ENABLE: @@ -464,7 +483,7 @@ protmax_ctl(struct thread *td, struct proc *p, int state) } static int -protmax_status(struct thread *td, struct proc *p, int *data) +protmax_status(struct thread *td, struct proc *p, void *data) { int d; @@ -481,15 +500,17 @@ protmax_status(struct thread *td, struct proc *p, int *data) } if (kern_mmap_maxprot(p, PROT_READ) == PROT_READ) d |= PROC_PROTMAX_ACTIVE; - *data = d; + *(int *)data = d; return (0); } static int -aslr_ctl(struct thread *td, struct proc *p, int state) +aslr_ctl(struct thread *td, struct proc *p, void *data) { + int state; PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; switch (state) { case PROC_ASLR_FORCE_ENABLE: @@ -510,7 +531,7 @@ aslr_ctl(struct thread *td, struct proc *p, int state) } static int -aslr_status(struct thread *td, struct proc *p, int *data) +aslr_status(struct thread *td, struct proc *p, void *data) { struct vmspace *vm; int d; @@ -538,14 +559,17 @@ aslr_status(struct thread *td, struct proc *p, int *data) PROC_LOCK(p); _PRELE(p); } - *data = d; + *(int *)data = d; return (0); } static int -stackgap_ctl(struct thread *td, struct proc *p, int state) +stackgap_ctl(struct thread *td, struct proc *p, void *data) { + int state; + PROC_LOCK_ASSERT(p, MA_OWNED); + state = *(int *)data; if ((state & ~(PROC_STACKGAP_ENABLE | PROC_STACKGAP_DISABLE | PROC_STACKGAP_ENABLE_EXEC | PROC_STACKGAP_DISABLE_EXEC)) != 0) @@ -580,26 +604,31 @@ stackgap_ctl(struct thread *td, struct proc *p, int state) } static int -stackgap_status(struct thread *td, struct proc *p, int *data) +stackgap_status(struct thread *td, struct proc *p, void *data) { + int d; + PROC_LOCK_ASSERT(p, MA_OWNED); - *data = (p->p_flag2 & P2_STKGAP_DISABLE) != 0 ? PROC_STACKGAP_DISABLE : + d = (p->p_flag2 & P2_STKGAP_DISABLE) != 0 ? PROC_STACKGAP_DISABLE : PROC_STACKGAP_ENABLE; - *data |= (p->p_flag2 & P2_STKGAP_DISABLE_EXEC) != 0 ? + d |= (p->p_flag2 & P2_STKGAP_DISABLE_EXEC) != 0 ? PROC_STACKGAP_DISABLE_EXEC : PROC_STACKGAP_ENABLE_EXEC; + *(int *)data = d; return (0); } static int -wxmap_ctl(struct thread *td, struct proc *p, int state) +wxmap_ctl(struct thread *td, struct proc *p, void *data) { struct vmspace *vm; vm_map_t map; + int state; PROC_LOCK_ASSERT(p, MA_OWNED); if ((p->p_flag & P_WEXIT) != 0) return (ESRCH); + state = *(int *)data; switch (state) { case PROC_WX_MAPPINGS_PERMIT: @@ -628,7 +657,7 @@ wxmap_ctl(struct thread *td, struct proc *p, int state) } static int -wxmap_status(struct thread *td, struct proc *p, int *data) +wxmap_status(struct thread *td, struct proc *p, void *data) { struct vmspace *vm; int d; @@ -652,21 +681,24 @@ wxmap_status(struct thread *td, struct proc *p, int *data) } PROC_LOCK(p); _PRELE(p); - *data = d; + *(int *)data = d; return (0); } static int -pdeathsig_ctl(struct thread *td, struct proc *p, int data) +pdeathsig_ctl(struct thread *td, struct proc *p, void *data) { - if (p != td->td_proc || (data != 0 && !_SIG_VALID(data))) + int signum; + + signum = *(int *)data; + if (p != td->td_proc || (signum != 0 && !_SIG_VALID(signum))) return (EINVAL); - p->p_pdeathsig = data; + p->p_pdeathsig = signum; return (0); } static int -pdeathsig_status(struct thread *td, struct proc *p, int *data) +pdeathsig_status(struct thread *td, struct proc *p, void *data) { if (p != td->td_proc) return (EINVAL); @@ -678,74 +710,97 @@ struct procctl_cmd_info { int lock_tree; bool one_proc : 1; bool esrch_is_einval : 1; + int (*exec)(struct thread *, struct proc *, void *); }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = protect_set, }, [PROC_REAP_ACQUIRE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_acquire, }, [PROC_REAP_RELEASE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_release, }, [PROC_REAP_STATUS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_status, }, [PROC_REAP_GETPIDS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_getpids, }, [PROC_REAP_KILL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = reap_kill, }, [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trace_ctl, }, [PROC_TRACE_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trace_status, }, [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trapcap_ctl, }, [PROC_TRAPCAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = trapcap_status, }, [PROC_PDEATHSIG_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, }, + .esrch_is_einval = true, + .exec = pdeathsig_ctl, }, [PROC_PDEATHSIG_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, }, + .esrch_is_einval = true, + .exec = pdeathsig_status, }, [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = aslr_ctl, }, [PROC_ASLR_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = aslr_status, }, [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = protmax_ctl, }, [PROC_PROTMAX_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = protmax_status, }, [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = stackgap_ctl, }, [PROC_STACKGAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = stackgap_status, }, [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = no_new_privs_ctl, }, [PROC_NO_NEW_PRIVS_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = no_new_privs_status, }, [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = wxmap_ctl, }, [PROC_WXMAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, }, + .esrch_is_einval = false, + .exec = wxmap_status, }, }; int @@ -853,54 +908,7 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) { PROC_LOCK_ASSERT(p, MA_OWNED); - switch (com) { - case PROC_ASLR_CTL: - return (aslr_ctl(td, p, *(int *)data)); - case PROC_ASLR_STATUS: - return (aslr_status(td, p, data)); - case PROC_SPROTECT: - return (protect_set(td, p, *(int *)data)); - case PROC_PROTMAX_CTL: - return (protmax_ctl(td, p, *(int *)data)); - case PROC_PROTMAX_STATUS: - return (protmax_status(td, p, data)); - case PROC_STACKGAP_CTL: - return (stackgap_ctl(td, p, *(int *)data)); - case PROC_STACKGAP_STATUS: - return (stackgap_status(td, p, data)); - case PROC_REAP_ACQUIRE: - return (reap_acquire(td, p)); - case PROC_REAP_RELEASE: - return (reap_release(td, p)); - case PROC_REAP_STATUS: - return (reap_status(td, p, data)); - case PROC_REAP_GETPIDS: - return (reap_getpids(td, p, data)); - case PROC_REAP_KILL: - return (reap_kill(td, p, data)); - case PROC_TRACE_CTL: - return (trace_ctl(td, p, *(int *)data)); - case PROC_TRACE_STATUS: - return (trace_status(td, p, data)); - case PROC_TRAPCAP_CTL: - return (trapcap_ctl(td, p, *(int *)data)); - case PROC_TRAPCAP_STATUS: - return (trapcap_status(td, p, data)); - case PROC_PDEATHSIG_CTL: - return (pdeathsig_ctl(td, p, *(int *)data)); - case PROC_PDEATHSIG_STATUS: - return (pdeathsig_status(td, p, data)); - case PROC_NO_NEW_PRIVS_CTL: - return (no_new_privs_ctl(td, p, *(int *)data)); - case PROC_NO_NEW_PRIVS_STATUS: - return (no_new_privs_status(td, p, data)); - case PROC_WXMAP_CTL: - return (wxmap_ctl(td, p, *(int *)data)); - case PROC_WXMAP_STATUS: - return (wxmap_status(td, p, data)); - default: - return (EINVAL); - } + return (procctl_cmds_info[com].exec(td, p, data)); } int From nobody Tue Oct 26 02:37:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A7C291827F6E; Tue, 26 Oct 2021 02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZH5wFgz3Q1S; Tue, 26 Oct 2021 02:37:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 680331492D; Tue, 26 Oct 2021 02:37:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bBEG040015; Tue, 26 Oct 2021 02:37:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bBjY040014; Tue, 26 Oct 2021 02:37:11 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:11 GMT Message-Id: <202110260237.19Q2bBjY040014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 84722e8171a0 - stable/13 - sys_procctl(): zero the data buffer once, on syscall entry List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 84722e8171a0f5732eef9e817573000f93ea9bd8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=84722e8171a0f5732eef9e817573000f93ea9bd8 commit 84722e8171a0f5732eef9e817573000f93ea9bd8 Author: Konstantin Belousov AuthorDate: 2021-10-16 18:28:03 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 sys_procctl(): zero the data buffer once, on syscall entry (cherry picked from commit 32026f5983ed00e64829f8c20b09748077809729) --- sys/kern/kern_procctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 7a88ef24d987..387706a0cb1e 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -171,7 +171,6 @@ reap_status(struct thread *td, struct proc *p, void *data) rs = data; sx_assert(&proctree_lock, SX_LOCKED); - bzero(rs, sizeof(*rs)); if ((p->p_treeflag & P_TREE_REAPER) == 0) { reap = p->p_reaper; } else { @@ -850,6 +849,8 @@ sys_procctl(struct thread *td, struct procctl_args *uap) if (uap->com == 0 || uap->com >= nitems(procctl_cmds_info)) return (EINVAL); cmd_info = &procctl_cmds_info[uap->com]; + bzero(&x, sizeof(x)); + if (cmd_info->copyin_sz > 0) { error = copyin(uap->data, &x, cmd_info->copyin_sz); if (error != 0) From nobody Tue Oct 26 02:37:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0A3D71810133; Tue, 26 Oct 2021 02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZH2YN3z3Q5w; Tue, 26 Oct 2021 02:37:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 47F2F14758; Tue, 26 Oct 2021 02:37:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bAw6039991; Tue, 26 Oct 2021 02:37:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bAHH039990; Tue, 26 Oct 2021 02:37:10 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:10 GMT Message-Id: <202110260237.19Q2bAHH039990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a89f144b0da2 - stable/13 - sys_procctl(): use table data to do copyin/copyout List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a89f144b0da250badd599e507977d8ee56e03d5b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a89f144b0da250badd599e507977d8ee56e03d5b commit a89f144b0da250badd599e507977d8ee56e03d5b Author: Konstantin Belousov AuthorDate: 2021-10-15 19:56:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 sys_procctl(): use table data to do copyin/copyout (cherry picked from commit 56d5323b4d7d9ccbe1ca3e620400afd165519a12) --- sys/kern/kern_procctl.c | 210 ++++++++++++++++++++---------------------------- 1 file changed, 88 insertions(+), 122 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 06efcf0e8c74..7a88ef24d987 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -710,195 +710,161 @@ struct procctl_cmd_info { int lock_tree; bool one_proc : 1; bool esrch_is_einval : 1; + bool copyout_on_error : 1; + bool no_nonnull_data : 1; + int copyin_sz; + int copyout_sz; int (*exec)(struct thread *, struct proc *, void *); }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, - .exec = protect_set, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = protect_set, .copyout_on_error = false, }, [PROC_REAP_ACQUIRE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_acquire, }, + .esrch_is_einval = false, .no_nonnull_data = true, + .copyin_sz = 0, .copyout_sz = 0, + .exec = reap_acquire, .copyout_on_error = false, }, [PROC_REAP_RELEASE] = { .lock_tree = SA_XLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_release, }, + .esrch_is_einval = false, .no_nonnull_data = true, + .copyin_sz = 0, .copyout_sz = 0, + .exec = reap_release, .copyout_on_error = false, }, [PROC_REAP_STATUS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, + .copyout_sz = sizeof(struct procctl_reaper_status), + .exec = reap_status, .copyout_on_error = false, }, [PROC_REAP_GETPIDS] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_getpids, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(struct procctl_reaper_pids), + .copyout_sz = 0, + .exec = reap_getpids, .copyout_on_error = false, }, [PROC_REAP_KILL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = reap_kill, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(struct procctl_reaper_kill), + .copyout_sz = sizeof(struct procctl_reaper_kill), + .exec = reap_kill, .copyout_on_error = true, }, [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, - .exec = trace_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = trace_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = trace_status, .copyout_on_error = false, }, [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, - .esrch_is_einval = false, - .exec = trapcap_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = trapcap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = trapcap_status, .copyout_on_error = false, }, [PROC_PDEATHSIG_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, - .exec = pdeathsig_ctl, }, + .esrch_is_einval = true, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = pdeathsig_ctl, .copyout_on_error = false, }, [PROC_PDEATHSIG_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = true, - .exec = pdeathsig_status, }, + .esrch_is_einval = true, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = pdeathsig_status, .copyout_on_error = false, }, [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = aslr_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = aslr_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = aslr_status, .copyout_on_error = false, }, [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = protmax_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = protmax_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = protmax_status, .copyout_on_error = false, }, [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = stackgap_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = stackgap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = stackgap_status, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = no_new_privs_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = no_new_privs_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = no_new_privs_status, .copyout_on_error = false, }, [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = wxmap_ctl, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = sizeof(int), .copyout_sz = 0, + .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, - .esrch_is_einval = false, - .exec = wxmap_status, }, + .esrch_is_einval = false, .no_nonnull_data = false, + .copyin_sz = 0, .copyout_sz = sizeof(int), + .exec = wxmap_status, .copyout_on_error = false, }, }; int sys_procctl(struct thread *td, struct procctl_args *uap) { - void *data; union { struct procctl_reaper_status rs; struct procctl_reaper_pids rp; struct procctl_reaper_kill rk; + int flags; } x; - int error, error1, flags, signum; + const struct procctl_cmd_info *cmd_info; + int error, error1; if (uap->com >= PROC_PROCCTL_MD_MIN) return (cpu_procctl(td, uap->idtype, uap->id, uap->com, uap->data)); - - switch (uap->com) { - case PROC_ASLR_CTL: - case PROC_PROTMAX_CTL: - case PROC_SPROTECT: - case PROC_STACKGAP_CTL: - case PROC_TRACE_CTL: - case PROC_TRAPCAP_CTL: - case PROC_NO_NEW_PRIVS_CTL: - case PROC_WXMAP_CTL: - error = copyin(uap->data, &flags, sizeof(flags)); - if (error != 0) - return (error); - data = &flags; - break; - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: - if (uap->data != NULL) - return (EINVAL); - data = NULL; - break; - case PROC_REAP_STATUS: - data = &x.rs; - break; - case PROC_REAP_GETPIDS: - error = copyin(uap->data, &x.rp, sizeof(x.rp)); - if (error != 0) - return (error); - data = &x.rp; - break; - case PROC_REAP_KILL: - error = copyin(uap->data, &x.rk, sizeof(x.rk)); - if (error != 0) - return (error); - data = &x.rk; - break; - case PROC_ASLR_STATUS: - case PROC_PROTMAX_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_STATUS: - data = &flags; - break; - case PROC_PDEATHSIG_CTL: - error = copyin(uap->data, &signum, sizeof(signum)); + if (uap->com == 0 || uap->com >= nitems(procctl_cmds_info)) + return (EINVAL); + cmd_info = &procctl_cmds_info[uap->com]; + if (cmd_info->copyin_sz > 0) { + error = copyin(uap->data, &x, cmd_info->copyin_sz); if (error != 0) return (error); - data = &signum; - break; - case PROC_PDEATHSIG_STATUS: - data = &signum; - break; - default: + } else if (cmd_info->no_nonnull_data && uap->data != NULL) { return (EINVAL); } - error = kern_procctl(td, uap->idtype, uap->id, uap->com, data); - switch (uap->com) { - case PROC_REAP_STATUS: - if (error == 0) - error = copyout(&x.rs, uap->data, sizeof(x.rs)); - break; - case PROC_REAP_KILL: - error1 = copyout(&x.rk, uap->data, sizeof(x.rk)); + + error = kern_procctl(td, uap->idtype, uap->id, uap->com, &x); + + if (cmd_info->copyout_sz > 0 && (error == 0 || + cmd_info->copyout_on_error)) { + error1 = copyout(&x, uap->data, cmd_info->copyout_sz); if (error == 0) error = error1; - break; - case PROC_ASLR_STATUS: - case PROC_PROTMAX_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRACE_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_NO_NEW_PRIVS_STATUS: - case PROC_WXMAP_STATUS: - if (error == 0) - error = copyout(&flags, uap->data, sizeof(flags)); - break; - case PROC_PDEATHSIG_STATUS: - if (error == 0) - error = copyout(&signum, uap->data, sizeof(signum)); - break; } return (error); } From nobody Tue Oct 26 02:37:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8BE041827FE5; Tue, 26 Oct 2021 02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZJ6pzWz3Q3w; Tue, 26 Oct 2021 02:37:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 817D014759; Tue, 26 Oct 2021 02:37:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bCpn040039; Tue, 26 Oct 2021 02:37:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bCWn040038; Tue, 26 Oct 2021 02:37:12 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:12 GMT Message-Id: <202110260237.19Q2bCWn040038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c7d4bd74773e - stable/13 - procctl: make it possible to specify that some operations require debug privilege over the target List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c7d4bd74773e78a243531678052902f09f912409 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c7d4bd74773e78a243531678052902f09f912409 commit c7d4bd74773e78a243531678052902f09f912409 Author: Konstantin Belousov AuthorDate: 2021-10-15 20:02:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 procctl: make it possible to specify that some operations require debug privilege over the target (cherry picked from commit 1c4dbee5dd224c08241c0922ff577bb226171e81) --- sys/kern/kern_procctl.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 387706a0cb1e..6229d2140228 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -711,6 +711,7 @@ struct procctl_cmd_info { bool esrch_is_einval : 1; bool copyout_on_error : 1; bool no_nonnull_data : 1; + bool need_candebug : 1; int copyin_sz; int copyout_sz; int (*exec)(struct thread *, struct proc *, void *); @@ -719,114 +720,136 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protect_set, .copyout_on_error = false, }, [PROC_REAP_ACQUIRE] = { .lock_tree = SA_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_acquire, .copyout_on_error = false, }, [PROC_REAP_RELEASE] = { .lock_tree = SA_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_release, .copyout_on_error = false, }, [PROC_REAP_STATUS] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(struct procctl_reaper_status), .exec = reap_status, .copyout_on_error = false, }, [PROC_REAP_GETPIDS] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_pids), .copyout_sz = 0, .exec = reap_getpids, .copyout_on_error = false, }, [PROC_REAP_KILL] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_kill), .copyout_sz = sizeof(struct procctl_reaper_kill), .exec = reap_kill, .copyout_on_error = true, }, [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trace_status, .copyout_on_error = false, }, [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trapcap_status, .copyout_on_error = false, }, [PROC_PDEATHSIG_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = pdeathsig_ctl, .copyout_on_error = false, }, [PROC_PDEATHSIG_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = pdeathsig_status, .copyout_on_error = false, }, [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = aslr_status, .copyout_on_error = false, }, [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = protmax_status, .copyout_on_error = false, }, [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = stackgap_status, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = no_new_privs_status, .copyout_on_error = false, }, [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, + .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = wxmap_status, .copyout_on_error = false, }, }; @@ -913,7 +936,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) EINVAL : ESRCH; break; } - error = p_cansee(td, p); + error = cmd_info->need_candebug ? p_candebug(td, p) : + p_cansee(td, p); } if (error == 0) error = kern_procctl_single(td, p, com, data); @@ -936,7 +960,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) first_error = 0; LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p->p_state == PRS_NEW || p_cansee(td, p) != 0) { + if (p->p_state == PRS_NEW || (cmd_info->need_candebug ? + p_candebug(td, p) : p_cansee(td, p)) != 0) { PROC_UNLOCK(p); continue; } From nobody Tue Oct 26 02:37:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D214A18102A2; Tue, 26 Oct 2021 02:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZL3ZGZz3Q66; Tue, 26 Oct 2021 02:37:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AEEF5146D8; Tue, 26 Oct 2021 02:37:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bDBG040063; Tue, 26 Oct 2021 02:37:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bD0E040062; Tue, 26 Oct 2021 02:37:13 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:13 GMT Message-Id: <202110260237.19Q2bD0E040062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c802b970a543 - stable/13 - procctl: actually require debug privileges over target List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c802b970a5434eb622eed7176f31cdf41170cb1f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c802b970a5434eb622eed7176f31cdf41170cb1f commit c802b970a5434eb622eed7176f31cdf41170cb1f Author: Konstantin Belousov AuthorDate: 2021-10-15 20:09:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 procctl: actually require debug privileges over target (cherry picked from commit f5bb6e5a6d488740e451ad4acd82a70b95e786cd) --- lib/libc/sys/procctl.2 | 8 ++++++++ sys/kern/kern_procctl.c | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 9ceea00191e0..02979e934451 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -72,6 +72,14 @@ Control processes belonging to the process group with the ID The control request to perform is specified by the .Fa cmd argument. +.Pp +All status changing requests +.Dv *_CTL +require the caller to have the right to debug the target. +All status query requests +.DV *_STATUS +require the caller to have the right to observe the target. +.Pp The following commands are supported: .Bl -tag -width PROC_TRAPCAP_STATUS .It Dv PROC_ASLR_CTL diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 6229d2140228..c3f078f96e80 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -759,7 +759,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_TRACE_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = @@ -771,7 +771,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_TRAPCAP_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = @@ -795,7 +795,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_ASLR_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = @@ -807,7 +807,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_PROTMAX_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = @@ -819,7 +819,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_STACKGAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = @@ -831,7 +831,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_NO_NEW_PRIVS_CTL] = { .lock_tree = SA_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = @@ -843,7 +843,7 @@ static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_WXMAP_CTL] = { .lock_tree = SA_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, - .need_candebug = false, + .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = From nobody Tue Oct 26 02:37:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7E36B18102B6; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZM1wwZz3Q6F; Tue, 26 Oct 2021 02:37:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB387146D9; Tue, 26 Oct 2021 02:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bEcQ040089; Tue, 26 Oct 2021 02:37:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bEaN040088; Tue, 26 Oct 2021 02:37:14 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:14 GMT Message-Id: <202110260237.19Q2bEaN040088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 8589a3470d5e - stable/13 - kern_procctl.c: use td->td_proc instead of curproc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8589a3470d5e0d2c636fd0449473a1b546bf180e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8589a3470d5e0d2c636fd0449473a1b546bf180e commit 8589a3470d5e0d2c636fd0449473a1b546bf180e Author: Konstantin Belousov AuthorDate: 2021-10-18 21:07:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 kern_procctl.c: use td->td_proc instead of curproc (cherry picked from commit 3692877a6cf8fc374349f3d9b2cbb190fec484a0) --- sys/kern/kern_procctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index c3f078f96e80..890a2e05bb27 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -136,7 +136,7 @@ reap_acquire(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); - if (p != curproc) + if (p != td->td_proc) return (EPERM); if ((p->p_treeflag & P_TREE_REAPER) != 0) return (EBUSY); @@ -153,7 +153,7 @@ reap_release(struct thread *td, struct proc *p, void *data __unused) { sx_assert(&proctree_lock, SX_XLOCKED); - if (p != curproc) + if (p != td->td_proc) return (EPERM); if (p == initproc) return (EINVAL); From nobody Tue Oct 26 02:37:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 35C571810493; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZQ1CTdz3Q1t; Tue, 26 Oct 2021 02:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 229951475A; Tue, 26 Oct 2021 02:37:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bHvK040141; Tue, 26 Oct 2021 02:37:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bH2j040140; Tue, 26 Oct 2021 02:37:17 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:17 GMT Message-Id: <202110260237.19Q2bH2j040140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 485cc5549c3b - stable/13 - procctl: stop using SA_*LOCKED, define local enum List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 485cc5549c3b383c6158bf47ac40c8002e276666 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=485cc5549c3b383c6158bf47ac40c8002e276666 commit 485cc5549c3b383c6158bf47ac40c8002e276666 Author: Konstantin Belousov AuthorDate: 2021-10-19 21:25:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 procctl: stop using SA_*LOCKED, define local enum (cherry picked from commit c7f38a2df1f0d15346f4405407d89365f6ae3fe1) --- sys/kern/kern_procctl.c | 62 ++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 00c68359f375..f90c0e146e2b 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -705,6 +705,12 @@ pdeathsig_status(struct thread *td, struct proc *p, void *data) return (0); } +enum { + PCTL_SLOCKED, + PCTL_XLOCKED, + PCTL_UNLOCKED, +}; + struct procctl_cmd_info { int lock_tree; bool one_proc : 1; @@ -718,136 +724,136 @@ struct procctl_cmd_info { }; static const struct procctl_cmd_info procctl_cmds_info[] = { [PROC_SPROTECT] = - { .lock_tree = SA_SLOCKED, .one_proc = false, + { .lock_tree = PCTL_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protect_set, .copyout_on_error = false, }, [PROC_REAP_ACQUIRE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, + { .lock_tree = PCTL_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_acquire, .copyout_on_error = false, }, [PROC_REAP_RELEASE] = - { .lock_tree = SA_XLOCKED, .one_proc = true, + { .lock_tree = PCTL_XLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = true, .need_candebug = false, .copyin_sz = 0, .copyout_sz = 0, .exec = reap_release, .copyout_on_error = false, }, [PROC_REAP_STATUS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(struct procctl_reaper_status), .exec = reap_status, .copyout_on_error = false, }, [PROC_REAP_GETPIDS] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_pids), .copyout_sz = 0, .exec = reap_getpids, .copyout_on_error = false, }, [PROC_REAP_KILL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(struct procctl_reaper_kill), .copyout_sz = sizeof(struct procctl_reaper_kill), .exec = reap_kill, .copyout_on_error = true, }, [PROC_TRACE_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, + { .lock_tree = PCTL_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trace_ctl, .copyout_on_error = false, }, [PROC_TRACE_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trace_status, .copyout_on_error = false, }, [PROC_TRAPCAP_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = false, + { .lock_tree = PCTL_SLOCKED, .one_proc = false, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = trapcap_ctl, .copyout_on_error = false, }, [PROC_TRAPCAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = trapcap_status, .copyout_on_error = false, }, [PROC_PDEATHSIG_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = pdeathsig_ctl, .copyout_on_error = false, }, [PROC_PDEATHSIG_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = true, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = pdeathsig_status, .copyout_on_error = false, }, [PROC_ASLR_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = aslr_ctl, .copyout_on_error = false, }, [PROC_ASLR_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = aslr_status, .copyout_on_error = false, }, [PROC_PROTMAX_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = protmax_ctl, .copyout_on_error = false, }, [PROC_PROTMAX_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = protmax_status, .copyout_on_error = false, }, [PROC_STACKGAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = stackgap_ctl, .copyout_on_error = false, }, [PROC_STACKGAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = stackgap_status, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_CTL] = - { .lock_tree = SA_SLOCKED, .one_proc = true, + { .lock_tree = PCTL_SLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = no_new_privs_ctl, .copyout_on_error = false, }, [PROC_NO_NEW_PRIVS_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), .exec = no_new_privs_status, .copyout_on_error = false, }, [PROC_WXMAP_CTL] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = true, .copyin_sz = sizeof(int), .copyout_sz = 0, .exec = wxmap_ctl, .copyout_on_error = false, }, [PROC_WXMAP_STATUS] = - { .lock_tree = SA_UNLOCKED, .one_proc = true, + { .lock_tree = PCTL_UNLOCKED, .one_proc = true, .esrch_is_einval = false, .no_nonnull_data = false, .need_candebug = false, .copyin_sz = 0, .copyout_sz = sizeof(int), @@ -915,12 +921,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) return (EINVAL); switch (cmd_info->lock_tree) { - case SA_XLOCKED: + case PCTL_XLOCKED: sx_xlock(&proctree_lock); break; - case SA_SLOCKED: + case PCTL_SLOCKED: sx_slock(&proctree_lock); break; + default: + break; } switch (idtype) { @@ -991,12 +999,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) } switch (cmd_info->lock_tree) { - case SA_XLOCKED: + case PCTL_XLOCKED: sx_xunlock(&proctree_lock); break; - case SA_SLOCKED: + case PCTL_SLOCKED: sx_sunlock(&proctree_lock); break; + default: + break; } return (error); } From nobody Tue Oct 26 02:37:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8EFC518102D7; Tue, 26 Oct 2021 02:37: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdbZP0bGbz3QBj; Tue, 26 Oct 2021 02:37:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0305814A51; Tue, 26 Oct 2021 02:37:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q2bFFC040117; Tue, 26 Oct 2021 02:37:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q2bFbW040116; Tue, 26 Oct 2021 02:37:15 GMT (envelope-from git) Date: Tue, 26 Oct 2021 02:37:15 GMT Message-Id: <202110260237.19Q2bFbW040116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 59447a02f1a9 - stable/13 - kern_procctl: skip zombies for process group operations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59447a02f1a9083f37d8e1e0d75bbb76ccb669d6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=59447a02f1a9083f37d8e1e0d75bbb76ccb669d6 commit 59447a02f1a9083f37d8e1e0d75bbb76ccb669d6 Author: Konstantin Belousov AuthorDate: 2021-10-18 21:29:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 02:26:27 +0000 kern_procctl: skip zombies for process group operations (cherry picked from commit 49db81aa053beb131ba9dbf5519a5f0eacf28265) --- sys/kern/kern_procctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 890a2e05bb27..00c68359f375 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -960,8 +960,10 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) first_error = 0; LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); - if (p->p_state == PRS_NEW || (cmd_info->need_candebug ? - p_candebug(td, p) : p_cansee(td, p)) != 0) { + if (p->p_state == PRS_NEW || + p->p_state == PRS_ZOMBIE || + (cmd_info->need_candebug ? p_candebug(td, p) : + p_cansee(td, p)) != 0) { PROC_UNLOCK(p); continue; } From nobody Tue Oct 26 07:50:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E7F6118251B2; Tue, 26 Oct 2021 07:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdkX26H7Mz4X8H; Tue, 26 Oct 2021 07:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B80FB18E7A; Tue, 26 Oct 2021 07:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q7ogBI060798; Tue, 26 Oct 2021 07:50:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q7ogA8060797; Tue, 26 Oct 2021 07:50:42 GMT (envelope-from git) Date: Tue, 26 Oct 2021 07:50:42 GMT Message-Id: <202110260750.19Q7ogA8060797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 3a504205e430 - releng/12.3 - cmp: initialize limit to avoid stack garbage limits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 3a504205e4301be9378d17282a571f311272c6fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3a504205e4301be9378d17282a571f311272c6fb commit 3a504205e4301be9378d17282a571f311272c6fb Author: Kyle Evans AuthorDate: 2021-10-21 16:30:55 +0000 Commit: Kyle Evans CommitDate: 2021-10-26 07:47:17 +0000 cmp: initialize limit to avoid stack garbage limits Approved by: re (gjb) Pointy hat: kevans Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]") Sponsored by: Klara, Inc. (cherry picked from commit f1f7f31366e5830f4f5b96c6394a0b91475744f4) (cherry picked from commit aba2dc46dfa51cf9e1b1987ca4e91f703ae7e368) --- usr.bin/cmp/cmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 98ae96c73375..83ea7ae7eee0 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -105,7 +105,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; - skip1 = skip2 = 0; + limit = skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { From nobody Tue Oct 26 09:59:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7976218360BE; Tue, 26 Oct 2021 09:59: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdnNq2v7Mz3MMx; Tue, 26 Oct 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 452451AAAE; Tue, 26 Oct 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19Q9xd9g026017; Tue, 26 Oct 2021 09:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19Q9xd0Y026016; Tue, 26 Oct 2021 09:59:39 GMT (envelope-from git) Date: Tue, 26 Oct 2021 09:59:39 GMT Message-Id: <202110260959.19Q9xd0Y026016@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: cbc3ecb7ef08 - main - stress2: Added two syzkaller reproducers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbc3ecb7ef08a2978d42b384a49d3456b0ba0a32 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=cbc3ecb7ef08a2978d42b384a49d3456b0ba0a32 commit cbc3ecb7ef08a2978d42b384a49d3456b0ba0a32 Author: Peter Holm AuthorDate: 2021-10-26 09:59:04 +0000 Commit: Peter Holm CommitDate: 2021-10-26 09:59:04 +0000 stress2: Added two syzkaller reproducers --- tools/test/stress2/misc/all.exclude | 2 + tools/test/stress2/misc/syzkaller46.sh | 118 ++++++++++ tools/test/stress2/misc/syzkaller47.sh | 404 +++++++++++++++++++++++++++++++++ 3 files changed, 524 insertions(+) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 7ee33f258f87..dfd936abde70 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -70,6 +70,8 @@ syzkaller40.sh WiP 20210607 syzkaller41.sh WiP 20210607 syzkaller42.sh WiP 20210613 syzkaller43.sh WiP 20210906 +syzkaller46.sh WiP 20211026 +syzkaller47.sh WiP 20211026 truss3.sh WiP 20200915 unionfs.sh insmntque: non-locked vp: xx is not exclusive locked... 20130909 unionfs2.sh insmntque: mp-safe fs and non-locked vp is not ... 20111219 diff --git a/tools/test/stress2/misc/syzkaller46.sh b/tools/test/stress2/misc/syzkaller46.sh new file mode 100755 index 000000000000..db1c9c27b221 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller46.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# Fatal trap 12: page fault while in kernel mode +# cpuid = 4; apic id = 04 +# fault virtual address = 0x28 +# fault code = supervisor read data, page not present +# instruction pointer = 0x20:0xffffffff81549dea +# stack pointer = 0x28:0xfffffe01d8689480 +# frame pointer = 0x28:0xfffffe01d8689490 +# code segment = base 0x0, limit 0xfffff, type 0x1b +# = DPL 0, pres 1, long 1, def32 0, gran 1 +# processor eflags = interrupt enabled, resume, IOPL = 0 +# current process = 3050 (syzkaller46) +# trap number = 12 +# panic: page fault +# cpuid = 4 +# time = 1635158869 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0xa5/frame 0xfffffe01d8688cb0 +# kdb_backtrace() at kdb_backtrace+0xc9/frame 0xfffffe01d8688e10 +# vpanic() at vpanic+0x248/frame 0xfffffe01d8688ef0 +# panic() at panic+0xb5/frame 0xfffffe01d8688fb0 +# trap_fatal() at trap_fatal+0x52e/frame 0xfffffe01d86890b0 +# trap_pfault() at trap_pfault+0x132/frame 0xfffffe01d86891d0 +# trap() at trap+0x53f/frame 0xfffffe01d86893b0 +# calltrap() at calltrap+0x8/frame 0xfffffe01d86893b0 +# --- trap 0xc, rip = 0xffffffff81549dea, rsp = 0xfffffe01d8689480, rbp = 0xfffffe01d8689490 --- +# filt_bpfwrite() filt_bpfwrite+0x4a/frame 0xfffffe01d8689490 +# kqueue_register() at kqueue_register+0xea3/frame 0xfffffe01d86895d0 +# kqueue_kevent() at kqueue_kevent+0x26a/frame 0xfffffe01d86899c0 +# kern_kevent_fp() at kern_kevent_fp+0xd2/frame 0xfffffe01d8689a10 +# kern_kevent() at kern_kevent+0x138/frame 0xfffffe01d8689b10 +# kern_kevent_generic() at kern_kevent_gene6/frame 0xfffffesys_kevent() at sys_kevent+0x1e1/frame 0xfffffe01d8689d30 +# amd64_syscall() at amd64_syscall+0x31e/frame 0xfffffe01d8689f30 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01d8689f30 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003adafa, rsp = 0x7fffffffe648, rbp = 0x7fffffffe670 --- +# KDB: enter: panic +# [ thread pid 3050 tid 100263 ] +# Stopped at kdb_enter+0x37: movq $0,0x2638c4e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n250242-eab5358b9080-dirty: Mon Oct 25 11:32:45 CEST 2021 +# pho@mercat1.netperf.freebsd.org +# db> + + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller46.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[1] = {0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + memcpy((void*)0x20000040, "/dev/bpf\000", 9); + syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000040ul, 0ul, 0ul); + res = syscall(SYS_kqueue); + if (res != -1) + r[0] = res; + *(uint64_t*)0x20000480 = 0x284; + *(uint16_t*)0x20000488 = 0xfff8; + *(uint16_t*)0x2000048a = 0x10; + *(uint32_t*)0x2000048c = 1; + *(uint64_t*)0x20000490 = 0x401; + *(uint64_t*)0x20000498 = 5; + *(uint64_t*)0x200004a0 = 5; + *(uint64_t*)0x200004a8 = 0x24000000; + *(uint64_t*)0x200004b0 = 0x100000000; + *(uint64_t*)0x200004b8 = 0x3f; + *(uint64_t*)0x200004c0 = 3; + *(uint16_t*)0x200004c8 = 0xfffe; + *(uint16_t*)0x200004ca = 1; + *(uint32_t*)0x200004cc = 1; + *(uint64_t*)0x200004d0 = 1; + *(uint64_t*)0x200004d8 = 3; + *(uint64_t*)0x200004e0 = 9; + *(uint64_t*)0x200004e8 = 0x3ff; + *(uint64_t*)0x200004f0 = 0x100000001; + *(uint64_t*)0x200004f8 = 3; + *(uint64_t*)0x20000500 = 5; + *(uint16_t*)0x20000508 = 0xfffe; + *(uint16_t*)0x2000050a = 0x42; + *(uint32_t*)0x2000050c = 2; + *(uint64_t*)0x20000510 = 5; + *(uint64_t*)0x20000518 = 0x7f; + *(uint64_t*)0x20000520 = 9; + *(uint64_t*)0x20000528 = 0x600000000; + *(uint64_t*)0x20000530 = 0x1f; + *(uint64_t*)0x20000538 = 7; + syscall(SYS_kevent, r[0], 0x20000480ul, 3ul, 0x200001c0ul, 0xaul, 0ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller46 -Wall -Wextra -O0 /tmp/syzkaller46.c -lpthread || exit 1 + +(cd /tmp; ./syzkaller46) + +rm -rf /tmp/syzkaller46 /tmp/syzkaller46.c /tmp/syzkaller.* +exit 0 diff --git a/tools/test/stress2/misc/syzkaller47.sh b/tools/test/stress2/misc/syzkaller47.sh new file mode 100755 index 000000000000..76561282a86b --- /dev/null +++ b/tools/test/stress2/misc/syzkaller47.sh @@ -0,0 +1,404 @@ +#!/bin/sh + +# panic: ASan: Invalid access, 32-byte read at 0xfffffe01f76145a0, UseAfterScope(f8) +# cpuid = 3 +# time = 1635158022 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0xa5/frame 0xfffffe01f7614170 +# kdb_backtrace() at kdb_backtrace+0xc9/frame 0xfffffe01f76142d0 +# vpanic() at vpanic+0x248/frame 0xfffffe01f76143b0 +# panic() at panic+0xb5/frame 0xfffffe01f7614480 +# __asan_storeN() at __asan_storeN/frame 0xfffffe01f7614550 +# smp_masked_invlpg_range() at smp_masked_invlpg_range+0xb2/frame 0xfffffe01f7614630 +# pmap_invalidate_range() at pmap_invalidate_range+0x22b/frame 0xfffffe01f7614730 +# vm_thread_stack_create() at vm_thread_stack_create+0xf5/frame 0xfffffe01f7614910 +# kstack_import() at kstack_import+0xcache_alloc() at cache_alloc+0x556/frame 0xfffffe01f7614a10 +# cache_alloc_retry() at cache_alloc_retry+0x30/frame 0xfffffe01f7614a80 +# vm_thread_new() at vm_thread_new+0x61/frame 0xfffffe01f7614ab0 +# thread_alloc() at thread_alloc+0x5f/frame 0xfffffe01f7614af0 +# thread_create() at thread_create+0x1b3/frame 0xfffffe01f7614bf0 +# sys_thr_new() at sys_thr_new+0x15a/framd30 +# amd64_syscall() at amd64_syscall+0x31e/frame 0xfffffe01f7614f30 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01f7614f30 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003afafa, rsp = 0x7fffdfffdf58, rbp = 0x7fffdfffdf70 --- +# KDB: enter: panic +# [ thread pid 69407 tid 100937 ] +# Stopped at kdb_enter+0x37: movq $0,0x2638c4e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n250242-eab5358b9080-dirty: Mon Oct 25 11:32:45 CEST 2021 +# pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO-KASAN +# db> + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ "`sysctl -in kern.features.kasan`" != "1" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller47.c < + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static __thread int skip_segv; +static __thread jmp_buf segv_env; + +static void segv_handler(int sig, siginfo_t* info, void* ctx __unused) +{ + uintptr_t addr = (uintptr_t)info->si_addr; + const uintptr_t prog_start = 1 << 20; + const uintptr_t prog_end = 100 << 20; + int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; + int valid = addr < prog_start || addr > prog_end; + if (sig == SIGBUS) + valid = 1; + if (skip && valid) { + _longjmp(segv_env, 1); + } + exit(sig); +} + +static void install_segv_handler(void) +{ + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_sigaction = segv_handler; + sa.sa_flags = SA_NODEFER | SA_SIGINFO; + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); +} + +#define NONFAILING(...) \ + ({ \ + int ok = 1; \ + __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ + if (_setjmp(segv_env) == 0) { \ + __VA_ARGS__; \ + } else \ + ok = 0; \ + __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ + ok; \ + }) + +static void kill_and_wait(int pid, int* status) +{ + kill(pid, SIGKILL); + while (waitpid(-1, status, 0) != pid) { + } +} + +static void sleep_ms(uint64_t ms) +{ + usleep(ms * 1000); +} + +static uint64_t current_time_ms(void) +{ + struct timespec ts; + if (clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(1); + return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; +} + +static void use_temporary_dir(void) +{ + char tmpdir_template[] = "./syzkaller.XXXXXX"; + char* tmpdir = mkdtemp(tmpdir_template); + if (!tmpdir) + exit(1); + if (chmod(tmpdir, 0777)) + exit(1); + if (chdir(tmpdir)) + exit(1); +} + +static void __attribute__((noinline)) remove_dir(const char* dir) +{ + DIR* dp = opendir(dir); + if (dp == NULL) { + if (errno == EACCES) { + if (rmdir(dir)) + exit(1); + return; + } + exit(1); + } + struct dirent* ep = 0; + while ((ep = readdir(dp))) { + if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) + continue; + char filename[FILENAME_MAX]; + snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); + struct stat st; + if (lstat(filename, &st)) + exit(1); + if (S_ISDIR(st.st_mode)) { + remove_dir(filename); + continue; + } + if (unlink(filename)) + exit(1); + } + closedir(dp); + if (rmdir(dir)) + exit(1); +} + +static void thread_start(void* (*fn)(void*), void* arg) +{ + pthread_t th; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 128 << 10); + int i = 0; + for (; i < 100; i++) { + if (pthread_create(&th, &attr, fn, arg) == 0) { + pthread_attr_destroy(&attr); + return; + } + if (errno == EAGAIN) { + usleep(50); + continue; + } + break; + } + exit(1); +} + +typedef struct { + pthread_mutex_t mu; + pthread_cond_t cv; + int state; +} event_t; + +static void event_init(event_t* ev) +{ + if (pthread_mutex_init(&ev->mu, 0)) + exit(1); + if (pthread_cond_init(&ev->cv, 0)) + exit(1); + ev->state = 0; +} + +static void event_reset(event_t* ev) +{ + ev->state = 0; +} + +static void event_set(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + if (ev->state) + exit(1); + ev->state = 1; + pthread_mutex_unlock(&ev->mu); + pthread_cond_broadcast(&ev->cv); +} + +static void event_wait(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + while (!ev->state) + pthread_cond_wait(&ev->cv, &ev->mu); + pthread_mutex_unlock(&ev->mu); +} + +static int event_isset(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +static int event_timedwait(event_t* ev, uint64_t timeout) +{ + uint64_t start = current_time_ms(); + uint64_t now = start; + pthread_mutex_lock(&ev->mu); + for (;;) { + if (ev->state) + break; + uint64_t remain = timeout - (now - start); + struct timespec ts; + ts.tv_sec = remain / 1000; + ts.tv_nsec = (remain % 1000) * 1000 * 1000; + pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); + now = current_time_ms(); + if (now - start > timeout) + break; + } + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +static void sandbox_common() +{ + struct rlimit rlim; + rlim.rlim_cur = rlim.rlim_max = 128 << 20; + setrlimit(RLIMIT_AS, &rlim); + rlim.rlim_cur = rlim.rlim_max = 8 << 20; + setrlimit(RLIMIT_MEMLOCK, &rlim); + rlim.rlim_cur = rlim.rlim_max = 1 << 20; + setrlimit(RLIMIT_FSIZE, &rlim); + rlim.rlim_cur = rlim.rlim_max = 1 << 20; + setrlimit(RLIMIT_STACK, &rlim); + rlim.rlim_cur = rlim.rlim_max = 0; + setrlimit(RLIMIT_CORE, &rlim); + rlim.rlim_cur = rlim.rlim_max = 256; + setrlimit(RLIMIT_NOFILE, &rlim); +} + +static void loop(); + +static int do_sandbox_none(void) +{ + sandbox_common(); + loop(); + return 0; +} + +struct thread_t { + int created, call; + event_t ready, done; +}; + +static struct thread_t threads[16]; +static void execute_call(int call); +static int running; + +static void* thr(void* arg) +{ + struct thread_t* th = (struct thread_t*)arg; + for (;;) { + event_wait(&th->ready); + event_reset(&th->ready); + execute_call(th->call); + __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); + event_set(&th->done); + } + return 0; +} + +static void execute_one(void) +{ + int i, call, thread; + int collide = 0; +again: + for (call = 0; call < 2; call++) { + for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); + thread++) { + struct thread_t* th = &threads[thread]; + if (!th->created) { + th->created = 1; + event_init(&th->ready); + event_init(&th->done); + event_set(&th->done); + thread_start(thr, th); + } + if (!event_isset(&th->done)) + continue; + event_reset(&th->done); + th->call = call; + __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); + event_set(&th->ready); + if (collide && (call % 2) == 0) + break; + event_timedwait(&th->done, 50); + break; + } + } + for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) + sleep_ms(1); + if (!collide) { + collide = 1; + goto again; + } +} + +static void execute_one(void); + +#define WAIT_FLAGS 0 + +static void loop(void) +{ + int iter = 0; + for (;; iter++) { + char cwdbuf[32]; + sprintf(cwdbuf, "./%d", iter); + if (mkdir(cwdbuf, 0777)) + exit(1); + int pid = fork(); + if (pid < 0) + exit(1); + if (pid == 0) { + if (chdir(cwdbuf)) + exit(1); + execute_one(); + exit(0); + } + int status = 0; + uint64_t start = current_time_ms(); + for (;;) { + if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) + break; + sleep_ms(1); + if (current_time_ms() - start < 5000) + continue; + kill_and_wait(pid, &status); + break; + } + remove_dir(cwdbuf); + } +} + +void execute_call(int call) +{ + switch (call) { + case 0: + syscall(SYS_rfork, 0x4030ul); + break; + case 1: + syscall(SYS_thr_new, 0ul, 0ul); + break; + } +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + install_segv_handler(); + use_temporary_dir(); + do_sandbox_none(); + return 0; +} +EOF +mycc -o /tmp/syzkaller47 -Wall -Wextra -O0 /tmp/syzkaller47.c -lpthread || exit 1 + +(cd /tmp; timeout 2m ./syzkaller47) + +rm -rf /tmp/syzkaller47 /tmp/syzkaller47.c /tmp/syzkaller.* +exit 0 From nobody Tue Oct 26 10:05:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 102751811CBE; Tue, 26 Oct 2021 10:05:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdnWv6xHWz3QFv; Tue, 26 Oct 2021 10:05:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C92911AC6C; Tue, 26 Oct 2021 10:05:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QA5lrO039737; Tue, 26 Oct 2021 10:05:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QA5lTO039736; Tue, 26 Oct 2021 10:05:47 GMT (envelope-from git) Date: Tue, 26 Oct 2021 10:05:47 GMT Message-Id: <202110261005.19QA5lTO039736@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: fcb99f1e5976 - stable/13 - Fix clang's internal assembler adding unwanted prefix to VIA xstore List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fcb99f1e5976599dda3d25082a5f27bd2611a8da Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=fcb99f1e5976599dda3d25082a5f27bd2611a8da commit fcb99f1e5976599dda3d25082a5f27bd2611a8da Author: Dimitry Andric AuthorDate: 2021-10-23 18:19:26 +0000 Commit: Dimitry Andric CommitDate: 2021-10-26 10:03:22 +0000 Fix clang's internal assembler adding unwanted prefix to VIA xstore Merge commit 2d8c18fbbdd1 from llvm git (by Jessica Clarke): [X86] Don't add implicit REP prefix to VIA PadLock xstore Commit 8fa3e8fa1492 added an implicit REP prefix to all VIA PadLock instructions, but GNU as doesn't add one to xstore, only all the others. This resulted in a kernel panic regression in FreeBSD upon updating to LLVM 11 (https://bugs.freebsd.org/259218) which includes the commit in question. This partially reverts that commit. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D112355 (cherry picked from commit 4b9725184e315596aa401cecb230033c6d6d5f29) --- contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td index eb8740896e5d..89b6dbdab5dc 100644 --- a/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td +++ b/contrib/llvm-project/llvm/lib/Target/X86/X86InstrSystem.td @@ -585,7 +585,7 @@ def XRSTORS64 : RI<0xC7, MRM3m, (outs), (ins opaquemem:$dst), //===----------------------------------------------------------------------===// // VIA PadLock crypto instructions let Defs = [RAX, RDI], Uses = [RDX, RDI], SchedRW = [WriteSystem] in - def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB, REP; + def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB; def : InstAlias<"xstorerng", (XSTORE)>; From nobody Tue Oct 26 12:35:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 20388182BBEC; Tue, 26 Oct 2021 12:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hdrrx6hhwz4m4c; Tue, 26 Oct 2021 12:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C5DB61CD5D; Tue, 26 Oct 2021 12:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QCZjA8038801; Tue, 26 Oct 2021 12:35:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QCZje7038800; Tue, 26 Oct 2021 12:35:45 GMT (envelope-from git) Date: Tue, 26 Oct 2021 12:35:45 GMT Message-Id: <202110261235.19QCZje7038800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 1833cf137365 - main - Mana: move mana polling from EQ to CQ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1833cf1373655de0446d3c5504aecbff99e2b6cf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=1833cf1373655de0446d3c5504aecbff99e2b6cf commit 1833cf1373655de0446d3c5504aecbff99e2b6cf Author: Wei Hu AuthorDate: 2021-10-26 12:25:22 +0000 Commit: Wei Hu CommitDate: 2021-10-26 12:25:22 +0000 Mana: move mana polling from EQ to CQ -Each CQ start task queue to poll when completion happens. This means every rx and tx queue has its own cleanup task thread to poll the completion. - Arm EQ everytime no matter it is mana or hwc. CQ arming depends on the budget. - Fix a warning in mana_poll_tx_cq() when cqe_read is 0. - Move cqe_poll from EQ to CQ struct. - Support EQ sharing up to 8 vPorts. - Ease linkdown message from mana_info to mana_dbg. Tested by: whu MFC after: 2 weeks Sponsored by: Microsoft --- sys/dev/mana/gdma.h | 16 +-- sys/dev/mana/gdma_main.c | 107 +------------------- sys/dev/mana/hw_channel.c | 2 +- sys/dev/mana/mana.h | 29 ++++-- sys/dev/mana/mana_en.c | 253 ++++++++++++++++++++++++++++++---------------- 5 files changed, 193 insertions(+), 214 deletions(-) diff --git a/sys/dev/mana/gdma.h b/sys/dev/mana/gdma.h index 097b2b65e545..8b225800ccdb 100644 --- a/sys/dev/mana/gdma.h +++ b/sys/dev/mana/gdma.h @@ -291,8 +291,6 @@ struct gdma_event { struct gdma_queue; -#define CQE_POLLING_BUFFER 512 - typedef void gdma_eq_callback(void *context, struct gdma_queue *q, struct gdma_event *e); @@ -339,14 +337,6 @@ struct gdma_queue { unsigned int msix_index; uint32_t log2_throttle_limit; - - struct task cleanup_task; - struct taskqueue *cleanup_tq; - int cpu; - bool do_not_ring_db; - - int work_done; - int budget; } eq; struct { @@ -371,9 +361,6 @@ struct gdma_queue_spec { void *context; unsigned long log2_throttle_limit; - - /* Only used by the MANA device. */ - struct ifnet *ndev; } eq; struct { @@ -388,7 +375,6 @@ struct gdma_queue_spec { struct mana_eq { struct gdma_queue *eq; - struct gdma_comp cqe_poll[CQE_POLLING_BUFFER]; }; struct gdma_irq_context { @@ -473,7 +459,7 @@ void mana_gd_destroy_queue(struct gdma_context *gc, struct gdma_queue *queue); int mana_gd_poll_cq(struct gdma_queue *cq, struct gdma_comp *comp, int num_cqe); -void mana_gd_arm_cq(struct gdma_queue *cq); +void mana_gd_ring_cq(struct gdma_queue *cq, uint8_t arm_bit); struct gdma_wqe { uint32_t reserved :24; diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c index 910992ce17a4..211e47368cc5 100644 --- a/sys/dev/mana/gdma_main.c +++ b/sys/dev/mana/gdma_main.c @@ -422,7 +422,7 @@ mana_gd_wq_ring_doorbell(struct gdma_context *gc, struct gdma_queue *queue) } void -mana_gd_arm_cq(struct gdma_queue *cq) +mana_gd_ring_cq(struct gdma_queue *cq, uint8_t arm_bit) { struct gdma_context *gc = cq->gdma_dev->gdma_context; @@ -431,7 +431,7 @@ mana_gd_arm_cq(struct gdma_queue *cq) uint32_t head = cq->head % (num_cqe << GDMA_CQE_OWNER_BITS); mana_gd_ring_doorbell(gc, cq->gdma_dev->doorbell, cq->type, cq->id, - head, SET_ARM_BIT); + head, arm_bit); } static void @@ -508,7 +508,6 @@ mana_gd_process_eq_events(void *arg) struct gdma_context *gc; uint32_t head, num_eqe; struct gdma_eqe *eqe; - unsigned int arm_bit; int i, j; gc = eq->gdma_dev->gdma_context; @@ -565,66 +564,17 @@ mana_gd_process_eq_events(void *arg) bus_dmamap_sync(eq->mem_info.dma_tag, eq->mem_info.dma_map, BUS_DMASYNC_PREREAD); - /* Always rearm the EQ for HWC. */ - if (mana_gd_is_hwc(eq->gdma_dev)) { - arm_bit = SET_ARM_BIT; - } else if (eq->eq.work_done < eq->eq.budget && - eq->eq.do_not_ring_db == false) { - arm_bit = SET_ARM_BIT; - } else { - arm_bit = 0; - } - head = eq->head % (num_eqe << GDMA_EQE_OWNER_BITS); mana_gd_ring_doorbell(gc, eq->gdma_dev->doorbell, eq->type, eq->id, - head, arm_bit); -} - -#define MANA_POLL_BUDGET 8 -#define MANA_RX_BUDGET 256 - -static void -mana_poll(void *arg, int pending) -{ - struct gdma_queue *eq = arg; - int i; - - eq->eq.work_done = 0; - eq->eq.budget = MANA_RX_BUDGET; - - for (i = 0; i < MANA_POLL_BUDGET; i++) { - /* - * If this is the last loop, set the budget big enough - * so it will arm the EQ any way. - */ - if (i == (MANA_POLL_BUDGET - 1)) - eq->eq.budget = CQE_POLLING_BUFFER + 1; - - mana_gd_process_eq_events(eq); - - if (eq->eq.work_done < eq->eq.budget) - break; - - eq->eq.work_done = 0; - } -} - -static void -mana_gd_schedule_task(void *arg) -{ - struct gdma_queue *eq = arg; - - taskqueue_enqueue(eq->eq.cleanup_tq, &eq->eq.cleanup_task); + head, SET_ARM_BIT); } static int mana_gd_register_irq(struct gdma_queue *queue, const struct gdma_queue_spec *spec) { - static int mana_last_bind_cpu = -1; struct gdma_dev *gd = queue->gdma_dev; - bool is_mana = mana_gd_is_mana(gd); struct gdma_irq_context *gic; struct gdma_context *gc; struct gdma_resource *r; @@ -659,39 +609,6 @@ mana_gd_register_irq(struct gdma_queue *queue, gic = &gc->irq_contexts[msi_index]; - if (is_mana) { - struct mana_port_context *apc = if_getsoftc(spec->eq.ndev); - queue->eq.do_not_ring_db = false; - - NET_TASK_INIT(&queue->eq.cleanup_task, 0, mana_poll, queue); - queue->eq.cleanup_tq = - taskqueue_create_fast("mana eq cleanup", - M_WAITOK, taskqueue_thread_enqueue, - &queue->eq.cleanup_tq); - - if (mana_last_bind_cpu < 0) - mana_last_bind_cpu = CPU_FIRST(); - queue->eq.cpu = mana_last_bind_cpu; - mana_last_bind_cpu = CPU_NEXT(mana_last_bind_cpu); - - /* XXX Name is not optimal. However we have to start - * the task here. Otherwise, test eq will have no - * handler. - */ - if (apc->bind_cleanup_thread_cpu) { - cpuset_t cpu_mask; - CPU_SETOF(queue->eq.cpu, &cpu_mask); - taskqueue_start_threads_cpuset(&queue->eq.cleanup_tq, - 1, PI_NET, &cpu_mask, - "mana eq poll msix %u on cpu %d", - msi_index, queue->eq.cpu); - } else { - - taskqueue_start_threads(&queue->eq.cleanup_tq, 1, - PI_NET, "mana eq poll on msix %u", msi_index); - } - } - if (unlikely(gic->handler || gic->arg)) { device_printf(gc->dev, "interrupt handler or arg already assigned, " @@ -700,10 +617,7 @@ mana_gd_register_irq(struct gdma_queue *queue, gic->arg = queue; - if (is_mana) - gic->handler = mana_gd_schedule_task; - else - gic->handler = mana_gd_process_eq_events; + gic->handler = mana_gd_process_eq_events; mana_dbg(NULL, "registered msix index %d vector %d irq %ju\n", msi_index, gic->msix_e.vector, rman_get_start(gic->res)); @@ -810,15 +724,6 @@ mana_gd_destroy_eq(struct gdma_context *gc, bool flush_evenets, mana_gd_deregiser_irq(queue); - if (mana_gd_is_mana(queue->gdma_dev)) { - while (taskqueue_cancel(queue->eq.cleanup_tq, - &queue->eq.cleanup_task, NULL)) - taskqueue_drain(queue->eq.cleanup_tq, - &queue->eq.cleanup_task); - - taskqueue_free(queue->eq.cleanup_tq); - } - if (queue->eq.disable_needed) mana_gd_disable_queue(queue); } @@ -1602,10 +1507,8 @@ mana_gd_setup_irqs(device_t dev) if (max_queues_per_port > MANA_MAX_NUM_QUEUES) max_queues_per_port = MANA_MAX_NUM_QUEUES; - max_irqs = max_queues_per_port * MAX_PORTS_IN_MANA_DEV; - /* Need 1 interrupt for the Hardware communication Channel (HWC) */ - max_irqs++; + max_irqs = max_queues_per_port + 1; nvec = max_irqs; rc = pci_alloc_msix(dev, &nvec); diff --git a/sys/dev/mana/hw_channel.c b/sys/dev/mana/hw_channel.c index 1949f1d2e049..c24e62970f69 100644 --- a/sys/dev/mana/hw_channel.c +++ b/sys/dev/mana/hw_channel.c @@ -377,7 +377,7 @@ mana_hwc_comp_event(void *ctx, struct gdma_queue *q_self) bus_dmamap_sync(q_self->mem_info.dma_tag, q_self->mem_info.dma_map, BUS_DMASYNC_POSTREAD); - mana_gd_arm_cq(q_self); + mana_gd_ring_cq(q_self, SET_ARM_BIT); } static void diff --git a/sys/dev/mana/mana.h b/sys/dev/mana/mana.h index 683ab67a6abd..da551102c246 100644 --- a/sys/dev/mana/mana.h +++ b/sys/dev/mana/mana.h @@ -115,11 +115,7 @@ enum TRI_STATE { #define EQ_SIZE (8 * PAGE_SIZE) #define LOG2_EQ_THROTTLE 3 -#if 1 /* XXX */ -#define MAX_PORTS_IN_MANA_DEV 1 -#else -#define MAX_PORTS_IN_MANA_DEV 16 -#endif +#define MAX_PORTS_IN_MANA_DEV 8 struct mana_send_buf_info { struct mbuf *mbuf; @@ -351,6 +347,8 @@ struct mana_tx_comp_oob { struct mana_rxq; +#define CQE_POLLING_BUFFER 512 + struct mana_cq { struct gdma_queue *gdma_cq; @@ -370,8 +368,18 @@ struct mana_cq { */ struct mana_txq *txq; - /* Pointer to a buffer which the CQ handler can copy the CQE's into. */ - struct gdma_comp *gdma_comp_buf; + /* Taskqueue and related structs */ + struct task cleanup_task; + struct taskqueue *cleanup_tq; + int cpu; + bool do_not_ring_db; + + /* Budget for one cleanup task */ + int work_done; + int budget; + + /* Buffer which the CQ handler can copy the CQE's into. */ + struct gdma_comp gdma_comp_buf[CQE_POLLING_BUFFER]; }; #define GDMA_MAX_RQE_SGES 15 @@ -451,6 +459,8 @@ struct mana_context { uint16_t num_ports; + struct mana_eq *eqs; + struct ifnet *ports[MAX_PORTS_IN_MANA_DEV]; }; @@ -467,8 +477,6 @@ struct mana_port_context { uint8_t mac_addr[ETHER_ADDR_LEN]; - struct mana_eq *eqs; - enum TRI_STATE rss_state; mana_handle_t default_rxobj; @@ -503,7 +511,10 @@ struct mana_port_context { bool port_st_save; /* Saved port state */ bool enable_tx_altq; + bool bind_cleanup_thread_cpu; + int last_tx_cq_bind_cpu; + int last_rx_cq_bind_cpu; struct mana_port_stats port_stats; diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 5b680f146476..7ad69457afc2 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -108,7 +108,7 @@ mana_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr) if (!apc->port_is_up) { MANA_APC_LOCK_UNLOCK(apc); - mana_info(NULL, "Port %u link is down\n", apc->port_idx); + mana_dbg(NULL, "Port %u link is down\n", apc->port_idx); return; } @@ -142,19 +142,6 @@ mana_get_counter(struct ifnet *ifp, ift_counter cnt) } } -static void -mana_drain_eq_task(struct gdma_queue *queue) -{ - if (!queue || !queue->eq.cleanup_tq) - return; - - while (taskqueue_cancel(queue->eq.cleanup_tq, - &queue->eq.cleanup_task, NULL)) { - taskqueue_drain(queue->eq.cleanup_tq, - &queue->eq.cleanup_task); - } -} - static void mana_qflush(struct ifnet *ifp) { @@ -439,13 +426,11 @@ mana_xmit(struct mana_txq *txq) struct mana_tx_package pkg = {}; struct mana_stats *tx_stats; struct gdma_queue *gdma_sq; - struct gdma_queue *gdma_eq; struct mana_cq *cq; int err, len; gdma_sq = txq->gdma_sq; cq = &apc->tx_qp[txq->idx].tx_cq; - gdma_eq = cq->gdma_cq->cq.parent; tx_stats = &txq->stats; packets = 0; @@ -476,8 +461,7 @@ mana_xmit(struct mana_txq *txq) drbr_putback(ndev, txq->txq_br, mbuf); - taskqueue_enqueue(gdma_eq->eq.cleanup_tq, - &gdma_eq->eq.cleanup_task); + taskqueue_enqueue(cq->cleanup_tq, &cq->cleanup_task); break; } @@ -1183,67 +1167,57 @@ mana_destroy_wq_obj(struct mana_port_context *apc, uint32_t wq_type, } static void -mana_init_cqe_poll_buf(struct gdma_comp *cqe_poll_buf) -{ - int i; - - for (i = 0; i < CQE_POLLING_BUFFER; i++) - memset(&cqe_poll_buf[i], 0, sizeof(struct gdma_comp)); -} - -static void -mana_destroy_eq(struct gdma_context *gc, struct mana_port_context *apc) +mana_destroy_eq(struct mana_context *ac) { + struct gdma_context *gc = ac->gdma_dev->gdma_context; struct gdma_queue *eq; int i; - if (!apc->eqs) + if (!ac->eqs) return; - for (i = 0; i < apc->num_queues; i++) { - eq = apc->eqs[i].eq; + for (i = 0; i < gc->max_num_queues; i++) { + eq = ac->eqs[i].eq; if (!eq) continue; mana_gd_destroy_queue(gc, eq); } - free(apc->eqs, M_DEVBUF); - apc->eqs = NULL; + free(ac->eqs, M_DEVBUF); + ac->eqs = NULL; } static int -mana_create_eq(struct mana_port_context *apc) +mana_create_eq(struct mana_context *ac) { - struct gdma_dev *gd = apc->ac->gdma_dev; + struct gdma_dev *gd = ac->gdma_dev; + struct gdma_context *gc = gd->gdma_context; struct gdma_queue_spec spec = {}; int err; int i; - apc->eqs = mallocarray(apc->num_queues, sizeof(struct mana_eq), + ac->eqs = mallocarray(gc->max_num_queues, sizeof(struct mana_eq), M_DEVBUF, M_WAITOK | M_ZERO); - if (!apc->eqs) + if (!ac->eqs) return ENOMEM; spec.type = GDMA_EQ; spec.monitor_avl_buf = false; spec.queue_size = EQ_SIZE; spec.eq.callback = NULL; - spec.eq.context = apc->eqs; + spec.eq.context = ac->eqs; spec.eq.log2_throttle_limit = LOG2_EQ_THROTTLE; - spec.eq.ndev = apc->ndev; - - for (i = 0; i < apc->num_queues; i++) { - mana_init_cqe_poll_buf(apc->eqs[i].cqe_poll); - err = mana_gd_create_mana_eq(gd, &spec, &apc->eqs[i].eq); + for (i = 0; i < gc->max_num_queues; i++) { + err = mana_gd_create_mana_eq(gd, &spec, &ac->eqs[i].eq); if (err) goto out; } return 0; out: - mana_destroy_eq(gd->gdma_context, apc); + mana_destroy_eq(ac); return err; } @@ -1294,6 +1268,9 @@ mana_poll_tx_cq(struct mana_cq *cq) comp_read = mana_gd_poll_cq(cq->gdma_cq, completions, CQE_POLLING_BUFFER); + if (comp_read < 1) + return; + next_to_complete = txq->next_to_complete; for (i = 0; i < comp_read; i++) { @@ -1360,7 +1337,7 @@ mana_poll_tx_cq(struct mana_cq *cq) txq_idx, next_to_complete, txq->next_to_use, txq->pending_sends, pkt_transmitted, sa_drop, i, comp_read); - continue; + break; } wqe_info = &tx_info->wqe_inf; @@ -1430,6 +1407,8 @@ mana_poll_tx_cq(struct mana_cq *cq) mana_err(NULL, "WARNING: TX %d pending_sends error: %d\n", txq->idx, txq->pending_sends); + + cq->work_done = pkt_transmitted; } static void @@ -1468,13 +1447,11 @@ mana_rx_mbuf(struct mbuf *mbuf, struct mana_rxcomp_oob *cqe, uint32_t pkt_len = cqe->ppi[0].pkt_len; uint16_t rxq_idx = rxq->rxq_idx; struct mana_port_context *apc; - struct gdma_queue *eq; bool do_lro = false; bool do_if_input; apc = if_getsoftc(ndev); - eq = apc->eqs[rxq_idx].eq; - eq->eq.work_done++; + rxq->rx_cq.work_done++; if (!mbuf) { return; @@ -1688,6 +1665,7 @@ static void mana_cq_handler(void *context, struct gdma_queue *gdma_queue) { struct mana_cq *cq = context; + uint8_t arm_bit; KASSERT(cq->gdma_cq == gdma_queue, ("cq do not match %p, %p", cq->gdma_cq, gdma_queue)); @@ -1698,7 +1676,54 @@ mana_cq_handler(void *context, struct gdma_queue *gdma_queue) mana_poll_tx_cq(cq); } - mana_gd_arm_cq(gdma_queue); + if (cq->work_done < cq->budget && cq->do_not_ring_db == false) + arm_bit = SET_ARM_BIT; + else + arm_bit = 0; + + mana_gd_ring_cq(gdma_queue, arm_bit); +} + +#define MANA_POLL_BUDGET 8 +#define MANA_RX_BUDGET 256 +#define MANA_TX_BUDGET MAX_SEND_BUFFERS_PER_QUEUE + +static void +mana_poll(void *arg, int pending) +{ + struct mana_cq *cq = arg; + int i; + + cq->work_done = 0; + if (cq->type == MANA_CQ_TYPE_RX) { + cq->budget = MANA_RX_BUDGET; + } else { + cq->budget = MANA_TX_BUDGET; + } + + for (i = 0; i < MANA_POLL_BUDGET; i++) { + /* + * If this is the last loop, set the budget big enough + * so it will arm the CQ any way. + */ + if (i == (MANA_POLL_BUDGET - 1)) + cq->budget = CQE_POLLING_BUFFER + 1; + + mana_cq_handler(cq, cq->gdma_cq); + + if (cq->work_done < cq->budget) + break; + + cq->work_done = 0; + } +} + +static void +mana_schedule_task(void *arg, struct gdma_queue *gdma_queue) +{ + struct mana_cq *cq = arg; + + taskqueue_enqueue(cq->cleanup_tq, &cq->cleanup_task); } static void @@ -1709,6 +1734,17 @@ mana_deinit_cq(struct mana_port_context *apc, struct mana_cq *cq) if (!cq->gdma_cq) return; + /* Drain cleanup taskqueue */ + if (cq->cleanup_tq) { + while (taskqueue_cancel(cq->cleanup_tq, + &cq->cleanup_task, NULL)) { + taskqueue_drain(cq->cleanup_tq, + &cq->cleanup_task); + } + + taskqueue_free(cq->cleanup_tq); + } + mana_gd_destroy_queue(gd->gdma_context, cq->gdma_cq); } @@ -1798,7 +1834,8 @@ mana_destroy_txq(struct mana_port_context *apc) static int mana_create_txq(struct mana_port_context *apc, struct ifnet *net) { - struct gdma_dev *gd = apc->ac->gdma_dev; + struct mana_context *ac = apc->ac; + struct gdma_dev *gd = ac->gdma_dev; struct mana_obj_spec wq_spec; struct mana_obj_spec cq_spec; struct gdma_queue_spec spec; @@ -1850,7 +1887,6 @@ mana_create_txq(struct mana_port_context *apc, struct ifnet *net) /* Create SQ's CQ */ cq = &apc->tx_qp[i].tx_cq; - cq->gdma_comp_buf = apc->eqs[i].cqe_poll; cq->type = MANA_CQ_TYPE_TX; cq->txq = txq; @@ -1859,8 +1895,8 @@ mana_create_txq(struct mana_port_context *apc, struct ifnet *net) spec.type = GDMA_CQ; spec.monitor_avl_buf = false; spec.queue_size = cq_size; - spec.cq.callback = mana_cq_handler; - spec.cq.parent_eq = apc->eqs[i].eq; + spec.cq.callback = mana_schedule_task; + spec.cq.parent_eq = ac->eqs[i].eq; spec.cq.context = cq; err = mana_gd_create_mana_wq_cq(gd, &spec, &cq->gdma_cq); if (err) @@ -1942,12 +1978,39 @@ mana_create_txq(struct mana_port_context *apc, struct ifnet *net) goto out; } taskqueue_start_threads(&txq->enqueue_tq, 1, PI_NET, - "mana txq %d", i); + "mana txq p%u-tx%d", apc->port_idx, i); mana_alloc_counters((counter_u64_t *)&txq->stats, sizeof(txq->stats)); - mana_gd_arm_cq(cq->gdma_cq); + /* Allocate and start the cleanup task on CQ */ + cq->do_not_ring_db = false; + + NET_TASK_INIT(&cq->cleanup_task, 0, mana_poll, cq); + cq->cleanup_tq = + taskqueue_create_fast("mana tx cq cleanup", + M_WAITOK, taskqueue_thread_enqueue, + &cq->cleanup_tq); + + if (apc->last_tx_cq_bind_cpu < 0) + apc->last_tx_cq_bind_cpu = CPU_FIRST(); + cq->cpu = apc->last_tx_cq_bind_cpu; + apc->last_tx_cq_bind_cpu = CPU_NEXT(apc->last_tx_cq_bind_cpu); + + if (apc->bind_cleanup_thread_cpu) { + cpuset_t cpu_mask; + CPU_SETOF(cq->cpu, &cpu_mask); + taskqueue_start_threads_cpuset(&cq->cleanup_tq, + 1, PI_NET, &cpu_mask, + "mana cq p%u-tx%u-cpu%d", + apc->port_idx, txq->idx, cq->cpu); + } else { + taskqueue_start_threads(&cq->cleanup_tq, 1, + PI_NET, "mana cq p%u-tx%u", + apc->port_idx, txq->idx); + } + + mana_gd_ring_cq(cq->gdma_cq, SET_ARM_BIT); } return 0; @@ -2144,7 +2207,6 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, /* Create RQ's CQ */ cq = &rxq->rx_cq; - cq->gdma_comp_buf = eq->cqe_poll; cq->type = MANA_CQ_TYPE_RX; cq->rxq = rxq; @@ -2152,7 +2214,7 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, spec.type = GDMA_CQ; spec.monitor_avl_buf = false; spec.queue_size = cq_size; - spec.cq.callback = mana_cq_handler; + spec.cq.callback = mana_schedule_task; spec.cq.parent_eq = eq->eq; spec.cq.context = cq; err = mana_gd_create_mana_wq_cq(gd, &spec, &cq->gdma_cq); @@ -2192,7 +2254,34 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, gc->cq_table[cq->gdma_id] = cq->gdma_cq; - mana_gd_arm_cq(cq->gdma_cq); + /* Allocate and start the cleanup task on CQ */ + cq->do_not_ring_db = false; + + NET_TASK_INIT(&cq->cleanup_task, 0, mana_poll, cq); + cq->cleanup_tq = + taskqueue_create_fast("mana rx cq cleanup", + M_WAITOK, taskqueue_thread_enqueue, + &cq->cleanup_tq); + + if (apc->last_rx_cq_bind_cpu < 0) + apc->last_rx_cq_bind_cpu = CPU_FIRST(); + cq->cpu = apc->last_rx_cq_bind_cpu; + apc->last_rx_cq_bind_cpu = CPU_NEXT(apc->last_rx_cq_bind_cpu); + + if (apc->bind_cleanup_thread_cpu) { + cpuset_t cpu_mask; + CPU_SETOF(cq->cpu, &cpu_mask); + taskqueue_start_threads_cpuset(&cq->cleanup_tq, + 1, PI_NET, &cpu_mask, + "mana cq p%u-rx%u-cpu%d", + apc->port_idx, rxq->rxq_idx, cq->cpu); + } else { + taskqueue_start_threads(&cq->cleanup_tq, 1, + PI_NET, "mana cq p%u-rx%u", + apc->port_idx, rxq->rxq_idx); + } + + mana_gd_ring_cq(cq->gdma_cq, SET_ARM_BIT); out: if (!err) return rxq; @@ -2210,12 +2299,13 @@ out: static int mana_add_rx_queues(struct mana_port_context *apc, struct ifnet *ndev) { + struct mana_context *ac = apc->ac; struct mana_rxq *rxq; int err = 0; int i; for (i = 0; i < apc->num_queues; i++) { - rxq = mana_create_rxq(apc, i, &apc->eqs[i], ndev); + rxq = mana_create_rxq(apc, i, &ac->eqs[i], ndev); if (!rxq) { err = ENOMEM; goto out; @@ -2234,20 +2324,12 @@ mana_destroy_vport(struct mana_port_context *apc) { struct mana_rxq *rxq; uint32_t rxq_idx; - struct mana_cq *rx_cq; - struct gdma_queue *cq, *eq; for (rxq_idx = 0; rxq_idx < apc->num_queues; rxq_idx++) { rxq = apc->rxqs[rxq_idx]; if (!rxq) continue; - rx_cq = &rxq->rx_cq; - if ((cq = rx_cq->gdma_cq) != NULL) { - eq = cq->cq.parent; - mana_drain_eq_task(eq); - } - mana_destroy_rxq(apc, rxq, true); apc->rxqs[rxq_idx] = NULL; } @@ -2336,16 +2418,11 @@ int mana_alloc_queues(struct ifnet *ndev) { struct mana_port_context *apc = if_getsoftc(ndev); - struct gdma_dev *gd = apc->ac->gdma_dev; int err; - err = mana_create_eq(apc); - if (err) - return err; - err = mana_create_vport(apc, ndev); if (err) - goto destroy_eq; + return err; err = mana_add_rx_queues(apc, ndev); if (err) @@ -2363,8 +2440,6 @@ mana_alloc_queues(struct ifnet *ndev) destroy_vport: mana_destroy_vport(apc); -destroy_eq: - mana_destroy_eq(gd->gdma_context, apc); return err; } @@ -2430,16 +2505,13 @@ mana_dealloc_queues(struct ifnet *ndev) txq = &apc->tx_qp[i].txq; struct mana_cq *tx_cq = &apc->tx_qp[i].tx_cq; - struct gdma_queue *eq = NULL; - if (tx_cq->gdma_cq) - eq = tx_cq->gdma_cq->cq.parent; - if (eq) { - /* Stop EQ interrupt */ - eq->eq.do_not_ring_db = true; - /* Schedule a cleanup task */ - taskqueue_enqueue(eq->eq.cleanup_tq, - &eq->eq.cleanup_task); - } + struct mana_cq *rx_cq = &(apc->rxqs[i]->rx_cq); + + tx_cq->do_not_ring_db = true; + rx_cq->do_not_ring_db = true; + + /* Schedule a cleanup task */ + taskqueue_enqueue(tx_cq->cleanup_tq, &tx_cq->cleanup_task); while (atomic_read(&txq->pending_sends) > 0) usleep_range(1000, 2000); @@ -2461,8 +2533,6 @@ mana_dealloc_queues(struct ifnet *ndev) mana_destroy_vport(apc); - mana_destroy_eq(apc->ac->gdma_dev->gdma_context, apc); - return 0; } @@ -2550,6 +2620,8 @@ mana_probe_port(struct mana_context *ac, int port_idx, apc->port_handle = INVALID_MANA_HANDLE; apc->port_idx = port_idx; apc->frame_size = DEFAULT_FRAME_SIZE; + apc->last_tx_cq_bind_cpu = -1; + apc->last_rx_cq_bind_cpu = -1; MANA_APC_LOCK_INIT(apc); @@ -2637,6 +2709,10 @@ int mana_probe(struct gdma_dev *gd) ac->num_ports = 1; gd->driver_data = ac; + err = mana_create_eq(ac); + if (err) + goto out; + err = mana_query_device_cfg(ac, MANA_MAJOR_VERSION, MANA_MINOR_VERSION, MANA_MICRO_VERSION, &ac->num_ports); if (err) @@ -2682,6 +2758,9 @@ mana_remove(struct gdma_dev *gd) if_free(ndev); } + + mana_destroy_eq(ac); + out: mana_gd_deregister_device(gd); gd->driver_data = NULL; From nobody Tue Oct 26 12:50:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5ED1B1832D07; Tue, 26 Oct 2021 12:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdsB51qJCz4qsL; Tue, 26 Oct 2021 12:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 14E461CD75; Tue, 26 Oct 2021 12:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QCoaNQ060560; Tue, 26 Oct 2021 12:50:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QCoa7f060559; Tue, 26 Oct 2021 12:50:36 GMT (envelope-from git) Date: Tue, 26 Oct 2021 12:50:36 GMT Message-Id: <202110261250.19QCoa7f060559@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: f2069331e582 - main - libutil: add kinfo_getswapvmobject(3) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2069331e5821f4c2b65d82af2809946a34158d2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f2069331e5821f4c2b65d82af2809946a34158d2 commit f2069331e5821f4c2b65d82af2809946a34158d2 Author: Konstantin Belousov AuthorDate: 2021-10-26 08:40:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 12:50:29 +0000 libutil: add kinfo_getswapvmobject(3) which is the wrapper around the vm.swap_objects sysctl, same as kinfo_getvmobject(3) wraps vm.objects. Submitted by: Yoshihiro Ota MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29754 --- lib/libutil/kinfo_getvmobject.c | 20 ++++++++++++++++---- lib/libutil/libutil.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/libutil/kinfo_getvmobject.c b/lib/libutil/kinfo_getvmobject.c index de55650a518b..4bf666fd7f3b 100644 --- a/lib/libutil/kinfo_getvmobject.c +++ b/lib/libutil/kinfo_getvmobject.c @@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$"); #include "libutil.h" -struct kinfo_vmobject * -kinfo_getvmobject(int *cntp) +static struct kinfo_vmobject * +kinfo_getvmobject_impl(int *cntp, const char *vmobjsysctl) { char *buf, *bp, *ep; struct kinfo_vmobject *kvo, *list, *kp; @@ -46,14 +46,14 @@ kinfo_getvmobject(int *cntp) buf = NULL; for (i = 0; i < 3; i++) { - if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0) { + if (sysctlbyname(vmobjsysctl, NULL, &len, NULL, 0) < 0) { free(buf); return (NULL); } buf = reallocf(buf, len); if (buf == NULL) return (NULL); - if (sysctlbyname("vm.objects", buf, &len, NULL, 0) == 0) + if (sysctlbyname(vmobjsysctl, buf, &len, NULL, 0) == 0) goto unpack; if (errno != ENOMEM) { free(buf); @@ -94,3 +94,15 @@ unpack: *cntp = cnt; return (list); } + +struct kinfo_vmobject * +kinfo_getvmobject(int *cntp) +{ + return (kinfo_getvmobject_impl(cntp, "vm.objects")); +} + +struct kinfo_vmobject * +kinfo_getswapvmobject(int *cntp) +{ + return (kinfo_getvmobject_impl(cntp, "vm.swap_objects")); +} diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h index bb96b2caa502..17c44de0fce7 100644 --- a/lib/libutil/libutil.h +++ b/lib/libutil/libutil.h @@ -109,6 +109,8 @@ struct kinfo_vmentry * kinfo_getvmmap(pid_t _pid, int *_cntp); struct kinfo_vmobject * kinfo_getvmobject(int *_cntp); +struct kinfo_vmobject * + kinfo_getswapvmobject(int *_cntp); struct kinfo_proc * kinfo_getallproc(int *_cntp); struct kinfo_proc * From nobody Tue Oct 26 12:50:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 78DB01832CC7; Tue, 26 Oct 2021 12:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdsB62S1Fz4qqK; Tue, 26 Oct 2021 12:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2395A1CF15; Tue, 26 Oct 2021 12:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QCoceL060584; Tue, 26 Oct 2021 12:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QCoc3Z060583; Tue, 26 Oct 2021 12:50:38 GMT (envelope-from git) Date: Tue, 26 Oct 2021 12:50:38 GMT Message-Id: <202110261250.19QCoc3Z060583@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: 57e5da2c9800 - main - Augment systat(1) -swap to display large swap space processes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57e5da2c98003e5ab77a337e9fbe22ab7e512ba7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=57e5da2c98003e5ab77a337e9fbe22ab7e512ba7 commit 57e5da2c98003e5ab77a337e9fbe22ab7e512ba7 Author: Konstantin Belousov AuthorDate: 2021-10-26 08:43:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 12:50:29 +0000 Augment systat(1) -swap to display large swap space processes This change updates the systat(1) -swap display to use libprocstat to obtain and display per-process swap space usage infomation following its existing swap devise/file statistics. It also incorporates the disk I/O information from the -vmstat display. The new screen looks like below with 'systat -swap': /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10 Load Average | Device/Path Size Used |0% /10 /20 /30 /40 / 60\ 70\ 80\ 90\ 100| ada0s1b 2048M 2034M XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX zvol/sys/tempora 1024M 1015M XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX zvol/sys/swap 1024M 1014M XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Total 4096M 4063M XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Pid Username Command Swap/Total Per-Process Per-System 24153 hiro seamonkey 98M / 1G 7% 2% 23677 hiro xfce4-pane 28M / 81M 34% XXX 0% 23629 hiro xfce4-sess 25M / 118M 21% XX 0% 23681 hiro xfdesktop 20M / 58M 34% XXX 0% 23678 hiro thunar 15M / 43M 36% XXX 0% 23658 hiro at-spi-bus 14M / 23M 63% XXXXXX 0% 23660 hiro gvfsd 12M / 21M 56% XXXXX 0% Disks ada0 ada1 ada2 cd0 pass0 pass1 pass2 pass3 KB/t 8.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 tps 0 0 0 0 1 0 0 0 MB/s 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 %busy 0 0 0 0 0 0 0 0 Submitted by: Yoshihiro Ota MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29754 --- usr.bin/systat/Makefile | 4 +- usr.bin/systat/proc.c | 309 ++++++++++++++++++++++++++++++++++++++++++++++++ usr.bin/systat/swap.c | 24 ++-- usr.bin/systat/sysput.c | 24 +--- usr.bin/systat/systat.1 | 30 ++++- usr.bin/systat/systat.h | 6 + 6 files changed, 361 insertions(+), 36 deletions(-) diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile index 01cd36877101..58b6c855d6af 100644 --- a/usr.bin/systat/Makefile +++ b/usr.bin/systat/Makefile @@ -5,7 +5,7 @@ PROG= systat SRCS= cmds.c cmdtab.c devs.c fetch.c iostat.c keyboard.c main.c sysput.c \ - netcmds.c netstat.c pigs.c swap.c icmp.c \ + netcmds.c netstat.c pigs.c proc.c swap.c icmp.c \ mode.c ip.c sctp.c tcp.c zarc.c \ vmstat.c convtbl.c ifcmds.c ifstat.c @@ -16,6 +16,6 @@ CFLAGS+= -DINET6 WARNS?= 1 -LIBADD= tinfow ncursesw m devstat kvm util +LIBADD= tinfow ncursesw m devstat kvm util procstat .include diff --git a/usr.bin/systat/proc.c b/usr.bin/systat/proc.c new file mode 100644 index 000000000000..58c3bea64239 --- /dev/null +++ b/usr.bin/systat/proc.c @@ -0,0 +1,309 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Yoshihiro Ota + * + * 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 + +#include +#include +#include +#include +#include +#include +#include + +#include "systat.h" +#include "extern.h" + +/* + * vm objects of swappable types + */ +static struct swapvm { + uint64_t kvo_me; + uint32_t swapped; /* in pages */ + uint64_t next; + pid_t pid; /* to avoid double counting */ +} *swobj = NULL; +static int nswobj = 0; + +static struct procstat *prstat = NULL; +/* + *procstat_getvmmap() is an expensive call and the number of processes running + * may also be high. So, maintain an array of pointers for ease of expanding + * an array and also swapping pointers are faster than struct. + */ +static struct proc_usage { + pid_t pid; + uid_t uid; + char command[COMMLEN + 1]; + uint64_t total; + uint32_t pages; +} **pu = NULL; +static unsigned int nproc; +static int proc_compar(const void *, const void *); + +static void +display_proc_line(int idx, int y, uint64_t totalswappages) +{ + int offset = 0, rate; + const char *uname, *pname; + char buf[30]; + uint64_t swapbytes; + + wmove(wnd, y, 0); + wclrtoeol(wnd); + if (idx >= nproc) + return; + + uname = user_from_uid(pu[idx]->uid, 0); + swapbytes = ptoa(pu[idx]->pages); + + snprintf(buf, sizeof(buf), "%6d %-10s %-10.10s", pu[idx]->pid, uname, + pu[idx]->command); + offset = 6 + 1 + 10 + 1 + 10 + 1; + mvwaddstr(wnd, y, 0, buf); + sysputuint64(wnd, y, offset, 4, swapbytes, 0); + offset += 4; + mvwaddstr(wnd, y, offset, " / "); + offset += 3; + sysputuint64(wnd, y, offset, 4, pu[idx]->total, 0); + offset += 4; + + rate = pu[idx]->total > 1 ? 100 * swapbytes / pu[idx]->total : 0; + snprintf(buf, sizeof(buf), "%3d%%", rate); + mvwaddstr(wnd, y, offset, buf); + if (rate > 100) /* avoid running over the screen */ + rate = 100; + sysputXs(wnd, y, offset + 5, rate / 10); + + rate = 100 * pu[idx]->pages / totalswappages; + snprintf(buf, sizeof(buf), "%3d%%", rate); + mvwaddstr(wnd, y, offset + 16, buf); + if (rate > 100) /* avoid running over the screen */ + rate = 100; + sysputXs(wnd, y, offset + 21, rate / 10); +} + +static int +swobj_search(const void *a, const void *b) +{ + const uint64_t *aa = a; + const struct swapvm *bb = b; + + if (*aa == bb->kvo_me) + return (0); + return (*aa > bb->kvo_me ? -1 : 1); +} + +static int +swobj_sort(const void *a, const void *b) +{ + + return ((((const struct swapvm *) a)->kvo_me > + ((const struct swapvm *) b)->kvo_me) ? -1 : 1); +} + +static bool +get_swap_vmobjects(void) +{ + static int maxnobj; + int cnt, i, next_i, last_nswobj; + struct kinfo_vmobject *kvo; + + next_i = nswobj = 0; + kvo = kinfo_getswapvmobject(&cnt); + if (kvo == NULL) { + error("kinfo_getswapvmobject()"); + return (false); + } + do { + for (i = next_i; i < cnt; i++) { + if (kvo[i].kvo_type != KVME_TYPE_DEFAULT && + kvo[i].kvo_type != KVME_TYPE_SWAP) + continue; + if (nswobj < maxnobj) { + swobj[nswobj].kvo_me = kvo[i].kvo_me; + swobj[nswobj].swapped = kvo[i].kvo_swapped; + swobj[nswobj].next = kvo[i].kvo_backing_obj; + swobj[nswobj].pid = 0; + next_i = i + 1; + } + nswobj++; + } + if (nswobj <= maxnobj) + break; + /* allocate memory and fill skipped elements */ + last_nswobj = maxnobj; + maxnobj = nswobj; + nswobj = last_nswobj; + /* allocate more memory and fill missed ones */ + if ((swobj = reallocf(swobj, maxnobj * sizeof(*swobj))) == + NULL) { + error("Out of memory"); + die(0); + } + } while (i <= cnt); /* extra safety guard */ + free(kvo); + if (nswobj > 1) + qsort(swobj, nswobj, sizeof(swobj[0]), swobj_sort); + return (nswobj > 0); +} + +/* This returns the number of swap pages a process uses. */ +static uint32_t +per_proc_swap_usage(struct kinfo_proc *kipp) +{ + int i, cnt; + uint32_t pages = 0; + uint64_t vmobj; + struct kinfo_vmentry *freep, *kve; + struct swapvm *vm; + + freep = procstat_getvmmap(prstat, kipp, &cnt); + if (freep == NULL) + return (pages); + + for (i = 0; i < cnt; i++) { + kve = &freep[i]; + if (kve->kve_type == KVME_TYPE_DEFAULT || + kve->kve_type == KVME_TYPE_SWAP) { + vmobj = kve->kve_obj; + do { + vm = bsearch(&vmobj, swobj, nswobj, + sizeof(swobj[0]), swobj_search); + if (vm != NULL && vm->pid != kipp->ki_pid) { + pages += vm->swapped; + vmobj = vm->next; + vm->pid = kipp->ki_pid; + } else + break; + } while (vmobj != 0); + } + } + free(freep); + return (pages); +} + +void +closeproc(WINDOW *w) +{ + + if (prstat != NULL) + procstat_close(prstat); + prstat = NULL; + if (w == NULL) + return; + wclear(w); + wrefresh(w); + delwin(w); +} + +void +procshow(int col, int hight, uint64_t totalswappages) +{ + int i, y; + + for (i = 0, y = col + 1 /* HEADING */; i < hight; i++, y++) + display_proc_line(i, y, totalswappages); +} + +int +procinit(void) +{ + + if (prstat == NULL) + prstat = procstat_open_sysctl(); + return (prstat != NULL); +} + +void +procgetinfo(void) +{ + static unsigned int maxnproc = 0; + int cnt, i; + uint32_t pages; + struct kinfo_proc *kipp; + + nproc = 0; + if ( ! get_swap_vmobjects() ) /* call failed or nothing is paged-out */ + return; + + kipp = procstat_getprocs(prstat, KERN_PROC_PROC, 0, &cnt); + if (kipp == NULL) { + error("procstat_getprocs()"); + return; + } + if (maxnproc < cnt) { + if ((pu = realloc(pu, cnt * sizeof(*pu))) == NULL) { + error("Out of memory"); + die(0); + } + memset(&pu[maxnproc], 0, (cnt - maxnproc) * sizeof(pu[0])); + maxnproc = cnt; + } + + for (i = 0; i < cnt; i++) { + pages = per_proc_swap_usage(&kipp[i]); + if (pages == 0) + continue; + if (pu[nproc] == NULL && + (pu[nproc] = malloc(sizeof(**pu))) == NULL) { + error("Out of memory"); + die(0); + } + strlcpy(pu[nproc]->command, kipp[i].ki_comm, + sizeof(pu[nproc]->command)); + pu[nproc]->pid = kipp[i].ki_pid; + pu[nproc]->uid = kipp[i].ki_uid; + pu[nproc]->pages = pages; + pu[nproc]->total = kipp[i].ki_size; + nproc++; + } + if (nproc > 1) + qsort(pu, nproc, sizeof(*pu), proc_compar); +} + +void +proclabel(int col) +{ + + wmove(wnd, col, 0); + wclrtoeol(wnd); + mvwaddstr(wnd, col, 0, + "Pid Username Command Swap/Total " + "Per-Process Per-System"); +} + +int +proc_compar(const void *a, const void *b) +{ + const struct proc_usage *aa = *((const struct proc_usage **)a); + const struct proc_usage *bb = *((const struct proc_usage **)b); + + return (aa->pages > bb->pages ? -1 : 1); +} diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index 6052ca0d877b..19374918ff68 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -103,6 +103,7 @@ initswap(void) } pathlen = 80 - 50 /* % */ - 5 /* Used */ - 5 /* Size */ - 3 /* space */; dsinit(12); + procinit(); once = 1; return (1); @@ -125,14 +126,13 @@ fetchswap(void) cur_dev.dinfo = tmp_dinfo; last_dev.snap_time = cur_dev.snap_time; - dsgetinfo( &cur_dev ); + dsgetinfo(&cur_dev); + procgetinfo(); } void labelswap(void) { - const char *name; - int i; werase(wnd); @@ -146,18 +146,13 @@ labelswap(void) mvwprintw(wnd, 0, 0, "%*s%5s %5s %s", -pathlen, "Device/Path", "Size", "Used", "|0% /10 /20 /30 /40 / 60\\ 70\\ 80\\ 90\\ 100|"); - - for (i = 0; i <= kvnsw; ++i) { - name = i == kvnsw ? "Total" : kvmsw[i].ksw_devname; - mvwprintw(wnd, 1 + i, 0, "%-*.*s", pathlen, pathlen - 1, name); - } } void showswap(void) { - int count; - int i; + const char *name; + int count, i; if (kvnsw != okvnsw) labelswap(); @@ -167,7 +162,10 @@ showswap(void) if (kvnsw <= 0) return; - for (i = 0; i <= kvnsw; ++i) { + for (i = (kvnsw == 1 ? 0 : kvnsw); i >= 0; i--) { + name = i == kvnsw ? "Total" : kvmsw[i].ksw_devname; + mvwprintw(wnd, 1 + i, 0, "%-*.*s", pathlen, pathlen - 1, name); + sysputpage(wnd, i + 1, pathlen, 5, kvmsw[i].ksw_total, 0); sysputpage(wnd, i + 1, pathlen + 5 + 1, 5, kvmsw[i].ksw_used, 0); @@ -178,4 +176,8 @@ showswap(void) } wclrtoeol(wnd); } + count = kvnsw == 1 ? 2 : 3; + proclabel(kvnsw + count); + procshow(kvnsw + count, LINES - 5 - kvnsw + 3 - DISKHIGHT + 1, + kvmsw[kvnsw].ksw_total); } diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index e089c5c2ff55..6e14f9eb752f 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -31,10 +31,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include +#include #include +#include +#include #include "systat.h" #include "extern.h" @@ -103,26 +104,9 @@ sysputwuint64(WINDOW *wd, int row, int col, int width, uint64_t val, int flags) sysputuint64(wd, row, col, width, val, flags); } -static int -calc_page_shift() -{ - u_int page_size; - int shifts; - - shifts = 0; - GETSYSCTL("vm.stats.vm.v_page_size", page_size); - for(; page_size > 1; page_size >>= 1) - shifts++; - return shifts; -} - void sysputpage(WINDOW *wd, int row, int col, int width, uint64_t pages, int flags) { - static int shifts = 0; - if (shifts == 0) - shifts = calc_page_shift(); - pages <<= shifts; - sysputuint64(wd, row, col, width, pages, flags); + sysputuint64(wd, row, col, width, ptoa(pages), flags); } diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1 index 5ad8078a85a4..1f6ddaeafb1a 100644 --- a/usr.bin/systat/systat.1 +++ b/usr.bin/systat/systat.1 @@ -279,9 +279,11 @@ not display kilobytes per transaction). .El .It Ic swap Show information about swap space usage on all the -swap areas compiled into the kernel. -The first column is the device name of the partition. -The next column is the total space available in the partition. +swap areas compiled into the kernel and processes that are swapped out +as well as a summary of disk activity. +.Pp +The swap areas are displayed first with their name, sizes and +usage percentage. The .Ar Used column indicates the total blocks used so far; @@ -289,6 +291,28 @@ the graph shows the percentage of space in use on each partition. If there are more than one swap partition in use, a total line is also shown. Areas known to the kernel, but not in use are shown as not available. +.Pp +Below the swap space statistics, +processes are listed in order of higher swap area usage. +Pid, username, a part of command line, the total use of swap space +in bytes, the size of process, as well as per-process swap usage percentage and +per-system swap space percentage are shown per process. +.Pp +At the bottom left is the disk usage display. +It reports the number of +kilobytes per transaction, transactions per second, megabytes +per second and the percentage of the time the disk was busy averaged +over the refresh period of the display (by default, five seconds). +The system keeps statistics on most every storage device. +In general, up +to seven devices are displayed. +The devices displayed by default are the +first devices in the kernel's device list. +See +.Xr devstat 3 +and +.Xr devstat 9 +for details on the devstat system. .It Ic vmstat Take over the entire display and show a (rather crowded) compendium of statistics related to virtual memory usage, process scheduling, diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h index 92233e058172..4ced36c32932 100644 --- a/usr.bin/systat/systat.h +++ b/usr.bin/systat/systat.h @@ -32,6 +32,7 @@ * $FreeBSD$ */ +#include #include struct cmdtab { @@ -72,3 +73,8 @@ extern int use_kvm; extern void putint(int, int, int, int); extern void putfloat(double, int, int, int, int, int); extern void putlongdouble(long double, int, int, int, int, int); + +int procinit(void); +void procgetinfo(void); +void proclabel(int col); +void procshow(int col, int hight, uint64_t totalswappages); From nobody Tue Oct 26 13:57:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9CC321826148; Tue, 26 Oct 2021 13:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdtgK3tR3z3QVP; Tue, 26 Oct 2021 13:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 64BC41D56D; Tue, 26 Oct 2021 13:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QDvXIe045060; Tue, 26 Oct 2021 13:57:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QDvX43045059; Tue, 26 Oct 2021 13:57:33 GMT (envelope-from git) Date: Tue, 26 Oct 2021 13:57:33 GMT Message-Id: <202110261357.19QDvX43045059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: c0cf36bc0210 - main - ncurses: rework static linker script generation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0cf36bc0210c4d74f626b944b4c7036cb01df5d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c0cf36bc0210c4d74f626b944b4c7036cb01df5d commit c0cf36bc0210c4d74f626b944b4c7036cb01df5d Author: Baptiste Daroussin AuthorDate: 2021-10-26 10:02:00 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-26 13:57:29 +0000 ncurses: rework static linker script generation Rework the generation of the linker script to make it in par with ldscript, this also forces the regeneration of the .aldscript in the obj dir which might in the past have ended up empty. Tested by: manu --- lib/ncurses/ncurses/Makefile | 19 +++++++++---------- lib/ncurses/ncurses/libncursesw.aldscript | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index 951e8a4ea63f..af733d3ac613 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -170,13 +170,12 @@ SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcurses_p.a LIBADD+= tinfow SHLIB_LDSCRIPT= libncursesw.ldscript STATIC_LDSCRIPT= libncursesw.aldscript -CLEANFILES+= ${STATIC_LDSCRIPT} +CLEANFILES+= libncursesw.a -libncursesw.aldscript: - @${ECHO} "INPUT(-lncursesw_real -ltinfow)" >$@ - -libncurses.ldscript: - @${ECHO} "INPUT(${SHLIB_NAME} AS NEEDED(-ltinfow))" >$@ +libncursesw.a: ${.CURDIR}/${STATIC_LDSCRIPT} + sed -e 's,@@LIB@@,${LIB},g' \ + -e 's,@@STATICLIB_SUFFIX@@,${_STATICLIB_SUFFIX},g' \ + ${.ALLSRC} > ${.TARGET} lib_gen.c: MKlib_gen.sh ${.OBJDIR:H}/tinfo/curses.h ncurses_dll.h LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CPP:N${CCACHE_BIN}} ${CFLAGS}" \ @@ -185,13 +184,13 @@ lib_gen.c: MKlib_gen.sh ${.OBJDIR:H}/tinfo/curses.h ncurses_dll.h expanded.c: MKexpanded.sh sh ${NCURSES_DIR}/ncurses/tty/MKexpanded.sh "${CC:N${CCACHE_BIN}} -E" ${CFLAGS} >expanded.c -all: ${STATIC_LDSCRIPT} +all: ${STATIC_LDSCRIPT} libncursesw.a -install-aldscript: ${STATIC_LDSCRIPT} +install-libncursesw.a: libncursesw.a ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${_INSTALLFLAGS} ${STATIC_LDSCRIPT} ${DESTDIR}${_LIBDIR}/lib${LIB}.a + ${_INSTALLFLAGS} libncursesw.a ${DESTDIR}${_LIBDIR}/lib${LIB}.a -realinstall: install-aldscript +realinstall: install-libncursesw.a .include diff --git a/lib/ncurses/ncurses/libncursesw.aldscript b/lib/ncurses/ncurses/libncursesw.aldscript new file mode 100644 index 000000000000..337995f095c8 --- /dev/null +++ b/lib/ncurses/ncurses/libncursesw.aldscript @@ -0,0 +1 @@ +INPUT(-l@@LIB@@@@STATICLIB_SUFFIX@@ -ltinfow) From nobody Tue Oct 26 14:01:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A8FBD182646A; Tue, 26 Oct 2021 14:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdtlL4NZqz3R3F; Tue, 26 Oct 2021 14:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 766871DD40; Tue, 26 Oct 2021 14:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QE12Ut056862; Tue, 26 Oct 2021 14:01:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QE12HX056861; Tue, 26 Oct 2021 14:01:02 GMT (envelope-from git) Date: Tue, 26 Oct 2021 14:01:02 GMT Message-Id: <202110261401.19QE12HX056861@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: 426682b05a4c - main - bpf: Fix the write filter for detached descriptors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 426682b05a4cf700c20d503516bfa07c043fecf8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=426682b05a4cf700c20d503516bfa07c043fecf8 commit 426682b05a4cf700c20d503516bfa07c043fecf8 Author: Mark Johnston AuthorDate: 2021-10-26 13:57:27 +0000 Commit: Mark Johnston CommitDate: 2021-10-26 14:00:39 +0000 bpf: Fix the write filter for detached descriptors A BPF descriptor only has an associated interface descriptor once it is attached to an interface, e.g., with BIOCSETIF. Avoid dereferencing a NULL pointer in filt_bpfwrite() if the BPF descriptor is not attached. Reviewed by: ae Reported by: syzbot+ae45d5166afe15a5a21d@syzkaller.appspotmail.com Fixes: ded77e0237a8 ("Allow the BPF to be select for write.") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32561 --- lib/libc/sys/kqueue.2 | 4 ++-- sys/net/bpf.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 68929e973dc0..afa1dc5dcb4a 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -390,8 +390,8 @@ For eventfds, will contain the maximum value that can be added to the counter without blocking. .Pp -For BPF devices, the filter always indicates that it is possible to -write and +For BPF devices, when the descriptor is attached to an interface the filter +always indicates that it is possible to write and .Va data will contain the MTU size of the underlying interface. .It Dv EVFILT_EMPTY diff --git a/sys/net/bpf.c b/sys/net/bpf.c index ce7aba5a9bcd..b229dd81b127 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -763,6 +763,10 @@ bpf_attachd(struct bpf_d *d, struct bpf_if *bp) CK_LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); reset_d(d); + + /* Trigger EVFILT_WRITE events. */ + bpf_wakeup(d); + BPFD_UNLOCK(d); bpf_bpfd_cnt++; @@ -2229,11 +2233,16 @@ static int filt_bpfwrite(struct knote *kn, long hint) { struct bpf_d *d = (struct bpf_d *)kn->kn_hook; - BPFD_LOCK_ASSERT(d); - kn->kn_data = d->bd_bif->bif_ifp->if_mtu; + BPFD_LOCK_ASSERT(d); - return (1); + if (d->bd_bif == NULL) { + kn->kn_data = 0; + return (0); + } else { + kn->kn_data = d->bd_bif->bif_ifp->if_mtu; + return (1); + } } #define BPF_TSTAMP_NONE 0 From nobody Tue Oct 26 14:50:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 14F84181D8B8; Tue, 26 Oct 2021 14:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdvrG749Zz4RxP; Tue, 26 Oct 2021 14:50:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D3DED1EA8B; Tue, 26 Oct 2021 14:50:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QEoMXN020434; Tue, 26 Oct 2021 14:50:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QEoMqo020433; Tue, 26 Oct 2021 14:50:22 GMT (envelope-from git) Date: Tue, 26 Oct 2021 14:50:22 GMT Message-Id: <202110261450.19QEoMqo020433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: fcfa64801a4f - main - sh: Set PATH envvar after setting HOME in dotfile List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fcfa64801a4fe836ff481465ea068e791aa4ce6a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=fcfa64801a4fe836ff481465ea068e791aa4ce6a commit fcfa64801a4fe836ff481465ea068e791aa4ce6a Author: Ka Ho Ng AuthorDate: 2021-10-26 14:48:57 +0000 Commit: Ka Ho Ng CommitDate: 2021-10-26 14:50:09 +0000 sh: Set PATH envvar after setting HOME in dotfile In single-user mode, all env vars are absent, so exptilde() would not be able to expand ~ correctly. Place the lines setting PATH below HOME, so exptilde() would work as expected. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jilles, emaste Differential Revision: https://reviews.freebsd.org/D27003 --- bin/sh/dot.profile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile index fd0c43fdb927..e296a360bcc7 100644 --- a/bin/sh/dot.profile +++ b/bin/sh/dot.profile @@ -1,9 +1,9 @@ # $FreeBSD$ # -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin -export PATH HOME=/root export HOME +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin +export PATH TERM=${TERM:-xterm} export TERM PAGER=less From nobody Tue Oct 26 15:00:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DDD131821852; Tue, 26 Oct 2021 15:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hdw3p5xkwz4V5f; Tue, 26 Oct 2021 15:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 ABF551E762; Tue, 26 Oct 2021 15:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QF0MRi035040; Tue, 26 Oct 2021 15:00:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QF0MVn035039; Tue, 26 Oct 2021 15:00:22 GMT (envelope-from git) Date: Tue, 26 Oct 2021 15:00:22 GMT Message-Id: <202110261500.19QF0MVn035039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: 8019068d7c30 - main - /etc/periodic/weekly/310.locate must read /etc/locate.rc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8019068d7c30e45ad392669a6577e5f1db56421d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=8019068d7c30e45ad392669a6577e5f1db56421d commit 8019068d7c30e45ad392669a6577e5f1db56421d Author: Wolfram Schneider AuthorDate: 2021-10-26 14:59:39 +0000 Commit: Wolfram Schneider CommitDate: 2021-10-26 14:59:39 +0000 /etc/periodic/weekly/310.locate must read /etc/locate.rc PR: 160225 Reported by: Hiroaki Abe Reviewed by: se Approved by: se Differential Revision: https://reviews.freebsd.org/D32646 --- usr.sbin/periodic/etc/weekly/310.locate | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/periodic/etc/weekly/310.locate b/usr.sbin/periodic/etc/weekly/310.locate index 4079f5e8287e..b7481965444a 100755 --- a/usr.sbin/periodic/etc/weekly/310.locate +++ b/usr.sbin/periodic/etc/weekly/310.locate @@ -16,7 +16,9 @@ case "$weekly_locate_enable" in echo "" echo "Rebuilding locate database:" - locdb=/var/db/locate.database + . /etc/locate.rc + : ${FCODES:="/var/db/locate.database"} + locdb="$FCODES" touch $locdb && rc=0 || rc=3 chown nobody $locdb || rc=3 From nobody Tue Oct 26 15:32:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4A5A3182F2EE for ; Tue, 26 Oct 2021 15:32:17 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2q.ore.mailhop.org (outbound2q.ore.mailhop.org [54.187.71.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hdwmc6jzHz4gbJ for ; Tue, 26 Oct 2021 15:32:16 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1635262330; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=uB19c58GPvwrmlIny4Er4C8JZG/nM/nTzZzLSQ2JaIF8OGA4DNR0Wt0id7r0IIbDxj4sAuLqUnbG2 PTYLboRzFM5yNVE960aUG6ZGmj781Zh489FYaBmz5QEzEJDpRM47TM1zfUPc0YoM/JHgAsHWn6OXNF x3xNrzeGAlzMlwZPlf/sB5seL/AYUvZRJM86xH/t+BRPnclPaTmN0D4jB7azta9B7jdDLBCOQZYtjX Z62SDJDTUTjjPVnX59+aC/d0VT2LTmUldw6IaN7kUvY0V95YrHDrcd5I7YhieBn0mPjkI5ASPlfSV1 QMmZlVoJMTL78lAb7PcsqTFNhIUSlSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=kHp+/AgMnjXQKao+/n8p1lIkkn2C5jObzK8/isesJuo=; b=e1dZrXkmyEZIEPRhorrBsbj8bAyYAlEwWvTAdeHLwP0w8YflZDXVMtngVDIoDW8PJpdICJFBt1ogV LhKQrwHdoFKlVVbQBeltvP5hKZPlFlDkcy91ottZVgZhy3FDc4/l8goOaEi5MB6NNN7w7XmHXNJAl5 iRAvlCVmSLJs4fC+6KIG/1FTtFMomG0mi+Jkdl4xCUo89HP7eQDIbaBh0Qp8aeyqcdkmmzBspnovRH MdJzOs8sux5lbt3DJM7stwGvXozILDQc7xED85wXnODXiQqoUQAv8mTOLB3IfPDwIdwU+j2IPbB4VM pQ59K9odqFiWosqgrnQOiWNr3DLMOIw== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=kHp+/AgMnjXQKao+/n8p1lIkkn2C5jObzK8/isesJuo=; b=ws1jSO2sG+gmllyuGgLcACAqIkOUCf5qAdWkh/br7sbtsYeVv14tip6EfwnZOQ0tM8ZWIgSjJuxcd RZgPLNThWVL83f1+/R4G6kN9iHFuapdvdglspm+p/borfh2Ok30ar1FF2u2SF6nI7lNBk0/Dcx5Muz LMIuWZJDggo/b9UyhuLOeXsJoOPTxQ5PJxYKg6fVa2Qtc6kodCA3t+RW9+a9kbVphyvrJEq21qv6Jx hKVsraK6DfrZNjA7DWpz+tplhqa75rjUIkhpX4xVXb/30/tcoH0X51HdwKnujAdj5ATShYlC2hZzup 8zdUSx7tAUeSw+G8DfBGpsTCaPhw7jQ== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: e1bebaea-3671-11ec-a67c-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id e1bebaea-3671-11ec-a67c-89389772cfc7; Tue, 26 Oct 2021 15:32:09 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 19QFW86v001129; Tue, 26 Oct 2021 09:32:08 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <57f6f877de121954935225fba9874a39b6b768c4.camel@freebsd.org> Subject: Re: git: fcfa64801a4f - main - sh: Set PATH envvar after setting HOME in dotfile From: Ian Lepore To: Ka Ho Ng , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Tue, 26 Oct 2021 09:32:08 -0600 In-Reply-To: <202110261450.19QEoMqo020433@gitrepo.freebsd.org> References: <202110261450.19QEoMqo020433@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Hdwmc6jzHz4gbJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, 2021-10-26 at 14:50 +0000, Ka Ho Ng wrote: > The branch main has been updated by khng: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=fcfa64801a4fe836ff481465ea068e791aa4ce6a > > commit fcfa64801a4fe836ff481465ea068e791aa4ce6a > Author:     Ka Ho Ng > AuthorDate: 2021-10-26 14:48:57 +0000 > Commit:     Ka Ho Ng > CommitDate: 2021-10-26 14:50:09 +0000 > >     sh: Set PATH envvar after setting HOME in dotfile >     >     In single-user mode, all env vars are absent, so exptilde() would > not be >     able to expand ~ correctly. >     Place the lines setting PATH below HOME, so exptilde() would work > as >     expected. >     >     Sponsored by:   The FreeBSD Foundation >     MFC after:      3 days >     Reviewed by:    jilles, emaste >     Differential Revision:  https://reviews.freebsd.org/D27003 > --- >  bin/sh/dot.profile | 4 ++-- >  1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile > index fd0c43fdb927..e296a360bcc7 100644 > --- a/bin/sh/dot.profile > +++ b/bin/sh/dot.profile > @@ -1,9 +1,9 @@ >  # $FreeBSD$ >  # > - > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bi > n > -export PATH >  HOME=/root >  export HOME > +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/ > bin > +export PATH >  TERM=${TERM:-xterm} >  export TERM >  PAGER=less I've always been curious whether there's a reason we seem to favor VAR=value export VAR over the more compact form export VAR=value -- Ian From nobody Tue Oct 26 15:40:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6F6AD1812A6A; Tue, 26 Oct 2021 15:41:04 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hdwym1zvGz4jll; Tue, 26 Oct 2021 15:41:04 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id fNMTmGwXdczbLfOZOmFtuX; Tue, 26 Oct 2021 15:40:58 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id fOZMm63FfgxGifOZNmMH7l; Tue, 26 Oct 2021 15:40:58 +0000 X-Authority-Analysis: v=2.4 cv=SqLzVNC0 c=1 sm=1 tr=0 ts=6178218a a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=8nJEP1OIZ-IA:10 a=8gfv0ekSlNoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=YsaGJC6E6cbuPZDk6JEA:9 a=wPNLvfGTeEIA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 27C97235; Tue, 26 Oct 2021 08:40:54 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 19QFesnX010998; Tue, 26 Oct 2021 08:40:54 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202110261540.19QFesnX010998@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Ian Lepore cc: Ka Ho Ng , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fcfa64801a4f - main - sh: Set PATH envvar after setting HOME in dotfile In-reply-to: <57f6f877de121954935225fba9874a39b6b768c4.camel@freebsd.org> References: <202110261450.19QEoMqo020433@gitrepo.freebsd.org> <57f6f877de121954935225fba9874a39b6b768c4.camel@freebsd.org> Comments: In-reply-to Ian Lepore message dated "Tue, 26 Oct 2021 09:32:08 -0600." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 26 Oct 2021 08:40:54 -0700 X-CMAE-Envelope: MS4xfFFkl28w9kA0LCDIT6qctugGNREApuFoXq2GA8GVKAI7u4VBlVF6CIHNdsPXnOKEFPr7nzeuzyz6Xx6ki6h1jpb9pbqUO4rW6v+dBMDH8slTyE/Fi8Z9 P0v+nH7oKlCP9HYhnkdO3swIn5lTNLcdWHDOCgWWhDyF8gYqbLGQCrdYIDYNat0PZYzZmhoMsqHWsoE/MwHTwLzfN/z+hjRXhg1EfvSqXYg6wI6HXngOVL5J JceVpbUk7KPRh9esZC198szdpk7xaEwZBUpjw1Ml7VoDMk89ARAH3uwriQx19Fa/vMxQ9W3xnxVDBvNdM4gfZZGGVupZDi34r/8jtlyvmYzKw1BLvHJNFSBV K/JfwC2I X-Rspamd-Queue-Id: 4Hdwym1zvGz4jll X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message <57f6f877de121954935225fba9874a39b6b768c4.camel@freebsd.org>, Ian Le pore writes: > On Tue, 2021-10-26 at 14:50 +0000, Ka Ho Ng wrote: > > The branch main has been updated by khng: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=fcfa64801a4fe836ff481465ea068e791aa > 4ce6a > > > > commit fcfa64801a4fe836ff481465ea068e791aa4ce6a > > Author:     Ka Ho Ng > > AuthorDate: 2021-10-26 14:48:57 +0000 > > Commit:     Ka Ho Ng > > CommitDate: 2021-10-26 14:50:09 +0000 > > > >     sh: Set PATH envvar after setting HOME in dotfile > >     > >     In single-user mode, all env vars are absent, so exptilde() would > > not be > >     able to expand ~ correctly. > >     Place the lines setting PATH below HOME, so exptilde() would work > > as > >     expected. > >     > >     Sponsored by:   The FreeBSD Foundation > >     MFC after:      3 days > >     Reviewed by:    jilles, emaste > >     Differential Revision:  https://reviews.freebsd.org/D27003 > > --- > >  bin/sh/dot.profile | 4 ++-- > >  1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile > > index fd0c43fdb927..e296a360bcc7 100644 > > --- a/bin/sh/dot.profile > > +++ b/bin/sh/dot.profile > > @@ -1,9 +1,9 @@ > >  # $FreeBSD$ > >  # > > - > > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bi > > n > > -export PATH > >  HOME=/root > >  export HOME > > +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/ > > bin > > +export PATH > >  TERM=${TERM:-xterm} > >  export TERM > >  PAGER=less > > I've always been curious whether there's a reason we seem to favor > > VAR=value > export VAR > > over the more compact form > > export VAR=value Older Bourne shells don't support export VAR=value. This gives the user greater flexibility to choose an older shell as their login shell. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Tue Oct 26 16:24:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9E1CE1826106; Tue, 26 Oct 2021 16:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdxxG41bQz3CsM; Tue, 26 Oct 2021 16:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 69C491FD4A; Tue, 26 Oct 2021 16:24:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QGOo4s045533; Tue, 26 Oct 2021 16:24:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QGOo3F045532; Tue, 26 Oct 2021 16:24:50 GMT (envelope-from git) Date: Tue, 26 Oct 2021 16:24:50 GMT Message-Id: <202110261624.19QGOo3F045532@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: bb4c691299c5 - main - lualoader: fix the autoboot_delay countdown message List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb4c691299c5d699cea29e18fef96bda1cef13da Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bb4c691299c5d699cea29e18fef96bda1cef13da commit bb4c691299c5d699cea29e18fef96bda1cef13da Author: Katsuyuki Miyoshi AuthorDate: 2021-10-26 16:21:34 +0000 Commit: Kyle Evans CommitDate: 2021-10-26 16:24:29 +0000 lualoader: fix the autoboot_delay countdown message When the timer drops from double to single digits, a spare 'e' is left on the end of the line as we don't overwrite it. Include an extra space at the end to account for this and overwrite the leftover character. PR: 259429 MFC after: 3 days Reviewed by: emaste --- stand/lua/menu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index d1e1ee012834..f1a4f07a8d73 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -522,7 +522,7 @@ function menu.autoboot(delay) last = time screen.setcursor(x, y) print("Autoboot in " .. time .. - " seconds. [Space] to pause") + " seconds. [Space] to pause ") screen.defcursor() end if io.ischar() then From nobody Tue Oct 26 17:19:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B3BD71812D53; Tue, 26 Oct 2021 17:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hdz8f4nCLz3jCr; Tue, 26 Oct 2021 17:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 85943206FD; Tue, 26 Oct 2021 17:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QHJkQv012218; Tue, 26 Oct 2021 17:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QHJkmN012217; Tue, 26 Oct 2021 17:19:46 GMT (envelope-from git) Date: Tue, 26 Oct 2021 17:19:46 GMT Message-Id: <202110261719.19QHJkmN012217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 12752978d32b - main - tcp: The rack stack can incorrectly have an overflow when calculating a burst delay. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12752978d32b440f7cc79a9dfb539b5bf42620af Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=12752978d32b440f7cc79a9dfb539b5bf42620af commit 12752978d32b440f7cc79a9dfb539b5bf42620af Author: Randall Stewart AuthorDate: 2021-10-26 17:17:58 +0000 Commit: Randall Stewart CommitDate: 2021-10-26 17:17:58 +0000 tcp: The rack stack can incorrectly have an overflow when calculating a burst delay. If the congestion window is very large the fact that we multiply it by 1000 (for microseconds) can cause the uint32_t to overflow and we incorrectly calculate a very small divisor. This will then cause the burst timer to be very large when it should be 0. Instead lets make the three variables uint64_t and avoid the issue. Reviewed by: Michael Tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32668 --- sys/netinet/tcp_stacks/rack.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 059c7d26d81e..eee7db6e7a4c 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -14909,6 +14909,7 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se static int32_t rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, struct rack_sendmap *rsm, uint32_t segsiz) { + uint64_t srtt; int32_t slot = 0; int can_start_hw_pacing = 1; int err; @@ -14921,7 +14922,7 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str * quicker then possible. But thats ok we don't want * the peer to have a gap in data sending. */ - uint32_t srtt, cwnd, tr_perms = 0; + uint64_t cwnd, tr_perms = 0; int32_t reduce = 0; old_method: @@ -14971,7 +14972,7 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL, 0); } else { uint64_t bw_est, res, lentim, rate_wanted; - uint32_t orig_val, srtt, segs, oh; + uint32_t orig_val, segs, oh; int capped = 0; int prev_fill; @@ -15196,7 +15197,7 @@ done_w_hdwr: srtt = rack->rc_tp->t_srtt; else srtt = RACK_INITIAL_RTO * HPTS_USEC_IN_MSEC; /* its in ms convert */ - if (srtt < slot) { + if (srtt < (uint64_t)slot) { rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL, 0); slot = srtt; } From nobody Tue Oct 26 20:17:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1EA518120D4; Tue, 26 Oct 2021 20:17: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf36C62WCz3DR9; Tue, 26 Oct 2021 20:17:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AEBFE228FA; Tue, 26 Oct 2021 20:17:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QKHtMY051756; Tue, 26 Oct 2021 20:17:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QKHta1051755; Tue, 26 Oct 2021 20:17:55 GMT (envelope-from git) Date: Tue, 26 Oct 2021 20:17:55 GMT Message-Id: <202110262017.19QKHta1051755@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: 48cb3fee2586 - main - Retire obsolete iscsi_initiator(4) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48cb3fee25862a6adc10fe0b2c2dc15c7fd7fd9e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=48cb3fee25862a6adc10fe0b2c2dc15c7fd7fd9e commit 48cb3fee25862a6adc10fe0b2c2dc15c7fd7fd9e Author: Ed Maste AuthorDate: 2021-10-26 17:24:30 +0000 Commit: Ed Maste CommitDate: 2021-10-26 20:17:35 +0000 Retire obsolete iscsi_initiator(4) The new iSCSI initiator iscsi(4) was introduced with FreeBSD 10.0, and the old intiator was marked obsolete shortly thereafter (in commit d32789d95cfbf, MFC'd to stable/10 in ba54910169c4). Remove it now. Reviewed by: jhb, mav Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32673 --- ObsoleteFiles.inc | 5 + sbin/Makefile | 1 - sbin/iscontrol/Makefile | 14 - sbin/iscontrol/Makefile.depend | 21 - sbin/iscontrol/auth_subr.c | 206 ----- sbin/iscontrol/config.c | 382 --------- sbin/iscontrol/fsm.c | 759 ------------------ sbin/iscontrol/iscontrol.8 | 141 ---- sbin/iscontrol/iscontrol.c | 264 ------- sbin/iscontrol/iscontrol.h | 167 ---- sbin/iscontrol/login.c | 442 ----------- sbin/iscontrol/misc.c | 228 ------ sbin/iscontrol/pdu.c | 178 ----- share/man/man4/Makefile | 1 - share/man/man4/iscsi_initiator.4 | 118 --- sys/conf/NOTES | 1 - sys/conf/files | 6 - sys/dev/iscsi_initiator/isc_cam.c | 351 -------- sys/dev/iscsi_initiator/isc_sm.c | 750 ------------------ sys/dev/iscsi_initiator/isc_soc.c | 680 ---------------- sys/dev/iscsi_initiator/isc_subr.c | 184 ----- sys/dev/iscsi_initiator/iscsi.c | 880 --------------------- sys/dev/iscsi_initiator/iscsi.h | 502 ------------ sys/dev/iscsi_initiator/iscsi_subr.c | 603 -------------- sys/dev/iscsi_initiator/iscsivar.h | 571 ------------- sys/modules/Makefile | 1 - sys/modules/iscsi_initiator/Makefile | 14 - targets/pseudo/userland/Makefile.depend | 1 - tools/build/mk/OptionalObsoleteFiles.inc | 3 - .../kerneldoc/subsys/Doxyfile-dev_iscsi_initiator | 21 - usr.bin/iscsictl/iscsi.conf.5 | 5 +- usr.bin/iscsictl/iscsictl.8 | 15 - 32 files changed, 6 insertions(+), 7509 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index b6a2d299bc8c..c60629197386 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20211026: retire obsolete iscsi initiator +OLD_FILES+=sbin/iscontrol +OLD_FILES+=usr/share/man/man4/iscsi_initiator.4.gz +OLD_FILES+=usr/share/man/man8/iscontrol.8.gz + # 20211022 OLD_FILES+=sbin/spppcontrol .if ${TARGET_ARCH} == "i386" diff --git a/sbin/Makefile b/sbin/Makefile index b4da58680458..7eb497e3e3dd 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -76,7 +76,6 @@ SUBDIR.${MK_INET6}+= rtsol SUBDIR.${MK_IPFILTER}+= ipf SUBDIR.${MK_IPFW}+= ipfw SUBDIR.${MK_IPFW}+= natd -SUBDIR.${MK_ISCSI}+= iscontrol SUBDIR.${MK_NVME}+= nvmecontrol SUBDIR.${MK_OPENSSL}+= decryptcore SUBDIR.${MK_PF}+= pfctl diff --git a/sbin/iscontrol/Makefile b/sbin/iscontrol/Makefile deleted file mode 100644 index 613444a468f4..000000000000 --- a/sbin/iscontrol/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ - -PACKAGE=iscsilegacy -SRCS= iscontrol.c pdu.c fsm.c config.c login.c auth_subr.c misc.c -PROG= iscontrol -LIBADD= cam md -S= ${SRCTOP}/sys - -WARNS?= 3 -CFLAGS+= -I$S - -MAN= iscontrol.8 - -.include diff --git a/sbin/iscontrol/Makefile.depend b/sbin/iscontrol/Makefile.depend deleted file mode 100644 index c800a3df77c3..000000000000 --- a/sbin/iscontrol/Makefile.depend +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcam \ - lib/libcompiler_rt \ - lib/libmd \ - lib/libsbuf \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/sbin/iscontrol/auth_subr.c b/sbin/iscontrol/auth_subr.c deleted file mode 100644 index a4c17ba20868..000000000000 --- a/sbin/iscontrol/auth_subr.c +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005-2010 Daniel Braniss - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - | $Id: auth_subr.c,v 2.2 2007/06/01 08:09:37 danny Exp $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include "iscontrol.h" - -static int -chapMD5(char id, char *cp, char *chapSecret, unsigned char *digest) -{ - MD5_CTX ctx; - char *tmp; - int len; - - debug_called(3); - - MD5Init(&ctx); - - MD5Update(&ctx, &id, 1); - - if((len = str2bin(chapSecret, &tmp)) == 0) { - // print error - return -1; - } - MD5Update(&ctx, tmp, len); - free(tmp); - - if((len = str2bin(cp, &tmp)) == 0) { - // print error - return -1; - } - MD5Update(&ctx, tmp, len); - free(tmp); - - MD5Final(digest, &ctx); - - - return 0; -} - -static int -chapSHA1(char id, char *cp, char *chapSecret, unsigned char *digest) -{ - SHA1_CTX ctx; - char *tmp; - int len; - - debug_called(3); - - SHA1_Init(&ctx); - - SHA1_Update(&ctx, &id, 1); - - if((len = str2bin(chapSecret, &tmp)) == 0) { - // print error - return -1; - } - SHA1_Update(&ctx, tmp, len); - free(tmp); - - if((len = str2bin(cp, &tmp)) == 0) { - // print error - return -1; - } - SHA1_Update(&ctx, tmp, len); - free(tmp); - - SHA1_Final(digest, &ctx); - - return 0; - -} -/* - | the input text format can be anything that the rfc3270 defines - | (see section 5.1 and str2bin) - | digest length for md5 is 128bits, and for sha1 is 160bits. - | digest is an ASCII string which represents the bits in - | hexadecimal or base64 according to the challenge(cp) format - */ -char * -chapDigest(char *ap, char id, char *cp, char *chapSecret) -{ - int len; - unsigned char digest[20]; - char encoding[3]; - - debug_called(3); - - len = 0; - if(strcmp(ap, "5") == 0 && chapMD5(id, cp, chapSecret, digest) == 0) - len = 16; - else - if(strcmp(ap, "7") == 0 && chapSHA1(id, cp, chapSecret, digest) == 0) - len = 20; - - if(len) { - sprintf(encoding, "%.2s", cp); - return bin2str(encoding, digest, len); - } - - return NULL; -} - -char * -genChapChallenge(char *encoding, uint len) -{ - int fd; - unsigned char tmp[1024]; - - if(len > sizeof(tmp)) - return NULL; - - if((fd = open("/dev/random", O_RDONLY)) != -1) { - read(fd, tmp, len); - close(fd); - return bin2str(encoding, tmp, len); - } - perror("/dev/random"); - // make up something ... - return NULL; -} - -#ifdef TEST_AUTH -static void -puke(char *str, unsigned char *dg, int len) -{ - printf("%3d] %s\n 0x", len, str); - while(len-- > 0) - printf("%02x", *dg++); - printf("\n"); -} - -main(int cc, char **vv) -{ - char *p, *ap, *ip, *cp, *chapSecret, *digest; - int len; - -#if 0 - ap = "5"; - chapSecret = "0xa5aff013dd839b1edd31ee73a1df0b1b"; -// chapSecret = "abcdefghijklmnop"; - len = str2bin(chapSecret, &cp); - puke(chapSecret, cp, len); - - ip = "238"; - cp = "0xbd456029"; - - - if((digest = chapDigest(ap, ip, cp, chapSecret)) != NULL) { - len = str2bin(digest, &cp); - puke(digest, cp, len); - } -#else - printf("%d] %s\n", 24, genChallenge("0X", 24)); -#endif -} -#endif diff --git a/sbin/iscontrol/config.c b/sbin/iscontrol/config.c deleted file mode 100644 index 2fe44512f311..000000000000 --- a/sbin/iscontrol/config.c +++ /dev/null @@ -1,382 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005-2009 Daniel Braniss - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -/* - | $Id: config.c,v 2.1 2006/11/12 08:06:51 danny Exp danny $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "iscontrol.h" - -/* - | ints - */ -#define OPT_port 1 -#define OPT_tags 2 - -#define OPT_maxConnections 3 -#define OPT_maxRecvDataSegmentLength 4 -#define OPT_maxXmitDataSegmentLength 5 -#define OPT_maxBurstLength 6 -#define OPT_firstBurstLength 7 -#define OPT_defaultTime2Wait 8 -#define OPT_defaultTime2Retain 9 -#define OPT_maxOutstandingR2T 10 -#define OPT_errorRecoveryLevel 11 -#define OPT_targetPortalGroupTag 12 -#define OPT_headerDigest 13 -#define OPT_dataDigest 14 -/* - | Booleans - */ -#define OPT_initialR2T 16 -#define OPT_immediateData 17 -#define OPT_dataPDUInOrder 18 -#define OPT_dataSequenceInOrder 19 -/* - | strings - */ -#define OPT_sessionType 15 - -#define OPT_targetAddress 21 -#define OPT_targetAlias 22 -#define OPT_targetName 23 -#define OPT_initiatorName 24 -#define OPT_initiatorAlias 25 -#define OPT_authMethod 26 - -#define OPT_chapSecret 27 -#define OPT_chapIName 28 -#define OPT_chapDigest 29 -#define OPT_tgtChapName 30 -#define OPT_tgtChapSecret 31 -#define OPT_tgtChallengeLen 32 -/* - | private - */ -#define OPT_maxluns 33 -#define OPT_iqn 34 -#define OPT_sockbufsize 35 - -/* - | sentinel - */ -#define OPT_end 0 - -#define _OFF(v) ((int)&((isc_opt_t *)NULL)->v) -#define _E(u, s, v) {.usage=u, .scope=s, .name=#v, .tokenID=OPT_##v} - -textkey_t keyMap[] = { - _E(U_PR, S_PR, port), - _E(U_PR, S_PR, tags), - _E(U_PR, S_PR, maxluns), - _E(U_PR, S_PR, sockbufsize), - - _E(U_PR, S_PR, iqn), - _E(U_PR, S_PR, chapSecret), - _E(U_PR, S_PR, chapIName), - _E(U_PR, S_PR, chapDigest), - _E(U_PR, S_PR, tgtChapName), - _E(U_PR, S_PR, tgtChapSecret), - _E(U_PR, S_PR, tgtChallengeLen), - - _E(U_IO, S_CO, headerDigest), - _E(U_IO, S_CO, dataDigest), - - _E(U_IO, S_CO, authMethod), - - _E(U_LO, S_SW, maxConnections), - _E(U_IO, S_SW, targetName), - - _E(U_IO, S_SW, initiatorName), - _E(U_ALL,S_SW, targetAlias), - _E(U_ALL,S_SW, initiatorAlias), - _E(U_ALL,S_SW, targetAddress), - - _E(U_ALL,S_SW, targetPortalGroupTag), - - _E(U_LO, S_SW, initialR2T), - _E(U_LO, S_SW, immediateData), - - _E(U_ALL,S_CO, maxRecvDataSegmentLength), - _E(U_ALL,S_CO, maxXmitDataSegmentLength), - - _E(U_LO, S_SW, maxBurstLength), - _E(U_LO, S_SW, firstBurstLength), - _E(U_LO, S_SW, defaultTime2Wait), - _E(U_LO, S_SW, defaultTime2Retain), - - _E(U_LO, S_SW, maxOutstandingR2T), - _E(U_LO, S_SW, dataPDUInOrder), - _E(U_LO, S_SW, dataSequenceInOrder), - - _E(U_LO, S_SW, errorRecoveryLevel), - - _E(U_LO, S_SW, sessionType), - - _E(0, 0, end) -}; - -#define _OPT_INT(w) strtol((char *)w, NULL, 0) -#define _OPT_STR(w) (char *)(w) - -static __inline int -_OPT_BOOL(char *w) -{ - if(isalpha((unsigned char)*w)) - return strcasecmp(w, "TRUE") == 0; - else - return _OPT_INT(w); -} - -#define _CASE(k, v) case OPT_##k: op->k = v; break -static void -setOption(isc_opt_t *op, int which, void *rval) -{ - switch(which) { - _CASE(port, _OPT_INT(rval)); - _CASE(tags, _OPT_INT(rval)); - _CASE(maxluns, _OPT_INT(rval)); - _CASE(iqn, _OPT_STR(rval)); - _CASE(sockbufsize, _OPT_INT(rval)); - - _CASE(maxConnections, _OPT_INT(rval)); - _CASE(maxRecvDataSegmentLength, _OPT_INT(rval)); - _CASE(maxXmitDataSegmentLength, _OPT_INT(rval)); - _CASE(maxBurstLength, _OPT_INT(rval)); - _CASE(firstBurstLength, _OPT_INT(rval)); - _CASE(defaultTime2Wait, _OPT_INT(rval)); - _CASE(defaultTime2Retain, _OPT_INT(rval)); - _CASE(maxOutstandingR2T, _OPT_INT(rval)); - _CASE(errorRecoveryLevel, _OPT_INT(rval)); - _CASE(targetPortalGroupTag, _OPT_INT(rval)); - _CASE(headerDigest, _OPT_STR(rval)); - _CASE(dataDigest, _OPT_STR(rval)); - - _CASE(targetAddress, _OPT_STR(rval)); - _CASE(targetAlias, _OPT_STR(rval)); - _CASE(targetName, _OPT_STR(rval)); - _CASE(initiatorName, _OPT_STR(rval)); - _CASE(initiatorAlias, _OPT_STR(rval)); - _CASE(authMethod, _OPT_STR(rval)); - _CASE(chapSecret, _OPT_STR(rval)); - _CASE(chapIName, _OPT_STR(rval)); - _CASE(chapDigest, _OPT_STR(rval)); - - _CASE(tgtChapName, _OPT_STR(rval)); - _CASE(tgtChapSecret, _OPT_STR(rval)); - - _CASE(initialR2T, _OPT_BOOL(rval)); - _CASE(immediateData, _OPT_BOOL(rval)); - _CASE(dataPDUInOrder, _OPT_BOOL(rval)); - _CASE(dataSequenceInOrder, _OPT_BOOL(rval)); - } -} - -static char * -get_line(FILE *fd) -{ - static char *sp, line[BUFSIZ]; - char *lp, *p; - - do { - if(sp == NULL) - sp = fgets(line, sizeof line, fd); - - if((lp = sp) == NULL) - break; - if((p = strchr(lp, '\n')) != NULL) - *p = 0; - if((p = strchr(lp, '#')) != NULL) - *p = 0; - if((p = strchr(lp, ';')) != NULL) { - *p++ = 0; - sp = p; - } else - sp = NULL; - if(*lp) - return lp; - } while (feof(fd) == 0); - return NULL; -} - -static int -getConfig(FILE *fd, char *key, char **Ar, int *nargs) -{ - char *lp, *p, **ar; - int state, len, n; - - ar = Ar; - if(key) - len = strlen(key); - else - len = 0; - state = 0; - while((lp = get_line(fd)) != NULL) { - for(; isspace((unsigned char)*lp); lp++) - ; - switch(state) { - case 0: - if((p = strchr(lp, '{')) != NULL) { - while((--p > lp) && *p && isspace((unsigned char)*p)); - n = p - lp; - if(len && strncmp(lp, key, MAX(n, len)) == 0) - state = 2; - else - state = 1; - continue; - } - break; - - case 1: - if(*lp == '}') - state = 0; - continue; - - case 2: - if(*lp == '}') - goto done; - - break; - } - - - for(p = &lp[strlen(lp)-1]; isspace((unsigned char)*p); p--) - *p = 0; - if((*nargs)-- > 0) - *ar++ = strdup(lp); - } - - done: - if(*nargs > 0) - *ar = 0; - *nargs = ar - Ar; - return ar - Ar; -} - -static textkey_t * -keyLookup(char *key) -{ - textkey_t *tk; - - for(tk = keyMap; tk->name && strcmp(tk->name, "end"); tk++) { - if(strcasecmp(key, tk->name) == 0) - return tk; - } - return NULL; -} - -static void -puke(isc_opt_t *op) -{ - printf("%24s = %d\n", "port", op->port); - printf("%24s = %d\n", "tags", op->tags); - printf("%24s = %d\n", "maxluns", op->maxluns); - printf("%24s = %s\n", "iqn", op->iqn); - - printf("%24s = %d\n", "maxConnections", op->maxConnections); - printf("%24s = %d\n", "maxRecvDataSegmentLength", op->maxRecvDataSegmentLength); - printf("%24s = %d\n", "maxXmitDataSegmentLength", op->maxRecvDataSegmentLength); - printf("%24s = %d\n", "maxBurstLength", op->maxBurstLength); - printf("%24s = %d\n", "firstBurstLength", op->firstBurstLength); - printf("%24s = %d\n", "defaultTime2Wait", op->defaultTime2Wait); - printf("%24s = %d\n", "defaultTime2Retain", op->defaultTime2Retain); - printf("%24s = %d\n", "maxOutstandingR2T", op->maxOutstandingR2T); - printf("%24s = %d\n", "errorRecoveryLevel", op->errorRecoveryLevel); - printf("%24s = %d\n", "targetPortalGroupTag", op->targetPortalGroupTag); - - printf("%24s = %s\n", "headerDigest", op->headerDigest); - printf("%24s = %s\n", "dataDigest", op->dataDigest); - - printf("%24s = %d\n", "initialR2T", op->initialR2T); - printf("%24s = %d\n", "immediateData", op->immediateData); - printf("%24s = %d\n", "dataPDUInOrder", op->dataPDUInOrder); - printf("%24s = %d\n", "dataSequenceInOrder", op->dataSequenceInOrder); - - printf("%24s = %s\n", "sessionType", op->sessionType); - printf("%24s = %s\n", "targetAddress", op->targetAddress); - printf("%24s = %s\n", "targetAlias", op->targetAlias); - printf("%24s = %s\n", "targetName", op->targetName); - printf("%24s = %s\n", "initiatorName", op->initiatorName); - printf("%24s = %s\n", "initiatorAlias", op->initiatorAlias); - printf("%24s = %s\n", "authMethod", op->authMethod); - printf("%24s = %s\n", "chapSecret", op->chapSecret); - printf("%24s = %s\n", "chapIName", op->chapIName); - printf("%24s = %s\n", "tgtChapName", op->tgtChapName); - printf("%24s = %s\n", "tgtChapSecret", op->tgtChapSecret); - printf("%24s = %d\n", "tgttgtChallengeLen", op->tgtChallengeLen); -} - -void -parseArgs(int nargs, char **args, isc_opt_t *op) -{ - char **ar; - char *p, *v; - textkey_t *tk; - - for(ar = args; nargs > 0; nargs--, ar++) { - p = strchr(*ar, '='); - if(p == NULL) - continue; - *p = 0; - v = p + 1; - while(isspace((unsigned char)*--p)) - *p = 0; - while(isspace((unsigned char)*v)) - v++; - if((tk = keyLookup(*ar)) == NULL) - continue; - setOption(op, tk->tokenID, v); - } -} - -void -parseConfig(FILE *fd, char *key, isc_opt_t *op) -{ - char *Ar[256]; - int cc; - - cc = 256; - if(getConfig(fd, key, Ar, &cc)) - parseArgs(cc, Ar, op); - if(vflag) - puke(op); -} diff --git a/sbin/iscontrol/fsm.c b/sbin/iscontrol/fsm.c deleted file mode 100644 index 8efbe6667b16..000000000000 --- a/sbin/iscontrol/fsm.c +++ /dev/null @@ -1,759 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005-2010 Daniel Braniss - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - | $Id: fsm.c,v 2.8 2007/05/19 16:34:21 danny Exp danny $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "iscontrol.h" - -typedef enum { - T1 = 1, - T2, /*T3,*/ T4, T5, /*T6,*/ T7, T8, T9, - T10, T11, T12, T13, T14, T15, T16, T18 -} trans_t; - -/* - | now supports IPV6 - | thanks to: - | Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan - | ume@mahoroba.org ume@{,jp.}FreeBSD.org - | http://www.imasy.org/~ume/ - */ -static trans_t -tcpConnect(isess_t *sess) -{ - isc_opt_t *op = sess->op; - int val, sv_errno, soc; - struct addrinfo *res, *res0, hints; - char pbuf[10]; - - debug_called(3); - if(sess->flags & (SESS_RECONNECT|SESS_REDIRECT)) { - syslog(LOG_INFO, "%s", (sess->flags & SESS_RECONNECT) - ? "Reconnect": "Redirected"); - - debug(1, "%s", (sess->flags & SESS_RECONNECT) ? "Reconnect": "Redirected"); - shutdown(sess->soc, SHUT_RDWR); - //close(sess->soc); - sess->soc = -1; - - sess->flags &= ~SESS_CONNECTED; - if(sess->flags & SESS_REDIRECT) { - sess->redirect_cnt++; - sess->flags |= SESS_RECONNECT; - } else - sleep(2); // XXX: actually should be ? -#ifdef notyet - { - time_t sec; - // make sure we are not in a loop - // XXX: this code has to be tested - sec = time(0) - sess->reconnect_time; - if(sec > (5*60)) { - // if we've been connected for more that 5 minutes - // then just reconnect - sess->reconnect_time = sec; - sess->reconnect_cnt1 = 0; - } - else { - // - sess->reconnect_cnt1++; - if((sec / sess->reconnect_cnt1) < 2) { - // if less that 2 seconds from the last reconnect - // we are most probably looping - syslog(LOG_CRIT, "too many reconnects %d", sess->reconnect_cnt1); - return 0; - } - } - } -#endif - sess->reconnect_cnt++; - } - - snprintf(pbuf, sizeof(pbuf), "%d", op->port); - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - debug(1, "targetAddress=%s port=%d", op->targetAddress, op->port); - if((val = getaddrinfo(op->targetAddress, pbuf, &hints, &res0)) != 0) { - fprintf(stderr, "getaddrinfo(%s): %s\n", op->targetAddress, gai_strerror(val)); - return 0; - } - sess->flags &= ~SESS_CONNECTED; - sv_errno = 0; - soc = -1; - for(res = res0; res; res = res->ai_next) { - soc = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (soc == -1) - continue; - - // from Patrick.Guelat@imp.ch: - // iscontrol can be called without waiting for the socket entry to time out - val = 1; - if(setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, &val, (socklen_t)sizeof(val)) < 0) { - fprintf(stderr, "Cannot set socket SO_REUSEADDR %d: %s\n\n", - errno, strerror(errno)); - } - - if(connect(soc, res->ai_addr, res->ai_addrlen) == 0) - break; - sv_errno = errno; - close(soc); - soc = -1; - } - freeaddrinfo(res0); - if(soc != -1) { - sess->soc = soc; - -#if 0 - struct timeval timeout; - - val = 1; - if(setsockopt(sess->soc, IPPROTO_TCP, TCP_KEEPALIVE, &val, sizeof(val)) < 0) - fprintf(stderr, "Cannot set socket KEEPALIVE option err=%d %s\n", - errno, strerror(errno)); - - if(setsockopt(sess->soc, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) < 0) - fprintf(stderr, "Cannot set socket NO delay option err=%d %s\n", - errno, strerror(errno)); - - timeout.tv_sec = 10; - timeout.tv_usec = 0; - if((setsockopt(sess->soc, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) < 0) - || (setsockopt(sess->soc, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0)) { - fprintf(stderr, "Cannot set socket timeout to %ld err=%d %s\n", - timeout.tv_sec, errno, strerror(errno)); - } -#endif -#ifdef CURIOUS - { - int len = sizeof(val); - if(getsockopt(sess->soc, SOL_SOCKET, SO_SNDBUF, &val, &len) == 0) - fprintf(stderr, "was: SO_SNDBUF=%dK\n", val/1024); - } -#endif - if(sess->op->sockbufsize) { - val = sess->op->sockbufsize * 1024; - if((setsockopt(sess->soc, SOL_SOCKET, SO_SNDBUF, &val, sizeof(val)) < 0) - || (setsockopt(sess->soc, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val)) < 0)) { - fprintf(stderr, "Cannot set socket sndbuf & rcvbuf to %d err=%d %s\n", - val, errno, strerror(errno)); - return 0; - } - } - sess->flags |= SESS_CONNECTED; - return T1; - } - - fprintf(stderr, "errno=%d\n", sv_errno); - perror("connect"); - switch(sv_errno) { - case ECONNREFUSED: - case EHOSTUNREACH: - case ENETUNREACH: - case ETIMEDOUT: - if((sess->flags & SESS_REDIRECT) == 0) { - if(strcmp(op->targetAddress, sess->target.address) != 0) { - syslog(LOG_INFO, "reconnecting to original target address"); - free(op->targetAddress); - op->targetAddress = sess->target.address; - op->port = sess->target.port; - op->targetPortalGroupTag = sess->target.pgt; - return T1; - } - } - sleep(5); // for now ... - return T1; - default: - return 0; // terminal error - } -} - -int -setOptions(isess_t *sess, int flag) -{ - isc_opt_t oop; - char *sep; - - debug_called(3); - - bzero(&oop, sizeof(isc_opt_t)); - - if((flag & SESS_FULLFEATURE) == 0) { - oop.initiatorName = sess->op->initiatorName; - oop.targetAddress = sess->op->targetAddress; - if(sess->op->targetName != 0) - oop.targetName = sess->op->targetName; - - oop.maxRecvDataSegmentLength = sess->op->maxRecvDataSegmentLength; - oop.maxXmitDataSegmentLength = sess->op->maxXmitDataSegmentLength; // XXX: - oop.maxBurstLength = sess->op->maxBurstLength; - oop.maxluns = sess->op->maxluns; - } - else { - /* - | turn on digestion only after login - */ - if(sess->op->headerDigest != NULL) { - sep = strchr(sess->op->headerDigest, ','); - if(sep == NULL) *** 6836 LINES SKIPPED *** From nobody Tue Oct 26 20:24:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2650918157F1; Tue, 26 Oct 2021 20:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf3FG0dVQz3G2W; Tue, 26 Oct 2021 20:24:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E942522D78; Tue, 26 Oct 2021 20:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QKO1fn064578; Tue, 26 Oct 2021 20:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QKO1tS064577; Tue, 26 Oct 2021 20:24:01 GMT (envelope-from git) Date: Tue, 26 Oct 2021 20:24:01 GMT Message-Id: <202110262024.19QKO1tS064577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 8032812ac206 - stable/13 - Update old iSCSI initiator man pages for removal from 14 and later List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8032812ac206a3e2355b3331ace49c1d7e4194e3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8032812ac206a3e2355b3331ace49c1d7e4194e3 commit 8032812ac206a3e2355b3331ace49c1d7e4194e3 Author: Ed Maste AuthorDate: 2021-10-26 20:21:50 +0000 Commit: Ed Maste CommitDate: 2021-10-26 20:23:41 +0000 Update old iSCSI initiator man pages for removal from 14 and later The old initiator was removed from main in 48cb3fee2586 in advance of FreeBSD 14. --- sbin/iscontrol/iscontrol.8 | 6 ++++-- share/man/man4/iscsi_initiator.4 | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sbin/iscontrol/iscontrol.8 b/sbin/iscontrol/iscontrol.8 index abebf0c534d8..84d394afbcd2 100644 --- a/sbin/iscontrol/iscontrol.8 +++ b/sbin/iscontrol/iscontrol.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2016 +.Dd October 26, 2021 .Dt ISCONTROL 8 .Os .Sh NAME @@ -44,7 +44,9 @@ .Bf -symbolic This command, along with its kernel counterpart .Xr iscsi_initiator 4 , -is obsolete. +is obsolete and is not present in +.Fx 14 +and above. Users are advised to use .Xr iscsictl 8 instead. diff --git a/share/man/man4/iscsi_initiator.4 b/share/man/man4/iscsi_initiator.4 index a39339254b02..119d23d19316 100644 --- a/share/man/man4/iscsi_initiator.4 +++ b/share/man/man4/iscsi_initiator.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2014 +.Dd October 26, 2021 .Dt ISCSI_INITIATOR 4 .Os .Sh NAME @@ -48,7 +48,9 @@ iscsi_initiator_load="YES" .Bf -symbolic This driver, along with its userspace counterpart .Xr iscontrol 8 , -is obsolete. +is obsolete and is not present in +.Fx 14 +and above. Users are advised to use .Xr iscsi 4 instead. From nobody Tue Oct 26 20:24:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 912BC1815D9B; Tue, 26 Oct 2021 20:24: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf3Fx2642z3GTY; Tue, 26 Oct 2021 20:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 27E5A23119; Tue, 26 Oct 2021 20:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QKObDG064731; Tue, 26 Oct 2021 20:24:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QKObe8064730; Tue, 26 Oct 2021 20:24:37 GMT (envelope-from git) Date: Tue, 26 Oct 2021 20:24:37 GMT Message-Id: <202110262024.19QKObe8064730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: cddb2b8f5e11 - stable/12 - Update old iSCSI initiator man pages for removal from 14 and later List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cddb2b8f5e1125ca52b0abdfdbfdb6cfb931175d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cddb2b8f5e1125ca52b0abdfdbfdb6cfb931175d commit cddb2b8f5e1125ca52b0abdfdbfdb6cfb931175d Author: Ed Maste AuthorDate: 2021-10-26 20:21:50 +0000 Commit: Ed Maste CommitDate: 2021-10-26 20:24:23 +0000 Update old iSCSI initiator man pages for removal from 14 and later The old initiator was removed from main in 48cb3fee2586 in advance of FreeBSD 14. (cherry picked from commit 8032812ac206a3e2355b3331ace49c1d7e4194e3) --- sbin/iscontrol/iscontrol.8 | 6 ++++-- share/man/man4/iscsi_initiator.4 | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sbin/iscontrol/iscontrol.8 b/sbin/iscontrol/iscontrol.8 index abebf0c534d8..84d394afbcd2 100644 --- a/sbin/iscontrol/iscontrol.8 +++ b/sbin/iscontrol/iscontrol.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2016 +.Dd October 26, 2021 .Dt ISCONTROL 8 .Os .Sh NAME @@ -44,7 +44,9 @@ .Bf -symbolic This command, along with its kernel counterpart .Xr iscsi_initiator 4 , -is obsolete. +is obsolete and is not present in +.Fx 14 +and above. Users are advised to use .Xr iscsictl 8 instead. diff --git a/share/man/man4/iscsi_initiator.4 b/share/man/man4/iscsi_initiator.4 index a39339254b02..119d23d19316 100644 --- a/share/man/man4/iscsi_initiator.4 +++ b/share/man/man4/iscsi_initiator.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2014 +.Dd October 26, 2021 .Dt ISCSI_INITIATOR 4 .Os .Sh NAME @@ -48,7 +48,9 @@ iscsi_initiator_load="YES" .Bf -symbolic This driver, along with its userspace counterpart .Xr iscontrol 8 , -is obsolete. +is obsolete and is not present in +.Fx 14 +and above. Users are advised to use .Xr iscsi 4 instead. From nobody Tue Oct 26 20:54:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C1AAC1823AD4; Tue, 26 Oct 2021 20:54:38 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.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 "vtr.rulingia.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf3wY0LSDz3QBM; Tue, 26 Oct 2021 20:54:36 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (2001-44b8-31fc-0d00-ecde-7ed7-1c2c-43e2.static.ipv6.internode.on.net [IPv6:2001:44b8:31fc:d00:ecde:7ed7:1c2c:43e2]) by vtr.rulingia.com (8.16.1/8.16.1) with ESMTPS id 19QKsILs042564 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 07:54:24 +1100 (AEDT) (envelope-from peter@rulingia.com) DKIM-Filter: OpenDKIM Filter v2.10.3 vtr.rulingia.com 19QKsILs042564 X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.16.1/8.16.1) with ESMTPS id 19QKsCI0010924 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Oct 2021 07:54:12 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.16.1/8.16.1/Submit) id 19QKsCai010923; Wed, 27 Oct 2021 07:54:12 +1100 (AEDT) (envelope-from peter) Date: Wed, 27 Oct 2021 07:54:12 +1100 From: Peter Jeremy To: Ed Maste Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 7b1e19ad78c6 - main - Add libfido2 to the build Message-ID: References: <202110230000.19N00JIK052888@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oyfAo94szTeP6IyR" Content-Disposition: inline In-Reply-To: <202110230000.19N00JIK052888@gitrepo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 4Hf3wY0LSDz3QBM X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=quarantine) header.from=rulingia.com; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-3.90 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[peter]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_SPAM_SHORT(1.00)[1.000]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_MATCH_FROMTLD(0.00)[]; DMARC_POLICY_ALLOW(-0.50)[rulingia.com,quarantine]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --oyfAo94szTeP6IyR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-Oct-23 00:00:19 +0000, Ed Maste wrote: >The branch main has been updated by emaste: > >URL: https://cgit.FreeBSD.org/src/commit/?id=3D7b1e19ad78c6a3f84f81cb1a16a= 39500f0337062 > >commit 7b1e19ad78c6a3f84f81cb1a16a39500f0337062 >Author: Ed Maste >AuthorDate: 2021-10-07 01:52:05 +0000 >Commit: Ed Maste >CommitDate: 2021-10-22 23:57:57 +0000 > > Add libfido2 to the build This triggered build failures on two of my hosts: The first problem is that libfido2 is always built but has hard dependencies on and . The latter two headers are optionally installed based on "WITHOUT_USB". I worked around it by removing WITHOUT_USB but I'm not sure of the best general solution here - making libfido2 optional would make the SSH integration more complex. The second problem showed up in a META_MODE parallel build as: "install: libprivatefido2.a: No such file or directory" with the following meta data: =2EERROR_TARGET=3D'_libinstall' =2EERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/lib/libfido2/_libinsta= ll.meta' =2EMAKE.LEVEL=3D'5' =2ECURDIR=3D'/usr/src/lib/libfido2' =2EOBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/lib/libfido2' =2ETARGETS=3D'install' DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' A retry succeeded so this may indicate a dependency tracking issue. I haven't dug into this further yet. --=20 Peter Jeremy --oyfAo94szTeP6IyR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmF4au5fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzTQfA/+OWd/r3hn5kXuBWlP26yWh/T01WZrGSrG6pcfYV8EOwD//7V3CL+WiHYm CBZM9x53KvUpLY1AgTm6w6CB+n70xPuirk7mqTgE9gOofCOiFTXVRPuM57V0N5RH zwz2ZnC4+L5xIi1OE69b3PlNhjj90eN1D6SBk/o+c9lsezoXFKvqP11sCgFk2zN9 EO+xv06BnqUQo3lfTTpH8OBJMSBLnhOdlCRPgbNGGEtgkXqnbeYXgMsbWRm7St6C 5OJ7fC+lE9V9w8b3jAkhtLAFjyejmnm3iviBYOOIUqpuFMw41tK+Y9zs71bIritj U9X3vM14OFoRnVgF7O/wVYXMZjUoLgbasTn4WY2H0JNh8y0CVOQcxQG4yeK/142c 47/QFUckaz7bMhLHJkva91jSQv2l148/L76DbuMDQ9n7kjiLYgcZLXeG0vBP5Ohe mxz4XDWKACU5eg5XSU1QeKsMty+l2UtkTBehoID09yZBRUWjic+uw8eIhdTeQ+K2 d5n30kqu0alDoTuW/Zzvpg8fzlMFryTmX8n80s83Jf9Xm+5vE1kckBwCPmYWdRwV GC7Bq3t6Y8lbu1kXCU4WBP31Y7HVxZNSeZHLhYG5ApnqFXgOAL99/nW0J/+gZhkT EXQZCn2YicGCMIYVqKjXgzjOaUMsf4RZiXEcOG8Oqp2An/vfiKo= =hNLR -----END PGP SIGNATURE----- --oyfAo94szTeP6IyR-- From nobody Tue Oct 26 21:00:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 24C531825C38; Tue, 26 Oct 2021 21:00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf43T0P7Yz3RBV; Tue, 26 Oct 2021 21:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E1C16235B7; Tue, 26 Oct 2021 21:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QL0abq014228; Tue, 26 Oct 2021 21:00:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QL0aW0014227; Tue, 26 Oct 2021 21:00:36 GMT (envelope-from git) Date: Tue, 26 Oct 2021 21:00:36 GMT Message-Id: <202110262100.19QL0aW0014227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4e56152e47dd - stable/13 - pthread_np.3: Add a manpage summarizing all of the pthread extensions. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e56152e47dd0093a09e6dddff2c5538e7af5427 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4e56152e47dd0093a09e6dddff2c5538e7af5427 commit 4e56152e47dd0093a09e6dddff2c5538e7af5427 Author: Felix Johnson AuthorDate: 2021-10-07 17:45:21 +0000 Commit: John Baldwin CommitDate: 2021-10-26 20:59:28 +0000 pthread_np.3: Add a manpage summarizing all of the pthread extensions. PR: 197299 (cherry picked from commit df7d763849655f4038428f97804bf7324d801684) --- share/man/man3/Makefile | 1 + share/man/man3/pthread.3 | 8 +- share/man/man3/pthread_affinity_np.3 | 5 +- share/man/man3/pthread_attr_affinity_np.3 | 3 +- share/man/man3/pthread_attr_get_np.3 | 5 +- share/man/man3/pthread_attr_setcreatesuspend_np.3 | 3 +- share/man/man3/pthread_getthreadid_np.3 | 3 +- share/man/man3/pthread_join.3 | 6 +- share/man/man3/pthread_main_np.3 | 3 +- share/man/man3/pthread_multi_np.3 | 3 +- share/man/man3/pthread_mutexattr_getkind_np.3 | 5 +- share/man/man3/pthread_np.3 | 230 ++++++++++++++++++++++ share/man/man3/pthread_resume_all_np.3 | 3 +- share/man/man3/pthread_resume_np.3 | 3 +- share/man/man3/pthread_set_name_np.3 | 3 +- share/man/man3/pthread_suspend_all_np.3 | 3 +- share/man/man3/pthread_suspend_np.3 | 3 +- share/man/man3/pthread_switch_add_np.3 | 5 +- 18 files changed, 273 insertions(+), 22 deletions(-) diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index ea01c2169100..37c7d0d79ab3 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -412,6 +412,7 @@ PTHREAD_MAN= pthread.3 \ pthread_mutex_timedlock.3 \ pthread_mutex_trylock.3 \ pthread_mutex_unlock.3 \ + pthread_np.3 \ pthread_once.3 \ pthread_resume_all_np.3 \ pthread_resume_np.3 \ diff --git a/share/man/man3/pthread.3 b/share/man/man3/pthread.3 index 8a437b1cedb4..6b7b82eb27f5 100644 --- a/share/man/man3/pthread.3 +++ b/share/man/man3/pthread.3 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2018 +.Dd October 12, 2021 .Dt PTHREAD 3 .Os .Sh NAME @@ -67,6 +67,10 @@ Per-Thread Context Routines .It Cleanup Routines .El +.Pp +.Fx +extensions to the POSIX thread functions are summarized in +.Xr pthread_np 3 . .Ss Thread Routines .Bl -tag -width indent .It Xo @@ -478,7 +482,6 @@ functions and the thread functions. Threaded applications are linked with this library. .Sh SEE ALSO .Xr libthr 3 , -.Xr pthread_affinity_np 3 , .Xr pthread_atfork 3 , .Xr pthread_attr 3 , .Xr pthread_cancel 3 , @@ -513,6 +516,7 @@ Threaded applications are linked with this library. .Xr pthread_mutexattr_setprioceiling 3 , .Xr pthread_mutexattr_setprotocol 3 , .Xr pthread_mutexattr_settype 3 , +.Xr pthread_np 3 , .Xr pthread_once 3 , .Xr pthread_rwlock_destroy 3 , .Xr pthread_rwlock_init 3 , diff --git a/share/man/man3/pthread_affinity_np.3 b/share/man/man3/pthread_affinity_np.3 index 24fef03ab4ed..0a52add2ee3c 100644 --- a/share/man/man3/pthread_affinity_np.3 +++ b/share/man/man3/pthread_affinity_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 23, 2010 +.Dd October 12, 2021 .Dt PTHREAD_AFFINITY_NP 3 .Os .Sh NAME @@ -124,7 +124,8 @@ operation. .Xr cpuset_setid 2 , .Xr pthread 3 , .Xr pthread_attr_getaffinity_np 3 , -.Xr pthread_attr_setaffinity_np 3 +.Xr pthread_attr_setaffinity_np 3 , +.Xr pthread_np 3 .Sh STANDARDS The .Nm pthread_getaffinity_np diff --git a/share/man/man3/pthread_attr_affinity_np.3 b/share/man/man3/pthread_attr_affinity_np.3 index 4c400b9a17e7..7b1cd3dea0d9 100644 --- a/share/man/man3/pthread_attr_affinity_np.3 +++ b/share/man/man3/pthread_attr_affinity_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2016 +.Dd October 12, 2021 .Dt PTHREAD_ATTR_AFFINITY_NP 3 .Os .Sh NAME @@ -132,6 +132,7 @@ Insufficient memory exists to store the cpuset mask. .Xr cpuset_getid 2 , .Xr cpuset_setid 2 , .Xr pthread_getaffinity_np 3 , +.Xr pthread_np 3 , .Xr pthread_setaffinity_np 3 .Sh STANDARDS The diff --git a/share/man/man3/pthread_attr_get_np.3 b/share/man/man3/pthread_attr_get_np.3 index a23cac6997c9..336c3626a27c 100644 --- a/share/man/man3/pthread_attr_get_np.3 +++ b/share/man/man3/pthread_attr_get_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2003 +.Dd October 12, 2021 .Dt PTHREAD_ATTR_GET_NP 3 .Os .Sh NAME @@ -107,7 +107,8 @@ thread ID. .Xr pthread_attr_getstack 3 , .Xr pthread_attr_getstackaddr 3 , .Xr pthread_attr_getstacksize 3 , -.Xr pthread_attr_init 3 +.Xr pthread_attr_init 3 , +.Xr pthread_np 3 .Sh AUTHORS The .Fn pthread_attr_get_np diff --git a/share/man/man3/pthread_attr_setcreatesuspend_np.3 b/share/man/man3/pthread_attr_setcreatesuspend_np.3 index 75408ccefc62..d2c6a6f74694 100644 --- a/share/man/man3/pthread_attr_setcreatesuspend_np.3 +++ b/share/man/man3/pthread_attr_setcreatesuspend_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_ATTR_SETCREATESUSPEND_NP 3 .Os .Sh NAME @@ -65,6 +65,7 @@ is invalid. .Xr pthread_attr_destroy 3 , .Xr pthread_attr_init 3 , .Xr pthread_create 3 , +.Xr pthread_np 3 , .Xr pthread_resume_all_np 3 , .Xr pthread_resume_np 3 .Sh AUTHORS diff --git a/share/man/man3/pthread_getthreadid_np.3 b/share/man/man3/pthread_getthreadid_np.3 index a912e7d42efa..562f6a7ae91a 100644 --- a/share/man/man3/pthread_getthreadid_np.3 +++ b/share/man/man3/pthread_getthreadid_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd October 12, 2021 .Dt PTHREAD_GETTHREADID_NP 3 .Os .Sh NAME @@ -50,6 +50,7 @@ function returns the thread integral ID of the calling thread. .Sh ERRORS None. .Sh SEE ALSO +.Xr pthread_np 3 , .Xr pthread_self 3 .Sh AUTHORS This manual page was written by diff --git a/share/man/man3/pthread_join.3 b/share/man/man3/pthread_join.3 index 799f6409fbfa..4cd04eade0aa 100644 --- a/share/man/man3/pthread_join.3 +++ b/share/man/man3/pthread_join.3 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2019 +.Dd October 12, 2021 .Dt PTHREAD_JOIN 3 .Os .Sh NAME @@ -156,7 +156,9 @@ The specified thread has not yet exited. .El .Sh SEE ALSO .Xr wait 2 , -.Xr pthread_create 3 +.Xr pthread 3 , +.Xr pthread_create 3 , +.Xr pthread_np 3 .Sh STANDARDS The .Fn pthread_join diff --git a/share/man/man3/pthread_main_np.3 b/share/man/man3/pthread_main_np.3 index 81669b786094..c386cb224a9b 100644 --- a/share/man/man3/pthread_main_np.3 +++ b/share/man/man3/pthread_main_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_MAIN_NP 3 .Os .Sh NAME @@ -54,6 +54,7 @@ and \-1 if the thread's initialization has not yet completed. .Sh SEE ALSO .Xr pthread_create 3 , .Xr pthread_equal 3 , +.Xr pthread_np 3 , .Xr pthread_self 3 .Sh AUTHORS This manual page was written by diff --git a/share/man/man3/pthread_multi_np.3 b/share/man/man3/pthread_multi_np.3 index c790d358ca3c..065b53c49b1f 100644 --- a/share/man/man3/pthread_multi_np.3 +++ b/share/man/man3/pthread_multi_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_MULTI_NP 3 .Os .Sh NAME @@ -59,6 +59,7 @@ and .Nm pthread_single_np functions always return 0. .Sh SEE ALSO +.Xr pthread_np 3 , .Xr pthread_resume_all_np 3 , .Xr pthread_suspend_all_np 3 .Sh AUTHORS diff --git a/share/man/man3/pthread_mutexattr_getkind_np.3 b/share/man/man3/pthread_mutexattr_getkind_np.3 index fe5435f90c30..cc3cc3df20ae 100644 --- a/share/man/man3/pthread_mutexattr_getkind_np.3 +++ b/share/man/man3/pthread_mutexattr_getkind_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_MUTEXATTR_GETKIND_NP 3 .Os .Sh NAME @@ -78,4 +78,5 @@ is invalid. .Xr pthread_mutex_destroy 3 , .Xr pthread_mutex_init 3 , .Xr pthread_mutexattr_gettype 3 , -.Xr pthread_mutexattr_settype 3 +.Xr pthread_mutexattr_settype 3 , +.Xr pthread_np 3 diff --git a/share/man/man3/pthread_np.3 b/share/man/man3/pthread_np.3 new file mode 100644 index 000000000000..caab8cc13209 --- /dev/null +++ b/share/man/man3/pthread_np.3 @@ -0,0 +1,230 @@ +.\" Copyright (c) 2021 Felix Johnson +.\" +.\" 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 COPYRIGHT HOLDERS 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 COPYRIGHT +.\" HOLDER 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. +.\" +.Dd October 12, 2021 +.Dt PTHREAD_NP 3 +.Os +.Sh NAME +.Nm pthread_np +.Nd FreeBSD extensions to POSIX thread functions +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread_np.h +.Sh DESCRIPTION +This manual page documents extensions to the POSIX thread functions. +These extensions may or may not be portable to other operating systems. +.Pp +The POSIX thread functions are summarized in this section in the following +groups: +.Pp +.Bl -bullet -offset indent -compact +.It +Thread Routines +.It +Attribute Object Routines +.It +Mutex Routines +.El +.\" .It +.\" Condition Variable Routines +.\" .It +.\" Read/Write Lock Routines +.\" .It +.\" Per-Thread Context Routines +.\" .It +.\" Cleanup Routines +.Ss Thread Routines +.Bl -tag -width indent +.It Xo +.Ft int +.Fo pthread_getaffinity_np +.Fa "pthread_t td" "size_t cpusetsize" "cpuset_t *cpusetp" +.Fc +.Xc +Get the CPU affinity of a specified thread. +.It Xo +.Ft int +.Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len" +.Xc +Get the name of a specified thread. +.It Xo +.Ft int +.Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len" +.Xc +Get the name of a specified thread. +.It Xo +.Ft int +.Fn pthread_getthreadid_np void +.Xc +Get the calling thread's integral ID. +.It Xo +.Ft int +.Fn pthread_main_np void +.Xc +Identify the initial thread. +.It Xo +.Ft int +.Fn pthread_multi_np void +.Xc +Sets the thread's scheduling mode to multi-threaded. +.It Xo +.Ft int +.Fn pthread_peekjoin_np "pthread_t thread" "void **value_ptr" +.Xc +Peek into the exit status of a specified thread. +.It Xo +.Ft int +.Fn pthread_resume_all_np void +.Xc +Resume all suspended threads. +.It Xo +.Ft int +.Fo pthread_setaffinity_np +.Fa "pthread_t td" "size_t cpusetsize" "const cpuset_t *cpusetp" +.Fc +.Xc +Set the CPU affinity of a specified thread. +.It Xo +.Ft int +.Fn pthread_set_name_np "pthread_t thread" "char *name" +.Xc +Sets the specified thread's name. +.It Xo +.Ft int +.Fn pthread_setname_np "pthread_t thread" "char *name" +.Xc +Sets the specified thread's name. +.It Xo +.Ft int +.Fn pthread_single_np void +.Xc +Sets the thread's scheduling mode to single-threaded. +.It Xo +.Ft int +.Fn pthread_suspend_np "pthread_t tid" +.Xc +Suspend the specified thread. +.It Xo +.Ft int +.Fn pthread_suspend_all_np void +.Xc +Suspend all active threads. +.It Xo +.Ft int +.Fn pthread_switch_add_np "pthread_switch_routine_t routine" +.Xc +Install a routine that is called every time a thread context switches. +.It Xo +.Ft int +.Fn pthread_switch_delete_np "pthread_switch_routine_t routine" +.Xc +Remove a routine that is called every time a thread context switches. +.It Xo +.Ft int +.Fo pthread_timedjoin_np +.Fa "pthread_t thread" "void **value_ptr" "const struct timespec *abstime" +.Fc +.Xc +A variant of +.Fn pthread_join +with a timeout. +.El +.Ss Attribute Object Routines +.Bl -tag -width indent +.It Xo +.Ft int +.Fo pthread_attr_get_np +.Fa "pthread_t pid" "pthread_attr_t *dst" +.Fc +.Xc +Get the attributes of an existent thread. +.It Xo +.Ft int +.Fo pthread_attr_getaffinity_np +.Fa "const pthread_attr_t *pattr" "size_t cpusetsize" "cpuset_t *cpusetp" +.Fc +.Xc +Get the CPU affinity mask from the thread attribute object. +.It Xo +.Ft int +.Fo pthread_attr_setaffinity_np +.Fa "pthread_attr_t *pattr" "size_t cpusetsize" "const cpuset_t *cpusetp" +.Fc +.Xc +Set the CPU affinity mask for the thread attribute object. +.It Xo +.Ft int +.Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr" +.Xc +Permit creation of suspended threads. +.El +.Ss Mutex Routines +.Bl -tag -width indent +.It Xo +.Ft int +.Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr" +.Xc +Deprecated, use +.Xr pthread_mutexattr_gettype 3 +instead. +.It Xo +.Ft int +.Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr" +.Xc +Deprecated, use +.Xr pthread_mutexattr_settype 3 +instead. +.El +.\" .Ss Condition Variable Routines +.\" .Bl -tag -width indent +.\" .El +.\" .Ss Read/Write Lock Routines +.\" .Bl -tag -width indent +.\" .El +.\" .Ss Per-Thread Context Routines +.\" .Bl -tag -width indent +.\" .El +.\" .Ss Cleanup Routines +.\" .Bl -tag -width indent +.\" .El +.Sh SEE ALSO +.Xr libthr 3 , +.Xr pthread 3 , +.Xr pthread_affinity_np 3 , +.Xr pthread_attr_affinity_np 3 , +.Xr pthread_attr_get_np 3 , +.Xr pthread_attr_setcreatesuspend_np 3 , +.Xr pthread_getthreadid_np 3 , +.Xr pthread_join 3 , +.Xr pthread_main_np 3 , +.Xr pthread_multi_np 3 , +.Xr pthread_mutexattr_getkind_np 3 , +.Xr pthread_resume_all_np 3 , +.Xr pthread_resume_np 3 , +.Xr pthread_set_name_np 3 , +.Xr pthread_suspend_all_np 3 , +.Xr pthread_suspend_np 3 , +.Xr pthread_switch_add_np 3 +.Sh STANDARDS +All of these functions are non-portable extensions to POSIX threads. diff --git a/share/man/man3/pthread_resume_all_np.3 b/share/man/man3/pthread_resume_all_np.3 index 0ac6736a9b74..40df03a07af1 100644 --- a/share/man/man3/pthread_resume_all_np.3 +++ b/share/man/man3/pthread_resume_all_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_RESUME_ALL_NP 3 .Os .Sh NAME @@ -43,6 +43,7 @@ function causes all active threads to be scanned and resumes those which were previously suspended. .Sh SEE ALSO .Xr pthread_attr_setcreatesuspend_np 3 , +.Xr pthread_np 3 , .Xr pthread_resume_np 3 , .Xr pthread_suspend_all_np 3 , .Xr pthread_suspend_np 3 diff --git a/share/man/man3/pthread_resume_np.3 b/share/man/man3/pthread_resume_np.3 index 898dbf9c0d11..16833872c010 100644 --- a/share/man/man3/pthread_resume_np.3 +++ b/share/man/man3/pthread_resume_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_RESUME_NP 3 .Os .Sh NAME @@ -64,6 +64,7 @@ argument. .El .Sh SEE ALSO .Xr pthread_attr_setcreatesuspend_np 3 , +.Xr pthread_np 3 , .Xr pthread_resume_all_np 3 , .Xr pthread_suspend_all_np 3 , .Xr pthread_suspend_np 3 diff --git a/share/man/man3/pthread_set_name_np.3 b/share/man/man3/pthread_set_name_np.3 index af668165d91a..5fb627a5a182 100644 --- a/share/man/man3/pthread_set_name_np.3 +++ b/share/man/man3/pthread_set_name_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 3, 2020 +.Dd October 12, 2021 .Dt PTHREAD_SET_NAME_NP 3 .Os .Sh NAME @@ -90,6 +90,7 @@ and functions, all errors that may appear inside are silently ignored. .Sh SEE ALSO +.Xr pthread_np 3 , .Xr thr_set_name 2 .Sh STANDARDS .Fn pthread_set_name_np diff --git a/share/man/man3/pthread_suspend_all_np.3 b/share/man/man3/pthread_suspend_all_np.3 index ecedca3ee24d..2821c7360786 100644 --- a/share/man/man3/pthread_suspend_all_np.3 +++ b/share/man/man3/pthread_suspend_all_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2016 +.Dd October 12, 2021 .Dt PTHREAD_SUSPEND_ALL_NP 3 .Os .Sh NAME @@ -52,6 +52,7 @@ function to use any non-async signal safe functions, besides until threads are resumed, unless measures are taken to ensure that all threads are suspended at safe points. .Sh SEE ALSO +.Xr pthread_np 3 , .Xr pthread_resume_all_np 3 , .Xr pthread_resume_np 3 , .Xr pthread_suspend_np 3 diff --git a/share/man/man3/pthread_suspend_np.3 b/share/man/man3/pthread_suspend_np.3 index ca8c72a38c52..58bcf56964b6 100644 --- a/share/man/man3/pthread_suspend_np.3 +++ b/share/man/man3/pthread_suspend_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2016 +.Dd October 12, 2021 .Dt PTHREAD_SUSPEND_NP 3 .Os .Sh NAME @@ -69,6 +69,7 @@ No thread could be found corresponding to the thread ID specified by the argument. .El .Sh SEE ALSO +.Xr pthread_np 3 , .Xr pthread_resume_all_np 3 , .Xr pthread_resume_np 3 , .Xr pthread_suspend_all_np 3 diff --git a/share/man/man3/pthread_switch_add_np.3 b/share/man/man3/pthread_switch_add_np.3 index e3400e790335..ddfa630ffd9a 100644 --- a/share/man/man3/pthread_switch_add_np.3 +++ b/share/man/man3/pthread_switch_add_np.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd October 12, 2021 .Dt PTHREAD_SWITCH_ADD_NP 3 .Os .Sh NAME @@ -81,7 +81,8 @@ argument is different from the argument previously passed to the function. .El .Sh SEE ALSO -.Xr pthread_create 3 +.Xr pthread_create 3 , +.Xr pthread_np 3 .Sh AUTHORS This manual page was written by .An Alexey Zelkin Aq Mt phantom@FreeBSD.org . From nobody Tue Oct 26 21:04:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E9A211826F28; Tue, 26 Oct 2021 21:05:05 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf48d6Gnmz3hyV; Tue, 26 Oct 2021 21:05:05 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f49.google.com with SMTP id d63so1041877iof.4; Tue, 26 Oct 2021 14:05:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g7kvhccdP2pszWsa7QmhJmxmHSn/69lLW598mHcdB3w=; b=jpW+nqnIluqrKMvqkXK6MsMIT6mPEQqW+rh0+AMfCPfAbP0lPUwBGRgAZOMxd2yU/P ez8nhPNWEJGN6U75spc6/R6KYr7d6ciXyrgWrdp4olx5t/w2BAo9kNAcp9BQx+OeNtfO baOs0v5Q4K0wKxDm6OFqjmjcRzGBm9UfaBgytrvA6b9Z/W/FikDnNJeea4OgiCGAM8xy +wM8Qend6nGAwgQHxTc1zqZcRDFmffGhJk4OM4iRFe2WtM7r9JoDx3yYs+yGvC7BluAw 6qUqhsy7qXcSVbiar+Vqllj4YvdeGhnIxSitrw2SxaX4VGmrlVsPm/lPZqCyNcVOI1HF Sb2Q== X-Gm-Message-State: AOAM533R2u9nc7/RRos47eXNZwxnfm+dj0lYnk8lG/uCIg20cyQW8u2q +GYN10ONyIQkR60HS640aiPYPUhiuMLFBHxzkesD6AZ8 X-Google-Smtp-Source: ABdhPJynHa4LF7ziXvq12wJRldnQhHkFZ0RdLzBEmHijvrzJN7PAM2xBIAj9uA7Vozcxtm1hIyEte1mxdPVUyltAHdg= X-Received: by 2002:a05:6638:2410:: with SMTP id z16mr17507615jat.76.1635282298340; Tue, 26 Oct 2021 14:04:58 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202110230000.19N00JIK052888@gitrepo.freebsd.org> In-Reply-To: From: Ed Maste Date: Tue, 26 Oct 2021 17:04:44 -0400 Message-ID: Subject: Re: git: 7b1e19ad78c6 - main - Add libfido2 to the build To: Peter Jeremy Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Hf48d6Gnmz3hyV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, 26 Oct 2021 at 16:54, Peter Jeremy wrote: > > This triggered build failures on two of my hosts: > > The first problem is that libfido2 is always built but has hard > dependencies on and . The latter > two headers are optionally installed based on "WITHOUT_USB". I worked > around it by removing WITHOUT_USB but I'm not sure of the best general > solution here - making libfido2 optional would make the SSH integration > more complex. Thanks for the report. I think we can always build ssh-sk-helper, but have it use internal support only when MK_USB is true. This should simplify the integration. From nobody Tue Oct 26 21:20:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A7F52182C7F1; Tue, 26 Oct 2021 21:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf4Tw4S8jz3mt5; Tue, 26 Oct 2021 21:20:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 79C6123C50; Tue, 26 Oct 2021 21:20:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QLK4sX034047; Tue, 26 Oct 2021 21:20:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QLK4nX034044; Tue, 26 Oct 2021 21:20:04 GMT (envelope-from git) Date: Tue, 26 Oct 2021 21:20:04 GMT Message-Id: <202110262120.19QLK4nX034044@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: 93942379cced - main - Avoid building libfido2 if WITHOUT_USB List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93942379cced89ad4ac653f262ac8277a8550853 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=93942379cced89ad4ac653f262ac8277a8550853 commit 93942379cced89ad4ac653f262ac8277a8550853 Author: Ed Maste AuthorDate: 2021-10-26 21:15:54 +0000 Commit: Ed Maste CommitDate: 2021-10-26 21:17:56 +0000 Avoid building libfido2 if WITHOUT_USB libfido2 requires USB, so disable it if not available. Reported by: peterj Fixes: 7b1e19ad78c6 ("Add libfido2 to the build") Sponsored by: The FreeBSD Foundation --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 81ace36ba990..3f30917173af 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -215,7 +215,7 @@ SUBDIR.${MK_BHYVE}+= libvmmapi .if ${MACHINE_ARCH} != "powerpc" SUBDIR.${MK_OPENMP}+= libomp .endif -.if !defined(COMPAT_32BIT) +.if !defined(COMPAT_32BIT) && ${MK_USB} != "no" SUBDIR.${MK_OPENSSH}+= libcbor libfido2 .endif SUBDIR.${MK_OPENSSL}+= libmp From nobody Tue Oct 26 21:55:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0C6F2181BA90; Tue, 26 Oct 2021 21:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf5HD6sWtz4RPm; Tue, 26 Oct 2021 21:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BEB6B24144; Tue, 26 Oct 2021 21:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QLtquT084074; Tue, 26 Oct 2021 21:55:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QLtqeS084073; Tue, 26 Oct 2021 21:55:52 GMT (envelope-from git) Date: Tue, 26 Oct 2021 21:55:52 GMT Message-Id: <202110262155.19QLtqeS084073@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: cdbc4a074bec - main - Further refine the ExpDataSN checks for SCSI Response PDUs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cdbc4a074bec094dc7f1dfde0773a9417d118ffa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cdbc4a074bec094dc7f1dfde0773a9417d118ffa commit cdbc4a074bec094dc7f1dfde0773a9417d118ffa Author: John Baldwin AuthorDate: 2021-10-26 21:50:05 +0000 Commit: John Baldwin CommitDate: 2021-10-26 21:50:05 +0000 Further refine the ExpDataSN checks for SCSI Response PDUs. According to 11.4.8 in RFC 7143, ExpDataSN MUST be 0 if the response code is not Command Completed, but we were requiring it to always be the count of DataIn PDUs regardless of the response code. In addition, at least one target (OCI Oracle iSCSI block device) returns an ExpDataSN of 0 when returning a valid completion with an error status (Check Condition) in response to a SCSI Inquiry. As a workaround for this target, only warn without resetting the connection for a 0 ExpDataSN for responses with a non-zero error status. PR: 259152 Reported by: dch Reviewed by: dch, mav, emaste Fixes: 4f0f5bf99591 iscsi: Validate DataSN values in Data-In PDUs in the initiator. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32650 --- sys/dev/iscsi/iscsi.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index eba365f7ad3e..9f49db2ad935 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -892,15 +892,39 @@ iscsi_pdu_handle_scsi_response(struct icl_pdu *response) } ccb = io->io_ccb; - if (ntohl(bhssr->bhssr_expdatasn) != io->io_datasn) { - ISCSI_SESSION_WARN(is, - "ExpDataSN mismatch in SCSI Response (%u vs %u)", - ntohl(bhssr->bhssr_expdatasn), io->io_datasn); - icl_pdu_free(response); - iscsi_session_reconnect(is); - ISCSI_SESSION_UNLOCK(is); - return; + if (bhssr->bhssr_response == BHSSR_RESPONSE_COMMAND_COMPLETED) { + if (ntohl(bhssr->bhssr_expdatasn) != io->io_datasn) { + ISCSI_SESSION_WARN(is, + "ExpDataSN mismatch in SCSI Response (%u vs %u)", + ntohl(bhssr->bhssr_expdatasn), io->io_datasn); + + /* + * XXX: Permit an ExpDataSN of zero for errors. + * + * This doesn't conform to RFC 7143, but some + * targets seem to do this. + */ + if (bhssr->bhssr_status != 0 && + bhssr->bhssr_expdatasn == htonl(0)) + goto skip_expdatasn; + + icl_pdu_free(response); + iscsi_session_reconnect(is); + ISCSI_SESSION_UNLOCK(is); + return; + } + } else { + if (bhssr->bhssr_expdatasn != htonl(0)) { + ISCSI_SESSION_WARN(is, + "ExpDataSN mismatch in SCSI Response (%u vs 0)", + ntohl(bhssr->bhssr_expdatasn)); + icl_pdu_free(response); + iscsi_session_reconnect(is); + ISCSI_SESSION_UNLOCK(is); + return; + } } +skip_expdatasn: /* * With iSER, after getting good response we can be sure From nobody Tue Oct 26 21:55:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 56F99181B95E; Tue, 26 Oct 2021 21:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf5HG0VZ0z4R0f; Tue, 26 Oct 2021 21:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DAC4F24067; Tue, 26 Oct 2021 21:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QLtr5L084098; Tue, 26 Oct 2021 21:55:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QLtrSm084097; Tue, 26 Oct 2021 21:55:53 GMT (envelope-from git) Date: Tue, 26 Oct 2021 21:55:53 GMT Message-Id: <202110262155.19QLtrSm084097@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: 7ef7b252adc0 - main - ctld: Always declare MaxRecvDataSegmentLength. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ef7b252adc0152e5f726d00640124c5de0909a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ef7b252adc0152e5f726d00640124c5de0909a9 commit 7ef7b252adc0152e5f726d00640124c5de0909a9 Author: John Baldwin AuthorDate: 2021-10-26 21:52:40 +0000 Commit: John Baldwin CommitDate: 2021-10-26 21:52:40 +0000 ctld: Always declare MaxRecvDataSegmentLength. This key is Declarative and should always be sent even if the initiator did not send it's own limit. This is similar to the fix in fc79cf4fea72 but for the target side. However, unlike that fix, failure to send the key simply results in reduced performance. PR: 259439 Reviewed by: mav, emaste Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32651 --- usr.sbin/ctld/login.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index f219a3044586..63b2cfd51d92 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -565,10 +565,6 @@ login_negotiate_key(struct pdu *request, const char *name, tmp = conn->conn_max_send_data_segment_limit; } conn->conn_max_send_data_segment_length = tmp; - conn->conn_max_recv_data_segment_length = - conn->conn_max_recv_data_segment_limit; - keys_add_int(response_keys, name, - conn->conn_max_recv_data_segment_length); } else if (strcmp(name, "MaxBurstLength") == 0) { tmp = strtoul(value, NULL, 10); if (tmp <= 0) { @@ -796,6 +792,11 @@ login_negotiate(struct connection *conn, struct pdu *request) log_errx(1, "initiator sent FirstBurstLength > MaxBurstLength"); } + conn->conn_max_recv_data_segment_length = + conn->conn_max_recv_data_segment_limit; + keys_add_int(response_keys, "MaxRecvDataSegmentLength", + conn->conn_max_recv_data_segment_length); + log_debugx("operational parameter negotiation done; " "transitioning to Full Feature Phase"); From nobody Tue Oct 26 22:34:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 39EC3182B72F; Tue, 26 Oct 2021 22:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf67t1BT1z4d7d; Tue, 26 Oct 2021 22:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0595424BB2; Tue, 26 Oct 2021 22:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QMYXGN038128; Tue, 26 Oct 2021 22:34:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QMYXRu038127; Tue, 26 Oct 2021 22:34:33 GMT (envelope-from git) Date: Tue, 26 Oct 2021 22:34:33 GMT Message-Id: <202110262234.19QMYXRu038127@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: 6312d144613f - main - lib/msun/ld128/s_tanpil.c: make it compile. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6312d144613f97bf59703c442ee4871be1450c46 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6312d144613f97bf59703c442ee4871be1450c46 commit 6312d144613f97bf59703c442ee4871be1450c46 Author: Konstantin Belousov AuthorDate: 2021-10-26 21:14:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 22:34:12 +0000 lib/msun/ld128/s_tanpil.c: make it compile. Declare local, add missed ';'. Name function properly. Fixes: dce5f3abed7181cc533ca5ed Reviewed by: kargl Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/msun/ld128/s_tanpil.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/ld128/s_tanpil.c b/lib/msun/ld128/s_tanpil.c index 33a61cf3115d..7cbbdc8a5d05 100644 --- a/lib/msun/ld128/s_tanpil.c +++ b/lib/msun/ld128/s_tanpil.c @@ -42,7 +42,7 @@ pi_hi = 3.14159265358979322702026593105983920e+00L, pi_lo = 1.14423774522196636802434264184180742e-17L; static inline long double -__kernel_tanpi(long double x) +__kernel_tanpil(long double x) { long double hi, lo, t; @@ -72,7 +72,7 @@ volatile static const double vzero = 0; long double tanpil(long double x) { - long double ax, hi, lo, xf; + long double ax, hi, lo, xf, t; uint32_t ix; ax = fabsl(ax); @@ -83,7 +83,7 @@ tanpil(long double x) if (x == 0) return (x); hi = (double)x; - hi *= 0x1p113L + hi *= 0x1p113L; lo = x * 0x1p113L - hi; t = (pi_lo + pi_hi) * lo + pi_lo * lo + pi_hi * hi; From nobody Tue Oct 26 22:34:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 961D1182B6B1; Tue, 26 Oct 2021 22:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf67v280Fz4dHG; Tue, 26 Oct 2021 22:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 275E92477B; Tue, 26 Oct 2021 22:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19QMYZiL038152; Tue, 26 Oct 2021 22:34:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19QMYZA5038151; Tue, 26 Oct 2021 22:34:35 GMT (envelope-from git) Date: Tue, 26 Oct 2021 22:34:35 GMT Message-Id: <202110262234.19QMYZA5038151@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: ca3d8cb087cd - main - lib/msun: Move the files to appropriate locations in the Makefile List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca3d8cb087cd5b40369478b1693f3e4038b5fa23 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ca3d8cb087cd5b40369478b1693f3e4038b5fa23 commit ca3d8cb087cd5b40369478b1693f3e4038b5fa23 Author: Steve Kargl AuthorDate: 2021-10-26 20:53:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-26 22:34:12 +0000 lib/msun: Move the files to appropriate locations in the Makefile Fixes: dce5f3abed7181cc533ca5ed PR: 218514 MFC after: 1 week --- lib/msun/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index dcee5572f949..1d94e371e61f 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -89,6 +89,11 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \ s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_tgammaf.c s_trunc.c s_truncf.c \ w_cabs.c w_cabsf.c w_drem.c w_dremf.c +# IEEE-754 2008 and ISO/IEC TS 18661-4 half-cycle trignometric functions +COMMON_SRCS+= s_cospi.c s_cospif.c \ + s_sinpi.c s_sinpif.c \ + s_tanpi.c s_tanpif.c + # Location of fpmath.h and _fpmath.h .if exists(${LIBCSRCDIR}/${MACHINE_ARCH}) LIBC_ARCH=${MACHINE_ARCH} @@ -113,12 +118,12 @@ COMMON_SRCS+= catrigl.c \ e_remainderl.c e_sinhl.c e_sqrtl.c \ invtrig.c k_cosl.c k_sinl.c k_tanl.c \ s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c \ - s_clogl.c s_cosl.c s_cprojl.c \ + s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \ s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \ s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \ - s_scalbnl.c s_sinl.c s_sincosl.c \ - s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c + s_scalbnl.c s_sinl.c s_sincosl.c s_sinpil.c \ + s_tanhl.c s_tanl.c s_tanpil.c s_truncl.c w_cabsl.c # Work around this warning from gcc: # lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of # 'long double' [-Werror=overflow] @@ -126,12 +131,6 @@ COMMON_SRCS+= catrigl.c \ # See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067 .if ${COMPILER_TYPE} == "gcc" CFLAGS.e_powl.c+= -Wno-error=overflow - -# IEEE-754 2008 and ISO/IEC TS 18661-4 half-cycle trignometric functions -COMMON_SRCS+= s_cospi.c s_cospif.c s_cospil.c \ - s_sinpi.c s_sinpif.c s_sinpil.c \ - s_tanpi.c s_tanpif.c s_tanpil.c - .endif .endif From nobody Wed Oct 27 00:45:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 53A1B18184D2; Wed, 27 Oct 2021 00:45:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92g1tz3z3ks6; Wed, 27 Oct 2021 00:45:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 209A5264D1; Wed, 27 Oct 2021 00:45:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jF2o011114; Wed, 27 Oct 2021 00:45:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jF7O011113; Wed, 27 Oct 2021 00:45:15 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:15 GMT Message-Id: <202110270045.19R0jF7O011113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: bb7b0674f622 - stable/13 - tmpfs: remove write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb7b0674f6228c7e5c232b38e1ceaefdf34715ed Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bb7b0674f6228c7e5c232b38e1ceaefdf34715ed commit bb7b0674f6228c7e5c232b38e1ceaefdf34715ed Author: Konstantin Belousov AuthorDate: 2021-10-20 01:54:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 tmpfs: remove write-only variables (cherry picked from commit 80bca63cf48d0f4f1c6cfc1dace1369947eaaa47) --- sys/fs/tmpfs/tmpfs_subr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index e746a7455860..2aa8891f907d 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -454,7 +454,6 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, const char *target, dev_t rdev, struct tmpfs_node **node) { struct tmpfs_node *nnode; - vm_object_t obj; char *symlink; char symlink_smr; @@ -566,7 +565,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, break; case VREG: - obj = nnode->tn_reg.tn_aobj = + nnode->tn_reg.tn_aobj = vm_pager_allocate(tmpfs_pager_type, NULL, 0, VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); From nobody Wed Oct 27 00:45:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8DEEB18183E2; Wed, 27 Oct 2021 00:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92h2npsz3kf4; Wed, 27 Oct 2021 00:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 40430266E1; Wed, 27 Oct 2021 00:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jGJH011138; Wed, 27 Oct 2021 00:45:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jGaP011137; Wed, 27 Oct 2021 00:45:16 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:16 GMT Message-Id: <202110270045.19R0jGaP011137@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3d7f945a6b77 - stable/13 - msdosfs_rename: remove write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3d7f945a6b770d466e605b7346f9a90da6a2c85d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3d7f945a6b770d466e605b7346f9a90da6a2c85d commit 3d7f945a6b770d466e605b7346f9a90da6a2c85d Author: Konstantin Belousov AuthorDate: 2021-10-20 01:55:50 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 msdosfs_rename: remove write-only variables (cherry picked from commit 2bd6d910b24343f7678be7482a78fd7d596e6753) --- sys/fs/msdosfs/msdosfs_vnops.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index dda45ddda2a4..d64dcf4266bb 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -941,14 +941,12 @@ msdosfs_rename(struct vop_rename_args *ap) struct componentname *fcnp, *tcnp; struct denode *fdip, *fip, *tdip, *tip, *nip; u_char toname[12], oldname[11]; - u_long from_diroffset, to_diroffset; + u_long to_diroffset; bool checkpath_locked, doingdirectory, newparent; - u_char to_count; int error; u_long cn, pcl, blkoff; daddr_t bn, wait_scn, scn; struct msdosfsmount *pmp; - struct mount *mp; struct direntry *dotdotp; struct buf *bp; @@ -968,7 +966,6 @@ msdosfs_rename(struct vop_rename_args *ap) /* * Check for cross-device rename. */ - mp = fvp->v_mount; if (fvp->v_mount != tdvp->v_mount || (tvp != NULL && fvp->v_mount != tvp->v_mount)) { error = EXDEV; @@ -1031,7 +1028,6 @@ relock: } vrele(fvp); fvp = DETOV(nip); - from_diroffset = fdip->de_fndoffset; error = msdosfs_lookup_ino(tdvp, NULL, tcnp, &scn, &blkoff); if (error != 0 && error != EJUSTRETURN) { @@ -1077,7 +1073,6 @@ relock: * Remember direntry place to use for destination */ to_diroffset = tdip->de_fndoffset; - to_count = tdip->de_fndcnt; /* * Be sure we are not renaming ".", "..", or an alias of ".". This From nobody Wed Oct 27 00:45:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A2A4A1818556; Wed, 27 Oct 2021 00:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92j3lYfz3kms; Wed, 27 Oct 2021 00:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5E748268B6; Wed, 27 Oct 2021 00:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jHnx011162; Wed, 27 Oct 2021 00:45:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jHgQ011161; Wed, 27 Oct 2021 00:45:17 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:17 GMT Message-Id: <202110270045.19R0jHgQ011161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 958335164054 - stable/13 - sys/bus.h: silence warnings about write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9583351640540846bee811008d452564b792505d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9583351640540846bee811008d452564b792505d commit 9583351640540846bee811008d452564b792505d Author: Konstantin Belousov AuthorDate: 2021-10-20 13:23:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 sys/bus.h: silence warnings about write-only variables (cherry picked from commit 2ff7c2cc4f28ab05caccb2936ba0d74c6734dd39) --- sys/sys/bus.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/bus.h b/sys/sys/bus.h index fbc69ca625c1..fa2b17008691 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -800,7 +800,7 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ static __inline type varp ## _get_ ## var(device_t dev) \ { \ uintptr_t v; \ - int e; \ + int e __diagused; \ e = BUS_READ_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, &v); \ KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ @@ -812,7 +812,7 @@ static __inline type varp ## _get_ ## var(device_t dev) \ static __inline void varp ## _set_ ## var(device_t dev, type t) \ { \ uintptr_t v = (uintptr_t) t; \ - int e; \ + int e __diagused; \ e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, v); \ KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ From nobody Wed Oct 27 00:45:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C829518183FB; Wed, 27 Oct 2021 00:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92l3HLzz3kYc; Wed, 27 Oct 2021 00:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 889A2268B7; Wed, 27 Oct 2021 00:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jIZQ011186; Wed, 27 Oct 2021 00:45:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jIgq011185; Wed, 27 Oct 2021 00:45:18 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:18 GMT Message-Id: <202110270045.19R0jIgq011185@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c026e9c5d3cd - stable/13 - ufs: remove write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c026e9c5d3cdc80ca31e25173783678ebdc844ea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c026e9c5d3cdc80ca31e25173783678ebdc844ea commit c026e9c5d3cdc80ca31e25173783678ebdc844ea Author: Konstantin Belousov AuthorDate: 2021-10-20 01:42:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 ufs: remove write-only variables (cherry picked from commit 2030ee0e1b17e45a162bba6a636e07886a9eb67c) --- sys/ufs/ffs/ffs_inode.c | 6 ++---- sys/ufs/ffs/ffs_softdep.c | 12 ++++-------- sys/ufs/ffs/ffs_vfsops.c | 5 ++--- sys/ufs/ffs/ffs_vnops.c | 4 ---- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index b78f46ae4ba0..4b2b2989fb81 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -244,8 +244,8 @@ ffs_truncate(vp, length, flags, cred) ufs2_daddr_t bn, lbn, lastblock, lastiblock[UFS_NIADDR]; ufs2_daddr_t indir_lbn[UFS_NIADDR], oldblks[UFS_NDADDR + UFS_NIADDR]; ufs2_daddr_t newblks[UFS_NDADDR + UFS_NIADDR]; - ufs2_daddr_t count, blocksreleased = 0, datablocks, blkno; - struct bufobj *bo; + ufs2_daddr_t count, blocksreleased = 0, blkno; + struct bufobj *bo __diagused; struct fs *fs; struct buf *bp; struct ufsmount *ump; @@ -297,10 +297,8 @@ ffs_truncate(vp, length, flags, cred) if (journaltrunc == 0 && DOINGSOFTDEP(vp) && length == 0) softdeptrunc = !softdep_slowdown(vp); extblocks = 0; - datablocks = DIP(ip, i_blocks); if (fs->fs_magic == FS_UFS2_MAGIC && ip->i_din2->di_extsize > 0) { extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); - datablocks -= extblocks; } if ((flags & IO_EXT) && extblocks > 0) { if (length != 0) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 27d1cc8b0537..0d2de850bd3e 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -5066,7 +5066,7 @@ softdep_setup_create(dp, ip) struct inode *ip; { struct inodedep *inodedep; - struct jaddref *jaddref; + struct jaddref *jaddref __diagused; struct vnode *dvp; KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0, @@ -5207,11 +5207,9 @@ softdep_setup_rmdir(dp, ip) struct inode *dp; struct inode *ip; { - struct vnode *dvp; KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0, ("softdep_setup_rmdir called on non-softdep filesystem")); - dvp = ITOV(dp); ACQUIRE_LOCK(ITOUMP(dp)); (void) inodedep_lookup_ip(ip); (void) inodedep_lookup_ip(dp); @@ -5227,11 +5225,9 @@ softdep_setup_unlink(dp, ip) struct inode *dp; struct inode *ip; { - struct vnode *dvp; KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0, ("softdep_setup_unlink called on non-softdep filesystem")); - dvp = ITOV(dp); ACQUIRE_LOCK(ITOUMP(dp)); (void) inodedep_lookup_ip(ip); (void) inodedep_lookup_ip(dp); @@ -6426,7 +6422,7 @@ setup_allocindir_phase2(bp, ip, inodedep, aip, lbn) struct allocindir *aip; /* allocindir allocated by the above routines */ ufs_lbn_t lbn; /* Logical block number for this block. */ { - struct fs *fs; + struct fs *fs __diagused; struct indirdep *indirdep; struct allocindir *oldaip; struct freefrag *freefrag; @@ -10628,7 +10624,7 @@ initiate_write_inodeblock_ufs1(inodedep, bp) #ifdef INVARIANTS ufs_lbn_t prevlbn = 0; #endif - int deplist; + int deplist __diagused; if (inodedep->id_state & IOSTARTED) panic("initiate_write_inodeblock_ufs1: already started"); @@ -10800,7 +10796,7 @@ initiate_write_inodeblock_ufs2(inodedep, bp) #ifdef INVARIANTS ufs_lbn_t prevlbn = 0; #endif - int deplist; + int deplist __diagused; if (inodedep->id_state & IOSTARTED) panic("initiate_write_inodeblock_ufs2: already started"); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index fb00218f5d3a..0b96edff12ff 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -374,7 +374,8 @@ ffs_mount(struct mount *mp) struct thread *td; struct ufsmount *ump = NULL; struct fs *fs; - int error, error1, flags; + int error, flags; + int error1 __diagused; uint64_t mntorflags, saved_mnt_flag; accmode_t accmode; struct nameidata ndp; @@ -1646,11 +1647,9 @@ ffs_sync_lazy(mp) { struct vnode *mvp, *vp; struct inode *ip; - struct thread *td; int allerror, error; allerror = 0; - td = curthread; if ((mp->mnt_flag & MNT_NOATIME) != 0) { #ifdef QUOTA qsync(mp); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 7b2c70af54c9..ceea2237c94e 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1399,7 +1399,6 @@ static int ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) { struct inode *ip; - struct ufs2_dinode *dp; int error; ip = VTOI(vp); @@ -1410,7 +1409,6 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) ffs_unlock_ea(vp); return (0); } - dp = ip->i_din2; error = ffs_rdextattr(&ip->i_ea_area, vp, td); if (error) { ffs_unlock_ea(vp); @@ -1994,7 +1992,6 @@ ffs_vput_pair(struct vop_vput_pair_args *ap) struct inode *dp, *ip; ino_t ip_ino; u_int64_t ip_gen; - off_t old_size; int error, vp_locked; dvp = ap->a_dvp; @@ -2031,7 +2028,6 @@ ffs_vput_pair(struct vop_vput_pair_args *ap) VNASSERT(I_ENDOFF(dp) != 0 && I_ENDOFF(dp) < dp->i_size, dvp, ("IN_ENDOFF set but I_ENDOFF() is not")); dp->i_flag &= ~IN_ENDOFF; - old_size = dp->i_size; error = UFS_TRUNCATE(dvp, (off_t)I_ENDOFF(dp), IO_NORMAL | (DOINGASYNC(dvp) ? 0 : IO_SYNC), curthread->td_ucred); if (error != 0 && error != ERELOOKUP) { From nobody Wed Oct 27 00:45:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 50A5B1818574; Wed, 27 Oct 2021 00:45:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92m71Kwz3kyX; Wed, 27 Oct 2021 00:45:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AB14E266E2; Wed, 27 Oct 2021 00:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jJvX011210; Wed, 27 Oct 2021 00:45:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jJlo011209; Wed, 27 Oct 2021 00:45:19 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:19 GMT Message-Id: <202110270045.19R0jJlo011209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: cf049c292eb4 - stable/13 - DMAR: clean up warnings about write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cf049c292eb42095189663565bf68bd8118f0130 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf049c292eb42095189663565bf68bd8118f0130 commit cf049c292eb42095189663565bf68bd8118f0130 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:23:45 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 DMAR: clean up warnings about write-only variables (cherry picked from commit 661bd70bd72d510ad7153df530d55a300046d619) --- sys/dev/iommu/busdma_iommu.c | 3 ++- sys/dev/iommu/iommu_gas.c | 4 ++-- sys/x86/iommu/intel_ctx.c | 4 ++-- sys/x86/iommu/intel_drv.c | 2 -- sys/x86/iommu/intel_idpgtbl.c | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index 9cafd49807ff..41d370a608bc 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -398,7 +398,8 @@ iommu_bus_dma_tag_set_domain(bus_dma_tag_t dmat) static int iommu_bus_dma_tag_destroy(bus_dma_tag_t dmat1) { - struct bus_dma_tag_iommu *dmat, *dmat_copy, *parent; + struct bus_dma_tag_iommu *dmat, *parent; + struct bus_dma_tag_iommu *dmat_copy __unused; int error; error = 0; diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 431c0c195c35..ba79ea5ce44e 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -355,7 +355,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg, static void iommu_gas_match_insert(struct iommu_gas_match_args *a) { - bool found; + bool found __diagused; /* * The prev->end is always aligned on the page size, which @@ -476,7 +476,7 @@ iommu_gas_alloc_region(struct iommu_domain *domain, struct iommu_map_entry *entr u_int flags) { struct iommu_map_entry *next, *prev; - bool found; + bool found __diagused; IOMMU_DOMAIN_ASSERT_LOCKED(domain); diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index 110740d6ad01..78d6ef8cc254 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -522,7 +522,7 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid, { struct dmar_domain *domain, *domain1; struct dmar_ctx *ctx, *ctx1; - struct iommu_unit *unit; + struct iommu_unit *unit __diagused; dmar_ctx_entry_t *ctxp; struct sf_buf *sf; int bus, slot, func, error; @@ -905,7 +905,7 @@ dmar_domain_unload(struct dmar_domain *domain, struct dmar_unit *unit; struct iommu_domain *iodom; struct iommu_map_entry *entry, *entry1; - int error; + int error __diagused; iodom = DOM2IODOM(domain); unit = DOM2DMAR(domain); diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index 38442795c5e4..96ed1d04a794 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -763,7 +763,6 @@ dmar_find_by_scope(int dev_domain, int dev_busno, struct dmar_unit * dmar_find(device_t dev, bool verbose) { - device_t dmar_dev; struct dmar_unit *unit; const char *banner; int i, dev_domain, dev_busno, dev_path_len; @@ -775,7 +774,6 @@ dmar_find(device_t dev, bool verbose) devclass_find("pci")) return (NULL); - dmar_dev = NULL; dev_domain = pci_get_domain(dev); dev_path_len = dmar_dev_depth(dev); ACPI_DMAR_PCI_PATH dev_path[dev_path_len]; diff --git a/sys/x86/iommu/intel_idpgtbl.c b/sys/x86/iommu/intel_idpgtbl.c index 9fd06d49d3b0..e031799d2a01 100644 --- a/sys/x86/iommu/intel_idpgtbl.c +++ b/sys/x86/iommu/intel_idpgtbl.c @@ -426,7 +426,7 @@ domain_map_buf_locked(struct dmar_domain *domain, iommu_gaddr_t base, { dmar_pte_t *pte; struct sf_buf *sf; - iommu_gaddr_t pg_sz, base1, size1; + iommu_gaddr_t pg_sz, base1; vm_pindex_t pi, c, idx, run_sz; int lvl; bool superpage; @@ -434,7 +434,6 @@ domain_map_buf_locked(struct dmar_domain *domain, iommu_gaddr_t base, DMAR_DOMAIN_ASSERT_PGLOCKED(domain); base1 = base; - size1 = size; flags |= IOMMU_PGF_OBJL; TD_PREP_PINNED_ASSERT; From nobody Wed Oct 27 00:45:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CB527181880D; Wed, 27 Oct 2021 00:45:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92n1KdNz3ksY; Wed, 27 Oct 2021 00:45:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C69D6268B8; Wed, 27 Oct 2021 00:45:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jKOj011241; Wed, 27 Oct 2021 00:45:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jK8U011240; Wed, 27 Oct 2021 00:45:20 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:20 GMT Message-Id: <202110270045.19R0jK8U011240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ec235e162af9 - stable/13 - subr_firmware.c::unloadentry(): remove write-only variable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ec235e162af984c3b8893d8381868506360b27c9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ec235e162af984c3b8893d8381868506360b27c9 commit ec235e162af984c3b8893d8381868506360b27c9 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:40:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 subr_firmware.c::unloadentry(): remove write-only variable (cherry picked from commit 6776747a0e0b1c0e3fb916685ac2180ca4ce2f3d) --- sys/kern/subr_firmware.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/subr_firmware.c b/sys/kern/subr_firmware.c index 0465f2a88483..aafb2a2ba265 100644 --- a/sys/kern/subr_firmware.c +++ b/sys/kern/subr_firmware.c @@ -412,7 +412,6 @@ static void unloadentry(void *unused1, int unused2) { struct priv_fw *fp; - int err; mtx_lock(&firmware_mtx); restart: @@ -434,7 +433,7 @@ restart: * on unload to actually free the entry. */ mtx_unlock(&firmware_mtx); - err = linker_release_module(NULL, NULL, fp->file); + (void)linker_release_module(NULL, NULL, fp->file); mtx_lock(&firmware_mtx); /* From nobody Wed Oct 27 00:45:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4235B1818A1A; Wed, 27 Oct 2021 00:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92p3Rvxz3kym; Wed, 27 Oct 2021 00:45:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E06E4268B9; Wed, 27 Oct 2021 00:45:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jLZh011265; Wed, 27 Oct 2021 00:45:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jLYv011264; Wed, 27 Oct 2021 00:45:21 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:21 GMT Message-Id: <202110270045.19R0jLYv011264@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 17c83b76702c - stable/13 - sig_ast_checksusp(): mark the local p as __diagused List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 17c83b76702ca910cd6d386eb97f7a27f6fa3d79 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=17c83b76702ca910cd6d386eb97f7a27f6fa3d79 commit 17c83b76702ca910cd6d386eb97f7a27f6fa3d79 Author: Konstantin Belousov AuthorDate: 2021-10-21 17:43:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:40 +0000 sig_ast_checksusp(): mark the local p as __diagused (cherry picked from commit 3d2778515aa4748f5d561a282d44c7a8c8acfe35) --- sys/kern/kern_sig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index af5c70ada3e6..f73c9e85442f 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3232,7 +3232,7 @@ postsig(int sig) int sig_ast_checksusp(struct thread *td) { - struct proc *p; + struct proc *p __diagused; int ret; p = td->td_proc; From nobody Wed Oct 27 00:45:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0D5C418187D0; Wed, 27 Oct 2021 00:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hf92q33Knz3kqQ; Wed, 27 Oct 2021 00:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 139632617C; Wed, 27 Oct 2021 00:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R0jMn5011289; Wed, 27 Oct 2021 00:45:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R0jMOf011288; Wed, 27 Oct 2021 00:45:22 GMT (envelope-from git) Date: Wed, 27 Oct 2021 00:45:22 GMT Message-Id: <202110270045.19R0jMOf011288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c3c880be15a4 - stable/13 - uipc_shm: silent warnings about write-only variables in largepage code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c3c880be15a40985268f018c7828f8b98dfa93be Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c3c880be15a40985268f018c7828f8b98dfa93be commit c3c880be15a40985268f018c7828f8b98dfa93be Author: Konstantin Belousov AuthorDate: 2021-10-21 17:46:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-27 00:24:41 +0000 uipc_shm: silent warnings about write-only variables in largepage code (cherry picked from commit 3b5331dd8d413807cf1d6cb26630ccf9028168e6) --- sys/kern/uipc_shm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 622886e15e58..7823e92378b0 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -263,7 +263,7 @@ static int shm_largepage_phys_populate(vm_object_t object, vm_pindex_t pidx, int fault_type, vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last) { - vm_page_t m; + vm_page_t m __diagused; int psind; psind = object->un_pager.phys.data_val; @@ -733,7 +733,8 @@ shm_dotruncate_largepage(struct shmfd *shmfd, off_t length, void *rl_cookie) { vm_object_t object; vm_page_t m; - vm_pindex_t newobjsz, oldobjsz; + vm_pindex_t newobjsz; + vm_pindex_t oldobjsz __unused; int aflags, error, i, psind, try; KASSERT(length >= 0, ("shm_dotruncate: length < 0")); From nobody Wed Oct 27 02:38:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99F771820075; Wed, 27 Oct 2021 02:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfCY340Mfz4ncB; Wed, 27 Oct 2021 02:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 697F527DB3; Wed, 27 Oct 2021 02:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R2cFmP057064; Wed, 27 Oct 2021 02:38:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R2cFdG057063; Wed, 27 Oct 2021 02:38:15 GMT (envelope-from git) Date: Wed, 27 Oct 2021 02:38:15 GMT Message-Id: <202110270238.19R2cFdG057063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: da6c043ff3a2 - stable/13 - nfscl: Make nfscl_getlayout() acquire the correct pNFS layout List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: da6c043ff3a2b75d7d1ce56ada0c2cc817f2afe0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=da6c043ff3a2b75d7d1ce56ada0c2cc817f2afe0 commit da6c043ff3a2b75d7d1ce56ada0c2cc817f2afe0 Author: Rick Macklem AuthorDate: 2021-10-13 22:48:54 +0000 Commit: Rick Macklem CommitDate: 2021-10-27 02:33:45 +0000 nfscl: Make nfscl_getlayout() acquire the correct pNFS layout Without this patch, if a pNFS read layout has already been acquired for a file, writes would be redirected to the Metadata Server (MDS), because nfscl_getlayout() would not acquire a read/write layout for the file. This happened because there was no "mode" argument to nfscl_getlayout() to indicate whether reading or writing was being done. Since doing I/O through the Metadata Server is not encouraged for some pNFS servers, it is preferable to get a read/write layout for writes instead of redirecting the write to the MDS. This patch adds a access mode argument to nfscl_getlayout() and nfsrpc_getlayout(), so that nfscl_getlayout() knows to acquire a read/write layout for writing, even if a read layout has already been acquired. This patch only affects NFSv4.1/4.2 client behaviour when pNFS ("pnfs" mount option against a server that supports pNFS) is in use. This problem was detected during a recent NFSv4 interoperability testing event held by the IETF working group. (cherry picked from commit 24af0fcdfc4983fd3cef10f9d949aca79476c2c2) --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 14 +++++++------- sys/fs/nfsclient/nfs_clstate.c | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 846ab2503981..04946d88c26b 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -631,7 +631,7 @@ int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t *, int, nfsv4stateid_t *, int, int, struct nfsclflayouthead *, struct nfscllayout **, struct ucred *, NFSPROC_T *); struct nfscllayout *nfscl_getlayout(struct nfsclclient *, uint8_t *, int, - uint64_t, struct nfsclflayout **, int *); + uint64_t, uint32_t, struct nfsclflayout **, int *); void nfscl_dserr(uint32_t, uint32_t, struct nfscldevinfo *, struct nfscllayout *, struct nfsclds *); void nfscl_cancelreqs(struct nfsclds *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index dbbfdb3b2976..36ee7768686f 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -148,7 +148,7 @@ static int nfsrpc_locku(struct nfsrv_descript *, struct nfsmount *, static int nfsrpc_setaclrpc(vnode_t, struct ucred *, NFSPROC_T *, struct acl *, nfsv4stateid_t *, void *); static int nfsrpc_getlayout(struct nfsmount *, vnode_t, struct nfsfh *, int, - uint32_t *, nfsv4stateid_t *, uint64_t, struct nfscllayout **, + uint32_t, uint32_t *, nfsv4stateid_t *, uint64_t, struct nfscllayout **, struct ucred *, NFSPROC_T *); static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_in *, struct sockaddr_in6 *, sa_family_t, int, int, struct nfsclds **, @@ -5438,8 +5438,8 @@ nfsmout: */ static int nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, struct nfsfh *nfhp, - int iomode, uint32_t *notifybitsp, nfsv4stateid_t *stateidp, uint64_t off, - struct nfscllayout **lypp, struct ucred *cred, NFSPROC_T *p) + int iomode, uint32_t rw, uint32_t *notifybitsp, nfsv4stateid_t *stateidp, + uint64_t off, struct nfscllayout **lypp, struct ucred *cred, NFSPROC_T *p) { struct nfscllayout *lyp; struct nfsclflayout *flp; @@ -5459,7 +5459,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, struct nfsfh *nfhp, * flp == NULL. */ lyp = nfscl_getlayout(nmp->nm_clp, nfhp->nfh_fh, nfhp->nfh_len, - off, &flp, &recalled); + off, rw, &flp, &recalled); islocked = 0; if (lyp == NULL || flp == NULL) { if (recalled != 0) @@ -5790,7 +5790,7 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, /* Search for a layout for this file. */ off = uiop->uio_offset; layp = nfscl_getlayout(nmp->nm_clp, np->n_fhp->nfh_fh, - np->n_fhp->nfh_len, off, &rflp, &recalled); + np->n_fhp->nfh_len, off, rwaccess, &rflp, &recalled); if (layp == NULL || rflp == NULL) { if (recalled != 0) { NFSFREECRED(newcred); @@ -5808,7 +5808,7 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, else iolaymode = NFSLAYOUTIOMODE_READ; error = nfsrpc_getlayout(nmp, vp, np->n_fhp, iolaymode, - NULL, &stateid, off, &layp, newcred, p); + rwaccess, NULL, &stateid, off, &layp, newcred, p); if (error != 0) { NFSLOCKNODE(np); np->n_flag |= NNOLAYOUT; @@ -7494,7 +7494,7 @@ nfsrpc_getopenlayout(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, * on it, iff flp != NULL or a lock (exclusive lock) on it iff * flp == NULL. */ - lyp = nfscl_getlayout(nmp->nm_clp, newfhp, newfhlen, 0, &flp, + lyp = nfscl_getlayout(nmp->nm_clp, newfhp, newfhlen, 0, mode, &flp, &recalled); NFSCL_DEBUG(4, "nfsrpc_getopenlayout nfscl_getlayout lyp=%p\n", lyp); if (lyp == NULL) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 276e94002d34..248725c668d7 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -5143,7 +5143,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, */ struct nfscllayout * nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, int fhlen, - uint64_t off, struct nfsclflayout **retflpp, int *recalledp) + uint64_t off, uint32_t rwaccess, struct nfsclflayout **retflpp, + int *recalledp) { struct nfscllayout *lyp; mount_t mp; @@ -5159,8 +5160,8 @@ nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, int fhlen, TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; - error = nfscl_findlayoutforio(lyp, off, - NFSV4OPEN_ACCESSREAD, retflpp); + error = nfscl_findlayoutforio(lyp, off, rwaccess, + retflpp); if (error == 0) nfsv4_getref(&lyp->nfsly_lock, NULL, NFSCLSTATEMUTEXPTR, mp); From nobody Wed Oct 27 03:29:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5193918120BB; Wed, 27 Oct 2021 03:29:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfDhT0m6tz505M; Wed, 27 Oct 2021 03:29:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EF5A39BA; Wed, 27 Oct 2021 03:29:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R3TijE025233; Wed, 27 Oct 2021 03:29:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R3Tiq7025232; Wed, 27 Oct 2021 03:29:44 GMT (envelope-from git) Date: Wed, 27 Oct 2021 03:29:44 GMT Message-Id: <202110270329.19R3Tiq7025232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 355c15130aef - main - iwm: update if_iwmreg.h to the latest (as of today) openbsd changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 355c15130aef13484821051a655da9b9066e1015 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=355c15130aef13484821051a655da9b9066e1015 commit 355c15130aef13484821051a655da9b9066e1015 Author: Adrian Chadd AuthorDate: 2021-10-24 15:47:04 +0000 Commit: Adrian Chadd CommitDate: 2021-10-27 03:28:54 +0000 iwm: update if_iwmreg.h to the latest (as of today) openbsd changes Summary: This updates the if_iwmreg.h definitions to; OpenBSD: if_iwmreg.h,v 1.65 2021/10/11 09:03:22 stsp Exp A few things haven't been fully converted, namely: * I left a couple things as enums for now just to reduce the other diffs needed; but they're the same values * The IWM_SCD_QUEUE_* macros have different offsets which I didn't update in case they broke things / changed based on later firmware. But they also may be real bugfixes which are needed for later chips. It'll need more testing before flipping this on. The c file updates are: * Use the newer names for things if the name changed but the semantics didn't * Explicitly use the earlier firmware structs which maintain compat with the current firmware and code. The newer ones are in here and they'll get converted when more openbsd code is merged into this tree. * Use the older iwm rate table for now, which has entries for legacy rates, HT and VHT. Our code works with that right now, updating it to openbsd's err, "different" version can be done at a later date when HT/VHT support is added. Notably, a bunch of definitions were deleted that weren't used. They're not used either in the openbsd/dfbsd drivers so I think it's safe to delete them in the long run. Test Plan: 7260 hw 0x140 Subscribers: imp Differential Revision: https://reviews.freebsd.org/D32627 Reviewed by: md5 Obtained From: OpenBSD --- sys/dev/iwm/if_iwm.c | 112 +- sys/dev/iwm/if_iwm_binding.c | 2 +- sys/dev/iwm/if_iwm_phy_db.c | 37 +- sys/dev/iwm/if_iwm_scan.c | 10 +- sys/dev/iwm/if_iwmreg.h | 3522 ++++++++++++++++++++++++------------------ sys/dev/iwm/if_iwmvar.h | 2 +- 6 files changed, 2030 insertions(+), 1655 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index f994e8e75307..3e34c3cac98e 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -1914,98 +1914,6 @@ iwm_nvm_read_section(struct iwm_softc *sc, /* iwlwifi/iwl-nvm-parse.c */ -/* NVM offsets (in words) definitions */ -enum iwm_nvm_offsets { - /* NVM HW-Section offset (in words) definitions */ - IWM_HW_ADDR = 0x15, - -/* NVM SW-Section offset (in words) definitions */ - IWM_NVM_SW_SECTION = 0x1C0, - IWM_NVM_VERSION = 0, - IWM_RADIO_CFG = 1, - IWM_SKU = 2, - IWM_N_HW_ADDRS = 3, - IWM_NVM_CHANNELS = 0x1E0 - IWM_NVM_SW_SECTION, - -/* NVM calibration section offset (in words) definitions */ - IWM_NVM_CALIB_SECTION = 0x2B8, - IWM_XTAL_CALIB = 0x316 - IWM_NVM_CALIB_SECTION -}; - -enum iwm_8000_nvm_offsets { - /* NVM HW-Section offset (in words) definitions */ - IWM_HW_ADDR0_WFPM_8000 = 0x12, - IWM_HW_ADDR1_WFPM_8000 = 0x16, - IWM_HW_ADDR0_PCIE_8000 = 0x8A, - IWM_HW_ADDR1_PCIE_8000 = 0x8E, - IWM_MAC_ADDRESS_OVERRIDE_8000 = 1, - - /* NVM SW-Section offset (in words) definitions */ - IWM_NVM_SW_SECTION_8000 = 0x1C0, - IWM_NVM_VERSION_8000 = 0, - IWM_RADIO_CFG_8000 = 0, - IWM_SKU_8000 = 2, - IWM_N_HW_ADDRS_8000 = 3, - - /* NVM REGULATORY -Section offset (in words) definitions */ - IWM_NVM_CHANNELS_8000 = 0, - IWM_NVM_LAR_OFFSET_8000_OLD = 0x4C7, - IWM_NVM_LAR_OFFSET_8000 = 0x507, - IWM_NVM_LAR_ENABLED_8000 = 0x7, - - /* NVM calibration section offset (in words) definitions */ - IWM_NVM_CALIB_SECTION_8000 = 0x2B8, - IWM_XTAL_CALIB_8000 = 0x316 - IWM_NVM_CALIB_SECTION_8000 -}; - -/* SKU Capabilities (actual values from NVM definition) */ -enum nvm_sku_bits { - IWM_NVM_SKU_CAP_BAND_24GHZ = (1 << 0), - IWM_NVM_SKU_CAP_BAND_52GHZ = (1 << 1), - IWM_NVM_SKU_CAP_11N_ENABLE = (1 << 2), - IWM_NVM_SKU_CAP_11AC_ENABLE = (1 << 3), -}; - -/* radio config bits (actual values from NVM definition) */ -#define IWM_NVM_RF_CFG_DASH_MSK(x) (x & 0x3) /* bits 0-1 */ -#define IWM_NVM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */ -#define IWM_NVM_RF_CFG_TYPE_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */ -#define IWM_NVM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */ -#define IWM_NVM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */ -#define IWM_NVM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */ - -#define IWM_NVM_RF_CFG_FLAVOR_MSK_8000(x) (x & 0xF) -#define IWM_NVM_RF_CFG_DASH_MSK_8000(x) ((x >> 4) & 0xF) -#define IWM_NVM_RF_CFG_STEP_MSK_8000(x) ((x >> 8) & 0xF) -#define IWM_NVM_RF_CFG_TYPE_MSK_8000(x) ((x >> 12) & 0xFFF) -#define IWM_NVM_RF_CFG_TX_ANT_MSK_8000(x) ((x >> 24) & 0xF) -#define IWM_NVM_RF_CFG_RX_ANT_MSK_8000(x) ((x >> 28) & 0xF) - -/** - * enum iwm_nvm_channel_flags - channel flags in NVM - * @IWM_NVM_CHANNEL_VALID: channel is usable for this SKU/geo - * @IWM_NVM_CHANNEL_IBSS: usable as an IBSS channel - * @IWM_NVM_CHANNEL_ACTIVE: active scanning allowed - * @IWM_NVM_CHANNEL_RADAR: radar detection required - * XXX cannot find this (DFS) flag in iwm-nvm-parse.c - * @IWM_NVM_CHANNEL_DFS: dynamic freq selection candidate - * @IWM_NVM_CHANNEL_WIDE: 20 MHz channel okay (?) - * @IWM_NVM_CHANNEL_40MHZ: 40 MHz channel okay (?) - * @IWM_NVM_CHANNEL_80MHZ: 80 MHz channel okay (?) - * @IWM_NVM_CHANNEL_160MHZ: 160 MHz channel okay (?) - */ -enum iwm_nvm_channel_flags { - IWM_NVM_CHANNEL_VALID = (1 << 0), - IWM_NVM_CHANNEL_IBSS = (1 << 1), - IWM_NVM_CHANNEL_ACTIVE = (1 << 3), - IWM_NVM_CHANNEL_RADAR = (1 << 4), - IWM_NVM_CHANNEL_DFS = (1 << 7), - IWM_NVM_CHANNEL_WIDE = (1 << 8), - IWM_NVM_CHANNEL_40MHZ = (1 << 9), - IWM_NVM_CHANNEL_80MHZ = (1 << 10), - IWM_NVM_CHANNEL_160MHZ = (1 << 11), -}; - /* * Translate EEPROM flags to net80211. */ @@ -2220,7 +2128,7 @@ iwm_set_radio_cfg(const struct iwm_softc *sc, struct iwm_nvm_data *data, data->radio_cfg_type = IWM_NVM_RF_CFG_TYPE_MSK_8000(radio_cfg); data->radio_cfg_step = IWM_NVM_RF_CFG_STEP_MSK_8000(radio_cfg); data->radio_cfg_dash = IWM_NVM_RF_CFG_DASH_MSK_8000(radio_cfg); - data->radio_cfg_pnum = IWM_NVM_RF_CFG_FLAVOR_MSK_8000(radio_cfg); + data->radio_cfg_pnum = IWM_NVM_RF_CFG_PNUM_MSK_8000(radio_cfg); data->valid_tx_ant = IWM_NVM_RF_CFG_TX_ANT_MSK_8000(radio_cfg); data->valid_rx_ant = IWM_NVM_RF_CFG_RX_ANT_MSK_8000(radio_cfg); } @@ -2383,7 +2291,7 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iwm_nvm_section *sections) static int iwm_nvm_init(struct iwm_softc *sc) { - struct iwm_nvm_section nvm_sections[IWM_NVM_MAX_NUM_SECTIONS]; + struct iwm_nvm_section nvm_sections[IWM_NVM_NUM_OF_SECTIONS]; int i, ret, section; uint32_t size_read = 0; uint8_t *nvm_buffer, *temp; @@ -2391,7 +2299,7 @@ iwm_nvm_init(struct iwm_softc *sc) memset(nvm_sections, 0, sizeof(nvm_sections)); - if (sc->cfg->nvm_hw_section_num >= IWM_NVM_MAX_NUM_SECTIONS) + if (sc->cfg->nvm_hw_section_num >= IWM_NVM_NUM_OF_SECTIONS) return EINVAL; /* load NVM values from nic */ @@ -2401,7 +2309,7 @@ iwm_nvm_init(struct iwm_softc *sc) nvm_buffer = malloc(sc->cfg->eeprom_size, M_DEVBUF, M_NOWAIT | M_ZERO); if (!nvm_buffer) return ENOMEM; - for (section = 0; section < IWM_NVM_MAX_NUM_SECTIONS; section++) { + for (section = 0; section < IWM_NVM_NUM_OF_SECTIONS; section++) { /* we override the constness for initial read */ ret = iwm_nvm_read_section(sc, section, nvm_buffer, &len, size_read); @@ -2428,7 +2336,7 @@ iwm_nvm_init(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_EEPROM | IWM_DEBUG_RESET, "nvm version = %x\n", sc->nvm_data->nvm_version); - for (i = 0; i < IWM_NVM_MAX_NUM_SECTIONS; i++) { + for (i = 0; i < IWM_NVM_NUM_OF_SECTIONS; i++) { if (nvm_sections[i].data != NULL) free(nvm_sections[i].data, M_DEVBUF); } @@ -3181,7 +3089,7 @@ iwm_get_noise(struct iwm_softc *sc, static void iwm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { - struct iwm_notif_statistics_v10 *stats = (void *)&pkt->data; + struct iwm_notif_statistics *stats = (void *)&pkt->data; memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); @@ -3897,7 +3805,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) if (hdrlen & 3) { /* First segment length must be a multiple of 4. */ flags |= IWM_TX_CMD_FLG_MH_PAD; - tx->offload_assist |= htole16(1 << IWM_TX_CMD_OFFLD_PAD); + tx->offload_assist |= htole16(IWM_TX_CMD_OFFLD_PAD); pad = 4 - (hdrlen & 3); } else { tx->offload_assist = 0; @@ -4059,7 +3967,7 @@ int iwm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) { int ret; - struct iwm_tx_path_flush_cmd flush_cmd = { + struct iwm_tx_path_flush_cmd_v1 flush_cmd = { .queues_ctl = htole32(tfd_msk), .flush_ctl = htole16(IWM_DUMP_TX_FIFO_FLUSH), }; @@ -4079,7 +3987,7 @@ iwm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) static int iwm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) { - struct iwm_time_quota_cmd cmd; + struct iwm_time_quota_cmd_v1 cmd; int i, idx, ret, num_active_macs, quota, quota_rem; int colors[IWM_MAX_BINDINGS] = { -1, -1, -1, -1, }; int n_ifs[IWM_MAX_BINDINGS] = {0, }; @@ -4711,7 +4619,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2) #ifdef IWM_DEBUG struct iwm_rx_packet *pkt; struct iwm_mcc_update_resp_v1 *mcc_resp_v1 = NULL; - struct iwm_mcc_update_resp *mcc_resp; + struct iwm_mcc_update_resp_v2 *mcc_resp; int n_channels; uint16_t mcc; #endif diff --git a/sys/dev/iwm/if_iwm_binding.c b/sys/dev/iwm/if_iwm_binding.c index 28207c998d77..6b0b19b7515c 100644 --- a/sys/dev/iwm/if_iwm_binding.c +++ b/sys/dev/iwm/if_iwm_binding.c @@ -159,7 +159,7 @@ static int iwm_binding_cmd(struct iwm_softc *sc, uint32_t action, struct iwm_iface_iterator_data *data) { - struct iwm_binding_cmd cmd; + struct iwm_binding_cmd_v1 cmd; struct iwm_phy_ctxt *phyctxt = data->phyctxt; int i, ret; uint32_t status; diff --git a/sys/dev/iwm/if_iwm_phy_db.c b/sys/dev/iwm/if_iwm_phy_db.c index 40a0a05adb15..08ded1121d03 100644 --- a/sys/dev/iwm/if_iwm_phy_db.c +++ b/sys/dev/iwm/if_iwm_phy_db.c @@ -186,41 +186,6 @@ struct iwm_phy_db { struct iwm_softc *sc; }; -enum iwm_phy_db_section_type { - IWM_PHY_DB_CFG = 1, - IWM_PHY_DB_CALIB_NCH, - IWM_PHY_DB_UNUSED, - IWM_PHY_DB_CALIB_CHG_PAPD, - IWM_PHY_DB_CALIB_CHG_TXP, - IWM_PHY_DB_MAX -}; - -#define PHY_DB_CMD 0x6c - -/* - * phy db - configure operational ucode - */ -struct iwm_phy_db_cmd { - uint16_t type; - uint16_t length; - uint8_t data[]; -} __packed; - -/* for parsing of tx power channel group data that comes from the firmware*/ -struct iwm_phy_db_chg_txp { - uint32_t space; - uint16_t max_channel_idx; -} __packed; - -/* - * phy db - Receive phy db chunk after calibrations - */ -struct iwm_calib_res_notif_phy_db { - uint16_t type; - uint16_t length; - uint8_t data[]; -} __packed; - struct iwm_phy_db * iwm_phy_db_init(struct iwm_softc *sc) { @@ -477,7 +442,7 @@ iwm_send_phy_db_cmd(struct iwm_phy_db *phy_db, uint16_t type, { struct iwm_phy_db_cmd phy_db_cmd; struct iwm_host_cmd cmd = { - .id = PHY_DB_CMD, + .id = IWM_PHY_DB_CMD, }; IWM_DPRINTF(phy_db->sc, IWM_DEBUG_RESET, diff --git a/sys/dev/iwm/if_iwm_scan.c b/sys/dev/iwm/if_iwm_scan.c index cdf7985d9a97..efba76ad502a 100644 --- a/sys/dev/iwm/if_iwm_scan.c +++ b/sys/dev/iwm/if_iwm_scan.c @@ -379,7 +379,7 @@ iwm_umac_scan_fill_channels(struct iwm_softc *sc, } static int -iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) +iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req_v1 *preq) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); @@ -594,12 +594,12 @@ iwm_scan_size(struct iwm_softc *sc) return base_size + sizeof(struct iwm_scan_channel_cfg_umac) * sc->sc_fw.ucode_capa.n_scan_channels + - sizeof(struct iwm_scan_req_umac_tail); + sizeof(struct iwm_scan_req_umac_tail_v1); } else { return sizeof(struct iwm_scan_req_lmac) + sizeof(struct iwm_scan_channel_cfg_lmac) * sc->sc_fw.ucode_capa.n_scan_channels + - sizeof(struct iwm_scan_probe_req); + sizeof(struct iwm_scan_probe_req_v1); } } @@ -614,7 +614,7 @@ iwm_umac_scan(struct iwm_softc *sc) }; struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; struct iwm_scan_req_umac *req; - struct iwm_scan_req_umac_tail *tail; + struct iwm_scan_req_umac_tail_v1 *tail; size_t req_len; uint16_t general_flags; uint8_t channel_flags, i, nssid; @@ -799,7 +799,7 @@ iwm_lmac_scan(struct iwm_softc *sc) (struct iwm_scan_channel_cfg_lmac *)req->data, nssid); ret = iwm_fill_probe_req(sc, - (struct iwm_scan_probe_req *)(req->data + + (struct iwm_scan_probe_req_v1 *)(req->data + (sizeof(struct iwm_scan_channel_cfg_lmac) * sc->sc_fw.ucode_capa.n_scan_channels))); if (ret) { diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 310b2d53a82e..c3c51a25c4b0 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -1,5 +1,4 @@ -/* $OpenBSD: if_iwmreg.h,v 1.4 2015/06/15 08:06:11 stsp Exp $ */ -/* $FreeBSD$ */ +/* $OpenBSD: if_iwmreg.h,v 1.65 2021/10/11 09:03:22 stsp Exp $ */ /****************************************************************************** * @@ -63,6 +62,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ + #ifndef __IF_IWM_REG_H__ #define __IF_IWM_REG_H__ @@ -193,7 +193,7 @@ /* interrupt flags in INTA, set by uCode or hardware (e.g. dma), * acknowledged (reset) by host writing "1" to flagged bits. */ -#define IWM_CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ +#define IWM_CSR_INT_BIT_FH_RX (1U << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ #define IWM_CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ #define IWM_CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */ #define IWM_CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ @@ -216,7 +216,7 @@ IWM_CSR_INT_BIT_RX_PERIODIC) /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ -#define IWM_CSR_FH_INT_BIT_ERR (1 << 31) /* Error */ +#define IWM_CSR_FH_INT_BIT_ERR (1U << 31) /* Error */ #define IWM_CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */ #define IWM_CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */ #define IWM_CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */ @@ -306,7 +306,6 @@ enum { IWM_SILICON_C_STEP, }; - #define IWM_CSR_HW_REV_TYPE_MSK (0x000FFF0) #define IWM_CSR_HW_REV_TYPE_5300 (0x0000020) #define IWM_CSR_HW_REV_TYPE_5350 (0x0000030) @@ -417,30 +416,131 @@ enum { #define IWM_CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000) /* DRAM INT TABLE */ -#define IWM_CSR_DRAM_INT_TBL_ENABLE (1 << 31) +#define IWM_CSR_DRAM_INT_TBL_ENABLE (1U << 31) #define IWM_CSR_DRAM_INIT_TBL_WRITE_POINTER (1 << 28) #define IWM_CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27) /* SECURE boot registers */ #define IWM_CSR_SECURE_BOOT_CONFIG_ADDR (0x100) -enum iwm_secure_boot_config_reg { - IWM_CSR_SECURE_BOOT_CONFIG_INSPECTOR_BURNED_IN_OTP = 0x00000001, - IWM_CSR_SECURE_BOOT_CONFIG_INSPECTOR_NOT_REQ = 0x00000002, -}; - +#define IWM_CSR_SECURE_BOOT_CONFIG_INSPECTOR_BURNED_IN_OTP 0x00000001 +#define IWM_CSR_SECURE_BOOT_CONFIG_INSPECTOR_NOT_REQ 0x00000002 #define IWM_CSR_SECURE_BOOT_CPU1_STATUS_ADDR (0x100) #define IWM_CSR_SECURE_BOOT_CPU2_STATUS_ADDR (0x100) -enum iwm_secure_boot_status_reg { - IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_STATUS = 0x00000003, - IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_COMPLETED = 0x00000002, - IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_SUCCESS = 0x00000004, - IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_FAIL = 0x00000008, - IWM_CSR_SECURE_BOOT_CPU_STATUS_SIGN_VERF_FAIL = 0x00000010, -}; +#define IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_STATUS 0x00000003 +#define IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_COMPLETED 0x00000002 +#define IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_SUCCESS 0x00000004 +#define IWM_CSR_SECURE_BOOT_CPU_STATUS_VERF_FAIL 0x00000008 +#define IWM_CSR_SECURE_BOOT_CPU_STATUS_SIGN_VERF_FAIL 0x00000010 #define IWM_FH_UCODE_LOAD_STATUS 0x1af0 + #define IWM_FH_MEM_TB_MAX_LENGTH 0x20000 +/* 9000 rx series registers */ + +#define IWM_RFH_Q0_FRBDCB_BA_LSB 0xA08000 /* 64 bit address */ +#define IWM_RFH_Q_FRBDCB_BA_LSB(q) (IWM_RFH_Q0_FRBDCB_BA_LSB + (q) * 8) +/* Write index table */ +#define IWM_RFH_Q0_FRBDCB_WIDX 0xA08080 +#define IWM_RFH_Q_FRBDCB_WIDX(q) (IWM_RFH_Q0_FRBDCB_WIDX + (q) * 4) +/* Write index table - shadow registers */ +#define IWM_RFH_Q0_FRBDCB_WIDX_TRG 0x1C80 +#define IWM_RFH_Q_FRBDCB_WIDX_TRG(q) (IWM_RFH_Q0_FRBDCB_WIDX_TRG + (q) * 4) +/* Read index table */ +#define IWM_RFH_Q0_FRBDCB_RIDX 0xA080C0 +#define IWM_RFH_Q_FRBDCB_RIDX(q) (IWM_RFH_Q0_FRBDCB_RIDX + (q) * 4) +/* Used list table */ +#define IWM_RFH_Q0_URBDCB_BA_LSB 0xA08100 /* 64 bit address */ +#define IWM_RFH_Q_URBDCB_BA_LSB(q) (IWM_RFH_Q0_URBDCB_BA_LSB + (q) * 8) +/* Write index table */ +#define IWM_RFH_Q0_URBDCB_WIDX 0xA08180 +#define IWM_RFH_Q_URBDCB_WIDX(q) (IWM_RFH_Q0_URBDCB_WIDX + (q) * 4) +#define IWM_RFH_Q0_URBDCB_VAID 0xA081C0 +#define IWM_RFH_Q_URBDCB_VAID(q) (IWM_RFH_Q0_URBDCB_VAID + (q) * 4) +/* stts */ +#define IWM_RFH_Q0_URBD_STTS_WPTR_LSB 0xA08200 /*64 bits address */ +#define IWM_RFH_Q_URBD_STTS_WPTR_LSB(q) (IWM_RFH_Q0_URBD_STTS_WPTR_LSB + (q) * 8) + +#define IWM_RFH_Q0_ORB_WPTR_LSB 0xA08280 +#define IWM_RFH_Q_ORB_WPTR_LSB(q) (IWM_RFH_Q0_ORB_WPTR_LSB + (q) * 8) +#define IWM_RFH_RBDBUF_RBD0_LSB 0xA08300 +#define IWM_RFH_RBDBUF_RBD_LSB(q) (IWM_RFH_RBDBUF_RBD0_LSB + (q) * 8) + +/** + * RFH Status Register + * + * Bit fields: + * + * Bit 29: RBD_FETCH_IDLE + * This status flag is set by the RFH when there is no active RBD fetch from + * DRAM. + * Once the RFH RBD controller starts fetching (or when there is a pending + * RBD read response from DRAM), this flag is immediately turned off. + * + * Bit 30: SRAM_DMA_IDLE + * This status flag is set by the RFH when there is no active transaction from + * SRAM to DRAM. + * Once the SRAM to DRAM DMA is active, this flag is immediately turned off. + * + * Bit 31: RXF_DMA_IDLE + * This status flag is set by the RFH when there is no active transaction from + * RXF to DRAM. + * Once the RXF-to-DRAM DMA is active, this flag is immediately turned off. + */ +#define IWM_RFH_GEN_STATUS 0xA09808 +#define IWM_RFH_GEN_STATUS_GEN3 0xA07824 +#define IWM_RBD_FETCH_IDLE (1 << 29) +#define IWM_SRAM_DMA_IDLE (1 << 30) +#define IWM_RXF_DMA_IDLE (1U << 31) + +/* DMA configuration */ +#define IWM_RFH_RXF_DMA_CFG 0xA09820 +#define IWM_RFH_RXF_DMA_CFG_GEN3 0xA07880 +/* RB size */ +#define IWM_RFH_RXF_DMA_RB_SIZE_MASK (0x000F0000) /* bits 16-19 */ +#define IWM_RFH_RXF_DMA_RB_SIZE_POS 16 +#define IWM_RFH_RXF_DMA_RB_SIZE_1K (0x1 << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_2K (0x2 << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_4K (0x4 << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_8K (0x8 << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_12K (0x9 << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_16K (0xA << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_20K (0xB << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_24K (0xC << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_28K (0xD << IWM_RFH_RXF_DMA_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RB_SIZE_32K (0xE << IWM_RFH_RXF_DMA_RB_SIZE_POS) +/* RB Circular Buffer size:defines the table sizes in RBD units */ +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_MASK (0x00F00000) /* bits 20-23 */ +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_POS 20 +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_8 (0x3 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_16 (0x4 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_32 (0x5 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_64 (0x7 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_128 (0x7 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_256 (0x8 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_512 (0x9 << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_1024 (0xA << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_2048 (0xB << IWM_RFH_RXF_DMA_RBDCB_SIZE_POS) +#define IWM_RFH_RXF_DMA_MIN_RB_SIZE_MASK (0x03000000) /* bit 24-25 */ +#define IWM_RFH_RXF_DMA_MIN_RB_SIZE_POS 24 +#define IWM_RFH_RXF_DMA_MIN_RB_4_8 (3 << IWM_RFH_RXF_DMA_MIN_RB_SIZE_POS) +#define IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK (0x04000000) /* bit 26 */ +#define IWM_RFH_RXF_DMA_SINGLE_FRAME_MASK (0x20000000) /* bit 29 */ +#define IWM_RFH_DMA_EN_MASK (0xC0000000) /* bits 30-31*/ +#define IWM_RFH_DMA_EN_ENABLE_VAL (1U << 31) + +#define IWM_RFH_RXF_RXQ_ACTIVE 0xA0980C + +#define IWM_RFH_GEN_CFG 0xA09800 +#define IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP (1 << 0) +#define IWM_RFH_GEN_CFG_RFH_DMA_SNOOP (1 << 1) +#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128 0x00000010 +#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 0x00000000 +/* the driver assumes everywhere that the default RXQ is 0 */ +#define IWM_RFH_GEN_CFG_DEFAULT_RXQ_NUM 0xF00 + +/* end of 9000 rx series registers */ + #define IWM_LMPM_SECURE_UCODE_LOAD_CPU1_HDR_ADDR 0x1e78 #define IWM_LMPM_SECURE_UCODE_LOAD_CPU2_HDR_ADDR 0x1e7c @@ -457,10 +557,6 @@ enum iwm_secure_boot_status_reg { #define IWM_LMPM_CHICK 0xa01ff8 #define IWM_LMPM_CHICK_EXTENDED_ADDR_SPACE 0x01 -#define IWM_UREG_CHICK 0xa05c00 -#define IWM_UREG_CHICK_MSI_ENABLE 0x01000000 -#define IWM_UREG_CHICK_MSIX_ENABLE 0x02000000 - #define IWM_FH_TCSR_0_REG0 (0x1D00) /* @@ -530,6 +626,8 @@ enum iwm_secure_boot_status_reg { #define IWM_AUX_MISC_MASTER1_SMPHR_STATUS 0xa20800 #define IWM_RSA_ENABLE 0xa24b08 #define IWM_PREG_AUX_BUS_WPROT_0 0xa04cc0 +#define IWM_PREG_PRPH_WPROT_9000 0xa04ce0 +#define IWM_PREG_PRPH_WPROT_22000 0xa04d00 #define IWM_SB_CFG_OVERRIDE_ADDR 0xa26c78 #define IWM_SB_CFG_OVERRIDE_ENABLE 0x8000 #define IWM_SB_CFG_BASE_OVERRIDE 0xa20000 @@ -537,6 +635,14 @@ enum iwm_secure_boot_status_reg { #define IWM_SB_CPU_1_STATUS 0xa01e30 #define IWM_SB_CPU_2_STATUS 0Xa01e34 +#define IWM_UREG_CHICK 0xa05c00 +#define IWM_UREG_CHICK_MSI_ENABLE (1 << 24) +#define IWM_UREG_CHICK_MSIX_ENABLE (1 << 25) + +#define IWM_HPM_DEBUG 0xa03440 +#define IWM_HPM_PERSISTENCE_BIT (1 << 12) +#define IWM_PREG_WFPM_ACCESS (1 << 12) + /* Used to enable DBGM */ #define IWM_HBUS_TARG_TEST_REG (IWM_HBUS_BASE+0x05c) @@ -562,25 +668,51 @@ enum iwm_secure_boot_status_reg { #define IWM_HOST_INT_TIMEOUT_MAX (0xFF) #define IWM_HOST_INT_TIMEOUT_DEF (0x40) #define IWM_HOST_INT_TIMEOUT_MIN (0x0) -#define IWM_HOST_INT_OPER_MODE (1 << 31) +#define IWM_HOST_INT_OPER_MODE (1U << 31) /***************************************************************************** * 7000/3000 series SHR DTS addresses * *****************************************************************************/ /* Diode Results Register Structure: */ -enum iwm_dtd_diode_reg { - IWM_DTS_DIODE_REG_DIG_VAL = 0x000000FF, /* bits [7:0] */ - IWM_DTS_DIODE_REG_VREF_LOW = 0x0000FF00, /* bits [15:8] */ - IWM_DTS_DIODE_REG_VREF_HIGH = 0x00FF0000, /* bits [23:16] */ - IWM_DTS_DIODE_REG_VREF_ID = 0x03000000, /* bits [25:24] */ - IWM_DTS_DIODE_REG_PASS_ONCE = 0x80000000, /* bits [31:31] */ - IWM_DTS_DIODE_REG_FLAGS_MSK = 0xFF000000, /* bits [31:24] */ +#define IWM_DTS_DIODE_REG_DIG_VAL 0x000000FF /* bits [7:0] */ +#define IWM_DTS_DIODE_REG_VREF_LOW 0x0000FF00 /* bits [15:8] */ +#define IWM_DTS_DIODE_REG_VREF_HIGH 0x00FF0000 /* bits [23:16] */ +#define IWM_DTS_DIODE_REG_VREF_ID 0x03000000 /* bits [25:24] */ +#define IWM_DTS_DIODE_REG_PASS_ONCE 0x80000000 /* bits [31:31] */ +#define IWM_DTS_DIODE_REG_FLAGS_MSK 0xFF000000 /* bits [31:24] */ /* Those are the masks INSIDE the flags bit-field: */ - IWM_DTS_DIODE_REG_FLAGS_VREFS_ID_POS = 0, - IWM_DTS_DIODE_REG_FLAGS_VREFS_ID = 0x00000003, /* bits [1:0] */ - IWM_DTS_DIODE_REG_FLAGS_PASS_ONCE_POS = 7, - IWM_DTS_DIODE_REG_FLAGS_PASS_ONCE = 0x00000080, /* bits [7:7] */ +#define IWM_DTS_DIODE_REG_FLAGS_VREFS_ID_POS 0 +#define IWM_DTS_DIODE_REG_FLAGS_VREFS_ID 0x00000003 /* bits [1:0] */ +#define IWM_DTS_DIODE_REG_FLAGS_PASS_ONCE_POS 7 +#define IWM_DTS_DIODE_REG_FLAGS_PASS_ONCE 0x00000080 /* bits [7:7] */ + +/***************************************************************************** + * MSIX related registers * + *****************************************************************************/ + +#define IWM_CSR_MSIX_BASE (0x2000) +#define IWM_CSR_MSIX_FH_INT_CAUSES_AD (IWM_CSR_MSIX_BASE + 0x800) +#define IWM_CSR_MSIX_FH_INT_MASK_AD (IWM_CSR_MSIX_BASE + 0x804) +#define IWM_CSR_MSIX_HW_INT_CAUSES_AD (IWM_CSR_MSIX_BASE + 0x808) +#define IWM_CSR_MSIX_HW_INT_MASK_AD (IWM_CSR_MSIX_BASE + 0x80C) +#define IWM_CSR_MSIX_AUTOMASK_ST_AD (IWM_CSR_MSIX_BASE + 0x810) +#define IWM_CSR_MSIX_RX_IVAR_AD_REG (IWM_CSR_MSIX_BASE + 0x880) +#define IWM_CSR_MSIX_IVAR_AD_REG (IWM_CSR_MSIX_BASE + 0x890) +#define IWM_CSR_MSIX_PENDING_PBA_AD (IWM_CSR_MSIX_BASE + 0x1000) +#define IWM_CSR_MSIX_RX_IVAR(cause) (IWM_CSR_MSIX_RX_IVAR_AD_REG + (cause)) +#define IWM_CSR_MSIX_IVAR(cause) (IWM_CSR_MSIX_IVAR_AD_REG + (cause)) + +/* + * Causes for the FH register interrupts + */ +enum msix_fh_int_causes { + IWM_MSIX_FH_INT_CAUSES_Q0 = (1 << 0), + IWM_MSIX_FH_INT_CAUSES_Q1 = (1 << 1), + IWM_MSIX_FH_INT_CAUSES_D2S_CH0_NUM = (1 << 16), + IWM_MSIX_FH_INT_CAUSES_D2S_CH1_NUM = (1 << 17), + IWM_MSIX_FH_INT_CAUSES_S2D = (1 << 19), + IWM_MSIX_FH_INT_CAUSES_FH_ERR = (1 << 21), }; /* @@ -591,13 +723,58 @@ enum iwm_dtd_diode_reg { * BEGIN iwl-fw.h */ +/* + * Causes for the HW register interrupts + */ +enum msix_hw_int_causes { + IWM_MSIX_HW_INT_CAUSES_REG_ALIVE = (1 << 0), + IWM_MSIX_HW_INT_CAUSES_REG_WAKEUP = (1 << 1), + IWM_MSIX_HW_INT_CAUSES_REG_IPC = (1 << 1), + IWM_MSIX_HW_INT_CAUSES_REG_IML = (1 << 2), + IWM_MSIX_HW_INT_CAUSES_REG_SW_ERR_V2 = (1 << 5), + IWM_MSIX_HW_INT_CAUSES_REG_CT_KILL = (1 << 6), + IWM_MSIX_HW_INT_CAUSES_REG_RF_KILL = (1 << 7), + IWM_MSIX_HW_INT_CAUSES_REG_PERIODIC = (1 << 8), + IWM_MSIX_HW_INT_CAUSES_REG_SW_ERR = (1 << 25), + IWM_MSIX_HW_INT_CAUSES_REG_SCD = (1 << 26), + IWM_MSIX_HW_INT_CAUSES_REG_FH_TX = (1 << 27), + IWM_MSIX_HW_INT_CAUSES_REG_HW_ERR = (1 << 29), + IWM_MSIX_HW_INT_CAUSES_REG_HAP = (1 << 30), +}; + +/* + * Registers to map causes to vectors + */ +enum msix_ivar_for_cause { + IWM_MSIX_IVAR_CAUSE_D2S_CH0_NUM = 0x0, + IWM_MSIX_IVAR_CAUSE_D2S_CH1_NUM = 0x1, + IWM_MSIX_IVAR_CAUSE_S2D = 0x3, + IWM_MSIX_IVAR_CAUSE_FH_ERR = 0x5, + IWM_MSIX_IVAR_CAUSE_REG_ALIVE = 0x10, + IWM_MSIX_IVAR_CAUSE_REG_WAKEUP = 0x11, + IWM_MSIX_IVAR_CAUSE_REG_IML = 0x12, + IWM_MSIX_IVAR_CAUSE_REG_CT_KILL = 0x16, + IWM_MSIX_IVAR_CAUSE_REG_RF_KILL = 0x17, + IWM_MSIX_IVAR_CAUSE_REG_PERIODIC = 0x18, + IWM_MSIX_IVAR_CAUSE_REG_SW_ERR = 0x29, + IWM_MSIX_IVAR_CAUSE_REG_SCD = 0x2a, + IWM_MSIX_IVAR_CAUSE_REG_FH_TX = 0x2b, + IWM_MSIX_IVAR_CAUSE_REG_HW_ERR = 0x2d, + IWM_MSIX_IVAR_CAUSE_REG_HAP = 0x2e, +}; + +#define IWM_MSIX_AUTO_CLEAR_CAUSE (0 << 7) +#define IWM_MSIX_NON_AUTO_CLEAR_CAUSE (1 << 7) + /** - * enum iwm_ucode_tlv_flag - ucode API flags + * uCode API flags * @IWM_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously * was a separate TLV but moved here to save space. * @IWM_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID, * treats good CRC threshold as a boolean * @IWM_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). + * @IWM_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. + * @IWM_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS * @IWM_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD * @IWM_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan * offload profile config command. @@ -607,39 +784,48 @@ enum iwm_dtd_diode_reg { * from the probe request template. * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version) * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version) + * @IWM_UCODE_TLV_FLAGS_P2P_PS: P2P client power save is supported (only on a + * single bound interface). * @IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD * @IWM_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS. * @IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save * @IWM_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. + * @IWM_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients + * */ -enum iwm_ucode_tlv_flag { - IWM_UCODE_TLV_FLAGS_PAN = (1 << 0), - IWM_UCODE_TLV_FLAGS_NEWSCAN = (1 << 1), - IWM_UCODE_TLV_FLAGS_MFP = (1 << 2), - IWM_UCODE_TLV_FLAGS_SHORT_BL = (1 << 7), - IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS = (1 << 10), - IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID = (1 << 12), - IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL = (1 << 15), - IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE = (1 << 16), - IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT = (1 << 24), - IWM_UCODE_TLV_FLAGS_EBS_SUPPORT = (1 << 25), - IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD = (1 << 26), - IWM_UCODE_TLV_FLAGS_BCAST_FILTERING = (1 << 29), -}; +#define IWM_UCODE_TLV_FLAGS_PAN (1 << 0) +#define IWM_UCODE_TLV_FLAGS_NEWSCAN (1 << 1) +#define IWM_UCODE_TLV_FLAGS_MFP (1 << 2) +#define IWM_UCODE_TLV_FLAGS_P2P (1 << 3) +#define IWM_UCODE_TLV_FLAGS_DW_BC_TABLE (1 << 4) +#define IWM_UCODE_TLV_FLAGS_SHORT_BL (1 << 7) +#define IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS (1 << 10) +#define IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID (1 << 12) +#define IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL (1 << 15) +#define IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE (1 << 16) +#define IWM_UCODE_TLV_FLAGS_P2P_PS (1 << 21) +#define IWM_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM (1 << 22) +#define IWM_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM (1 << 23) +#define IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT (1 << 24) +#define IWM_UCODE_TLV_FLAGS_EBS_SUPPORT (1 << 25) +#define IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD (1 << 26) +#define IWM_UCODE_TLV_FLAGS_BCAST_FILTERING (1 << 29) +#define IWM_UCODE_TLV_FLAGS_GO_UAPSD (1 << 30) +#define IWM_UCODE_TLV_FLAGS_LTE_COEX (1U << 31) #define IWM_UCODE_TLV_FLAG_BITS \ - "\020\1PAN\2NEWSCAN\3MFP\4P2P\5DW_BC_TABLE\6NEWBT_COEX\7PM_CMD\10SHORT_BL\11RX_ENERG \ -Y\12TIME_EVENT_V2\13D3_6_IPV6\14BF_UPDATED\15NO_BASIC_SSID\17D3_CONTINUITY\20NEW_NSOFF \ -L_S\21NEW_NSOFFL_L\22SCHED_SCAN\24STA_KEY_CMD\25DEVICE_PS_CMD\26P2P_PS\27P2P_PS_DCM\30 \ -P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40LTE_COEX" + "\020\1PAN\2NEWSCAN\3MFP\4P2P\5DW_BC_TABLE\6NEWBT_COEX\7PM_CMD\10SHORT_BL\11RX_ENERGY\12TIME_EVENT_V2\13D3_6_IPV6\14BF_UPDATED\15NO_BASIC_SSID\17D3_CONTINUITY\20NEW_NSOFFL_S\21NEW_NSOFFL_L\22SCHED_SCAN\24STA_KEY_CMD\25DEVICE_PS_CMD\26P2P_PS\27P2P_PS_DCM\30P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40LTE_COEX" /** - * enum iwm_ucode_tlv_api - ucode api + * uCode TLV api * @IWM_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time * longer than the passive one, which is essential for fragmented scan. * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source. + * @IWM_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params * @IWM_UCODE_TLV_API_NEW_VERSION: new versioning format + * @IWM_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size + * (command version 3) that supports per-chain limits * @IWM_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan * iteration complete notification, and the timestamp reported for RX * received during scan, are reported in TSF of the mac specified in the @@ -647,71 +833,35 @@ P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40L * @IWM_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of * ADD_MODIFY_STA_KEY_API_S_VER_2. * @IWM_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement. - * @IWM_UCODE_TLV_API_NAN2_VER2: This ucode supports NAN API version 2 + * @IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority + * instead of 3. * @IWM_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used - * @IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY: Quota command includes a field - * indicating low latency direction. - * @IWM_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is - * deprecated. - * @IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8 - * of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8 - * @IWM_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS - * @IWM_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of - * the REDUCE_TX_POWER_CMD. - * @IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short - * version of the beacon notification. - * @IWM_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of - * BEACON_FILTER_CONFIG_API_S_VER_4. - * @IWM_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of - * REGULATORY_NVM_GET_INFO_RSP_API_S. - * @IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of - * LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S. - * @IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of - * SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S and v3 of - * SCAN_OFFLOAD_PROFILES_QUERY_RSP_S. - * @IWM_UCODE_TLV_API_MBSSID_HE: This ucode supports v2 of - * STA_CONTEXT_DOT11AX_API_S - * @IWM_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar - * version tables. * * @IWM_NUM_UCODE_TLV_API: number of bits used */ -enum iwm_ucode_tlv_api { - IWM_UCODE_TLV_API_FRAGMENTED_SCAN = 8, - IWM_UCODE_TLV_API_WIFI_MCC_UPDATE = 9, - IWM_UCODE_TLV_API_LQ_SS_PARAMS = 18, - IWM_UCODE_TLV_API_NEW_VERSION = 20, - IWM_UCODE_TLV_API_SCAN_TSF_REPORT = 28, - IWM_UCODE_TLV_API_TKIP_MIC_KEYS = 29, - IWM_UCODE_TLV_API_STA_TYPE = 30, - IWM_UCODE_TLV_API_NAN2_VER2 = 31, - IWM_UCODE_TLV_API_ADAPTIVE_DWELL = 32, - IWM_UCODE_TLV_API_OCE = 33, - IWM_UCODE_TLV_API_NEW_BEACON_TEMPLATE = 34, - IWM_UCODE_TLV_API_NEW_RX_STATS = 35, - IWM_UCODE_TLV_API_WOWLAN_KEY_MATERIAL = 36, - IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY = 38, - IWM_UCODE_TLV_API_DEPRECATE_TTAK = 41, - IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = 42, - IWM_UCODE_TLV_API_FRAG_EBS = 44, - IWM_UCODE_TLV_API_REDUCE_TX_POWER = 45, - IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF = 46, - IWM_UCODE_TLV_API_BEACON_FILTER_V4 = 47, - IWM_UCODE_TLV_API_REGULATORY_NVM_INFO = 48, - IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ = 49, - IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS = 50, - IWM_UCODE_TLV_API_MBSSID_HE = 52, - IWM_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = 53, - IWM_UCODE_TLV_API_FTM_RTT_ACCURACY = 54, - IWM_UCODE_TLV_API_SAR_TABLE_VER = 55, - IWM_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = 57, - IWM_UCODE_TLV_API_SCAN_EXT_CHAN_VER = 58, - - IWM_NUM_UCODE_TLV_API = 128, -}; - -/** - * enum iwm_ucode_tlv_capa - ucode capabilities +#define IWM_UCODE_TLV_API_FRAGMENTED_SCAN 8 +#define IWM_UCODE_TLV_API_WIFI_MCC_UPDATE 9 +#define IWM_UCODE_TLV_API_WIDE_CMD_HDR 14 +#define IWM_UCODE_TLV_API_LQ_SS_PARAMS 18 +#define IWM_UCODE_TLV_API_NEW_VERSION 20 +#define IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY 24 +#define IWM_UCODE_TLV_API_TX_POWER_CHAIN 27 +#define IWM_UCODE_TLV_API_SCAN_TSF_REPORT 28 +#define IWM_UCODE_TLV_API_TKIP_MIC_KEYS 29 +#define IWM_UCODE_TLV_API_STA_TYPE 30 +#define IWM_UCODE_TLV_API_NAN2_VER2 31 +#define IWM_UCODE_TLV_API_ADAPTIVE_DWELL 32 +#define IWM_UCODE_TLV_API_NEW_RX_STATS 35 +#define IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY 38 +#define IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2 42 +#define IWM_UCODE_TLV_API_SCAN_EXT_CHAN_VER 58 +#define IWM_NUM_UCODE_TLV_API 128 + +#define IWM_UCODE_TLV_API_BITS \ + "\020\10FRAGMENTED_SCAN\11WIFI_MCC_UPDATE\16WIDE_CMD_HDR\22LQ_SS_PARAMS\30EXT_SCAN_PRIO\33TX_POWER_CHAIN\35TKIP_MIC_KEYS" + +/** + * uCode capabilities * @IWM_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3 * @IWM_UCODE_TLV_CAPA_LAR_SUPPORT: supports Location Aware Regulatory * @IWM_UCODE_TLV_CAPA_UMAC_SCAN: supports UMAC scan. @@ -763,55 +913,57 @@ enum iwm_ucode_tlv_api { * @IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared * memory addresses from the firmware. * @IWM_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement - * @IWM_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger - * command size (command version 4) that supports toggling ACK TX - * power reduction. + * @IWM_UCODE_TLV_CAPA_LMAC_UPLOAD: supports upload mode in lmac (1=supported, + * 0=no support) * * @IWM_NUM_UCODE_TLV_CAPA: number of bits used */ -enum iwm_ucode_tlv_capa { - IWM_UCODE_TLV_CAPA_D0I3_SUPPORT = 0, - IWM_UCODE_TLV_CAPA_LAR_SUPPORT = 1, - IWM_UCODE_TLV_CAPA_UMAC_SCAN = 2, - IWM_UCODE_TLV_CAPA_BEAMFORMER = 3, - IWM_UCODE_TLV_CAPA_TOF_SUPPORT = 5, - IWM_UCODE_TLV_CAPA_TDLS_SUPPORT = 6, - IWM_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT = 8, - IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT = 9, - IWM_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = 10, - IWM_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = 11, - IWM_UCODE_TLV_CAPA_DQA_SUPPORT = 12, - IWM_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH = 13, - IWM_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG = 17, - IWM_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = 18, - IWM_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT = 19, - IWM_UCODE_TLV_CAPA_2G_COEX_SUPPORT = 20, - IWM_UCODE_TLV_CAPA_CSUM_SUPPORT = 21, - IWM_UCODE_TLV_CAPA_RADIO_BEACON_STATS = 22, - IWM_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD = 26, - IWM_UCODE_TLV_CAPA_BT_COEX_PLCR = 28, - IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC = 29, - IWM_UCODE_TLV_CAPA_BT_COEX_RRC = 30, - IWM_UCODE_TLV_CAPA_GSCAN_SUPPORT = 31, - IWM_UCODE_TLV_CAPA_NAN_SUPPORT = 34, - IWM_UCODE_TLV_CAPA_UMAC_UPLOAD = 35, - IWM_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = 64, - IWM_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = 65, - IWM_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = 67, - IWM_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT = 68, - IWM_UCODE_TLV_CAPA_BEACON_ANT_SELECTION = 71, - IWM_UCODE_TLV_CAPA_BEACON_STORING = 72, - IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2 = 73, - IWM_UCODE_TLV_CAPA_CT_KILL_BY_FW = 74, - IWM_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT = 75, - IWM_UCODE_TLV_CAPA_CTDP_SUPPORT = 76, - IWM_UCODE_TLV_CAPA_USNIFFER_UNIFIED = 77, - IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = 80, - IWM_UCODE_TLV_CAPA_LQM_SUPPORT = 81, - IWM_UCODE_TLV_CAPA_TX_POWER_ACK = 84, - - IWM_NUM_UCODE_TLV_CAPA = 128 -}; +#define IWM_UCODE_TLV_CAPA_D0I3_SUPPORT 0 +#define IWM_UCODE_TLV_CAPA_LAR_SUPPORT 1 +#define IWM_UCODE_TLV_CAPA_UMAC_SCAN 2 +#define IWM_UCODE_TLV_CAPA_BEAMFORMER 3 +#define IWM_UCODE_TLV_CAPA_TOF_SUPPORT 5 +#define IWM_UCODE_TLV_CAPA_TDLS_SUPPORT 6 +#define IWM_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT 8 +#define IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT 9 +#define IWM_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT 10 +#define IWM_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT 11 +#define IWM_UCODE_TLV_CAPA_DQA_SUPPORT 12 +#define IWM_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH 13 +#define IWM_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG 17 +#define IWM_UCODE_TLV_CAPA_HOTSPOT_SUPPORT 18 +#define IWM_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT 19 +#define IWM_UCODE_TLV_CAPA_2G_COEX_SUPPORT 20 +#define IWM_UCODE_TLV_CAPA_CSUM_SUPPORT 21 +#define IWM_UCODE_TLV_CAPA_RADIO_BEACON_STATS 22 +#define IWM_UCODE_TLV_CAPA_P2P_STANDALONE_UAPSD 26 +#define IWM_UCODE_TLV_CAPA_BT_COEX_PLCR 28 +#define IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC 29 +#define IWM_UCODE_TLV_CAPA_BT_COEX_RRC 30 +#define IWM_UCODE_TLV_CAPA_GSCAN_SUPPORT 31 +#define IWM_UCODE_TLV_CAPA_NAN_SUPPORT 34 +#define IWM_UCODE_TLV_CAPA_UMAC_UPLOAD 35 +#define IWM_UCODE_TLV_CAPA_SOC_LATENCY_SUPPORT 37 +#define IWM_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT 39 +#define IWM_UCODE_TLV_CAPA_CDB_SUPPORT 40 +#define IWM_UCODE_TLV_CAPA_DYNAMIC_QUOTA 44 +#define IWM_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS 48 +#define IWM_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE 64 +#define IWM_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS 65 +#define IWM_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT 67 +#define IWM_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT 68 +#define IWM_UCODE_TLV_CAPA_BEACON_ANT_SELECTION 71 +#define IWM_UCODE_TLV_CAPA_BEACON_STORING 72 +#define IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2 73 +#define IWM_UCODE_TLV_CAPA_CT_KILL_BY_FW 74 +#define IWM_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT 75 +#define IWM_UCODE_TLV_CAPA_CTDP_SUPPORT 76 +#define IWM_UCODE_TLV_CAPA_USNIFFER_UNIFIED 77 +#define IWM_UCODE_TLV_CAPA_LMAC_UPLOAD 79 +#define IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG 80 +#define IWM_UCODE_TLV_CAPA_LQM_SUPPORT 81 + +#define IWM_NUM_UCODE_TLV_CAPA 128 /* The default calibrate table size if not specified by firmware file */ #define IWM_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 @@ -821,17 +973,6 @@ enum iwm_ucode_tlv_capa { /* The default max probe length if not specified by the firmware file */ #define IWM_DEFAULT_MAX_PROBE_LENGTH 200 *** 4208 LINES SKIPPED *** From nobody Wed Oct 27 03:29:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 456B71812111; Wed, 27 Oct 2021 03:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfDhV1Ll1z507J; Wed, 27 Oct 2021 03:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0A524C92; Wed, 27 Oct 2021 03:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R3Tj3N025257; Wed, 27 Oct 2021 03:29:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R3TjaX025256; Wed, 27 Oct 2021 03:29:45 GMT (envelope-from git) Date: Wed, 27 Oct 2021 03:29:45 GMT Message-Id: <202110270329.19R3TjaX025256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: d524e370c4db - main - iwm: Update SCD register accesses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d524e370c4dbabf607546aec6e4bcc8d64758851 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=d524e370c4dbabf607546aec6e4bcc8d64758851 commit d524e370c4dbabf607546aec6e4bcc8d64758851 Author: Adrian Chadd AuthorDate: 2021-10-25 04:29:53 +0000 Commit: Adrian Chadd CommitDate: 2021-10-27 03:28:55 +0000 iwm: Update SCD register accesses This brings it inline with what's in openbsd. I tested it locally with 2G and 5G association; it seems to work. Tested: Intel 7260 AC, hw 0x140, STA mode, 2G/5G Differential Revision: https://reviews.freebsd.org/D32627 Subscribers: imp Obtainde from: OpenBSD --- sys/dev/iwm/if_iwmreg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index c3c51a25c4b0..ee5c5ec07b21 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -1410,14 +1410,14 @@ static inline unsigned int IWM_SCD_QUEUE_RDPTR(unsigned int chnl) { if (chnl < 20) return IWM_SCD_BASE + 0x68 + chnl * 4; - return IWM_SCD_BASE + 0x2B4 + (chnl - 20) * 4; + return IWM_SCD_BASE + 0x2B4 + chnl * 4; } static inline unsigned int IWM_SCD_QUEUE_STATUS_BITS(unsigned int chnl) { if (chnl < 20) return IWM_SCD_BASE + 0x10c + chnl * 4; - return IWM_SCD_BASE + 0x384 + (chnl - 20) * 4; + return IWM_SCD_BASE + 0x334 + chnl * 4; } /*********************** END TX SCHEDULER *************************************/ From nobody Wed Oct 27 04:15:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ADD231825BB7; Wed, 27 Oct 2021 04:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfFjp2fl7z3CQ2; Wed, 27 Oct 2021 04:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 37891180B; Wed, 27 Oct 2021 04:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R4FwjE091531; Wed, 27 Oct 2021 04:15:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R4FwBQ091530; Wed, 27 Oct 2021 04:15:58 GMT (envelope-from git) Date: Wed, 27 Oct 2021 04:15:58 GMT Message-Id: <202110270415.19R4FwBQ091530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 80abcfbdfe1a - main - bxe(4): Fix a few common typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80abcfbdfe1af72318c2c0b1690013f43e875267 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=80abcfbdfe1af72318c2c0b1690013f43e875267 commit 80abcfbdfe1af72318c2c0b1690013f43e875267 Author: Gordon Bergling AuthorDate: 2021-10-27 04:15:06 +0000 Commit: Gordon Bergling CommitDate: 2021-10-27 04:15:06 +0000 bxe(4): Fix a few common typos in source code comments - s/controled/controlled/ - s/allignment/alignment/ MFC after: 3 days --- sys/dev/bxe/bxe_elink.c | 4 ++-- sys/dev/bxe/ecore_hsi.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/bxe/bxe_elink.c b/sys/dev/bxe/bxe_elink.c index bdd8affdb437..dd77e9301ab0 100644 --- a/sys/dev/bxe/bxe_elink.c +++ b/sys/dev/bxe/bxe_elink.c @@ -4418,7 +4418,7 @@ static uint8_t elink_ext_phy_resolve_fc(struct elink_phy *phy, uint8_t ret = 0; vars->flow_ctrl = ELINK_FLOW_CTRL_NONE; if (phy->req_flow_ctrl != ELINK_FLOW_CTRL_AUTO) { - /* Update the advertised flow-controled of LD/LP in AN */ + /* Update the advertised flow-controlled of LD/LP in AN */ if (phy->req_line_speed == ELINK_SPEED_AUTO_NEG) elink_ext_phy_update_adv_fc(phy, params, vars); /* But set the flow-control result as the requested one */ @@ -6262,7 +6262,7 @@ static void elink_flow_ctrl_resolve(struct elink_phy *phy, /* Resolve from gp_status in case of AN complete and not sgmii */ if (phy->req_flow_ctrl != ELINK_FLOW_CTRL_AUTO) { - /* Update the advertised flow-controled of LD/LP in AN */ + /* Update the advertised flow-controlled of LD/LP in AN */ if (phy->req_line_speed == ELINK_SPEED_AUTO_NEG) elink_update_adv_fc(phy, params, vars, gp_status); /* But set the flow-control result as the requested one */ diff --git a/sys/dev/bxe/ecore_hsi.h b/sys/dev/bxe/ecore_hsi.h index 5048ff5dfc78..22f0767e6b0f 100644 --- a/sys/dev/bxe/ecore_hsi.h +++ b/sys/dev/bxe/ecore_hsi.h @@ -9448,7 +9448,7 @@ struct iscsi_cq_db struct iscsi_cq_db_prod_pnd_cmpltn_cnt_arr cq_u_prod_pend_comp_ctr_arr /* Ustorm CQ producer and pending completion counter array, updated by Ustorm */; struct iscsi_cq_db_pnd_comp_itt_arr cq_c_pend_comp_itt_arr /* Cstorm CQ pending completion ITT array, updated by Cstorm */; struct iscsi_cq_db_sqn_2_notify_arr cq_drv_sqn_2_notify_arr /* Cstorm CQ sequence to notify array, updated by driver */; - uint32_t reserved[4] /* 16 byte allignment */; + uint32_t reserved[4] /* 16 byte alignment */; }; From nobody Wed Oct 27 04:16:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AB91C1825FBE; Wed, 27 Oct 2021 04:16: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfFkV3L6xz3CrV; Wed, 27 Oct 2021 04:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5279A1665; Wed, 27 Oct 2021 04:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R4GYk1091686; Wed, 27 Oct 2021 04:16:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R4GYpE091685; Wed, 27 Oct 2021 04:16:34 GMT (envelope-from git) Date: Wed, 27 Oct 2021 04:16:34 GMT Message-Id: <202110270416.19R4GYpE091685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 70de1003da6f - main - jail(8): Fix a few common typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70de1003da6f6e78e32f92bd98c9f18f965e6663 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=70de1003da6f6e78e32f92bd98c9f18f965e6663 commit 70de1003da6f6e78e32f92bd98c9f18f965e6663 Author: Gordon Bergling AuthorDate: 2021-10-27 04:16:06 +0000 Commit: Gordon Bergling CommitDate: 2021-10-27 04:16:06 +0000 jail(8): Fix a few common typos in source code comments - s/phyiscal/physical/ MFC after: 3 days --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index c13aa73538a5..e9019eda4d6c 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -3618,7 +3618,7 @@ prison_priv_check(struct ucred *cred, int priv) /* * As in the non-jail case, non-root users are expected to be - * able to read kernel/phyiscal memory (provided /dev/[k]mem + * able to read kernel/physical memory (provided /dev/[k]mem * exists in the jail and they have permission to access it). */ case PRIV_KMEM_READ: From nobody Wed Oct 27 09:27:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CF8AF18140C7; Wed, 27 Oct 2021 09:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfNdY5bpdz3tKm; Wed, 27 Oct 2021 09:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9C4C058CC; Wed, 27 Oct 2021 09:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19R9Rjd5004096; Wed, 27 Oct 2021 09:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19R9Rjic004095; Wed, 27 Oct 2021 09:27:45 GMT (envelope-from git) Date: Wed, 27 Oct 2021 09:27:45 GMT Message-Id: <202110270927.19R9Rjic004095@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexey Dokuchaev Subject: git: ccfdf335d697 - main - crunchgen: use realpath(3) instead of ``pwd -P'' List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: danfe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccfdf335d6976bb0e3436b808418d14f3d150a3d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by danfe (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ccfdf335d6976bb0e3436b808418d14f3d150a3d commit ccfdf335d6976bb0e3436b808418d14f3d150a3d Author: Alexey Dokuchaev AuthorDate: 2020-10-11 08:23:00 +0000 Commit: Alexey Dokuchaev CommitDate: 2021-10-27 09:26:00 +0000 crunchgen: use realpath(3) instead of ``pwd -P'' r366466 (9c7bd4f198e1) fixed a subtle bug by stripping the trailing '\n' appended to the output of popen("cd %s && pwd -P", p->srcdir). Replace this cumbersome implementation with a single realpath(3) call which avoids spawning a shell, reading from the stream with fgets(3), and final strdup(3). Reviewed by: arichardson, kevans Approved by: imp Differential Revision: https://reviews.freebsd.org/D26734 --- usr.sbin/crunch/crunchgen/crunchgen.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c index 94792c5ec50b..89d549b18b4e 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunch/crunchgen/crunchgen.c @@ -639,7 +639,6 @@ fillin_program(prog_t *p) { char path[MAXPATHLEN]; char line[MAXLINELEN]; - FILE *f; snprintf(line, MAXLINELEN, "filling in parms for %s", p->name); status(line); @@ -654,22 +653,9 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && pwd -P", p->srcdir); - f = popen(line,"r"); - if (!f) - errx(1, "Can't execute: %s\n", line); - - path[0] = '\0'; - fgets(path, sizeof path, f); - if (pclose(f)) - errx(1, "Can't execute: %s\n", line); - - if (!*path) - errx(1, "Can't perform pwd on: %s\n", p->srcdir); - - /* Chop off trailing newline. */ - path[strlen(path) - 1] = '\0'; - p->realsrcdir = strdup(path); + p->realsrcdir = realpath(p->srcdir, NULL); + if (p->realsrcdir == NULL) + errx(1, "Can't resolve path: %s\n", p->srcdir); } /* Unless the option to make object files was specified the From nobody Wed Oct 27 13:56:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 118D3181918F; Wed, 27 Oct 2021 13: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfVbN6wYbz4YdJ; Wed, 27 Oct 2021 13:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C2E6A11964; Wed, 27 Oct 2021 13:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RDuGvS062992; Wed, 27 Oct 2021 13:56:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RDuGP7062991; Wed, 27 Oct 2021 13:56:16 GMT (envelope-from git) Date: Wed, 27 Oct 2021 13:56:16 GMT Message-Id: <202110271356.19RDuGP7062991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 74efe421ea04 - stable/13 - vm_page: Move vm_page_alloc_check() to after page allocator definitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 74efe421ea041b1e948041d460bbeb65ea1a3748 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=74efe421ea041b1e948041d460bbeb65ea1a3748 commit 74efe421ea041b1e948041d460bbeb65ea1a3748 Author: Mark Johnston AuthorDate: 2021-10-20 01:22:50 +0000 Commit: Mark Johnston CommitDate: 2021-10-27 13:53:29 +0000 vm_page: Move vm_page_alloc_check() to after page allocator definitions This way all of the vm_page_alloc_*() allocator functions are grouped together. Sponsored by: The FreeBSD Foundation (cherry picked from commit a23e6a1078d6d6c361481ab4f835449f177edac3) --- sys/vm/vm_page.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 9ca18129f415..b5c29b27bc2a 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2394,28 +2394,6 @@ found: return (m_ret); } -/* - * Check a page that has been freshly dequeued from a freelist. - */ -static void -vm_page_alloc_check(vm_page_t m) -{ - - KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->a.queue == PQ_NONE && - (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, - ("page %p has unexpected queue %d, flags %#x", - m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); - KASSERT(m->ref_count == 0, ("page %p has references", m)); - KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); - KASSERT(m->dirty == 0, ("page %p is dirty", m)); - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, - ("page %p has unexpected memattr %d", - m, pmap_page_get_memattr(m))); - KASSERT(m->valid == 0, ("free page %p is valid", m)); - pmap_vm_page_alloc_check(m); -} - /* * vm_page_alloc_freelist: * @@ -2494,6 +2472,27 @@ again: return (m); } +/* + * Check a page that has been freshly dequeued from a freelist. + */ +static void +vm_page_alloc_check(vm_page_t m) +{ + KASSERT(m->object == NULL, ("page %p has object", m)); + KASSERT(m->ref_count == 0, ("page %p has references", m)); + KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); + KASSERT(m->a.queue == PQ_NONE && + (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, + ("page %p has unexpected queue %d, flags %#x", + m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); + KASSERT(m->valid == 0, ("free page %p is valid", m)); + KASSERT(m->dirty == 0, ("page %p is dirty", m)); + KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, + ("page %p has unexpected memattr %d", + m, pmap_page_get_memattr(m))); + pmap_vm_page_alloc_check(m); +} + static int vm_page_zone_import(void *arg, void **store, int cnt, int domain, int flags) { From nobody Wed Oct 27 15:19:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D154E1812307; Wed, 27 Oct 2021 15:19: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfXR25TqWz3Cq6; Wed, 27 Oct 2021 15:19:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 987D912915; Wed, 27 Oct 2021 15:19:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFJAYG070567; Wed, 27 Oct 2021 15:19:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFJA2g070566; Wed, 27 Oct 2021 15:19:10 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:19:10 GMT Message-Id: <202110271519.19RFJA2g070566@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: 71f31d784e18 - main - rmslock: Update td_locks during lock and unlock operations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71f31d784e1816a155cafbccf4b28291200097aa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71f31d784e1816a155cafbccf4b28291200097aa commit 71f31d784e1816a155cafbccf4b28291200097aa Author: Mark Johnston AuthorDate: 2021-10-27 15:18:13 +0000 Commit: Mark Johnston CommitDate: 2021-10-27 15:18:13 +0000 rmslock: Update td_locks during lock and unlock operations Reviewed by: mjg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32692 --- sys/kern/kern_rmlock.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 7230a00e357b..f9b5559a648c 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -1017,6 +1017,7 @@ rms_rlock_fallback(struct rmslock *rms) rms_int_readers_inc(rms, rms_int_pcpu(rms)); mtx_unlock(&rms->mtx); critical_exit(); + TD_LOCKS_INC(curthread); } void @@ -1040,6 +1041,7 @@ rms_rlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_INC(curthread); } int @@ -1063,6 +1065,7 @@ rms_try_rlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_INC(curthread); return (1); } @@ -1082,6 +1085,7 @@ rms_runlock_fallback(struct rmslock *rms) if (rms->readers == 0) wakeup_one(&rms->writers); mtx_unlock(&rms->mtx); + TD_LOCKS_DEC(curthread); } void @@ -1102,6 +1106,7 @@ rms_runlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_DEC(curthread); } struct rmslock_ipi { @@ -1219,6 +1224,7 @@ out_grab: rms_assert_no_pcpu_readers(rms); mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); + TD_LOCKS_INC(curthread); } void @@ -1239,6 +1245,7 @@ rms_wunlock(struct rmslock *rms) rms->owner = RMS_NOOWNER; } mtx_unlock(&rms->mtx); + TD_LOCKS_DEC(curthread); } void From nobody Wed Oct 27 15:22:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E17AA1813DDA; Wed, 27 Oct 2021 15:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfXWN4fHWz3Dpr; Wed, 27 Oct 2021 15:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 643ED129C7; Wed, 27 Oct 2021 15:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFMuMa084000; Wed, 27 Oct 2021 15:22:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFMuX4083999; Wed, 27 Oct 2021 15:22:56 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:22:56 GMT Message-Id: <202110271522.19RFMuX4083999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: e28330832be4 - main - tcp: socket option to get stack alias name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e28330832be41d2ef012dda1dafef25895ab2c6b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=e28330832be41d2ef012dda1dafef25895ab2c6b commit e28330832be41d2ef012dda1dafef25895ab2c6b Author: Peter Lei AuthorDate: 2021-10-26 03:08:54 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-27 15:21:59 +0000 tcp: socket option to get stack alias name TCP stack sysctl nodes are currently inserted using the stack name alias. Allow the user to get the current stack's alias to allow for programatic sysctl access. Obtained from: Netflix --- sys/netinet/tcp.h | 1 + sys/netinet/tcp_subr.c | 31 +++++++++++++++++++++++++++++++ sys/netinet/tcp_usrreq.c | 15 +++++++++++---- sys/netinet/tcp_var.h | 1 + 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index e7c47e85bb7b..6dc7403aae28 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -210,6 +210,7 @@ struct tcphdr { #define TCP_PCAP_OUT 2048 /* number of output packets to keep */ #define TCP_PCAP_IN 4096 /* number of input packets to keep */ #define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */ +#define TCP_FUNCTION_ALIAS 8193 /* Get the current tcp function pointer name alias */ /* Options for Rack and BBR */ #define TCP_REUSPORT_LB_NUMA 1026 /* set listen socket numa domain */ #define TCP_RACK_MBUF_QUEUE 1050 /* Do we allow mbuf queuing if supported */ diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 9d66086a383b..2752773a95fc 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -473,6 +473,37 @@ find_and_ref_tcp_fb(struct tcp_function_block *blk) return(rblk); } +/* Find a matching alias for the given tcp_function_block. */ +int +find_tcp_function_alias(struct tcp_function_block *blk, + struct tcp_function_set *fs) +{ + struct tcp_function *f; + int found; + + found = 0; + rw_rlock(&tcp_function_lock); + TAILQ_FOREACH(f, &t_functions, tf_next) { + if ((f->tf_fb == blk) && + (strncmp(f->tf_name, blk->tfb_tcp_block_name, + TCP_FUNCTION_NAME_LEN_MAX) != 0)) { + /* Matching function block with different name. */ + strncpy(fs->function_set_name, f->tf_name, + TCP_FUNCTION_NAME_LEN_MAX); + found = 1; + break; + } + } + /* Null terminate the string appropriately. */ + if (found) { + fs->function_set_name[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; + } else { + fs->function_set_name[0] = '\0'; + } + rw_runlock(&tcp_function_lock); + return (found); +} + static struct tcp_function_block * find_and_ref_tcp_default_fb(void) { diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index e9f7fa541461..f004d54b4657 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1894,10 +1894,17 @@ err_out: INP_WUNLOCK(inp); return (error); } else if ((sopt->sopt_dir == SOPT_GET) && - (sopt->sopt_name == TCP_FUNCTION_BLK)) { - strncpy(fsn.function_set_name, tp->t_fb->tfb_tcp_block_name, - TCP_FUNCTION_NAME_LEN_MAX); - fsn.function_set_name[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; + ((sopt->sopt_name == TCP_FUNCTION_BLK) || + (sopt->sopt_name == TCP_FUNCTION_ALIAS))) { + if (sopt->sopt_name == TCP_FUNCTION_ALIAS) { + memset(&fsn, 0, sizeof(fsn)); + find_tcp_function_alias(tp->t_fb, &fsn); + } else { + strncpy(fsn.function_set_name, + tp->t_fb->tfb_tcp_block_name, + TCP_FUNCTION_NAME_LEN_MAX); + fsn.function_set_name[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; + } fsn.pcbcnt = tp->t_fb->tfb_refcnt; INP_WUNLOCK(inp); error = sooptcopyout(sopt, &fsn, sizeof fsn); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index d5b2963ef4dc..2775fb392a1a 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1020,6 +1020,7 @@ int register_tcp_functions_as_name(struct tcp_function_block *blk, int deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce, bool force); struct tcp_function_block *find_and_ref_tcp_functions(struct tcp_function_set *fs); +int find_tcp_function_alias(struct tcp_function_block *blk, struct tcp_function_set *fs); void tcp_switch_back_to_default(struct tcpcb *tp); struct tcp_function_block * find_and_ref_tcp_fb(struct tcp_function_block *fs); From nobody Wed Oct 27 15:22:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D946B1813F35; Wed, 27 Oct 2021 15:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfXWP5Nlrz3DZJ; Wed, 27 Oct 2021 15:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8C36D126E9; Wed, 27 Oct 2021 15:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFMvEM084024; Wed, 27 Oct 2021 15:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFMvHK084023; Wed, 27 Oct 2021 15:22:57 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:22:57 GMT Message-Id: <202110271522.19RFMvHK084023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: fc4d53cc2ef3 - main - Split tcp_ctloutput() into set/get parts. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc4d53cc2ef3345ad36c874010c4abc2317a61f8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=fc4d53cc2ef3345ad36c874010c4abc2317a61f8 commit fc4d53cc2ef3345ad36c874010c4abc2317a61f8 Author: Gleb Smirnoff AuthorDate: 2021-10-26 03:38:31 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-27 15:21:59 +0000 Split tcp_ctloutput() into set/get parts. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D32655 --- sys/netinet/tcp_usrreq.c | 125 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 35 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index f004d54b4657..0fca9b88e6f3 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1729,22 +1729,18 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti) } while(0) #define INP_WLOCK_RECHECK(inp) INP_WLOCK_RECHECK_CLEANUP((inp), /* noop */) -int -tcp_ctloutput(struct socket *so, struct sockopt *sopt) +static int +tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) { - int error; - struct inpcb *inp; - struct tcpcb *tp; - struct tcp_function_block *blk; - struct tcp_function_set fsn; + struct tcpcb *tp = intotcpcb(inp); + int error = 0; + + MPASS(sopt->sopt_dir == SOPT_SET); - error = 0; - inp = sotoinpcb(so); - KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL")); if (sopt->sopt_level != IPPROTO_TCP) { #ifdef INET6 if (inp->inp_vflag & INP_IPV6PROTO) { - error = ip6_ctloutput(so, sopt); + error = ip6_ctloutput(inp->inp_socket, sopt); /* * In case of the IPV6_USE_MIN_MTU socket option, * the INC_IPV6MINMTU flag to announce a corresponding @@ -1755,7 +1751,6 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) * be fragmented at the IPv6 layer. */ if ((error == 0) && - (sopt->sopt_dir == SOPT_SET) && (sopt->sopt_level == IPPROTO_IPV6) && (sopt->sopt_name == IPV6_USE_MIN_MTU)) { INP_WLOCK(inp); @@ -1788,29 +1783,29 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) #endif #ifdef INET { - error = ip_ctloutput(so, sopt); + error = ip_ctloutput(inp->inp_socket, sopt); } #endif return (error); - } - INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { - INP_WUNLOCK(inp); - return (ECONNRESET); - } - tp = intotcpcb(inp); - /* - * Protect the TCP option TCP_FUNCTION_BLK so - * that a sub-function can *never* overwrite this. - */ - if ((sopt->sopt_dir == SOPT_SET) && - (sopt->sopt_name == TCP_FUNCTION_BLK)) { - INP_WUNLOCK(inp); - error = sooptcopyin(sopt, &fsn, sizeof fsn, - sizeof fsn); + } else if (sopt->sopt_name == TCP_FUNCTION_BLK) { + /* + * Protect the TCP option TCP_FUNCTION_BLK so + * that a sub-function can *never* overwrite this. + */ + struct tcp_function_set fsn; + struct tcp_function_block *blk; + + error = sooptcopyin(sopt, &fsn, sizeof fsn, sizeof fsn); if (error) return (error); - INP_WLOCK_RECHECK(inp); + + INP_WLOCK(inp); + if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + INP_WUNLOCK(inp); + return (ECONNRESET); + } + tp = intotcpcb(inp); + blk = find_and_ref_tcp_functions(&fsn); if (blk == NULL) { INP_WUNLOCK(inp); @@ -1875,7 +1870,7 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) if((*tp->t_fb->tfb_tcp_fb_init)(tp) != 0) { /* Fall back failed, drop the connection */ INP_WUNLOCK(inp); - soabort(so); + soabort(inp->inp_socket); return(error); } } @@ -1893,9 +1888,50 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) err_out: INP_WUNLOCK(inp); return (error); - } else if ((sopt->sopt_dir == SOPT_GET) && - ((sopt->sopt_name == TCP_FUNCTION_BLK) || + } + + INP_WLOCK(inp); + if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + INP_WUNLOCK(inp); + return (ECONNRESET); + } + tp = intotcpcb(inp); + + /* Pass in the INP locked, caller must unlock it. */ + return (tp->t_fb->tfb_tcp_ctloutput(inp->inp_socket, sopt, inp, tp)); +} + +static int +tcp_ctloutput_get(struct inpcb *inp, struct sockopt *sopt) +{ + int error = 0; + struct tcpcb *tp; + + MPASS(sopt->sopt_dir == SOPT_GET); + + if (sopt->sopt_level != IPPROTO_TCP) { +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6PROTO) + error = ip6_ctloutput(inp->inp_socket, sopt); +#endif /* INET6 */ +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET + error = ip_ctloutput(inp->inp_socket, sopt); +#endif + return (error); + } + INP_WLOCK(inp); + if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + INP_WUNLOCK(inp); + return (ECONNRESET); + } + tp = intotcpcb(inp); + if (((sopt->sopt_name == TCP_FUNCTION_BLK) || (sopt->sopt_name == TCP_FUNCTION_ALIAS))) { + struct tcp_function_set fsn; + if (sopt->sopt_name == TCP_FUNCTION_ALIAS) { memset(&fsn, 0, sizeof(fsn)); find_tcp_function_alias(tp->t_fb, &fsn); @@ -1910,8 +1946,27 @@ err_out: error = sooptcopyout(sopt, &fsn, sizeof fsn); return (error); } - /* Pass in the INP locked, called must unlock it */ - return (tp->t_fb->tfb_tcp_ctloutput(so, sopt, inp, tp)); + + /* Pass in the INP locked, caller must unlock it. */ + return (tp->t_fb->tfb_tcp_ctloutput(inp->inp_socket, sopt, inp, tp)); +} + +int +tcp_ctloutput(struct socket *so, struct sockopt *sopt) +{ + int error; + struct inpcb *inp; + + error = 0; + inp = sotoinpcb(so); + KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL")); + + if (sopt->sopt_dir == SOPT_SET) + return (tcp_ctloutput_set(inp, sopt)); + else if (sopt->sopt_dir == SOPT_GET) + return (tcp_ctloutput_get(inp, sopt)); + else + panic("%s: sopt_dir $%d", __func__, sopt->sopt_dir); } /* From nobody Wed Oct 27 15:22:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A10B11813DFD; Wed, 27 Oct 2021 15:22: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfXWR29sNz3F2P; Wed, 27 Oct 2021 15:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AA9BA12B3A; Wed, 27 Oct 2021 15:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFMwYD084048; Wed, 27 Oct 2021 15:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFMwUx084047; Wed, 27 Oct 2021 15:22:58 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:22:58 GMT Message-Id: <202110271522.19RFMwUx084047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: de156263a598 - main - Several IP level socket options may affect TCP. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de156263a598a0277b7bbc13ef8bdc6f4541b604 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=de156263a598a0277b7bbc13ef8bdc6f4541b604 commit de156263a598a0277b7bbc13ef8bdc6f4541b604 Author: Gleb Smirnoff AuthorDate: 2021-10-26 03:40:12 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-27 15:21:59 +0000 Several IP level socket options may affect TCP. After handling them in IP level ctloutput, pass them down to TCP ctloutput. We already have a hack to handle IPV6_USE_MIN_MTU. Leave it in place for now, but comment out how it should be handled. For IPv4 we are interested in IP_TOS and IP_TTL. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D32655 --- sys/netinet/tcp_usrreq.c | 75 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 0fca9b88e6f3..b6e345bd454c 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1739,20 +1739,44 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) if (sopt->sopt_level != IPPROTO_TCP) { #ifdef INET6 - if (inp->inp_vflag & INP_IPV6PROTO) { + if (inp->inp_vflag & INP_IPV6PROTO) error = ip6_ctloutput(inp->inp_socket, sopt); - /* - * In case of the IPV6_USE_MIN_MTU socket option, - * the INC_IPV6MINMTU flag to announce a corresponding - * MSS during the initial handshake. - * If the TCP connection is not in the front states, - * just reduce the MSS being used. - * This avoids the sending of TCP segments which will - * be fragmented at the IPv6 layer. - */ - if ((error == 0) && - (sopt->sopt_level == IPPROTO_IPV6) && - (sopt->sopt_name == IPV6_USE_MIN_MTU)) { +#endif +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET + error = ip_ctloutput(inp->inp_socket, sopt); +#endif + /* + * When an IP-level socket option affects TCP, pass control + * down to stack tfb_tcp_ctloutput, otherwise return what + * IP level returned. + */ + switch (sopt->sopt_level) { +#ifdef INET6 + case IPPROTO_IPV6: + if ((inp->inp_vflag & INP_IPV6PROTO) == 0) + return (error); + switch (sopt->sopt_name) { + case IPV6_TCLASS: + /* Notify tcp stacks that care (e.g. RACK). */ + break; + case IPV6_USE_MIN_MTU: + /* + * XXXGL: this handling should belong to + * stack specific tfb_tcp_ctloutput, we + * should just break here. + * + * In case of the IPV6_USE_MIN_MTU socket + * option, the INC_IPV6MINMTU flag to announce + * a corresponding MSS during the initial + * handshake. If the TCP connection is not in + * the front states, just reduce the MSS being + * used. This avoids the sending of TCP + * segments which will be fragmented at the + * IPv6 layer. + */ INP_WLOCK(inp); if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED))) { @@ -1775,18 +1799,27 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) } } INP_WUNLOCK(inp); + /* FALLTHROUGH */ + default: + return (error); } - } -#endif /* INET6 */ -#if defined(INET6) && defined(INET) - else + break; #endif #ifdef INET - { - error = ip_ctloutput(inp->inp_socket, sopt); - } + case IPPROTO_IP: + switch (sopt->sopt_name) { + case IP_TOS: + case IP_TTL: + /* Notify tcp stacks that care (e.g. RACK). */ + break; + default: + return (error); + } + break; #endif - return (error); + default: + return (error); + } } else if (sopt->sopt_name == TCP_FUNCTION_BLK) { /* * Protect the TCP option TCP_FUNCTION_BLK so From nobody Wed Oct 27 15:22:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6F1891813E79; Wed, 27 Oct 2021 15:23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfXWS6XPBz3F4n; Wed, 27 Oct 2021 15:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D804E12762; Wed, 27 Oct 2021 15:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFMxiO084072; Wed, 27 Oct 2021 15:22:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFMxUI084071; Wed, 27 Oct 2021 15:22:59 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:22:59 GMT Message-Id: <202110271522.19RFMxUI084071@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: f581a26e46b8 - main - Factor out tcp6_use_min_mtu() to handle IPV6_USE_MIN_MTU by TCP. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f581a26e46b896657fd502672c134da115057839 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=f581a26e46b896657fd502672c134da115057839 commit f581a26e46b896657fd502672c134da115057839 Author: Gleb Smirnoff AuthorDate: 2021-10-26 03:53:07 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-27 15:22:00 +0000 Factor out tcp6_use_min_mtu() to handle IPV6_USE_MIN_MTU by TCP. Pass control for IP/IP6 level options from generic tcp_ctloutput_set() down to per-stack ctloutput. Call tcp6_use_min_mtu() from tcp stack tcp_default_ctloutput(). Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D32655 --- sys/netinet/tcp_stacks/bbr.c | 6 +++++ sys/netinet/tcp_stacks/rack.c | 19 ++++++++++++++ sys/netinet/tcp_subr.c | 35 +++++++++++++++++++++++++ sys/netinet/tcp_usrreq.c | 60 +++++++++++++++++-------------------------- sys/netinet/tcp_var.h | 1 + 5 files changed, 84 insertions(+), 37 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 3c4cf0f54d97..41f441da99a1 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -14253,6 +14253,12 @@ bbr_set_sockopt(struct socket *so, struct sockopt *sopt, struct epoch_tracker et; int32_t error = 0, optval; + switch (sopt->sopt_level) { + case IPPROTO_IPV6: + case IPPROTO_IP: + return (tcp_default_ctloutput(so, sopt, inp, tp)); + } + switch (sopt->sopt_name) { case TCP_RACK_PACE_MAX_SEG: case TCP_RACK_MIN_TO: diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index eee7db6e7a4c..3e3997f8e18e 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -20248,6 +20248,25 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, uint64_t loptval; int32_t error = 0, optval; + switch (sopt->sopt_level) { +#ifdef INET6 + case IPPROTO_IPV6: + MPASS(inp->inp_vflag & INP_IPV6PROTO); + switch (sopt->sopt_name) { + case IPV6_USE_MIN_MTU: + tcp6_use_min_mtu(tp); + /* FALLTHROUGH */ + } + INP_WUNLOCK(inp); + return (0); +#endif +#ifdef INET + case IPPROTO_IP: + INP_WUNLOCK(inp); + return (0); +#endif + } + switch (sopt->sopt_name) { case TCP_RACK_TLP_REDUCE: /* URL:tlp_reduce */ /* Pacing related ones */ diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 2752773a95fc..e12eb5682c14 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -3559,6 +3559,41 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap) return (maxmtu); } + +/* + * Handle setsockopt(IPV6_USE_MIN_MTU) by a TCP stack. + * + * XXXGL: we are updating inpcb here with INC_IPV6MINMTU flag. + * The right place to do that is ip6_setpktopt() that has just been + * executed. By the way it just filled ip6po_minmtu for us. + */ +void +tcp6_use_min_mtu(struct tcpcb *tp) +{ + struct inpcb *inp = tp->t_inpcb; + + INP_WLOCK_ASSERT(inp); + /* + * In case of the IPV6_USE_MIN_MTU socket + * option, the INC_IPV6MINMTU flag to announce + * a corresponding MSS during the initial + * handshake. If the TCP connection is not in + * the front states, just reduce the MSS being + * used. This avoids the sending of TCP + * segments which will be fragmented at the + * IPv6 layer. + */ + inp->inp_inc.inc_flags |= INC_IPV6MINMTU; + if ((tp->t_state >= TCPS_SYN_SENT) && + (inp->inp_inc.inc_flags & INC_ISIPV6)) { + struct ip6_pktopts *opt; + + opt = inp->in6p_outputopts; + if (opt != NULL && opt->ip6po_minmtu == IP6PO_MINMTU_ALL && + tp->t_maxseg > TCP6_MSS) + tp->t_maxseg = TCP6_MSS; + } +} #endif /* INET6 */ /* diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index b6e345bd454c..7e703af5aa67 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1763,43 +1763,8 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) /* Notify tcp stacks that care (e.g. RACK). */ break; case IPV6_USE_MIN_MTU: - /* - * XXXGL: this handling should belong to - * stack specific tfb_tcp_ctloutput, we - * should just break here. - * - * In case of the IPV6_USE_MIN_MTU socket - * option, the INC_IPV6MINMTU flag to announce - * a corresponding MSS during the initial - * handshake. If the TCP connection is not in - * the front states, just reduce the MSS being - * used. This avoids the sending of TCP - * segments which will be fragmented at the - * IPv6 layer. - */ - INP_WLOCK(inp); - if ((inp->inp_flags & - (INP_TIMEWAIT | INP_DROPPED))) { - INP_WUNLOCK(inp); - return (ECONNRESET); - } - inp->inp_inc.inc_flags |= INC_IPV6MINMTU; - tp = intotcpcb(inp); - if ((tp->t_state >= TCPS_SYN_SENT) && - (inp->inp_inc.inc_flags & INC_ISIPV6)) { - struct ip6_pktopts *opt; - - opt = inp->in6p_outputopts; - if ((opt != NULL) && - (opt->ip6po_minmtu == - IP6PO_MINMTU_ALL)) { - if (tp->t_maxseg > TCP6_MSS) { - tp->t_maxseg = TCP6_MSS; - } - } - } - INP_WUNLOCK(inp); - /* FALLTHROUGH */ + /* Update t_maxseg accordingly. */ + break; default: return (error); } @@ -2058,6 +2023,27 @@ tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp #endif size_t len; + INP_WLOCK_ASSERT(inp); + + switch (sopt->sopt_level) { +#ifdef INET6 + case IPPROTO_IPV6: + MPASS(inp->inp_vflag & INP_IPV6PROTO); + switch (sopt->sopt_name) { + case IPV6_USE_MIN_MTU: + tcp6_use_min_mtu(tp); + /* FALLTHROUGH */ + } + INP_WUNLOCK(inp); + return (0); +#endif +#ifdef INET + case IPPROTO_IP: + INP_WUNLOCK(inp); + return (0); +#endif + } + /* * For TCP_CCALGOOPT forward the control to CC module, for both * SOPT_SET and SOPT_GET. diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 2775fb392a1a..1511da3c70fd 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1053,6 +1053,7 @@ extern uint32_t tcp_ack_war_cnt; uint32_t tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); uint32_t tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); +void tcp6_use_min_mtu(struct tcpcb *); u_int tcp_maxseg(const struct tcpcb *); u_int tcp_fixed_maxseg(const struct tcpcb *); void tcp_mss_update(struct tcpcb *, int, int, struct hc_metrics_lite *, From nobody Wed Oct 27 15:23:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 10FDA181405A; Wed, 27 Oct 2021 15:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfXWV0FhJz3F7G; Wed, 27 Oct 2021 15:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 07ACA128AB; Wed, 27 Oct 2021 15:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFN0bf084102; Wed, 27 Oct 2021 15:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFN0dS084101; Wed, 27 Oct 2021 15:23:00 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:23:00 GMT Message-Id: <202110271523.19RFN0dS084101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 5d3bf5b1d27f - main - rack: Update the fast send block on setsockopt(2) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d3bf5b1d27f4b2bd85f40e26987af83353616f0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=5d3bf5b1d27f4b2bd85f40e26987af83353616f0 commit 5d3bf5b1d27f4b2bd85f40e26987af83353616f0 Author: Gleb Smirnoff AuthorDate: 2021-10-26 03:54:26 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-27 15:22:00 +0000 rack: Update the fast send block on setsockopt(2) Rack caches TCP/IP header for fast send, so it doesn't call tcpip_fillheaders(). After certain socket option changes, namely IPV6_TCLASS, IP_TOS and IP_TTL it needs to update its fast block to be in sync with the inpcb. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D32655 --- sys/netinet/tcp_stacks/rack.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 3e3997f8e18e..a92e43205f09 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -20245,6 +20245,12 @@ static int rack_set_sockopt(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp, struct tcp_rack *rack) { +#ifdef INET6 + struct ip6_hdr *ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif +#ifdef INET + struct ip *ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif uint64_t loptval; int32_t error = 0, optval; @@ -20255,13 +20261,34 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, switch (sopt->sopt_name) { case IPV6_USE_MIN_MTU: tcp6_use_min_mtu(tp); - /* FALLTHROUGH */ + break; + case IPV6_TCLASS: + /* + * The DSCP codepoint has changed, update the fsb. + */ + ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | + (rack->rc_inp->inp_flow & IPV6_FLOWINFO_MASK); + break; } INP_WUNLOCK(inp); return (0); #endif #ifdef INET case IPPROTO_IP: + switch (sopt->sopt_name) { + case IP_TOS: + /* + * The DSCP codepoint has changed, update the fsb. + */ + ip->ip_tos = rack->rc_inp->inp_ip_tos; + break; + case IP_TTL: + /* + * The TTL has changed, update the fsb. + */ + ip->ip_ttl = rack->rc_inp->inp_ip_ttl; + break; + } INP_WUNLOCK(inp); return (0); #endif From nobody Wed Oct 27 15:47:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1E04A181FCA6; Wed, 27 Oct 2021 15:47: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfY3g0NZYz3NGp; Wed, 27 Oct 2021 15:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E1DE2128E7; Wed, 27 Oct 2021 15:47:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RFlQP9010511; Wed, 27 Oct 2021 15:47:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFlQDe010510; Wed, 27 Oct 2021 15:47:26 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:47:26 GMT Message-Id: <202110271547.19RFlQDe010510@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: aa15f7df644a - main - arm: Remove obsolete comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa15f7df644a5ec0eff84f077920432d5dc81d97 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=aa15f7df644a5ec0eff84f077920432d5dc81d97 commit aa15f7df644a5ec0eff84f077920432d5dc81d97 Author: Warner Losh AuthorDate: 2021-10-27 15:44:41 +0000 Commit: Warner Losh CommitDate: 2021-10-27 15:44:58 +0000 arm: Remove obsolete comments FreeBSD has never supported arm26, so remove comments about what trapframes look like for that platform. Noticed by: kevans Sponsored by: Netflix --- sys/arm/include/frame.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm/include/frame.h b/sys/arm/include/frame.h index 8866e8ab0a33..39daeb5e9932 100644 --- a/sys/arm/include/frame.h +++ b/sys/arm/include/frame.h @@ -61,7 +61,7 @@ */ struct trapframe { - register_t tf_spsr; /* Zero on arm26 */ + register_t tf_spsr; register_t tf_r0; register_t tf_r1; register_t tf_r2; @@ -77,8 +77,8 @@ struct trapframe { register_t tf_r12; register_t tf_usr_sp; register_t tf_usr_lr; - register_t tf_svc_sp; /* Not used on arm26 */ - register_t tf_svc_lr; /* Not used on arm26 */ + register_t tf_svc_sp; + register_t tf_svc_lr; register_t tf_pc; register_t tf_pad; }; From nobody Wed Oct 27 16:31:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 09BE31811686; Wed, 27 Oct 2021 16:31:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfZ2K6xVjz3r1n; Wed, 27 Oct 2021 16:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C42E2138D3; Wed, 27 Oct 2021 16:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RGVLhf073155; Wed, 27 Oct 2021 16:31:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RGVL1N073154; Wed, 27 Oct 2021 16:31:21 GMT (envelope-from git) Date: Wed, 27 Oct 2021 16:31:21 GMT Message-Id: <202110271631.19RGVL1N073154@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: 2f7f8995367b - main - libdialog: Bump shared library version to 10. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f7f8995367b3fe1a9e2bf34be6f0684963eed02 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2f7f8995367b3fe1a9e2bf34be6f0684963eed02 commit 2f7f8995367b3fe1a9e2bf34be6f0684963eed02 Author: John Baldwin AuthorDate: 2021-10-27 16:30:24 +0000 Commit: John Baldwin CommitDate: 2021-10-27 16:30:24 +0000 libdialog: Bump shared library version to 10. The upgrade to libdialog 1.3 included changes to the ABI. Bump libdpv to 3 since it links against libdialog. Reported by: Mark Millard Reviewed by: bapt Fixes: a96ef4501919 dialog: import dialog 1.3-20210117 Differential Revision: https://reviews.freebsd.org/D32675 --- ObsoleteFiles.inc | 6 ++++++ gnu/lib/libdialog/Makefile | 2 +- lib/libdpv/Makefile | 2 +- tools/build/mk/OptionalObsoleteFiles.inc | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index c60629197386..43c977e3cff5 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,12 @@ # xargs -n1 | sort | uniq -d; # done +# 20211027: libdialog shlib bumped to version 10 for dialog 1.3 +OLD_LIBS+=usr/lib/libdialog.so.9 +OLD_LIBS+=usr/lib/libdpv.so.2 +OLD_LIBS+=usr/lib32/libdialog.so.9 +OLD_LIBS+=usr/lib32/libdpv.so.2 + # 20211026: retire obsolete iscsi initiator OLD_FILES+=sbin/iscontrol OLD_FILES+=usr/share/man/man4/iscsi_initiator.4.gz diff --git a/gnu/lib/libdialog/Makefile b/gnu/lib/libdialog/Makefile index 6de2460c62a5..73373b1d5827 100644 --- a/gnu/lib/libdialog/Makefile +++ b/gnu/lib/libdialog/Makefile @@ -3,7 +3,7 @@ DIALOG= ${SRCTOP}/contrib/dialog LIB= dialog -SHLIB_MAJOR= 9 +SHLIB_MAJOR= 10 SRCS= argv.c arrows.c buildlist.c buttons.c calendar.c checklist.c \ columns.c dlg_keys.c editbox.c fselect.c formbox.c guage.c \ help.c inputbox.c inputstr.c menubox.c mixedform.c \ diff --git a/lib/libdpv/Makefile b/lib/libdpv/Makefile index 5b432602ff7b..43cc6bce07c7 100644 --- a/lib/libdpv/Makefile +++ b/lib/libdpv/Makefile @@ -2,7 +2,7 @@ PACKAGE= dpv LIB= dpv -SHLIB_MAJOR= 2 +SHLIB_MAJOR= 3 INCS= dpv.h MAN= dpv.3 MLINKS= dpv.3 dpv_free.3 diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index a8b0329104c4..91822aac492a 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -1663,11 +1663,11 @@ OLD_FILES+=usr/bin/dialog OLD_FILES+=usr/bin/dpv OLD_FILES+=usr/lib/libdialog.a OLD_FILES+=usr/lib/libdialog.so -OLD_FILES+=usr/lib/libdialog.so.8 +OLD_FILES+=usr/lib/libdialog.so.10 OLD_FILES+=usr/lib/libdialog_p.a OLD_FILES+=usr/lib/libdpv.a OLD_FILES+=usr/lib/libdpv.so -OLD_FILES+=usr/lib/libdpv.so.1 +OLD_FILES+=usr/lib/libdpv.so.3 OLD_FILES+=usr/lib/libdpv_p.a OLD_FILES+=usr/sbin/bsdconfig OLD_FILES+=usr/share/man/man1/dialog.1.gz From nobody Wed Oct 27 17:38:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6B4C7182DA63; Wed, 27 Oct 2021 17:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfbX52Zbmz4fhw; Wed, 27 Oct 2021 17:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3895F143C5; Wed, 27 Oct 2021 17:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RHcjwU057688; Wed, 27 Oct 2021 17:38:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RHcju5057687; Wed, 27 Oct 2021 17:38:45 GMT (envelope-from git) Date: Wed, 27 Oct 2021 17:38:45 GMT Message-Id: <202110271738.19RHcju5057687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 29863d1effe2 - main - xhci: Rework 64-byte context support to avoid pointer abuse List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29863d1effe20da3cc75ae10bd52d96edafe9e59 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=29863d1effe20da3cc75ae10bd52d96edafe9e59 commit 29863d1effe20da3cc75ae10bd52d96edafe9e59 Author: Jessica Clarke AuthorDate: 2021-10-24 18:48:46 +0000 Commit: Jessica Clarke CommitDate: 2021-10-27 17:38:37 +0000 xhci: Rework 64-byte context support to avoid pointer abuse Currently, to support 64-byte contexts, xhci_ctx_[gs]et_le(32|64) take a pointer to the field within a 32-byte context and, if 64-byte contexts are in use, compute where the 64-byte context field is and use that instead by deriving a pointer from the 32-byte field pointer. This is done by exploiting a combination of 64-byte contexts being the same layout as their 32-byte counterparts, just with 32 bytes of padding at the end, and that all individual contexts are either in a device context or an input context which itself is page-aligned. By masking out the low 4 bits (which is the offset of the field within the 32-byte contxt) of the offset within the page, the offset of the invididual context within the containing device/input context can be determined, which is itself 32 times the number of preceding contexts. Thus, adding this value to the pointer again gets 64 times the number of preceding contexts plus the field offset, which gives the offset of the 64-byte context plus the field offset, which is the address of the field in the 64-byte context. However, this involves a fair amount of lying to the compiler when constructing these intermediate pointers, and is rather difficult to reason about. In particular, this is problematic for CHERI, where we compile the kernel with subobject bounds enabled; that is, unless annotated to opt out (e.g. for C struct inheritance reasons where you need to be able to downcast, or containerof idioms), a pointer to a member of a struct is a capability whose bounds only cover that field, and any attempt to dereference outside those bounds will fault, protecting against intra-object buffer overflows. Thus the pointer given to xhci_ctx_[gs]et_le(32|64) is a capability whose bounds only cover the field in the 32-byte context, and computing the pointer to the 64-byte context field takes the address out of bounds, resulting in a fault when later dereferenced. This can be cleaned up by using a different abstraction. Instead of doing the 32-byte to 64-byte conversion on access to the field, we can do the conversion when getting a pointer to the context itself, and define proper 64-byte versions of contexts in order to let the compiler do all the necessary arithmetic rather than do it manually ourselves. This provides a cleaner implementation, works for CHERI and may even be slightly more performant as it avoids the need to mess with masking pointers (which cannot in the general case be optimised by compilers to be reused across accesses to different fields within the same context, since it does not know that the contexts are over-aligned compared with the C ABI requirements). Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32554 --- sys/dev/usb/controller/xhci.c | 160 +++++++++++++++--------------------------- sys/dev/usb/controller/xhci.h | 26 +++++++ 2 files changed, 81 insertions(+), 105 deletions(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index e9d15eabc20a..0b0d9a7dc7be 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -88,6 +88,11 @@ #define XHCI_BUS2SC(bus) \ __containerof(bus, struct xhci_softc, sc_bus) +#define XHCI_GET_CTX(sc, which, field, ptr) \ + ((sc)->sc_ctx_is_64_byte ? \ + &((struct which##64 *)(ptr))->field.ctx : \ + &((struct which *)(ptr))->field) + static SYSCTL_NODE(_hw_usb, OID_AUTO, xhci, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "USB XHCI"); @@ -163,12 +168,6 @@ static usb_error_t xhci_configure_mask(struct usb_device *, static usb_error_t xhci_cmd_evaluate_ctx(struct xhci_softc *, uint64_t, uint8_t); static void xhci_endpoint_doorbell(struct usb_xfer *); -static void xhci_ctx_set_le32(struct xhci_softc *sc, volatile uint32_t *ptr, uint32_t val); -static uint32_t xhci_ctx_get_le32(struct xhci_softc *sc, volatile uint32_t *ptr); -static void xhci_ctx_set_le64(struct xhci_softc *sc, volatile uint64_t *ptr, uint64_t val); -#ifdef USB_DEBUG -static uint64_t xhci_ctx_get_le64(struct xhci_softc *sc, volatile uint64_t *ptr); -#endif static const struct usb_bus_methods xhci_bus_methods; @@ -183,26 +182,26 @@ xhci_dump_trb(struct xhci_trb *trb) } static void -xhci_dump_endpoint(struct xhci_softc *sc, struct xhci_endp_ctx *pep) +xhci_dump_endpoint(struct xhci_endp_ctx *pep) { DPRINTFN(5, "pep = %p\n", pep); - DPRINTFN(5, "dwEpCtx0=0x%08x\n", xhci_ctx_get_le32(sc, &pep->dwEpCtx0)); - DPRINTFN(5, "dwEpCtx1=0x%08x\n", xhci_ctx_get_le32(sc, &pep->dwEpCtx1)); - DPRINTFN(5, "qwEpCtx2=0x%016llx\n", (long long)xhci_ctx_get_le64(sc, &pep->qwEpCtx2)); - DPRINTFN(5, "dwEpCtx4=0x%08x\n", xhci_ctx_get_le32(sc, &pep->dwEpCtx4)); - DPRINTFN(5, "dwEpCtx5=0x%08x\n", xhci_ctx_get_le32(sc, &pep->dwEpCtx5)); - DPRINTFN(5, "dwEpCtx6=0x%08x\n", xhci_ctx_get_le32(sc, &pep->dwEpCtx6)); - DPRINTFN(5, "dwEpCtx7=0x%08x\n", xhci_ctx_get_le32(sc, &pep->dwEpCtx7)); + DPRINTFN(5, "dwEpCtx0=0x%08x\n", le32toh(pep->dwEpCtx0)); + DPRINTFN(5, "dwEpCtx1=0x%08x\n", le32toh(pep->dwEpCtx1)); + DPRINTFN(5, "qwEpCtx2=0x%016llx\n", (long long)le64toh(pep->qwEpCtx2)); + DPRINTFN(5, "dwEpCtx4=0x%08x\n", le32toh(pep->dwEpCtx4)); + DPRINTFN(5, "dwEpCtx5=0x%08x\n", le32toh(pep->dwEpCtx5)); + DPRINTFN(5, "dwEpCtx6=0x%08x\n", le32toh(pep->dwEpCtx6)); + DPRINTFN(5, "dwEpCtx7=0x%08x\n", le32toh(pep->dwEpCtx7)); } static void -xhci_dump_device(struct xhci_softc *sc, struct xhci_slot_ctx *psl) +xhci_dump_device(struct xhci_slot_ctx *psl) { DPRINTFN(5, "psl = %p\n", psl); - DPRINTFN(5, "dwSctx0=0x%08x\n", xhci_ctx_get_le32(sc, &psl->dwSctx0)); - DPRINTFN(5, "dwSctx1=0x%08x\n", xhci_ctx_get_le32(sc, &psl->dwSctx1)); - DPRINTFN(5, "dwSctx2=0x%08x\n", xhci_ctx_get_le32(sc, &psl->dwSctx2)); - DPRINTFN(5, "dwSctx3=0x%08x\n", xhci_ctx_get_le32(sc, &psl->dwSctx3)); + DPRINTFN(5, "dwSctx0=0x%08x\n", le32toh(psl->dwSctx0)); + DPRINTFN(5, "dwSctx1=0x%08x\n", le32toh(psl->dwSctx1)); + DPRINTFN(5, "dwSctx2=0x%08x\n", le32toh(psl->dwSctx2)); + DPRINTFN(5, "dwSctx3=0x%08x\n", le32toh(psl->dwSctx3)); } #endif @@ -234,60 +233,6 @@ xhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb) } } -static void -xhci_ctx_set_le32(struct xhci_softc *sc, volatile uint32_t *ptr, uint32_t val) -{ - if (sc->sc_ctx_is_64_byte) { - uint32_t offset; - /* exploit the fact that our structures are XHCI_PAGE_SIZE aligned */ - /* all contexts are initially 32-bytes */ - offset = ((uintptr_t)ptr) & ((XHCI_PAGE_SIZE - 1) & ~(31U)); - ptr = (volatile uint32_t *)(((volatile uint8_t *)ptr) + offset); - } - *ptr = htole32(val); -} - -static uint32_t -xhci_ctx_get_le32(struct xhci_softc *sc, volatile uint32_t *ptr) -{ - if (sc->sc_ctx_is_64_byte) { - uint32_t offset; - /* exploit the fact that our structures are XHCI_PAGE_SIZE aligned */ - /* all contexts are initially 32-bytes */ - offset = ((uintptr_t)ptr) & ((XHCI_PAGE_SIZE - 1) & ~(31U)); - ptr = (volatile uint32_t *)(((volatile uint8_t *)ptr) + offset); - } - return (le32toh(*ptr)); -} - -static void -xhci_ctx_set_le64(struct xhci_softc *sc, volatile uint64_t *ptr, uint64_t val) -{ - if (sc->sc_ctx_is_64_byte) { - uint32_t offset; - /* exploit the fact that our structures are XHCI_PAGE_SIZE aligned */ - /* all contexts are initially 32-bytes */ - offset = ((uintptr_t)ptr) & ((XHCI_PAGE_SIZE - 1) & ~(31U)); - ptr = (volatile uint64_t *)(((volatile uint8_t *)ptr) + offset); - } - *ptr = htole64(val); -} - -#ifdef USB_DEBUG -static uint64_t -xhci_ctx_get_le64(struct xhci_softc *sc, volatile uint64_t *ptr) -{ - if (sc->sc_ctx_is_64_byte) { - uint32_t offset; - /* exploit the fact that our structures are XHCI_PAGE_SIZE aligned */ - /* all contexts are initially 32-bytes */ - offset = ((uintptr_t)ptr) & ((XHCI_PAGE_SIZE - 1) & ~(31U)); - ptr = (volatile uint64_t *)(((volatile uint8_t *)ptr) + offset); - } - return (le64toh(*ptr)); -} -#endif - static int xhci_reset_command_queue_locked(struct xhci_softc *sc) { @@ -1397,7 +1342,7 @@ xhci_set_address(struct usb_device *udev, struct mtx *mtx, uint16_t address) struct usb_page_search buf_dev; struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); struct xhci_hw_dev *hdev; - struct xhci_dev_ctx *pdev; + struct xhci_slot_ctx *slot; struct xhci_endpoint_ext *pepext; uint32_t temp; uint16_t mps; @@ -1490,10 +1435,11 @@ xhci_set_address(struct usb_device *udev, struct mtx *mtx, uint16_t address) /* update device address to new value */ usbd_get_page(&hdev->device_pc, 0, &buf_dev); - pdev = buf_dev.buffer; + slot = XHCI_GET_CTX(sc, xhci_dev_ctx, ctx_slot, + buf_dev.buffer); usb_pc_cpu_invalidate(&hdev->device_pc); - temp = xhci_ctx_get_le32(sc, &pdev->ctx_slot.dwSctx3); + temp = le32toh(slot->dwSctx3); udev->address = XHCI_SCTX_3_DEV_ADDR_GET(temp); /* update device state to new value */ @@ -2298,7 +2244,8 @@ xhci_configure_mask(struct usb_device *udev, uint32_t mask, uint8_t drop) { struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); struct usb_page_search buf_inp; - struct xhci_input_dev_ctx *pinp; + struct xhci_input_ctx *input; + struct xhci_slot_ctx *slot; uint32_t temp; uint8_t index; uint8_t x; @@ -2307,22 +2254,23 @@ xhci_configure_mask(struct usb_device *udev, uint32_t mask, uint8_t drop) usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); - pinp = buf_inp.buffer; + input = XHCI_GET_CTX(sc, xhci_input_dev_ctx, ctx_input, + buf_inp.buffer); + slot = XHCI_GET_CTX(sc, xhci_input_dev_ctx, ctx_slot, buf_inp.buffer); if (drop) { mask &= XHCI_INCTX_NON_CTRL_MASK; - xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx0, mask); - xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx1, 0); + input->dwInCtx0 = htole32(mask); + input->dwInCtx1 = htole32(0); } else { /* * Some hardware requires that we drop the endpoint * context before adding it again: */ - xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx0, - mask & XHCI_INCTX_NON_CTRL_MASK); + input->dwInCtx0 = htole32(mask & XHCI_INCTX_NON_CTRL_MASK); /* Add new endpoint context */ - xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx1, mask); + input->dwInCtx1 = htole32(mask); /* find most significant set bit */ for (x = 31; x != 1; x--) { @@ -2340,10 +2288,10 @@ xhci_configure_mask(struct usb_device *udev, uint32_t mask, uint8_t drop) x = sc->sc_hw.devs[index].context_num; /* update number of contexts */ - temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0); + temp = le32toh(slot->dwSctx0); temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31); temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1); - xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp); + slot->dwSctx0 = htole32(temp); } usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc); return (0); @@ -2358,7 +2306,7 @@ xhci_configure_endpoint(struct usb_device *udev, { struct usb_page_search buf_inp; struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); - struct xhci_input_dev_ctx *pinp; + struct xhci_endp_ctx *endp; uint64_t ring_addr = pepext->physaddr; uint32_t temp; uint8_t index; @@ -2369,8 +2317,6 @@ xhci_configure_endpoint(struct usb_device *udev, usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); - pinp = buf_inp.buffer; - epno = edesc->bEndpointAddress; type = edesc->bmAttributes & UE_XFERTYPE; @@ -2390,6 +2336,9 @@ xhci_configure_endpoint(struct usb_device *udev, if (mult == 0) return (USB_ERR_BAD_BUFSIZE); + endp = XHCI_GET_CTX(sc, xhci_input_dev_ctx, ctx_ep[epno - 1], + buf_inp.buffer); + /* store endpoint mode */ pepext->trb_ep_mode = ep_mode; /* store bMaxPacketSize for control endpoints */ @@ -2445,7 +2394,7 @@ xhci_configure_endpoint(struct usb_device *udev, break; } - xhci_ctx_set_le32(sc, &pinp->ctx_ep[epno - 1].dwEpCtx0, temp); + endp->dwEpCtx0 = htole32(temp); temp = XHCI_EPCTX_1_HID_SET(0) | @@ -2480,8 +2429,8 @@ xhci_configure_endpoint(struct usb_device *udev, if (epno & 1) temp |= XHCI_EPCTX_1_EPTYPE_SET(4); - xhci_ctx_set_le32(sc, &pinp->ctx_ep[epno - 1].dwEpCtx1, temp); - xhci_ctx_set_le64(sc, &pinp->ctx_ep[epno - 1].qwEpCtx2, ring_addr); + endp->dwEpCtx1 = htole32(temp); + endp->qwEpCtx2 = htole64(ring_addr); switch (edesc->bmAttributes & UE_XFERTYPE) { case UE_INTERRUPT: @@ -2498,10 +2447,10 @@ xhci_configure_endpoint(struct usb_device *udev, break; } - xhci_ctx_set_le32(sc, &pinp->ctx_ep[epno - 1].dwEpCtx4, temp); + endp->dwEpCtx4 = htole32(temp); #ifdef USB_DEBUG - xhci_dump_endpoint(sc, &pinp->ctx_ep[epno - 1]); + xhci_dump_endpoint(endp); #endif usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc); @@ -2557,7 +2506,7 @@ xhci_configure_device(struct usb_device *udev) struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); struct usb_page_search buf_inp; struct usb_page_cache *pcinp; - struct xhci_input_dev_ctx *pinp; + struct xhci_slot_ctx *slot; struct usb_device *hubdev; uint32_t temp; uint32_t route; @@ -2574,7 +2523,7 @@ xhci_configure_device(struct usb_device *udev) usbd_get_page(pcinp, 0, &buf_inp); - pinp = buf_inp.buffer; + slot = XHCI_GET_CTX(sc, xhci_input_dev_ctx, ctx_slot, buf_inp.buffer); rh_port = 0; route = 0; @@ -2649,7 +2598,7 @@ xhci_configure_device(struct usb_device *udev) if (is_hub) temp |= XHCI_SCTX_0_HUB_SET(1); - xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp); + slot->dwSctx0 = htole32(temp); temp = XHCI_SCTX_1_RH_PORT_SET(rh_port); @@ -2658,7 +2607,7 @@ xhci_configure_device(struct usb_device *udev) sc->sc_hw.devs[index].nports); } - xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx1, temp); + slot->dwSctx1 = htole32(temp); temp = XHCI_SCTX_2_IRQ_TARGET_SET(0); @@ -2684,7 +2633,7 @@ xhci_configure_device(struct usb_device *udev) break; } - xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx2, temp); + slot->dwSctx2 = htole32(temp); /* * These fields should be initialized to zero, according to @@ -2693,10 +2642,10 @@ xhci_configure_device(struct usb_device *udev) temp = XHCI_SCTX_3_DEV_ADDR_SET(0) | XHCI_SCTX_3_SLOT_STATE_SET(0); - xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx3, temp); + slot->dwSctx3 = htole32(temp); #ifdef USB_DEBUG - xhci_dump_device(sc, &pinp->ctx_slot); + xhci_dump_device(slot); #endif usb_pc_cpu_flush(pcinp); @@ -2725,7 +2674,7 @@ xhci_alloc_device_ext(struct usb_device *udev) pc->tag_parent = sc->sc_bus.dma_parent_tag; if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? - (2 * sizeof(struct xhci_dev_ctx)) : + sizeof(struct xhci_dev_ctx64) : sizeof(struct xhci_dev_ctx), XHCI_PAGE_SIZE)) goto error; @@ -2738,7 +2687,7 @@ xhci_alloc_device_ext(struct usb_device *udev) pc->tag_parent = sc->sc_bus.dma_parent_tag; if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? - (2 * sizeof(struct xhci_input_dev_ctx)) : + sizeof(struct xhci_input_dev_ctx64) : sizeof(struct xhci_input_dev_ctx), XHCI_PAGE_SIZE)) { goto error; } @@ -3785,7 +3734,7 @@ xhci_get_endpoint_state(struct usb_device *udev, uint8_t epno) struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); struct usb_page_search buf_dev; struct xhci_hw_dev *hdev; - struct xhci_dev_ctx *pdev; + struct xhci_endp_ctx *endp; uint32_t temp; MPASS(epno != 0); @@ -3793,10 +3742,11 @@ xhci_get_endpoint_state(struct usb_device *udev, uint8_t epno) hdev = &sc->sc_hw.devs[udev->controller_slot_id]; usbd_get_page(&hdev->device_pc, 0, &buf_dev); - pdev = buf_dev.buffer; + endp = XHCI_GET_CTX(sc, xhci_dev_ctx, ctx_ep[epno - 1], + buf_dev.buffer); usb_pc_cpu_invalidate(&hdev->device_pc); - temp = xhci_ctx_get_le32(sc, &pdev->ctx_ep[epno - 1].dwEpCtx0); + temp = le32toh(endp->dwEpCtx0); return (XHCI_EPCTX_0_EPSTATE_GET(temp)); } diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index 802207208569..ff7ec23ca5f2 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -111,6 +111,11 @@ struct xhci_slot_ctx { volatile uint32_t dwSctx7; }; +struct xhci_slot_ctx64 { + struct xhci_slot_ctx ctx; + volatile uint8_t padding[32]; +}; + struct xhci_endp_ctx { volatile uint32_t dwEpCtx0; #define XHCI_EPCTX_0_EPSTATE_SET(x) ((x) & 0x7) @@ -156,6 +161,11 @@ struct xhci_endp_ctx { volatile uint32_t dwEpCtx7; }; +struct xhci_endp_ctx64 { + struct xhci_endp_ctx ctx; + volatile uint8_t padding[32]; +}; + struct xhci_input_ctx { #define XHCI_INCTX_NON_CTRL_MASK 0xFFFFFFFCU volatile uint32_t dwInCtx0; @@ -170,17 +180,33 @@ struct xhci_input_ctx { volatile uint32_t dwInCtx7; }; +struct xhci_input_ctx64 { + struct xhci_input_ctx ctx; + volatile uint8_t padding[32]; +}; + struct xhci_input_dev_ctx { struct xhci_input_ctx ctx_input; struct xhci_slot_ctx ctx_slot; struct xhci_endp_ctx ctx_ep[XHCI_MAX_ENDPOINTS - 1]; }; +struct xhci_input_dev_ctx64 { + struct xhci_input_ctx64 ctx_input; + struct xhci_slot_ctx64 ctx_slot; + struct xhci_endp_ctx64 ctx_ep[XHCI_MAX_ENDPOINTS - 1]; +}; + struct xhci_dev_ctx { struct xhci_slot_ctx ctx_slot; struct xhci_endp_ctx ctx_ep[XHCI_MAX_ENDPOINTS - 1]; } __aligned(XHCI_DEV_CTX_ALIGN); +struct xhci_dev_ctx64 { + struct xhci_slot_ctx64 ctx_slot; + struct xhci_endp_ctx64 ctx_ep[XHCI_MAX_ENDPOINTS - 1]; +} __aligned(XHCI_DEV_CTX_ALIGN); + struct xhci_stream_ctx { volatile uint64_t qwSctx0; #define XHCI_SCTX_0_DCS_GET(x) ((x) & 0x1) From nobody Wed Oct 27 17:38:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 220AA182DCBD; Wed, 27 Oct 2021 17:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfbX65NZjz4fnR; Wed, 27 Oct 2021 17:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 67398143C6; Wed, 27 Oct 2021 17:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RHckt7057712; Wed, 27 Oct 2021 17:38:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RHckeP057711; Wed, 27 Oct 2021 17:38:46 GMT (envelope-from git) Date: Wed, 27 Oct 2021 17:38:46 GMT Message-Id: <202110271738.19RHckeP057711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: f350bc1dd368 - main - ada: Fix intra-object buffer overread of identify strings List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f350bc1dd368a3024ba9ef2a9e8431fc1edd8094 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f350bc1dd368a3024ba9ef2a9e8431fc1edd8094 commit f350bc1dd368a3024ba9ef2a9e8431fc1edd8094 Author: Jessica Clarke AuthorDate: 2021-10-24 18:48:59 +0000 Commit: Jessica Clarke CommitDate: 2021-10-27 17:38:37 +0000 ada: Fix intra-object buffer overread of identify strings In the ATA/ATAPI spec these are space-padded fixed-length strings with no NUL-terminator (and byte swapped). When performing the identify we call ata_param_fixup to swap the bytes back to be in order, strip any leading/trailing spaces and coalesce consecutive spaces, padding with NULs. However, if the input has no padding spaces, the fixed-up strings are still not NUL-terminated. This causes two issues. The first is that strlcpy will truncate the string by replacing the final byte with a NUL. The second is that strlcpy will keep reading src until it finds a NUL in order to calculate the return value, which is defined as the length of src (so that callers can then compare it with the dsize input to see if the input string was truncated), thereby reading past the end of the buffer and into whatever adjacent fields are in the structure. In practice there's a NUL byte somewhere in the structure, but on CHERI with subobject bounds enabled in the compiler this overread will be detected and trap as a bounds violation. Note this matches ata_xpt's aprobedone, which does a bcopy to a malloc'ed buffer and manually NUL-terminates it for the CAM path's device's serial_num. Found by: CHERI Reviewed by: imp, scottl Differential Revision: https://reviews.freebsd.org/D32567 --- sys/cam/ata/ata_da.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 72bbbfe8ab1f..c05a9fa49d1c 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -3424,6 +3424,7 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev *cgd) u_int64_t lbasize48; u_int32_t lbasize; u_int maxio, d_flags; + size_t tmpsize; dp->secsize = ata_logical_sector_size(&cgd->ident_data); if ((cgd->ident_data.atavalid & ATA_FLAG_54_58) && @@ -3487,10 +3488,25 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev *cgd) softc->flags |= ADA_FLAG_UNMAPPEDIO; } softc->disk->d_flags = d_flags; - strlcpy(softc->disk->d_descr, cgd->ident_data.model, - MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); - strlcpy(softc->disk->d_ident, cgd->ident_data.serial, - MIN(sizeof(softc->disk->d_ident), sizeof(cgd->ident_data.serial))); + + /* + * ata_param_fixup will strip trailing padding spaces and add a NUL, + * but if the field has no padding (as is common for serial numbers) + * there will still be no NUL terminator. We cannot use strlcpy, since + * it keeps reading src until it finds a NUL in order to compute the + * return value (and will truncate the final character due to having a + * single dsize rather than separate ssize and dsize), and strncpy does + * not add a NUL to the destination if it reaches the character limit. + */ + tmpsize = MIN(sizeof(softc->disk->d_descr) - 1, + sizeof(cgd->ident_data.model)); + memcpy(softc->disk->d_descr, cgd->ident_data.model, tmpsize); + softc->disk->d_descr[tmpsize] = '\0'; + + tmpsize = MIN(sizeof(softc->disk->d_ident) - 1, + sizeof(cgd->ident_data.serial)); + memcpy(softc->disk->d_ident, cgd->ident_data.serial, tmpsize); + softc->disk->d_ident[tmpsize] = '\0'; softc->disk->d_sectorsize = softc->params.secsize; softc->disk->d_mediasize = (off_t)softc->params.sectors * From nobody Wed Oct 27 17:38:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DC3BD182DBE2; Wed, 27 Oct 2021 17:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfbX75DH8z4fnZ; Wed, 27 Oct 2021 17:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 808971484F; Wed, 27 Oct 2021 17:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RHcljt057736; Wed, 27 Oct 2021 17:38:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RHclQ6057735; Wed, 27 Oct 2021 17:38:47 GMT (envelope-from git) Date: Wed, 27 Oct 2021 17:38:47 GMT Message-Id: <202110271738.19RHclQ6057735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 34fb1c133c5b - main - Fix intra-object buffer overread for labeled msdosfs volumes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34fb1c133c5b8616f14f1d740d99747b427f5571 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=34fb1c133c5b8616f14f1d740d99747b427f5571 commit 34fb1c133c5b8616f14f1d740d99747b427f5571 Author: Jessica Clarke AuthorDate: 2021-10-24 18:49:21 +0000 Commit: Jessica Clarke CommitDate: 2021-10-27 17:38:37 +0000 Fix intra-object buffer overread for labeled msdosfs volumes Volume labels, like directory entries, are padded with spaces and so have no NUL terminator. Whilst the MIN for the dsize argument to strlcpy ensures that the copy does not overflow the destination, strlcpy is defined to return the number of characters in the source string, regardless of the provided dsize, and so keeps reading until it finds a NUL, which likely exists somewhere within the following fields, but On CHERI with the subobject bounds enabled in the compiler this buffer overread will be detected and trap with a bounds violation. Found by: CHERI Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D32579 --- sys/geom/label/g_label_msdosfs.c | 20 +++++++++++++------- usr.sbin/fstyp/msdosfs.c | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/sys/geom/label/g_label_msdosfs.c b/sys/geom/label/g_label_msdosfs.c index d6ccb8b334ee..2ba35ff80f51 100644 --- a/sys/geom/label/g_label_msdosfs.c +++ b/sys/geom/label/g_label_msdosfs.c @@ -50,6 +50,7 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) FAT32_BSBPB *pfat32_bsbpb; FAT_DES *pfat_entry; uint8_t *sector0, *sector; + size_t copysize; g_topology_assert_not(); pp = cp->provider; @@ -111,8 +112,9 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) pp->name); goto error; } - strlcpy(label, pfat_bsbpb->BS_VolLab, - MIN(size, sizeof(pfat_bsbpb->BS_VolLab) + 1)); + copysize = MIN(size - 1, sizeof(pfat_bsbpb->BS_VolLab)); + memcpy(label, pfat_bsbpb->BS_VolLab, copysize); + label[copysize] = '\0'; } else if (UINT32BYTES(pfat32_bsbpb->BPB_FATSz32) != 0) { uint32_t fat_FirstDataSector, fat_BytesPerSector, offset; @@ -133,8 +135,10 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) */ if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { - strlcpy(label, pfat32_bsbpb->BS_VolLab, - MIN(size, sizeof(pfat32_bsbpb->BS_VolLab) + 1)); + copysize = MIN(size - 1, + sizeof(pfat32_bsbpb->BS_VolLab) + 1); + memcpy(label, pfat32_bsbpb->BS_VolLab, copysize); + label[copysize] = '\0'; goto endofchecks; } @@ -184,9 +188,11 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) */ if (pfat_entry->DIR_Attr & FAT_DES_ATTR_VOLUME_ID) { - strlcpy(label, pfat_entry->DIR_Name, - MIN(size, - sizeof(pfat_entry->DIR_Name) + 1)); + copysize = MIN(size - 1, + sizeof(pfat_entry->DIR_Name)); + memcpy(label, pfat_entry->DIR_Name, + copysize); + label[copysize] = '\0'; goto endofchecks; } } while((uint8_t *)(++pfat_entry) < diff --git a/usr.sbin/fstyp/msdosfs.c b/usr.sbin/fstyp/msdosfs.c index 3d86802f6a2e..ce745869edba 100644 --- a/usr.sbin/fstyp/msdosfs.c +++ b/usr.sbin/fstyp/msdosfs.c @@ -48,6 +48,7 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size) FAT32_BSBPB *pfat32_bsbpb; FAT_DES *pfat_entry; uint8_t *sector0, *sector; + size_t copysize; sector0 = NULL; sector = NULL; @@ -83,8 +84,9 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size) sizeof(pfat_bsbpb->BS_VolLab)) == 0) { goto endofchecks; } - strlcpy(label, pfat_bsbpb->BS_VolLab, - MIN(size, sizeof(pfat_bsbpb->BS_VolLab) + 1)); + copysize = MIN(size - 1, sizeof(pfat_bsbpb->BS_VolLab)); + memcpy(label, pfat_bsbpb->BS_VolLab, copysize); + label[copysize] = '\0'; } else if (UINT32BYTES(pfat32_bsbpb->BPB_FATSz32) != 0) { uint32_t fat_FirstDataSector, fat_BytesPerSector, offset; @@ -101,8 +103,10 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size) */ if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { - strlcpy(label, pfat32_bsbpb->BS_VolLab, - MIN(size, sizeof(pfat32_bsbpb->BS_VolLab) + 1)); + copysize = MIN(size - 1, + sizeof(pfat32_bsbpb->BS_VolLab) + 1); + memcpy(label, pfat32_bsbpb->BS_VolLab, copysize); + label[copysize] = '\0'; goto endofchecks; } @@ -146,9 +150,11 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size) */ if (pfat_entry->DIR_Attr & FAT_DES_ATTR_VOLUME_ID) { - strlcpy(label, pfat_entry->DIR_Name, - MIN(size, - sizeof(pfat_entry->DIR_Name) + 1)); + copysize = MIN(size - 1, + sizeof(pfat_entry->DIR_Name)); + memcpy(label, pfat_entry->DIR_Name, + copysize); + label[copysize] = '\0'; goto endofchecks; } } while((uint8_t *)(++pfat_entry) < From nobody Wed Oct 27 18:28:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A728C181B681; Wed, 27 Oct 2021 18:28: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfcdH3RrKz4vJd; Wed, 27 Oct 2021 18:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0C78515031; Wed, 27 Oct 2021 18:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RISI8n024776; Wed, 27 Oct 2021 18:28:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RISIoR024775; Wed, 27 Oct 2021 18:28:18 GMT (envelope-from git) Date: Wed, 27 Oct 2021 18:28:18 GMT Message-Id: <202110271828.19RISIoR024775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 628c3b307fb2 - main - cache: only let non-dir descriptors through when doing EMPTYPATH lookups List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 628c3b307fb29e9812008b8a0b3ccb73e0f0ecfa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=628c3b307fb29e9812008b8a0b3ccb73e0f0ecfa commit 628c3b307fb29e9812008b8a0b3ccb73e0f0ecfa Author: Mateusz Guzik AuthorDate: 2021-10-27 18:17:59 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-27 18:27:47 +0000 cache: only let non-dir descriptors through when doing EMPTYPATH lookups Otherwise things like realpath against a file and '.' end up with an illegal state of having a regular vnode for the parent. Reported by: syzbot+9aa5439dd9c708aeb1a8@syzkaller.appspotmail.com --- sys/kern/vfs_cache.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 656f446b7394..99f7314822f0 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4245,19 +4245,28 @@ cache_can_fplookup(struct cache_fpl *fpl) return (true); } -static int +static int __noinline cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) { struct nameidata *ndp; + struct componentname *cnp; int error; bool fsearch; ndp = fpl->ndp; + cnp = fpl->cnp; + error = fgetvp_lookup_smr(ndp->ni_dirfd, ndp, vpp, &fsearch); if (__predict_false(error != 0)) { return (cache_fpl_aborted(fpl)); } fpl->fsearch = fsearch; + if ((*vpp)->v_type != VDIR) { + if (!((cnp->cn_flags & EMPTYPATH) != 0 && cnp->cn_pnbuf[0] == '\0')) { + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, ENOTDIR)); + } + } return (0); } From nobody Wed Oct 27 19:34:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0BF231813BED; Wed, 27 Oct 2021 19:34:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hff566r2vz3R8C; Wed, 27 Oct 2021 19:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CA99715E3D; Wed, 27 Oct 2021 19:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19RJY2lY017184; Wed, 27 Oct 2021 19:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RJY2x7017183; Wed, 27 Oct 2021 19:34:02 GMT (envelope-from git) Date: Wed, 27 Oct 2021 19:34:02 GMT Message-Id: <202110271934.19RJY2x7017183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jilles Tjoelker Subject: git: 72f750dc7c73 - main - sh: Fix heredoc at certain places in case and for List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jilles X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72f750dc7c7324c3999e4d6cfbb2758694893cdd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jilles: URL: https://cgit.FreeBSD.org/src/commit/?id=72f750dc7c7324c3999e4d6cfbb2758694893cdd commit 72f750dc7c7324c3999e4d6cfbb2758694893cdd Author: Jilles Tjoelker AuthorDate: 2021-10-14 20:53:42 +0000 Commit: Jilles Tjoelker CommitDate: 2021-10-27 19:05:19 +0000 sh: Fix heredoc at certain places in case and for After an unescaped newline, there may be a here-document. Some places in case and for did not check for one. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D32628 --- bin/sh/parser.c | 16 +++++++++------- bin/sh/tests/parser/Makefile | 3 +++ bin/sh/tests/parser/heredoc14.0 | 8 ++++++++ bin/sh/tests/parser/heredoc15.0 | 9 +++++++++ bin/sh/tests/parser/heredoc16.0 | 8 ++++++++ 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 297d19d4d9b6..e75798800edf 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -480,9 +480,9 @@ command(void) n1 = (union node *)stalloc(sizeof (struct nfor)); n1->type = NFOR; n1->nfor.var = wordtext; - while (readtoken() == TNL) - ; - if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) { + checkkwd = CHKNL; + if (readtoken() == TWORD && !quoteflag && + equal(wordtext, "in")) { app = ≈ while (readtoken() == TWORD) { n2 = makename(); @@ -491,7 +491,9 @@ command(void) } *app = NULL; n1->nfor.args = ap; - if (lasttoken != TNL && lasttoken != TSEMI) + if (lasttoken == TNL) + tokpushback++; + else if (lasttoken != TSEMI) synexpect(-1); } else { static char argvars[5] = { @@ -507,7 +509,7 @@ command(void) * Newline or semicolon here is optional (but note * that the original Bourne shell only allowed NL). */ - if (lasttoken != TNL && lasttoken != TSEMI) + if (lasttoken != TSEMI) tokpushback++; } checkkwd = CHKNL | CHKKWD | CHKALIAS; @@ -526,8 +528,8 @@ command(void) n1->type = NCASE; consumetoken(TWORD); n1->ncase.expr = makename(); - while (readtoken() == TNL); - if (lasttoken != TWORD || ! equal(wordtext, "in")) + checkkwd = CHKNL; + if (readtoken() != TWORD || ! equal(wordtext, "in")) synerror("expecting \"in\""); cpp = &n1->ncase.cases; checkkwd = CHKNL | CHKKWD, readtoken(); diff --git a/bin/sh/tests/parser/Makefile b/bin/sh/tests/parser/Makefile index f3a15badeb52..3239f5bccd84 100644 --- a/bin/sh/tests/parser/Makefile +++ b/bin/sh/tests/parser/Makefile @@ -65,6 +65,9 @@ ${PACKAGE}FILES+= heredoc10.0 ${PACKAGE}FILES+= heredoc11.0 ${PACKAGE}FILES+= heredoc12.0 ${PACKAGE}FILES+= heredoc13.0 +${PACKAGE}FILES+= heredoc14.0 +${PACKAGE}FILES+= heredoc15.0 +${PACKAGE}FILES+= heredoc16.0 ${PACKAGE}FILES+= line-cont1.0 ${PACKAGE}FILES+= line-cont2.0 ${PACKAGE}FILES+= line-cont3.0 diff --git a/bin/sh/tests/parser/heredoc14.0 b/bin/sh/tests/parser/heredoc14.0 new file mode 100644 index 000000000000..036be53dc0c9 --- /dev/null +++ b/bin/sh/tests/parser/heredoc14.0 @@ -0,0 +1,8 @@ +# +read x < To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4827bf76bce8 - main - ktls: Fix assertion for TLS 1.0 CBC when using non-zero starting seqno. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4827bf76bce8814b9d9a0d883467a3d2366e59a2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4827bf76bce8814b9d9a0d883467a3d2366e59a2 commit 4827bf76bce8814b9d9a0d883467a3d2366e59a2 Author: John Baldwin AuthorDate: 2021-10-27 23:35:56 +0000 Commit: John Baldwin CommitDate: 2021-10-27 23:35:56 +0000 ktls: Fix assertion for TLS 1.0 CBC when using non-zero starting seqno. The starting sequence number used to verify that TLS 1.0 CBC records are encrypted in-order in the OCF layer was always set to 0 and not to the initial sequence number from the struct tls_enable. In practice, OpenSSL always starts TLS transmit offload with a sequence number of zero, so this only matters for tests that use a random starting sequence number. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32676 --- sys/opencrypto/ktls_ocf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 0753f4bafb1a..0096b4189533 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -761,6 +761,9 @@ ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) if (tls->params.tls_vminor == TLS_MINOR_VER_ZERO) { os->implicit_iv = true; memcpy(os->iv, tls->params.iv, AES_BLOCK_LEN); +#ifdef INVARIANTS + os->next_seqno = tls->next_seqno; +#endif } } From nobody Thu Oct 28 00:01:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D231718119A5; Thu, 28 Oct 2021 00:01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfm1K4QyDz3wHf; Thu, 28 Oct 2021 00:01:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7942919A23; Thu, 28 Oct 2021 00:01:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S0192U075266; Thu, 28 Oct 2021 00:01:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S019Wx075265; Thu, 28 Oct 2021 00:01:09 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:01:09 GMT Message-Id: <202110280001.19S019Wx075265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 5f6e6bef15df - releng/12.3 - 12.3: Update to BETA2 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 5f6e6bef15dfe242a64e7f98ad5f53c7b0dd74e4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=5f6e6bef15dfe242a64e7f98ad5f53c7b0dd74e4 commit 5f6e6bef15dfe242a64e7f98ad5f53c7b0dd74e4 Author: Glen Barber AuthorDate: 2021-10-28 00:00:45 +0000 Commit: Glen Barber CommitDate: 2021-10-28 00:00:45 +0000 12.3: Update to BETA2 Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 1e65930884c0..b4ca2d22d495 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.3" -BRANCH="BETA1" +BRANCH="BETA2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Thu Oct 28 00:01:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 317241811F3E; Thu, 28 Oct 2021 00:01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfm1t697Hz3wV2; Thu, 28 Oct 2021 00:01:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A2D7F19B23; Thu, 28 Oct 2021 00:01:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S01cih075419; Thu, 28 Oct 2021 00:01:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S01cNU075418; Thu, 28 Oct 2021 00:01:38 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:01:38 GMT Message-Id: <202110280001.19S01cNU075418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 63d24336fd1a - main - Fix off-by-one error in msdosfs FAT32 volume label copying List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63d24336fd1aad81a4bdefb11d8c487cee5f88a0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=63d24336fd1aad81a4bdefb11d8c487cee5f88a0 commit 63d24336fd1aad81a4bdefb11d8c487cee5f88a0 Author: Jessica Clarke AuthorDate: 2021-10-28 00:01:00 +0000 Commit: Jessica Clarke CommitDate: 2021-10-28 00:01:00 +0000 Fix off-by-one error in msdosfs FAT32 volume label copying I dropped the + 1 from the other two instances in each file but failed to do so for this one, resulting in a more egregious buffer overread than the one I was fixing (since the read character ended up in the output if there was space). Reported by: Jenkins Fixes: 34fb1c133c5b ("Fix intra-object buffer overread for labeled msdosfs volumes") --- sys/geom/label/g_label_msdosfs.c | 2 +- usr.sbin/fstyp/msdosfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/geom/label/g_label_msdosfs.c b/sys/geom/label/g_label_msdosfs.c index 2ba35ff80f51..06d5f2a8e0f0 100644 --- a/sys/geom/label/g_label_msdosfs.c +++ b/sys/geom/label/g_label_msdosfs.c @@ -136,7 +136,7 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { copysize = MIN(size - 1, - sizeof(pfat32_bsbpb->BS_VolLab) + 1); + sizeof(pfat32_bsbpb->BS_VolLab)); memcpy(label, pfat32_bsbpb->BS_VolLab, copysize); label[copysize] = '\0'; goto endofchecks; diff --git a/usr.sbin/fstyp/msdosfs.c b/usr.sbin/fstyp/msdosfs.c index ce745869edba..47d2383fbc8f 100644 --- a/usr.sbin/fstyp/msdosfs.c +++ b/usr.sbin/fstyp/msdosfs.c @@ -104,7 +104,7 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size) if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { copysize = MIN(size - 1, - sizeof(pfat32_bsbpb->BS_VolLab) + 1); + sizeof(pfat32_bsbpb->BS_VolLab)); memcpy(label, pfat32_bsbpb->BS_VolLab, copysize); label[copysize] = '\0'; goto endofchecks; From nobody Thu Oct 28 00:36:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 172A218228D2; Thu, 28 Oct 2021 00:36: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfmp307ywz4dPy; Thu, 28 Oct 2021 00:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D4D4619C5B; Thu, 28 Oct 2021 00:36:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S0aQNg016794; Thu, 28 Oct 2021 00:36:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S0aQ81016793; Thu, 28 Oct 2021 00:36:26 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:36:26 GMT Message-Id: <202110280036.19S0aQ81016793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 57dc5bdc1297 - stable/13 - rtld: Print currently configured search path for libraries for -v List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57dc5bdc12979001584cb9acd1f932de06208e88 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=57dc5bdc12979001584cb9acd1f932de06208e88 commit 57dc5bdc12979001584cb9acd1f932de06208e88 Author: Konstantin Belousov AuthorDate: 2021-10-25 16:16:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 00:35:53 +0000 rtld: Print currently configured search path for libraries for -v (cherry picked from commit 40ddde6ef9f38fd238fd1d84d77750f96c96a157) --- libexec/rtld-elf/rtld.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8b1f84c6901a..05afe5f42c3e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -466,6 +466,13 @@ rtld_init_env_vars(char **env) rtld_init_env_vars_for_prefix(env, ld_env_prefix); } +static void +set_ld_elf_hints_path(void) +{ + if (ld_elf_hints_path == NULL || strlen(ld_elf_hints_path) == 0) + ld_elf_hints_path = ld_elf_hints_default; +} + /* * Main entry point for dynamic linking. The first argument is the * stack pointer. The stack is expected to be laid out as described @@ -723,9 +730,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); ld_utrace = ld_get_env_var(LD_UTRACE); - if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0) - ld_elf_hints_path = ld_elf_hints_default; - + set_ld_elf_hints_path(); if (ld_debug != NULL && *ld_debug != '\0') debug = 1; dbg("%s is initialized, base address = %p", __progname, @@ -5972,16 +5977,23 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, mib[1] = HW_MACHINE; sz = sizeof(machine); sysctl(mib, nitems(mib), machine, &sz, NULL, 0); + ld_elf_hints_path = ld_get_env_var( + LD_ELF_HINTS_PATH); + set_ld_elf_hints_path(); rtld_printf( "FreeBSD ld-elf.so.1 %s\n" "FreeBSD_version %d\n" "Default lib path %s\n" + "Hints lib path %s\n" "Env prefix %s\n" + "Default hint file %s\n" "Hint file %s\n" "libmap file %s\n", machine, __FreeBSD_version, ld_standard_library_path, + gethints(false), ld_env_prefix, ld_elf_hints_default, + ld_elf_hints_path, ld_path_libmap_conf); _exit(0); } else { From nobody Thu Oct 28 00:36:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 491F018228DA; Thu, 28 Oct 2021 00:36: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfmp411NGz4dQ6; Thu, 28 Oct 2021 00:36:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EFF6D1A295; Thu, 28 Oct 2021 00:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S0aR3T016822; Thu, 28 Oct 2021 00:36:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S0aRc7016821; Thu, 28 Oct 2021 00:36:27 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:36:27 GMT Message-Id: <202110280036.19S0aRc7016821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d53274be0dac - stable/13 - ldd: style List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d53274be0dac71865cc4ebb335c59795cc4e2c1a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d53274be0dac71865cc4ebb335c59795cc4e2c1a commit d53274be0dac71865cc4ebb335c59795cc4e2c1a Author: Konstantin Belousov AuthorDate: 2021-10-12 11:39:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 00:35:54 +0000 ldd: style (cherry picked from commit ca8c576d10e22830d0c7ac865af21aad9ae44181) --- usr.bin/ldd/ldd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 3353345d549d..ee3f2070598d 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) { char *fmt1, *fmt2; - int rval, c, aflag; + int aflag, c, fd, rval, status, is_shlib, rv, type; aflag = 0; fmt1 = fmt2 = NULL; @@ -167,8 +167,6 @@ main(int argc, char *argv[]) rval = 0; for (; argc > 0; argc--, argv++) { - int fd, status, is_shlib, rv, type; - if ((fd = open(*argv, O_RDONLY, 0)) < 0) { warn("%s", *argv); rval |= 1; @@ -244,7 +242,7 @@ main(int argc, char *argv[]) } } - return rval; + return (rval); } static void From nobody Thu Oct 28 00:36:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8B6861822B57; Thu, 28 Oct 2021 00:36: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfmp53x19z4dXX; Thu, 28 Oct 2021 00:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3084E1A134; Thu, 28 Oct 2021 00:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S0aTes016849; Thu, 28 Oct 2021 00:36:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S0aTmb016848; Thu, 28 Oct 2021 00:36:29 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:36:29 GMT Message-Id: <202110280036.19S0aTmb016848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7a3d7b9efc33 - stable/13 - ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7a3d7b9efc3373e439bccf234fd4fadd2af9a75f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7a3d7b9efc3373e439bccf234fd4fadd2af9a75f commit 7a3d7b9efc3373e439bccf234fd4fadd2af9a75f Author: Konstantin Belousov AuthorDate: 2021-10-11 22:35:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 00:35:54 +0000 ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified PR: 259069 (cherry picked from commit 2c7a6dad4de17c357eb91c723bad860c6512a598) --- usr.bin/ldd/Makefile | 1 + usr.bin/ldd/ldd.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/usr.bin/ldd/Makefile b/usr.bin/ldd/Makefile index 78e551d80a33..1a671bc9f402 100644 --- a/usr.bin/ldd/Makefile +++ b/usr.bin/ldd/Makefile @@ -3,6 +3,7 @@ PROG?= ldd SRCS= ldd.c +CFLAGS+= -I${SRCTOP}/libexec/rtld-elf LIBADD= elf .include diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index ee3f2070598d..492e29dff211 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -134,6 +135,7 @@ int main(int argc, char *argv[]) { char *fmt1, *fmt2; + const char *rtld; int aflag, c, fd, rval, status, is_shlib, rv, type; aflag = 0; @@ -234,9 +236,17 @@ main(int argc, char *argv[]) if (is_shlib == 0) { execl(*argv, *argv, (char *)NULL); warn("%s", *argv); - } else { + } else if (fmt1 == NULL && fmt2 == NULL) { dlopen(*argv, RTLD_TRACE); warnx("%s: %s", *argv, dlerror()); + } else { + rtld = _PATH_RTLD; +#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) + if (type == TYPE_ELF32) + rtld = _COMPAT32_PATH_RTLD; +#endif + execl(rtld, rtld, "-d", "--", + *argv, (char *)NULL); } _exit(1); } From nobody Thu Oct 28 00:36:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B87F61822979; Thu, 28 Oct 2021 00:36: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfmp63SHFz4dQM; Thu, 28 Oct 2021 00:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 45D401A135; Thu, 28 Oct 2021 00:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S0aUUi016873; Thu, 28 Oct 2021 00:36:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S0aUlw016872; Thu, 28 Oct 2021 00:36:30 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:36:30 GMT Message-Id: <202110280036.19S0aUlw016872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5306ca9a8e2f - stable/13 - nehemiah: manually assemble xstore(-rng) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae commit 5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae Author: Konstantin Belousov AuthorDate: 2021-10-20 22:42:05 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 00:35:54 +0000 nehemiah: manually assemble xstore(-rng) PR: 259218 (cherry picked from commit 362c6d8dec6dfbedc5717e45769042279a1dd3df) --- sys/dev/random/nehemiah.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c index ba0dfb200ba0..3ad18005c935 100644 --- a/sys/dev/random/nehemiah.c +++ b/sys/dev/random/nehemiah.c @@ -68,7 +68,7 @@ VIA_RNG_store(void *buf) #ifdef __GNUCLIKE_ASM __asm __volatile( "movl $0,%%edx\n\t" - "xstore" + ".byte 0x0f, 0xa7, 0xc0" : "=a" (retval), "+d" (rate), "+D" (buf) : : "memory" From nobody Thu Oct 28 02:00:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 28AE91828F88; Thu, 28 Oct 2021 02:00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hfpg10jDjz3MyF; Thu, 28 Oct 2021 02:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EC9B41B09F; Thu, 28 Oct 2021 02:00:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S20Swe032149; Thu, 28 Oct 2021 02:00:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S20S1h032148; Thu, 28 Oct 2021 02:00:28 GMT (envelope-from git) Date: Thu, 28 Oct 2021 02:00:28 GMT Message-Id: <202110280200.19S20S1h032148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 840680e601f1 - main - Wrap mutex(9), rwlock(9) and sx(9) macros into __extension__ ({}) instead of do {} while (0). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 840680e601f15b25abed3fad31399a9ce838f13a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=840680e601f15b25abed3fad31399a9ce838f13a commit 840680e601f15b25abed3fad31399a9ce838f13a Author: Gleb Smirnoff AuthorDate: 2021-10-27 17:33:01 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-28 01:58:36 +0000 Wrap mutex(9), rwlock(9) and sx(9) macros into __extension__ ({}) instead of do {} while (0). This makes them real void expressions, and they can be used anywhere where a void function call can be used, for example in a conditional operator. Reviewed by: kib, mjg Differential revision: https://reviews.freebsd.org/D32696 --- sys/sys/mutex.h | 28 ++++++++++++++++------------ sys/sys/rwlock.h | 15 +++++++++------ sys/sys/sx.h | 5 +++-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index f35cdd7413a6..04e2c823541a 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -236,14 +236,15 @@ void _thread_lock(struct thread *); */ /* Lock a normal mutex. */ -#define __mtx_lock(mp, tid, opts, file, line) do { \ +#define __mtx_lock(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ uintptr_t _v = MTX_UNOWNED; \ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__acquire) ||\ !_mtx_obtain_lock_fetch((mp), &_v, _tid))) \ _mtx_lock_sleep((mp), _v, (opts), (file), (line)); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) /* * Lock a spin mutex. For spinlocks, we handle recursion inline (it @@ -252,7 +253,7 @@ void _thread_lock(struct thread *); * inlining this code is not too big a deal. */ #ifdef SMP -#define __mtx_lock_spin(mp, tid, opts, file, line) do { \ +#define __mtx_lock_spin(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ uintptr_t _v = MTX_UNOWNED; \ \ @@ -260,7 +261,8 @@ void _thread_lock(struct thread *); if (__predict_false(LOCKSTAT_PROFILE_ENABLED(spin__acquire) || \ !_mtx_obtain_lock_fetch((mp), &_v, _tid))) \ _mtx_lock_spin((mp), _v, (opts), (file), (line)); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) #define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ int _ret; \ @@ -277,7 +279,7 @@ void _thread_lock(struct thread *); _ret; \ }) #else /* SMP */ -#define __mtx_lock_spin(mp, tid, opts, file, line) do { \ +#define __mtx_lock_spin(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ \ spinlock_enter(); \ @@ -287,7 +289,8 @@ void _thread_lock(struct thread *); KASSERT((mp)->mtx_lock == MTX_UNOWNED, ("corrupt spinlock")); \ (mp)->mtx_lock = _tid; \ } \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) #define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ int _ret; \ @@ -305,13 +308,14 @@ void _thread_lock(struct thread *); #endif /* SMP */ /* Unlock a normal mutex. */ -#define __mtx_unlock(mp, tid, opts, file, line) do { \ +#define __mtx_unlock(mp, tid, opts, file, line) __extension__ ({ \ uintptr_t _v = (uintptr_t)(tid); \ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__release) ||\ !_mtx_release_lock_fetch((mp), &_v))) \ _mtx_unlock_sleep((mp), _v, (opts), (file), (line)); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) /* * Unlock a spin mutex. For spinlocks, we can handle everything @@ -324,7 +328,7 @@ void _thread_lock(struct thread *); * releasing a spin lock. This includes the recursion cases. */ #ifdef SMP -#define __mtx_unlock_spin(mp) do { \ +#define __mtx_unlock_spin(mp) __extension__ ({ \ if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ else { \ @@ -332,9 +336,9 @@ void _thread_lock(struct thread *); _mtx_release_lock_quick((mp)); \ } \ spinlock_exit(); \ -} while (0) +}) #else /* SMP */ -#define __mtx_unlock_spin(mp) do { \ +#define __mtx_unlock_spin(mp) __extension__ ({ \ if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ else { \ @@ -342,7 +346,7 @@ void _thread_lock(struct thread *); (mp)->mtx_lock = MTX_UNOWNED; \ } \ spinlock_exit(); \ -} while (0) +}) #endif /* SMP */ /* diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h index 4e7768595737..99e885e07aaf 100644 --- a/sys/sys/rwlock.h +++ b/sys/sys/rwlock.h @@ -103,23 +103,25 @@ */ /* Acquire a write lock. */ -#define __rw_wlock(rw, tid, file, line) do { \ +#define __rw_wlock(rw, tid, file, line) __extension__ ({ \ uintptr_t _tid = (uintptr_t)(tid); \ uintptr_t _v = RW_UNLOCKED; \ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || \ !_rw_write_lock_fetch((rw), &_v, _tid))) \ _rw_wlock_hard((rw), _v, (file), (line)); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) /* Release a write lock. */ -#define __rw_wunlock(rw, tid, file, line) do { \ +#define __rw_wunlock(rw, tid, file, line) __extension__ ({ \ uintptr_t _v = (uintptr_t)(tid); \ \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) || \ !_rw_write_unlock_fetch((rw), &_v))) \ _rw_wunlock_hard((rw), _v, (file), (line)); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) /* * Function prototypes. Routines that start with _ are not part of the @@ -231,12 +233,13 @@ void __rw_assert(const volatile uintptr_t *c, int what, const char *file, #define rw_try_upgrade(rw) _rw_try_upgrade((rw), LOCK_FILE, LOCK_LINE) #define rw_try_wlock(rw) _rw_try_wlock((rw), LOCK_FILE, LOCK_LINE) #define rw_downgrade(rw) _rw_downgrade((rw), LOCK_FILE, LOCK_LINE) -#define rw_unlock(rw) do { \ +#define rw_unlock(rw) __extension__ ({ \ if (rw_wowned(rw)) \ rw_wunlock(rw); \ else \ rw_runlock(rw); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) #define rw_sleep(chan, rw, pri, wmesg, timo) \ _sleep((chan), &(rw)->lock_object, (pri), (wmesg), \ tick_sbt * (timo), 0, C_HARDCLOCK) diff --git a/sys/sys/sx.h b/sys/sys/sx.h index 1e6b9f3f8a46..bd164a96558b 100644 --- a/sys/sys/sx.h +++ b/sys/sys/sx.h @@ -253,12 +253,13 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) (((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) == \ (uintptr_t)curthread) -#define sx_unlock_(sx, file, line) do { \ +#define sx_unlock_(sx, file, line) __extension__ ({ \ if (sx_xlocked(sx)) \ sx_xunlock_(sx, file, line); \ else \ sx_sunlock_(sx, file, line); \ -} while (0) + (void)0; /* ensure void type for expression */ \ +}) #define sx_unlock(sx) sx_unlock_((sx), LOCK_FILE, LOCK_LINE) From nobody Thu Oct 28 05:12:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DDBDF182F495; Thu, 28 Oct 2021 05:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hftwh5gvjz3FcW; Thu, 28 Oct 2021 05:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A2C3A1DE2A; Thu, 28 Oct 2021 05:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S5Cadh089296; Thu, 28 Oct 2021 05:12:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S5Cacu089295; Thu, 28 Oct 2021 05:12:36 GMT (envelope-from git) Date: Thu, 28 Oct 2021 05:12:36 GMT Message-Id: <202110280512.19S5Cacu089295@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: fb3854845f50 - main - mroute: fix memory leak List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb3854845f500155982355a39d1d32ccc9a44c16 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=fb3854845f500155982355a39d1d32ccc9a44c16 commit fb3854845f500155982355a39d1d32ccc9a44c16 Author: Wojciech Macek AuthorDate: 2021-10-28 04:41:15 +0000 Commit: Wojciech Macek CommitDate: 2021-10-28 05:12:16 +0000 mroute: fix memory leak Add MFC to linked list to store incoming packets before MCAST JOIN was captured. Sponsored by: Stormshield Obtained from: Semihalf MFC after: 2 weeks --- sys/netinet/ip_mroute.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index efb34af60d9c..c992743a503e 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1466,6 +1466,9 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, timevalclear(&rt->mfc_last_assert); buf_ring_enqueue(rt->mfc_stall_ring, rte); + + /* Add RT to hashtable as it didn't exist before */ + LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); } else { /* determine if queue has overflowed */ if (buf_ring_full(rt->mfc_stall_ring)) { From nobody Thu Oct 28 05:12:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 435A1182F2D3; Thu, 28 Oct 2021 05:12: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hftwk0kZTz3FJK; Thu, 28 Oct 2021 05:12:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E1F621DC49; Thu, 28 Oct 2021 05:12:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S5CbdG089320; Thu, 28 Oct 2021 05:12:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S5Cbpj089319; Thu, 28 Oct 2021 05:12:37 GMT (envelope-from git) Date: Thu, 28 Oct 2021 05:12:37 GMT Message-Id: <202110280512.19S5Cbpj089319@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 8a727c3df89a - main - mroute: add missing WUNLOCK List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a727c3df89acd02050b849a916e49ae447c1d9d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=8a727c3df89acd02050b849a916e49ae447c1d9d commit 8a727c3df89acd02050b849a916e49ae447c1d9d Author: Wojciech Macek AuthorDate: 2021-10-28 04:59:37 +0000 Commit: Wojciech Macek CommitDate: 2021-10-28 05:12:23 +0000 mroute: add missing WUNLOCK Add missing WNLOCK as in all other error cases. Reported by: Stormshield Obtained from: Semihalf --- sys/netinet/ip_mroute.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index c992743a503e..02738616d56e 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -713,8 +713,10 @@ ip_mrouter_init(struct socket *so, int version) mtx_init(&V_bw_upcalls_ring_mtx, "mroute upcall buf_ring mtx", NULL, MTX_DEF); V_bw_upcalls_ring = buf_ring_alloc(BW_UPCALLS_MAX, M_MRTABLE, M_NOWAIT, &V_bw_upcalls_ring_mtx); - if (!V_bw_upcalls_ring) + if (!V_bw_upcalls_ring) { + MRW_WUNLOCK(); return (ENOMEM); + } /* Create upcall thread */ upcall_thread_shutdown = 0; From nobody Thu Oct 28 08:50:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 14F72181FADB; Thu, 28 Oct 2021 08:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfzmH074Fz4xJW; Thu, 28 Oct 2021 08:50:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D99D120C0C; Thu, 28 Oct 2021 08:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S8ocJL079494; Thu, 28 Oct 2021 08:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S8ocCH079483; Thu, 28 Oct 2021 08:50:38 GMT (envelope-from git) Date: Thu, 28 Oct 2021 08:50:38 GMT Message-Id: <202110280850.19S8ocCH079483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 62d2dcafb7f3 - main - if_epair: delete mbuf tags List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62d2dcafb7f33fe8f47e9d5dd519d665f7af140e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=62d2dcafb7f33fe8f47e9d5dd519d665f7af140e commit 62d2dcafb7f33fe8f47e9d5dd519d665f7af140e Author: Kristof Provost AuthorDate: 2021-10-26 07:57:56 +0000 Commit: Kristof Provost CommitDate: 2021-10-28 08:41:16 +0000 if_epair: delete mbuf tags Remove all (non-persistent) tags when we transmit a packet. Real network interfaces do not carry any tags either, and leaving tags attached can produce unexpected results. Reviewed by: bz, glebius MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32663 --- sys/net/if_epair.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index 7f62cdb427ff..a62fbfad8771 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -196,6 +196,19 @@ struct epair_dpcpu { }; DPCPU_DEFINE(struct epair_dpcpu, epair_dpcpu); +static void +epair_clear_mbuf(struct mbuf *m) +{ + /* Remove any CSUM_SND_TAG as ether_input will barf. */ + if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) { + m_snd_tag_rele(m->m_pkthdr.snd_tag); + m->m_pkthdr.snd_tag = NULL; + m->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; + } + + m_tag_delete_nonpersistent(m); +} + static void epair_dpcpu_init(void) { @@ -435,6 +448,8 @@ epair_start_locked(struct ifnet *ifp) } DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname); + epair_clear_mbuf(m); + /* * Add a reference so the interface cannot go while the * packet is in transit as we rely on rcvif to stay valid. @@ -556,6 +571,9 @@ epair_transmit_locked(struct ifnet *ifp, struct mbuf *m) (void)epair_add_ifp_for_draining(ifp); return (error); } + + epair_clear_mbuf(m); + sc = oifp->if_softc; /* * Add a reference so the interface cannot go while the From nobody Thu Oct 28 08:50:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AA49181FC95; Thu, 28 Oct 2021 08:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfzmJ1wQGz4xJd; Thu, 28 Oct 2021 08:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 11DF7208EE; Thu, 28 Oct 2021 08:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S8odKS079756; Thu, 28 Oct 2021 08:50:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S8od1g079755; Thu, 28 Oct 2021 08:50:39 GMT (envelope-from git) Date: Thu, 28 Oct 2021 08:50:39 GMT Message-Id: <202110280850.19S8od1g079755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7fe0c3f8d330 - main - mbuf: PACKET_TAG_PF should not be persistent List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fe0c3f8d3303b67e55e3abcd66cbd4a9eaa1a0d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7fe0c3f8d3303b67e55e3abcd66cbd4a9eaa1a0d commit 7fe0c3f8d3303b67e55e3abcd66cbd4a9eaa1a0d Author: Kristof Provost AuthorDate: 2021-10-26 07:51:33 +0000 Commit: Kristof Provost CommitDate: 2021-10-28 08:41:17 +0000 mbuf: PACKET_TAG_PF should not be persistent We should clear firewall tags on loopback, icmp reflection, or if_epair transmission. Left over tags can produce unexpected behaviour, especially on if_epair where a and b interfaces can be in different vnets, and have different firewall policies set. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32664 --- sys/sys/mbuf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 9c196f30b319..413854cc9a57 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1351,7 +1351,7 @@ extern bool mb_use_ext_pgs; /* Use ext_pgs for sendfile */ #define PACKET_TAG_DIVERT 17 /* divert info */ #define PACKET_TAG_IPFORWARD 18 /* ipforward info */ #define PACKET_TAG_MACLABEL (19 | MTAG_PERSISTENT) /* MAC label */ -#define PACKET_TAG_PF (21 | MTAG_PERSISTENT) /* PF/ALTQ information */ +#define PACKET_TAG_PF 21 /* PF/ALTQ information */ #define PACKET_TAG_RTSOCKFAM 25 /* rtsock sa family */ #define PACKET_TAG_IPOPTIONS 27 /* Saved IP options */ #define PACKET_TAG_CARP 28 /* CARP info */ From nobody Thu Oct 28 08:50:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8D870181FD12; Thu, 28 Oct 2021 08:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfzmK2hFzz4x9Z; Thu, 28 Oct 2021 08:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2A17A2084E; Thu, 28 Oct 2021 08:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S8ofa2079782; Thu, 28 Oct 2021 08:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S8oflX079781; Thu, 28 Oct 2021 08:50:41 GMT (envelope-from git) Date: Thu, 28 Oct 2021 08:50:41 GMT Message-Id: <202110280850.19S8oflX079781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e5c4987e3fc1 - main - pf: fix dummynet + NAT List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5c4987e3fc1997264f4c3a10d3047a9379b9b15 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e5c4987e3fc1997264f4c3a10d3047a9379b9b15 commit e5c4987e3fc1997264f4c3a10d3047a9379b9b15 Author: Kristof Provost AuthorDate: 2021-10-26 07:59:42 +0000 Commit: Kristof Provost CommitDate: 2021-10-28 08:41:17 +0000 pf: fix dummynet + NAT Dummynet differs from ALTQ in that ALTQ schedules packets after they leave pf. Dummynet schedules them after they leave pf, but then re-injects them. We currently deal with this by ensuring we don't re-schedule a packet we get from dummynet, but this produces unexpected results when combined with NAT, as dummynet processing is done after the NAT transformation. In other words, the second time the packet is handed to pf it may have a different source and destination address. Simplify this by moving dummynet processing to after all other pf processing, and not re-processing (but always passing) packets from dummynet. This fixes NAT of dummynet delayed packets, and also reduces processing overhead (because we only do state/rule lookup for each dummynet packet once, rather than twice). MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32665 --- sys/netpfil/pf/pf.c | 73 +++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index bb7667a3e270..61eea329a7f7 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6456,6 +6456,13 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * } pd.pf_mtag->flags |= PF_PACKET_LOOPED; m_tag_delete(m, ipfwtag); + if (rr->info & IPFW_IS_DUMMYNET) { + /* Dummynet re-injects packets after they've + * completed their delay. We've already + * processed them, so pass unconditionally. */ + PF_RULES_RUNLOCK(); + return (PF_PASS); + } } if (pd.pf_mtag && pd.pf_mtag->flags & PF_FASTFWD_OURS_PRESENT) { m->m_flags |= M_FASTFWD_OURS; @@ -6704,47 +6711,6 @@ done: } #endif /* ALTQ */ - if (s && (s->dnpipe || s->dnrpipe)) { - pd.act.dnpipe = s->dnpipe; - pd.act.dnrpipe = s->dnrpipe; - pd.act.flags = s->state_flags; - } else if (r->dnpipe || r->dnrpipe) { - pd.act.dnpipe = r->dnpipe; - pd.act.dnrpipe = r->dnrpipe; - pd.act.flags = r->free_flags; - } - if ((pd.act.dnpipe || pd.act.dnrpipe) && !PACKET_LOOPED(&pd)) { - if (ip_dn_io_ptr == NULL) { - action = PF_DROP; - REASON_SET(&reason, PFRES_MEMORY); - } else { - struct ip_fw_args dnflow; - - if (pd.pf_mtag == NULL && - ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { - action = PF_DROP; - REASON_SET(&reason, PFRES_MEMORY); - if (s) - PF_STATE_UNLOCK(s); - return (action); - } - - if (pf_pdesc_to_dnflow(dir, &pd, r, s, &dnflow)) { - ip_dn_io_ptr(m0, &dnflow); - - if (*m0 == NULL) { - if (s) - PF_STATE_UNLOCK(s); - return (action); - } else { - /* This is dummynet fast io processing */ - m_tag_delete(*m0, m_tag_first(*m0)); - pd.pf_mtag->flags &= ~PF_PACKET_LOOPED; - } - } - } - } - /* * connections redirected to loopback should not match sockets * bound specifically to loopback due to security implications, @@ -6885,6 +6851,31 @@ done: pf_route(m0, r, dir, kif->pfik_ifp, s, &pd, inp); return (action); } + /* Dummynet processing. */ + if (s && (s->dnpipe || s->dnrpipe)) { + pd.act.dnpipe = s->dnpipe; + pd.act.dnrpipe = s->dnrpipe; + pd.act.flags = s->state_flags; + } else if (r->dnpipe || r->dnrpipe) { + pd.act.dnpipe = r->dnpipe; + pd.act.dnrpipe = r->dnrpipe; + pd.act.flags = r->free_flags; + } + if (pd.act.dnpipe || pd.act.dnrpipe) { + if (ip_dn_io_ptr == NULL) { + m_freem(*m0); + *m0 = NULL; + REASON_SET(&reason, PFRES_MEMORY); + } else { + struct ip_fw_args dnflow; + + if (pf_pdesc_to_dnflow(dir, &pd, r, s, &dnflow)) { + ip_dn_io_ptr(m0, &dnflow); + if (*m0 == NULL) + action = PF_DROP; + } + } + } break; } From nobody Thu Oct 28 08:50:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 74A52181FBE1; Thu, 28 Oct 2021 08:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HfzmL4HCCz4xK2; Thu, 28 Oct 2021 08:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 479EC20C0D; Thu, 28 Oct 2021 08:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19S8ogu1079811; Thu, 28 Oct 2021 08:50:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S8oggf079810; Thu, 28 Oct 2021 08:50:42 GMT (envelope-from git) Date: Thu, 28 Oct 2021 08:50:42 GMT Message-Id: <202110280850.19S8oggf079810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 4ee0f6d87452 - main - netpfil tests: dummynet+NAT test for pf List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ee0f6d87452d156a588ea23b016203dcc7ec6ad Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ee0f6d87452d156a588ea23b016203dcc7ec6ad commit 4ee0f6d87452d156a588ea23b016203dcc7ec6ad Author: Kristof Provost AuthorDate: 2021-10-26 08:56:30 +0000 Commit: Kristof Provost CommitDate: 2021-10-28 08:41:17 +0000 netpfil tests: dummynet+NAT test for pf Ensure that NAT still works as expected when combined with dummynet. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32666 --- tests/sys/netpfil/common/dummynet.sh | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 644b36516b5a..448bb79a46f9 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -329,6 +329,50 @@ queue_v6_cleanup() firewall_cleanup $1 } +nat_head() +{ + atf_set descr 'Basic dummynet + NAT test' + atf_set require.user root +} + +nat_body() +{ + fw=$1 + firewall_init $fw + dummynet_init $fw + nat_init $fw + + epair=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + vnet_mkjail gw ${epair}b ${epair_two}a + jexec gw ifconfig ${epair}b 192.0.2.1/24 up + jexec gw ifconfig ${epair_two}a 198.51.100.1/24 up + jexec gw sysctl net.inet.ip.forwarding=1 + + vnet_mkjail srv ${epair_two}b + jexec srv ifconfig ${epair_two}b 198.51.100.2/24 up + + jexec gw dnctl pipe 1 config bw 300Byte/s + + firewall_config gw $fw \ + "pf" \ + "nat on ${epair_two}a inet from 192.0.2.0/24 to any -> (${epair_two}a)" \ + "pass dnpipe 1" + + # We've deliberately not set a route to 192.0.2.0/24 on srv, so the + # only way it can respond to this is if NAT is applied correctly. + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 +} + +nat_cleanup() +{ + firewall_cleanup $1 +} + setup_tests \ pipe \ ipfw \ @@ -341,4 +385,6 @@ setup_tests \ pf \ queue_v6 \ ipfw \ + pf \ + nat \ pf From nobody Thu Oct 28 13:51:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AB9EF182DD04; Thu, 28 Oct 2021 13:51: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hg6RW4QL9z3GN9; Thu, 28 Oct 2021 13:51:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7906C24E49; Thu, 28 Oct 2021 13:51:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SDpZY0080530; Thu, 28 Oct 2021 13:51:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SDpZiK080528; Thu, 28 Oct 2021 13:51:35 GMT (envelope-from git) Date: Thu, 28 Oct 2021 13:51:35 GMT Message-Id: <202110281351.19SDpZiK080528@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 1a4d5f13ba19 - main - ident: replace sbuf(9) with open_memstream(3) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a4d5f13ba19308f9909ef712c5d7eebaf1f9806 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4d5f13ba19308f9909ef712c5d7eebaf1f9806 commit 1a4d5f13ba19308f9909ef712c5d7eebaf1f9806 Author: Baptiste Daroussin AuthorDate: 2021-10-28 13:39:24 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-28 13:51:23 +0000 ident: replace sbuf(9) with open_memstream(3) This change makes ident only dependant on libc functions This makes our ident(1) more portable, also the fact that we only depend on libc which is maintained with excellent backward compatibility means that if one day ident is removed from base, someone using FreeBSD 22 will be able to fetch ident from FreeBSD 14 to run ident against FreeBSD 1.0 binary MFC After: 1 week --- usr.bin/ident/Makefile | 2 -- usr.bin/ident/ident.c | 35 +++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/usr.bin/ident/Makefile b/usr.bin/ident/Makefile index e0a3a80f7b09..0e0734081607 100644 --- a/usr.bin/ident/Makefile +++ b/usr.bin/ident/Makefile @@ -4,8 +4,6 @@ PROG= ident -LIBADD= sbuf - HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/usr.bin/ident/ident.c b/usr.bin/ident/ident.c index aa9612d2fce1..14ff8ec8f335 100644 --- a/usr.bin/ident/ident.c +++ b/usr.bin/ident/ident.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Baptiste Daroussin + * Copyright (c) 2015-2021 Baptiste Daroussin * Copyright (c) 2015 Xin LI * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -58,10 +59,17 @@ scan(FILE *fp, const char *name, bool quiet) bool hasid = false; bool subversion = false; analyzer_states state = INIT; - struct sbuf *id = sbuf_new_auto(); + FILE* buffp; + char *buf; + size_t sz; locale_t l; l = newlocale(LC_ALL_MASK, "C", NULL); + sz = 0; + buf = NULL; + buffp = open_memstream(&buf, &sz); + if (buffp == NULL) + err(EXIT_FAILURE, "open_memstream()"); if (name != NULL) printf("%s:\n", name); @@ -80,9 +88,11 @@ scan(FILE *fp, const char *name, bool quiet) case DELIM_SEEN: if (isalpha_l(c, l)) { /* Transit to KEYWORD if we see letter */ - sbuf_clear(id); - sbuf_putc(id, '$'); - sbuf_putc(id, c); + if (buf != NULL) + memset(buf, 0, sz); + rewind(buffp); + fputc('$', buffp); + fputc(c, buffp); state = KEYWORD; continue; @@ -95,7 +105,7 @@ scan(FILE *fp, const char *name, bool quiet) } break; case KEYWORD: - sbuf_putc(id, c); + fputc(c, buffp); if (isalpha_l(c, l)) { /* @@ -125,7 +135,7 @@ scan(FILE *fp, const char *name, bool quiet) break; case PUNC_SEEN: case PUNC_SEEN_SVN: - sbuf_putc(id, c); + fputc(c, buffp); switch (c) { case ':': @@ -159,13 +169,13 @@ scan(FILE *fp, const char *name, bool quiet) } break; case TEXT: - sbuf_putc(id, c); + fputc(c, buffp); if (iscntrl_l(c, l)) { /* Control characters are not allowed in this state */ state = INIT; } else if (c == '$') { - sbuf_finish(id); + fflush(buffp); /* * valid ident should end with a space. * @@ -175,9 +185,9 @@ scan(FILE *fp, const char *name, bool quiet) * subversion mode. No length check is enforced * because GNU RCS ident(1) does not do it either. */ - c = sbuf_data(id)[sbuf_len(id) - 2]; + c = buf[strlen(buf) -2 ]; if (c == ' ' || (subversion && c == '#')) { - printf(" %s\n", sbuf_data(id)); + printf(" %s\n", buf); hasid = true; } state = INIT; @@ -186,7 +196,8 @@ scan(FILE *fp, const char *name, bool quiet) break; } } - sbuf_delete(id); + fclose(buffp); + free(buf); freelocale(l); if (!hasid) { From nobody Thu Oct 28 15:45:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8F6AD1836FA0; Thu, 28 Oct 2021 15:45:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hg8z01hTdz4hQH; Thu, 28 Oct 2021 15:45:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 9A2CF9132; Thu, 28 Oct 2021 15:45:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 5306ca9a8e2f - stable/13 - nehemiah: manually assemble xstore(-rng) To: Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org References: <202110280036.19S0aUlw016872@gitrepo.freebsd.org> From: John Baldwin Message-ID: <5f2a0484-6016-2f9d-2697-54000cb8ee07@FreeBSD.org> Date: Thu, 28 Oct 2021 08:45:30 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110280036.19S0aUlw016872@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/27/21 5:36 PM, Konstantin Belousov wrote: > The branch stable/13 has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae > > commit 5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae > Author: Konstantin Belousov > AuthorDate: 2021-10-20 22:42:05 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-10-28 00:35:54 +0000 > > nehemiah: manually assemble xstore(-rng) > > PR: 259218 > > (cherry picked from commit 362c6d8dec6dfbedc5717e45769042279a1dd3df) Note that dim@ merged the LLVM fix to 13 yesterday. :) -- John Baldwin From nobody Thu Oct 28 15:45:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 53AA11836F3E; Thu, 28 Oct 2021 15:45:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hg8z56XCBz4hb1; Thu, 28 Oct 2021 15:45:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 3C8E19133; Thu, 28 Oct 2021 15:45:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 62d2dcafb7f3 - main - if_epair: delete mbuf tags To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110280850.19S8ocCH079483@gitrepo.freebsd.org> From: John Baldwin Message-ID: <451456f3-6a1f-78b3-4c34-01c6cf681cd0@FreeBSD.org> Date: Thu, 28 Oct 2021 08:45:36 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110280850.19S8ocCH079483@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/28/21 1:50 AM, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=62d2dcafb7f33fe8f47e9d5dd519d665f7af140e > > commit 62d2dcafb7f33fe8f47e9d5dd519d665f7af140e > Author: Kristof Provost > AuthorDate: 2021-10-26 07:57:56 +0000 > Commit: Kristof Provost > CommitDate: 2021-10-28 08:41:16 +0000 > > if_epair: delete mbuf tags > > Remove all (non-persistent) tags when we transmit a packet. Real network > interfaces do not carry any tags either, and leaving tags attached can > produce unexpected results. > > Reviewed by: bz, glebius > MFC after: 3 weeks > Sponsored by: Rubicon Communications, LLC ("Netgate") > Differential Revision: https://reviews.freebsd.org/D32663 Wireguard has similar functionality FWIW, so it might be worth exposing a generic "mb_free_tags". Wireguard also tries to reset some other state like the status of checksum offload since it is moving mbufs between an ifnet and a socket. Not sure if epair also needs to clear all the same things? -- John Baldwin From nobody Thu Oct 28 16:22:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D6E5F18277F0; Thu, 28 Oct 2021 16:22:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hg9nm5r6xz4vNH; Thu, 28 Oct 2021 16:22:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 8FC539C1D; Thu, 28 Oct 2021 16:22:36 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 2783A2978F; Thu, 28 Oct 2021 18:22:33 +0200 (CEST) From: Kristof Provost To: John Baldwin Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 62d2dcafb7f3 - main - if_epair: delete mbuf tags Date: Thu, 28 Oct 2021 18:22:32 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: In-Reply-To: <451456f3-6a1f-78b3-4c34-01c6cf681cd0@FreeBSD.org> References: <202110280850.19S8ocCH079483@gitrepo.freebsd.org> <451456f3-6a1f-78b3-4c34-01c6cf681cd0@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On 28 Oct 2021, at 17:45, John Baldwin wrote: > On 10/28/21 1:50 AM, Kristof Provost wrote: >> The branch main has been updated by kp: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D62d2dcafb7f33fe8f47e9d5= dd519d665f7af140e >> >> commit 62d2dcafb7f33fe8f47e9d5dd519d665f7af140e >> Author: Kristof Provost >> AuthorDate: 2021-10-26 07:57:56 +0000 >> Commit: Kristof Provost >> CommitDate: 2021-10-28 08:41:16 +0000 >> >> if_epair: delete mbuf tags >> Remove all (non-persistent) tags when we transmit a packet. R= eal network >> interfaces do not carry any tags either, and leaving tags attache= d can >> produce unexpected results. >> Reviewed by: bz, glebius >> MFC after: 3 weeks >> Sponsored by: Rubicon Communications, LLC ("Netgate") >> Differential Revision: https://reviews.freebsd.org/D32663 > > Wireguard has similar functionality FWIW, so it might be worth exposing= a generic > "mb_free_tags". Wireguard also tries to reset some other state like th= e status > of checksum offload since it is moving mbufs between an ifnet and a soc= ket. Not > sure if epair also needs to clear all the same things? > Something like https://reviews.freebsd.org/D32710 ? I stuck with the =E2=80=98clear=E2=80=99 terminology to distinguish it fr= om the existing free functions, and because the use case is slightly diff= erent. Kristof From nobody Thu Oct 28 17:50:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D32AA1827007; Thu, 28 Oct 2021 17:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClJ5hDKz4SWM; Thu, 28 Oct 2021 17:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A36A227CD8; Thu, 28 Oct 2021 17:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHoa9K097625; Thu, 28 Oct 2021 17:50:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHoaNk097624; Thu, 28 Oct 2021 17:50:36 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:36 GMT Message-Id: <202110281750.19SHoaNk097624@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: 143dba3a9142 - main - kern_exec.c: style List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 143dba3a914294c2f4de80a46ffd04cd8b25246f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=143dba3a914294c2f4de80a46ffd04cd8b25246f commit 143dba3a914294c2f4de80a46ffd04cd8b25246f Author: Konstantin Belousov AuthorDate: 2021-10-22 23:49:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:49:10 +0000 kern_exec.c: style Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/kern_exec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index a8f07bf39564..eb785c9f71d5 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -241,9 +241,9 @@ static const struct execsw **execsw; #ifndef _SYS_SYSPROTO_H_ struct execve_args { - char *fname; + char *fname; char **argv; - char **envv; + char **envv; }; #endif @@ -509,7 +509,8 @@ interpret: /* * Descriptors opened only with O_EXEC or O_RDONLY are allowed. */ - error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, &newtextvp); + error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, + &newtextvp); if (error) goto exec_fail; vn_lock(newtextvp, LK_SHARED | LK_RETRY); @@ -628,7 +629,8 @@ interpret: imgp->execpath = args->fname; else { VOP_UNLOCK(imgp->vp); - if (vn_fullpath(imgp->vp, &imgp->execpath, &imgp->freepath) != 0) + if (vn_fullpath(imgp->vp, &imgp->execpath, + &imgp->freepath) != 0) imgp->execpath = args->fname; vn_lock(imgp->vp, LK_SHARED | LK_RETRY); } @@ -1040,7 +1042,7 @@ exec_map_first_page(struct image_params *imgp) #endif error = vm_page_grab_valid_unlocked(&m, object, 0, VM_ALLOC_COUNT(VM_INITIAL_PAGEIN) | - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED); + VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED); if (error != VM_PAGER_OK) return (EIO); @@ -1985,7 +1987,8 @@ sbuf_drain_core_output(void *arg, const char *data, int len) if (locked) PROC_UNLOCK(p); if (cp->comp != NULL) - error = compressor_write(cp->comp, __DECONST(char *, data), len); + error = compressor_write(cp->comp, __DECONST(char *, data), + len); else error = core_write(cp, __DECONST(void *, data), len, cp->offset, UIO_SYSSPACE, NULL); From nobody Thu Oct 28 17:50:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 507381826EB2; Thu, 28 Oct 2021 17:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClL0WJ1z4Spc; Thu, 28 Oct 2021 17:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D259E27CD9; Thu, 28 Oct 2021 17:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHobf0097649; Thu, 28 Oct 2021 17:50:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHobrH097648; Thu, 28 Oct 2021 17:50:37 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:37 GMT Message-Id: <202110281750.19SHobrH097648@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: 9d58243fbc4a - main - do_execve(): switch boolean locals to use bool type List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d58243fbc4a1931aba618f8f5f6872779656c42 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9d58243fbc4a1931aba618f8f5f6872779656c42 commit 9d58243fbc4a1931aba618f8f5f6872779656c42 Author: Konstantin Belousov AuthorDate: 2021-10-23 14:47:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:49:16 +0000 do_execve(): switch boolean locals to use bool type Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/kern_exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index eb785c9f71d5..e86d19e9eed1 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -421,10 +421,10 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, struct ktr_io_params *kiop; #endif struct vnode *oldtextvp = NULL, *newtextvp; - int credential_changing; + bool credential_changing; #ifdef MAC struct label *interpvplabel = NULL; - int will_transition; + bool will_transition; #endif #ifdef HWPMC_HOOKS struct pmckern_procexec pe; @@ -558,14 +558,14 @@ interpret: * XXXMAC: For the time being, use NOSUID to also prohibit * transitions on the file system. */ - credential_changing = 0; + credential_changing = false; credential_changing |= (attr.va_mode & S_ISUID) && oldcred->cr_uid != attr.va_uid; credential_changing |= (attr.va_mode & S_ISGID) && oldcred->cr_gid != attr.va_gid; #ifdef MAC will_transition = mac_vnode_execve_will_transition(oldcred, imgp->vp, - interpvplabel, imgp); + interpvplabel, imgp) != 0; credential_changing |= will_transition; #endif From nobody Thu Oct 28 17:50:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BA25E182701C; Thu, 28 Oct 2021 17:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClM1gxqz4ShT; Thu, 28 Oct 2021 17:50:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB74027E4F; Thu, 28 Oct 2021 17:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHocKJ097673; Thu, 28 Oct 2021 17:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHocdK097672; Thu, 28 Oct 2021 17:50:38 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:38 GMT Message-Id: <202110281750.19SHocdK097672@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: 15bf81f354a4 - main - struct image_params: use bool type for boolean members List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15bf81f354a428723d7e9ea61ea215d4195aa050 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=15bf81f354a428723d7e9ea61ea215d4195aa050 commit 15bf81f354a428723d7e9ea61ea215d4195aa050 Author: Konstantin Belousov AuthorDate: 2021-10-23 15:05:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:49:21 +0000 struct image_params: use bool type for boolean members Also re-align comments, and group booleans and char members together. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/kern_exec.c | 6 +++--- sys/sys/imgact.h | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index e86d19e9eed1..5cc5a1205901 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -687,7 +687,7 @@ interpret: #endif if (imgp->opened) { VOP_CLOSE(newtextvp, FREAD, td->td_ucred, td); - imgp->opened = 0; + imgp->opened = false; } vput(newtextvp); vm_object_deallocate(imgp->object); @@ -1091,7 +1091,7 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) vm_prot_t stack_prot; u_long ssiz; - imgp->vmspace_destroyed = 1; + imgp->vmspace_destroyed = true; imgp->sysent = sv; if (p->p_sysent->sv_onexec_old != NULL) @@ -1791,7 +1791,7 @@ exec_check_permissions(struct image_params *imgp) */ error = VOP_OPEN(vp, FREAD, td->td_ucred, td, NULL); if (error == 0) - imgp->opened = 1; + imgp->opened = true; return (error); } diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index ef4de48c3e6d..0e99737a84a7 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -58,21 +58,16 @@ struct image_args { }; struct image_params { - struct proc *proc; /* our process struct */ + struct proc *proc; /* our process */ struct label *execlabel; /* optional exec label */ - struct vnode *vp; /* pointer to vnode of file to exec */ + struct vnode *vp; /* pointer to vnode of file to exec */ struct vm_object *object; /* The vm object for this vp */ - struct vattr *attr; /* attributes of file */ - const char *image_header; /* head of file to exec */ - unsigned long entry_addr; /* entry address of target executable */ - unsigned long reloc_base; /* load address of image */ - char vmspace_destroyed; /* flag - we've blown away original vm space */ -#define IMGACT_SHELL 0x1 -#define IMGACT_BINMISC 0x2 - unsigned char interpreted; /* mask of interpreters that have run */ - char opened; /* flag - we have opened executable vnode */ - char *interpreter_name; /* name of the interpreter */ - void *auxargs; /* ELF Auxinfo structure pointer */ + struct vattr *attr; /* attributes of file */ + const char *image_header; /* header of file to exec */ + unsigned long entry_addr; /* entry address of target executable */ + unsigned long reloc_base; /* load address of image */ + char *interpreter_name; /* name of the interpreter */ + void *auxargs; /* ELF Auxinfo structure pointer */ struct sf_buf *firstpage; /* first page that we mapped */ void *ps_strings; /* pointer to ps_string (user space) */ struct image_args *args; /* system call arguments */ @@ -90,7 +85,12 @@ struct image_params { u_long stack_sz; u_long eff_stack_sz; struct ucred *newcred; /* new credentials if changing */ +#define IMGACT_SHELL 0x1 +#define IMGACT_BINMISC 0x2 + unsigned char interpreted; /* mask of interpreters that have run */ bool credential_setid; /* true if becoming setid */ + bool vmspace_destroyed; /* we've blown away original vm space */ + bool opened; /* we have opened executable vnode */ bool textset; u_int map_flags; }; From nobody Thu Oct 28 17:50:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BCC861826CFF; Thu, 28 Oct 2021 17:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClN57H6z4Shb; Thu, 28 Oct 2021 17:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 25E4D27BCA; Thu, 28 Oct 2021 17:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHoelc097697; Thu, 28 Oct 2021 17:50:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHoecR097696; Thu, 28 Oct 2021 17:50:40 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:40 GMT Message-Id: <202110281750.19SHoecR097696@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: 9a0bee9f6a77 - main - Make vn_fullpath_hardlink() externally callable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a0bee9f6a77a85e4dfb27c9a33d4e210d05b469 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9a0bee9f6a77a85e4dfb27c9a33d4e210d05b469 commit 9a0bee9f6a77a85e4dfb27c9a33d4e210d05b469 Author: Konstantin Belousov AuthorDate: 2021-10-23 00:23:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:49:26 +0000 Make vn_fullpath_hardlink() externally callable Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/vfs_cache.c | 28 +++++++++++++--------------- sys/sys/vnode.h | 3 +++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 99f7314822f0..006f16587021 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -579,8 +579,6 @@ DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); static void cache_zap_locked(struct namecache *ncp); -static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, - char **freebuf, size_t *buflen); static int vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *buflen, size_t addend); static int vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, @@ -3132,7 +3130,8 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) return (error); - error = vn_fullpath_hardlink(&nd, &retbuf, &freebuf, &size); + error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, nd.ni_cnd.cn_nameptr, + nd.ni_cnd.cn_namelen, &retbuf, &freebuf, &size); if (error == 0) { error = copyout(retbuf, buf, size); free(freebuf, M_TEMP); @@ -3593,8 +3592,9 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, /* * Resolve an arbitrary vnode to a pathname (taking care of hardlinks). * - * Since the namecache does not track hardlinks, the caller is expected to first - * look up the target vnode with SAVENAME | WANTPARENT flags passed to namei. + * Since the namecache does not track hardlinks, the caller is + * expected to first look up the target vnode with SAVENAME | + * WANTPARENT flags passed to namei to get dvp and vp. * * Then we have 2 cases: * - if the found vnode is a directory, the path can be constructed just by @@ -3602,14 +3602,13 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, * - otherwise we populate the buffer with the saved name and start resolving * from the parent */ -static int -vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, - size_t *buflen) +int +vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp, + const char *hrdl_name, size_t hrdl_name_length, + char **retbuf, char **freebuf, size_t *buflen) { char *buf, *tmpbuf; struct pwd *pwd; - struct componentname *cnp; - struct vnode *vp; size_t addend; int error; enum vtype type; @@ -3622,7 +3621,7 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, buf = malloc(*buflen, M_TEMP, M_WAITOK); addend = 0; - vp = ndp->ni_vp; + /* * Check for VBAD to work around the vp_crossmp bug in lookup(). * @@ -3648,8 +3647,7 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, goto out_bad; } if (type != VDIR) { - cnp = &ndp->ni_cnd; - addend = cnp->cn_namelen + 2; + addend = hrdl_name_length + 2; if (*buflen < addend) { error = ENOMEM; goto out_bad; @@ -3657,9 +3655,9 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, *buflen -= addend; tmpbuf = buf + *buflen; tmpbuf[0] = '/'; - memcpy(&tmpbuf[1], cnp->cn_nameptr, cnp->cn_namelen); + memcpy(&tmpbuf[1], hrdl_name, hrdl_name_length); tmpbuf[addend - 1] = '\0'; - vp = ndp->ni_dvp; + vp = dvp; } vfs_smr_enter(); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index a9b57dd4c25d..18bba17011e8 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -697,6 +697,9 @@ int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); int vn_getcwd(char *buf, char **retbuf, size_t *buflen); int vn_fullpath(struct vnode *vp, char **retbuf, char **freebuf); int vn_fullpath_global(struct vnode *vp, char **retbuf, char **freebuf); +int vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp, + const char *hdrl_name, size_t hrdl_name_length, char **retbuf, + char **freebuf, size_t *buflen); struct vnode * vn_dir_dd_ino(struct vnode *vp); int vn_commname(struct vnode *vn, char *buf, u_int buflen); From nobody Thu Oct 28 17:50:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 524101827047; Thu, 28 Oct 2021 17:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClP5Tpqz4SSp; Thu, 28 Oct 2021 17:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3EF4F88; Thu, 28 Oct 2021 17:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHofdT097721; Thu, 28 Oct 2021 17:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHofm3097720; Thu, 28 Oct 2021 17:50:41 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:41 GMT Message-Id: <202110281750.19SHofm3097720@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: 0c10648fbb75 - main - exec: provide right hardlink name in AT_EXECPATH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c10648fbb758bb76fd29330b7fe1bc519252325 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0c10648fbb758bb76fd29330b7fe1bc519252325 commit 0c10648fbb758bb76fd29330b7fe1bc519252325 Author: Konstantin Belousov AuthorDate: 2021-10-23 00:24:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:49:31 +0000 exec: provide right hardlink name in AT_EXECPATH For this, use vn_fullpath_hardlink() to resolve executable name for execve(2). This should provide the right hardlink name, used for execution, instead of random hardlink pointing to this binary. Also this should make the AT_EXECNAME reliable for execve(2), since kernel only needs to resolve parent directory path, which should always succeed (except pathological cases like unlinking a directory). PR: 248184 Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/kern_exec.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 5cc5a1205901..d61a9d5b0b1c 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -432,6 +432,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, int error, i, orig_osrel; uint32_t orig_fctl0; Elf_Brandinfo *orig_brandinfo; + size_t freepath_size; static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; @@ -479,7 +480,8 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, */ if (args->fname != NULL) { NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); + SAVENAME | AUDITVNODE1 | WANTPARENT, + UIO_SYSSPACE, args->fname, td); } SDT_PROBE1(proc, , , exec, args->fname); @@ -625,9 +627,18 @@ interpret: /* * Do the best to calculate the full path to the image file. */ - if (args->fname != NULL && args->fname[0] == '/') - imgp->execpath = args->fname; - else { + if (args->fname != NULL) { + if (args->fname[0] == '/') { + imgp->execpath = args->fname; + } else { + VOP_UNLOCK(imgp->vp); + freepath_size = MAXPATHLEN; + if (vn_fullpath_hardlink(&nd, &imgp->execpath, + &imgp->freepath, &freepath_size) != 0) + imgp->execpath = args->fname; + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + } + } else { VOP_UNLOCK(imgp->vp); if (vn_fullpath(imgp->vp, &imgp->execpath, &imgp->freepath) != 0) @@ -680,8 +691,6 @@ interpret: VOP_UNSET_TEXT_CHECKED(newtextvp); imgp->textset = false; /* free name buffer and old vnode */ - if (args->fname != NULL) - NDFREE(&nd, NDF_ONLY_PNBUF); #ifdef MAC mac_execve_interpreter_enter(newtextvp, &interpvplabel); #endif @@ -690,6 +699,11 @@ interpret: imgp->opened = false; } vput(newtextvp); + if (args->fname != NULL) { + if (nd.ni_dvp != NULL) + vrele(nd.ni_dvp); + NDFREE(&nd, NDF_ONLY_PNBUF); + } vm_object_deallocate(imgp->object); imgp->object = NULL; execve_nosetid(imgp); @@ -697,9 +711,10 @@ interpret: free(imgp->freepath, M_TEMP); imgp->freepath = NULL; /* set new name to that of the interpreter */ - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME, UIO_SYSSPACE, imgp->interpreter_name, td); args->fname = imgp->interpreter_name; + NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | + SAVENAME | WANTPARENT, + UIO_SYSSPACE, imgp->interpreter_name, td); goto interpret; } @@ -930,8 +945,6 @@ exec_fail_dealloc: exec_unmap_first_page(imgp); if (imgp->vp != NULL) { - if (args->fname) - NDFREE(&nd, NDF_ONLY_PNBUF); if (imgp->opened) VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td); if (imgp->textset) @@ -940,6 +953,11 @@ exec_fail_dealloc: vput(imgp->vp); else VOP_UNLOCK(imgp->vp); + if (args->fname != NULL) { + if (nd.ni_dvp != NULL) + vrele(nd.ni_dvp); + NDFREE(&nd, NDF_ONLY_PNBUF); + } } if (imgp->object != NULL) From nobody Thu Oct 28 17:50:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD1C71827052; Thu, 28 Oct 2021 17:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClQ4Dg4z4SmS; Thu, 28 Oct 2021 17:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 627D242; Thu, 28 Oct 2021 17:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHogdE097752; Thu, 28 Oct 2021 17:50:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHogaM097751; Thu, 28 Oct 2021 17:50:42 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:42 GMT Message-Id: <202110281750.19SHogaM097751@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: 351d5f7fc516 - main - exec: store parent directory and hardlink name of the binary in struct proc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 351d5f7fc5161ededeaa226ee3f21a438ee4a632 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=351d5f7fc5161ededeaa226ee3f21a438ee4a632 commit 351d5f7fc5161ededeaa226ee3f21a438ee4a632 Author: Konstantin Belousov AuthorDate: 2021-10-23 18:44:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:49:56 +0000 exec: store parent directory and hardlink name of the binary in struct proc While doing it, also move all the code to resolve pathnames and obtain text vp and dvp, into single place. Besides simplifying the code, it avoids spurious vnode relocks and validates the explanation why a transient text reference on the script vnode is not harmful. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/kern_exec.c | 108 ++++++++++++++++++++++++++++--------------------- sys/kern/kern_exit.c | 10 ++++- sys/kern/kern_fork.c | 12 +++++- sys/kern/kern_thread.c | 6 +-- sys/sys/proc.h | 2 + 5 files changed, 85 insertions(+), 53 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index d61a9d5b0b1c..52119036e95b 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -420,7 +420,9 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, #ifdef KTRACE struct ktr_io_params *kiop; #endif - struct vnode *oldtextvp = NULL, *newtextvp; + struct vnode *oldtextvp, *newtextvp; + struct vnode *oldtextdvp, *newtextdvp; + char *oldbinname, *newbinname; bool credential_changing; #ifdef MAC struct label *interpvplabel = NULL; @@ -436,6 +438,9 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; + oldtextvp = oldtextdvp = NULL; + newtextvp = newtextdvp = NULL; + newbinname = oldbinname = NULL; #ifdef KTRACE kiop = NULL; #endif @@ -471,19 +476,6 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, goto exec_fail; #endif - /* - * Translate the file name. namei() returns a vnode pointer - * in ni_vp among other things. - * - * XXXAUDIT: It would be desirable to also audit the name of the - * interpreter if this is an interpreted binary. - */ - if (args->fname != NULL) { - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME | AUDITVNODE1 | WANTPARENT, - UIO_SYSSPACE, args->fname, td); - } - SDT_PROBE1(proc, , , exec, args->fname); interpret: @@ -500,12 +492,42 @@ interpret: goto exec_fail; } #endif + + /* + * Translate the file name. namei() returns a vnode + * pointer in ni_vp among other things. + */ + NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | + SAVENAME | AUDITVNODE1 | WANTPARENT, UIO_SYSSPACE, + args->fname, td); + error = namei(&nd); if (error) goto exec_fail; newtextvp = nd.ni_vp; + newtextdvp = nd.ni_dvp; + nd.ni_dvp = NULL; + newbinname = malloc(nd.ni_cnd.cn_namelen + 1, M_PARGS, + M_WAITOK); + memcpy(newbinname, nd.ni_cnd.cn_nameptr, nd.ni_cnd.cn_namelen); + newbinname[nd.ni_cnd.cn_namelen] = '\0'; imgp->vp = newtextvp; + + /* + * Do the best to calculate the full path to the image file. + */ + if (args->fname[0] == '/') { + imgp->execpath = args->fname; + } else { + VOP_UNLOCK(imgp->vp); + freepath_size = MAXPATHLEN; + if (vn_fullpath_hardlink(newtextvp, newtextdvp, + newbinname, nd.ni_cnd.cn_namelen, &imgp->execpath, + &imgp->freepath, &freepath_size) != 0) + imgp->execpath = args->fname; + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + } } else { AUDIT_ARG_FD(args->fd); /* @@ -515,6 +537,9 @@ interpret: &newtextvp); if (error) goto exec_fail; + if (vn_fullpath(imgp->vp, &imgp->execpath, + &imgp->freepath) != 0) + imgp->execpath = args->fname; vn_lock(newtextvp, LK_SHARED | LK_RETRY); AUDIT_ARG_VNODE1(newtextvp); imgp->vp = newtextvp; @@ -624,28 +649,6 @@ interpret: } /* The new credentials are installed into the process later. */ - /* - * Do the best to calculate the full path to the image file. - */ - if (args->fname != NULL) { - if (args->fname[0] == '/') { - imgp->execpath = args->fname; - } else { - VOP_UNLOCK(imgp->vp); - freepath_size = MAXPATHLEN; - if (vn_fullpath_hardlink(&nd, &imgp->execpath, - &imgp->freepath, &freepath_size) != 0) - imgp->execpath = args->fname; - vn_lock(imgp->vp, LK_SHARED | LK_RETRY); - } - } else { - VOP_UNLOCK(imgp->vp); - if (vn_fullpath(imgp->vp, &imgp->execpath, - &imgp->freepath) != 0) - imgp->execpath = args->fname; - vn_lock(imgp->vp, LK_SHARED | LK_RETRY); - } - /* * If the current process has a special image activator it * wants to try first, call it. For example, emulating shell @@ -699,10 +702,15 @@ interpret: imgp->opened = false; } vput(newtextvp); + imgp->vp = newtextvp = NULL; if (args->fname != NULL) { - if (nd.ni_dvp != NULL) - vrele(nd.ni_dvp); + if (newtextdvp != NULL) { + vrele(newtextdvp); + newtextdvp = NULL; + } NDFREE(&nd, NDF_ONLY_PNBUF); + free(newbinname, M_PARGS); + newbinname = NULL; } vm_object_deallocate(imgp->object); imgp->object = NULL; @@ -712,9 +720,6 @@ interpret: imgp->freepath = NULL; /* set new name to that of the interpreter */ args->fname = imgp->interpreter_name; - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME | WANTPARENT, - UIO_SYSSPACE, imgp->interpreter_name, td); goto interpret; } @@ -875,11 +880,17 @@ interpret: } /* - * Store the vp for use in procfs. This vnode was referenced by namei - * or fgetvp_exec. + * Store the vp for use in kern.proc.pathname. This vnode was + * referenced by namei() or fgetvp_exec(). */ oldtextvp = p->p_textvp; p->p_textvp = newtextvp; + oldtextdvp = p->p_textdvp; + p->p_textdvp = newtextdvp; + newtextdvp = NULL; + oldbinname = p->p_binname; + p->p_binname = newbinname; + newbinname = NULL; #ifdef KDTRACE_HOOKS /* @@ -953,11 +964,11 @@ exec_fail_dealloc: vput(imgp->vp); else VOP_UNLOCK(imgp->vp); - if (args->fname != NULL) { - if (nd.ni_dvp != NULL) - vrele(nd.ni_dvp); + if (args->fname != NULL) NDFREE(&nd, NDF_ONLY_PNBUF); - } + if (newtextdvp != NULL) + vrele(newtextdvp); + free(newbinname, M_PARGS); } if (imgp->object != NULL) @@ -996,6 +1007,9 @@ exec_fail: */ if (oldtextvp != NULL) vrele(oldtextvp); + if (oldtextdvp != NULL) + vrele(oldtextdvp); + free(oldbinname, M_PARGS); #ifdef KTRACE ktr_io_params_free(kiop); #endif diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 79f1d5bd63e5..44203435fa68 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -424,12 +424,20 @@ exit1(struct thread *td, int rval, int signo) ktrprocexit(td); #endif /* - * Release reference to text vnode + * Release reference to text vnode etc */ if (p->p_textvp != NULL) { vrele(p->p_textvp); p->p_textvp = NULL; } + if (p->p_textdvp != NULL) { + vrele(p->p_textdvp); + p->p_textdvp = NULL; + } + if (p->p_binname != NULL) { + free(p->p_binname, M_PARGS); + p->p_binname = NULL; + } /* * Release our limits structure. diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index e8c34a31e6a1..5b518a0183d8 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -528,6 +528,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * } p2->p_textvp = p1->p_textvp; + p2->p_textdvp = p1->p_textdvp; p2->p_fd = fd; p2->p_fdtol = fdtol; p2->p_pd = pd; @@ -549,9 +550,16 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * PROC_UNLOCK(p1); PROC_UNLOCK(p2); - /* Bump references to the text vnode (for procfs). */ - if (p2->p_textvp) + /* + * Bump references to the text vnode and directory, and copy + * the hardlink name. + */ + if (p2->p_textvp != NULL) vrefact(p2->p_textvp); + if (p2->p_textdvp != NULL) + vrefact(p2->p_textdvp); + p2->p_binname = p1->p_binname == NULL ? NULL : + strdup(p1->p_binname, M_PARGS); /* * Set up linkage for kernel based threading. diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 65c5cc65c87e..71e3c501dddf 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -97,11 +97,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0xb8, "struct proc KBI p_flag"); _Static_assert(offsetof(struct proc, p_pid) == 0xc4, "struct proc KBI p_pid"); -_Static_assert(offsetof(struct proc, p_filemon) == 0x3b8, +_Static_assert(offsetof(struct proc, p_filemon) == 0x3c8, "struct proc KBI p_filemon"); -_Static_assert(offsetof(struct proc, p_comm) == 0x3d0, +_Static_assert(offsetof(struct proc, p_comm) == 0x3e0, "struct proc KBI p_comm"); -_Static_assert(offsetof(struct proc, p_emuldata) == 0x4b8, +_Static_assert(offsetof(struct proc, p_emuldata) == 0x4c8, "struct proc KBI p_emuldata"); #endif #ifdef __i386__ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index e83f98646451..177efd5257af 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -666,6 +666,8 @@ struct proc { int p_traceflag; /* (o) Kernel trace points. */ struct ktr_io_params *p_ktrioparms; /* (c + o) Params for ktrace. */ struct vnode *p_textvp; /* (b) Vnode of executable. */ + struct vnode *p_textdvp; /* (b) Dir containing textvp. */ + char *p_binname; /* (b) Binary hardlink name. */ u_int p_lock; /* (c) Proclock (prevent swap) count. */ struct sigiolst p_sigiolst; /* (c) List of sigio sources. */ int p_sigparent; /* (c) Signal to parent on exit. */ From nobody Thu Oct 28 17:50:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EADB5182719C; Thu, 28 Oct 2021 17:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgClS2VLBz4Svd; Thu, 28 Oct 2021 17:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7E8EC27C67; Thu, 28 Oct 2021 17:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SHohkE097777; Thu, 28 Oct 2021 17:50:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SHohAD097776; Thu, 28 Oct 2021 17:50:43 GMT (envelope-from git) Date: Thu, 28 Oct 2021 17:50:43 GMT Message-Id: <202110281750.19SHohAD097776@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: ee92c8a842d6 - main - sysctl kern.proc.procname: report right hardlink name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee92c8a842d61ffda8d111e1b0e398085c5bfb3a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee92c8a842d61ffda8d111e1b0e398085c5bfb3a commit ee92c8a842d61ffda8d111e1b0e398085c5bfb3a Author: Konstantin Belousov AuthorDate: 2021-10-23 19:01:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 17:50:02 +0000 sysctl kern.proc.procname: report right hardlink name PR: 248184 Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32611 --- sys/kern/kern_proc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 2649d1d3a58f..c4c01da1faea 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2233,32 +2235,74 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) pid_t *pidp = (pid_t *)arg1; unsigned int arglen = arg2; struct proc *p; - struct vnode *vp; - char *retbuf, *freebuf; + struct vnode *vp, *dvp; + char *retbuf, *freebuf, *binname; + struct nameidata nd; + size_t freepath_size; int error; + bool do_fullpath; if (arglen != 1) return (EINVAL); + binname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + binname[0] = '\0'; if (*pidp == -1) { /* -1 means this process */ p = req->td->td_proc; } else { error = pget(*pidp, PGET_CANSEE, &p); - if (error != 0) + if (error != 0) { + free(binname, M_TEMP); return (error); + } } vp = p->p_textvp; if (vp == NULL) { if (*pidp != -1) PROC_UNLOCK(p); + free(binname, M_TEMP); return (0); } vref(vp); + dvp = p->p_textdvp; + if (dvp != NULL) + vref(dvp); + if (p->p_binname != NULL) + strlcpy(binname, p->p_binname, MAXPATHLEN); if (*pidp != -1) PROC_UNLOCK(p); - error = vn_fullpath(vp, &retbuf, &freebuf); + do_fullpath = true; + freebuf = NULL; + if (dvp != NULL && binname[0] != '\0') { + freepath_size = MAXPATHLEN; + if (vn_fullpath_hardlink(vp, dvp, binname, strlen(binname), + &retbuf, &freebuf, &freepath_size) == 0) { + /* + * Recheck the looked up path. The binary + * might have been renamed or replaced, in + * which case we should not report old name. + */ + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, retbuf, + req->td); + error = namei(&nd); + if (error == 0) { + if (nd.ni_vp == vp) + do_fullpath = false; + vrele(nd.ni_vp); + NDFREE(&nd, NDF_ONLY_PNBUF); + } + } + } + if (do_fullpath) { + free(freebuf, M_TEMP); + freebuf = NULL; + error = vn_fullpath(vp, &retbuf, &freebuf); + } vrele(vp); - if (error) + if (dvp != NULL) + vrele(dvp); + free(binname, M_TEMP); + if (error != 0) return (error); error = SYSCTL_OUT(req, retbuf, strlen(retbuf) + 1); free(freebuf, M_TEMP); From nobody Thu Oct 28 17:52:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 66F141829AEB; Thu, 28 Oct 2021 17:52:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgCnz1Jt3z4W8F; Thu, 28 Oct 2021 17:52:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 19SHqf6t007699 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 28 Oct 2021 20:52:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 19SHqf6t007699 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 19SHqfm8007698; Thu, 28 Oct 2021 20:52:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 28 Oct 2021 20:52:41 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: 5306ca9a8e2f - stable/13 - nehemiah: manually assemble xstore(-rng) Message-ID: References: <202110280036.19S0aUlw016872@gitrepo.freebsd.org> <5f2a0484-6016-2f9d-2697-54000cb8ee07@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f2a0484-6016-2f9d-2697-54000cb8ee07@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HgCnz1Jt3z4W8F X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Oct 28, 2021 at 08:45:30AM -0700, John Baldwin wrote: > On 10/27/21 5:36 PM, Konstantin Belousov wrote: > > The branch stable/13 has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae > > > > commit 5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae > > Author: Konstantin Belousov > > AuthorDate: 2021-10-20 22:42:05 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-10-28 00:35:54 +0000 > > > > nehemiah: manually assemble xstore(-rng) > > PR: 259218 > > (cherry picked from commit 362c6d8dec6dfbedc5717e45769042279a1dd3df) > > Note that dim@ merged the LLVM fix to 13 yesterday. :) I delegate the revert to dim. Seriously thought, I think that the kernel patch should be left in tree for some more time, because people update kernel much more often than userspace. From nobody Thu Oct 28 17:59:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A140A182CA28; Thu, 28 Oct 2021 17:59:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgCxQ498Sz4ZVc; Thu, 28 Oct 2021 17:59:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 018A7AB14; Thu, 28 Oct 2021 17:59:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 5306ca9a8e2f - stable/13 - nehemiah: manually assemble xstore(-rng) To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org References: <202110280036.19S0aUlw016872@gitrepo.freebsd.org> <5f2a0484-6016-2f9d-2697-54000cb8ee07@FreeBSD.org> From: John Baldwin Message-ID: Date: Thu, 28 Oct 2021 10:59:20 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 10/28/21 10:52 AM, Konstantin Belousov wrote: > On Thu, Oct 28, 2021 at 08:45:30AM -0700, John Baldwin wrote: >> On 10/27/21 5:36 PM, Konstantin Belousov wrote: >>> The branch stable/13 has been updated by kib: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae >>> >>> commit 5306ca9a8e2f2b3bfa7d1ebc784dedbd5422fdae >>> Author: Konstantin Belousov >>> AuthorDate: 2021-10-20 22:42:05 +0000 >>> Commit: Konstantin Belousov >>> CommitDate: 2021-10-28 00:35:54 +0000 >>> >>> nehemiah: manually assemble xstore(-rng) >>> PR: 259218 >>> (cherry picked from commit 362c6d8dec6dfbedc5717e45769042279a1dd3df) >> >> Note that dim@ merged the LLVM fix to 13 yesterday. :) > I delegate the revert to dim. > > Seriously thought, I think that the kernel patch should be left in tree > for some more time, because people update kernel much more often than > userspace. That is fair. We could perhaps make it an #ifdef on the clang version perhaps (clang <= 13 perhaps). That would let us know when we can safely remove it and still have it readable in the source in the #else case. I can maybe try coming up with that. -- John Baldwin From nobody Thu Oct 28 18:20:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 61B871834E8B; Thu, 28 Oct 2021 18:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgDQC1x0Kz4gkT; Thu, 28 Oct 2021 18:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2325F4FD; Thu, 28 Oct 2021 18:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SIKpow040837; Thu, 28 Oct 2021 18:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SIKpYD040836; Thu, 28 Oct 2021 18:20:51 GMT (envelope-from git) Date: Thu, 28 Oct 2021 18:20:51 GMT Message-Id: <202110281820.19SIKpYD040836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: 191c624d9519 - main - config(5): Update upper limit for maxusers on 64-bit systems List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 191c624d9519a2767801de390b192ee7a96b41cd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=191c624d9519a2767801de390b192ee7a96b41cd commit 191c624d9519a2767801de390b192ee7a96b41cd Author: Felix Johnson AuthorDate: 2021-10-28 18:15:08 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-28 18:15:08 +0000 config(5): Update upper limit for maxusers on 64-bit systems The limit of 384 maxusers for auto configuration was only imposed on 32-bit systems. Document that maxusers scales above 384 based on memory for 64-bit systems. PR: 204938 MFC after: 3 days Reported by: David Höppner <0xffea@gmail.com> --- usr.sbin/config/config.5 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index 433194f3b22b..134e321831d8 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 9, 2020 +.Dd October 28, 2021 .Dt CONFIG 5 .Os .Sh NAME @@ -329,7 +329,9 @@ A value of 0 indicates that the kernel should configure its data structures according to the size of available physical memory. If auto configuration is requested, the kernel will set -this tunable to a value between 32 and 384. +this tunable to a value between 32 and 384 for 32-bit systems, +or scale the value higher based on available memory for 64-bit +systems. .Pp As explained in .Xr tuning 7 , From nobody Thu Oct 28 19:00:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5850718258EC; Thu, 28 Oct 2021 19:00:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgFJG21vVz4rWw; Thu, 28 Oct 2021 19:00:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 256D9FF0; Thu, 28 Oct 2021 19:00:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SJ0kJp091815; Thu, 28 Oct 2021 19:00:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SJ0kwX091814; Thu, 28 Oct 2021 19:00:46 GMT (envelope-from git) Date: Thu, 28 Oct 2021 19:00:46 GMT Message-Id: <202110281900.19SJ0kwX091814@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: 4d675b80f00f - main - i386: fix struct proc layout asserts after 351d5f7fc5161ede List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d675b80f00ffd85cce8e65dcd9ef787bb8a8019 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4d675b80f00ffd85cce8e65dcd9ef787bb8a8019 commit 4d675b80f00ffd85cce8e65dcd9ef787bb8a8019 Author: Konstantin Belousov AuthorDate: 2021-10-28 18:31:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 18:56:21 +0000 i386: fix struct proc layout asserts after 351d5f7fc5161ede Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 71e3c501dddf..7b0ff604b086 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -117,11 +117,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0x6c, "struct proc KBI p_flag"); _Static_assert(offsetof(struct proc, p_pid) == 0x78, "struct proc KBI p_pid"); -_Static_assert(offsetof(struct proc, p_filemon) == 0x268, +_Static_assert(offsetof(struct proc, p_filemon) == 0x270, "struct proc KBI p_filemon"); -_Static_assert(offsetof(struct proc, p_comm) == 0x27c, +_Static_assert(offsetof(struct proc, p_comm) == 0x284, "struct proc KBI p_comm"); -_Static_assert(offsetof(struct proc, p_emuldata) == 0x308, +_Static_assert(offsetof(struct proc, p_emuldata) == 0x310, "struct proc KBI p_emuldata"); #endif From nobody Thu Oct 28 19:02:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 873451825EE6; Thu, 28 Oct 2021 19:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgFKt3Sm8z4sCc; Thu, 28 Oct 2021 19:02:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 57AA19F9; Thu, 28 Oct 2021 19:02:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SJ2AQ6095321; Thu, 28 Oct 2021 19:02:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SJ2A0f095320; Thu, 28 Oct 2021 19:02:10 GMT (envelope-from git) Date: Thu, 28 Oct 2021 19:02:10 GMT Message-Id: <202110281902.19SJ2A0f095320@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: e93b5adb6bb8 - main - amd64 pmap: account for the top-level pages List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e93b5adb6bb83d487eaa4211ac26e116db748c63 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e93b5adb6bb83d487eaa4211ac26e116db748c63 commit e93b5adb6bb83d487eaa4211ac26e116db748c63 Author: Konstantin Belousov AuthorDate: 2021-10-20 01:03:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 19:01:58 +0000 amd64 pmap: account for the top-level pages both for kernel and user page tables, the later exist in the PTI case. Reviewed by: markj Tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32569 --- sys/amd64/amd64/pmap.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 66d7ac6669da..1c4e8b3354fc 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1495,6 +1495,15 @@ pmap_resident_count_adj(pmap_t pmap, int count) pmap->pm_stats.resident_count += count; } +static __inline void +pmap_pt_page_count_pinit(pmap_t pmap, int count) +{ + KASSERT(pmap->pm_stats.resident_count + count >= 0, + ("pmap %p resident count underflow %ld %d", pmap, + pmap->pm_stats.resident_count, count)); + pmap->pm_stats.resident_count += count; +} + static __inline void pmap_pt_page_count_adj(pmap_t pmap, int count) { @@ -4344,13 +4353,24 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) vm_paddr_t pmltop_phys; int i; + bzero(&pmap->pm_stats, sizeof pmap->pm_stats); + /* - * Allocate the page directory page. Pass NULL instead of a pointer to - * the pmap here to avoid recording this page in the resident count, as - * optimizations in pmap_remove() depend on this. + * Allocate the page directory page. Pass NULL instead of a + * pointer to the pmap here to avoid calling + * pmap_resident_count_adj() through pmap_pt_page_count_adj(), + * since that requires pmap lock. Instead do the accounting + * manually. + * + * Note that final call to pmap_remove() optimization that + * checks for zero resident_count is basically disabled by + * accounting for top-level page. But the optimization was + * not effective since we started using non-managed mapping of + * the shared page. */ pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + pmap_pt_page_count_pinit(pmap, 1); pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4380,11 +4400,13 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { /* - * As with pmltop_pg, pass NULL instead of a pointer to - * the pmap to ensure that the PTI page isn't counted. + * As with pmltop_pg, pass NULL instead of a + * pointer to the pmap to ensure that the PTI + * page counted explicitly. */ pmltop_pgu = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + pmap_pt_page_count_pinit(pmap, 1); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -4407,7 +4429,6 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); - bzero(&pmap->pm_stats, sizeof pmap->pm_stats); pmap->pm_flags = flags; pmap->pm_eptgen = 0; @@ -4799,9 +4820,6 @@ pmap_release(pmap_t pmap) vm_page_t m; int i; - KASSERT(pmap->pm_stats.resident_count == 0, - ("pmap_release: pmap %p resident count %ld != 0", - pmap, pmap->pm_stats.resident_count)); KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap %p has reserved page table page(s)", pmap)); @@ -4834,15 +4852,21 @@ pmap_release(pmap_t pmap) } pmap_free_pt_page(NULL, m, true); + pmap_pt_page_count_pinit(pmap, -1); if (pmap->pm_pmltopu != NULL) { m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap-> pm_pmltopu)); pmap_free_pt_page(NULL, m, false); + pmap_pt_page_count_pinit(pmap, -1); } if (pmap->pm_type == PT_X86 && (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) rangeset_fini(&pmap->pm_pkru); + + KASSERT(pmap->pm_stats.resident_count == 0, + ("pmap_release: pmap %p resident count %ld != 0", + pmap, pmap->pm_stats.resident_count)); } static int From nobody Thu Oct 28 19:02:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 082671826240; Thu, 28 Oct 2021 19:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgFKv5j0yz4sCk; Thu, 28 Oct 2021 19:02:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8DD641016; Thu, 28 Oct 2021 19:02:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SJ2BKP095345; Thu, 28 Oct 2021 19:02:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SJ2BRQ095344; Thu, 28 Oct 2021 19:02:11 GMT (envelope-from git) Date: Thu, 28 Oct 2021 19:02:11 GMT Message-Id: <202110281902.19SJ2BRQ095344@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: 0b3bc7288984 - main - amd64 pmap: adjust the empty pmap optimization in pmap_remove() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b3bc7288984c17da00d9f8c29f116d56bf44d35 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0b3bc7288984c17da00d9f8c29f116d56bf44d35 commit 0b3bc7288984c17da00d9f8c29f116d56bf44d35 Author: Konstantin Belousov AuthorDate: 2021-10-20 20:30:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 19:01:58 +0000 amd64 pmap: adjust the empty pmap optimization in pmap_remove() to match the added accounting of the top-level page table pages. Reviewed by: markj Tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32569 --- sys/amd64/amd64/pmap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 1c4e8b3354fc..8526cc3031d2 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -6278,9 +6278,14 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) PG_V = pmap_valid_bit(pmap); /* + * If there are no resident pages besides the top level page + * table page(s), there is nothing to do. Kernel pmap always + * accounts whole preloaded area as resident, which makes its + * resident count > 2. * Perform an unsynchronized read. This is, however, safe. */ - if (pmap->pm_stats.resident_count == 0) + if (pmap->pm_stats.resident_count <= 1 + (pmap->pm_pmltopu != NULL ? + 1 : 0)) return; anyvalid = 0; From nobody Thu Oct 28 19:02:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1B1E31825FFA; Thu, 28 Oct 2021 19:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgFKw5dGWz4s9Q; Thu, 28 Oct 2021 19:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9F3851129; Thu, 28 Oct 2021 19:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SJ2CxT095371; Thu, 28 Oct 2021 19:02:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SJ2CGx095370; Thu, 28 Oct 2021 19:02:12 GMT (envelope-from git) Date: Thu, 28 Oct 2021 19:02:12 GMT Message-Id: <202110281902.19SJ2CGx095370@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: 1c69690319c5 - main - Unmap shared page manually before doing vm_map_remove() on exit or exec List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c69690319c5bb7deae6ce1add6ea25bb40b3b91 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1c69690319c5bb7deae6ce1add6ea25bb40b3b91 commit 1c69690319c5bb7deae6ce1add6ea25bb40b3b91 Author: Konstantin Belousov AuthorDate: 2021-10-20 20:32:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 19:01:59 +0000 Unmap shared page manually before doing vm_map_remove() on exit or exec This allows the pmap_remove(min, max) call to see empty pmap and exploit empty pmap optimization. Reviewed by: markj Tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32569 --- sys/kern/kern_exec.c | 25 +++++++++++++++++++++++++ sys/kern/kern_exit.c | 1 + sys/sys/sysent.h | 1 + 3 files changed, 27 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 52119036e95b..780b917ad21d 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1104,6 +1104,30 @@ exec_onexec_old(struct thread *td) umtx_exec(td->td_proc); } +/* + * This is an optimization which removes the unmanaged shared page + * mapping. In combination with pmap_remove_pages(), which cleans all + * managed mappings in the process' vmspace pmap, no work will be left + * for pmap_remove(min, max). + */ +void +exec_free_abi_mappings(struct proc *p) +{ + struct vmspace *vmspace; + struct sysentvec *sv; + + vmspace = p->p_vmspace; + if (refcount_load(&vmspace->vm_refcnt) != 1) + return; + + sv = p->p_sysent; + if (sv->sv_shared_page_obj == NULL) + return; + + pmap_remove(vmspace_pmap(vmspace), sv->sv_shared_page_base, + sv->sv_shared_page_base + sv->sv_shared_page_len); +} + /* * Destroy old address space, and allocate a new stack. * The new stack is only sgrowsiz large because it is grown @@ -1146,6 +1170,7 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser && cpu_exec_vmspace_reuse(p, map)) { + exec_free_abi_mappings(p); shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 44203435fa68..14be2425511d 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -417,6 +417,7 @@ exit1(struct thread *td, int rval, int signo) mtx_unlock(&ppeers_lock); } + exec_free_abi_mappings(p); vmspace_exit(td); (void)acct_process(td); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index ea96c87a79af..fc678d49750a 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -324,6 +324,7 @@ void exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2); void exec_inittk(void); void exit_onexit(struct proc *p); +void exec_free_abi_mappings(struct proc *p); void exec_onexec_old(struct thread *td); #define INIT_SYSENTVEC(name, sv) \ From nobody Thu Oct 28 21:06:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6C6B2183A9E8; Thu, 28 Oct 2021 21:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgJ5D18TCz4WGy; Thu, 28 Oct 2021 21:06:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EE57529B3; Thu, 28 Oct 2021 21:06:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SL6NRW056451; Thu, 28 Oct 2021 21:06:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SL6Nrx056450; Thu, 28 Oct 2021 21:06:23 GMT (envelope-from git) Date: Thu, 28 Oct 2021 21:06:23 GMT Message-Id: <202110282106.19SL6Nrx056450@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: a901f2af587f - main - libradius: fix WITHOUT_OPENSSL build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a901f2af587f9cb068e2fca6b62f324bdde471d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a901f2af587f9cb068e2fca6b62f324bdde471d8 commit a901f2af587f9cb068e2fca6b62f324bdde471d8 Author: Ed Maste AuthorDate: 2021-10-28 20:27:10 +0000 Commit: Ed Maste CommitDate: 2021-10-28 21:05:53 +0000 libradius: fix WITHOUT_OPENSSL build int alen is used only with SSL. Reported by: Michael Dexter, Build Option Survey MFC after: 3 days Fixes: 8d5c7813061d ("libradius: Fix input validation bugs") Sponsored by: The FreeBSD Foundation --- lib/libradius/radlib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c index ce0c0ccf453a..dd65eda285cb 100644 --- a/lib/libradius/radlib.c +++ b/lib/libradius/radlib.c @@ -286,8 +286,9 @@ is_valid_request(struct rad_handle *h) MD5_CTX ctx; unsigned char md5[MD5_DIGEST_LENGTH]; const struct rad_server *srvp; - int alen, len; + int len; #ifdef WITH_SSL + int alen; HMAC_CTX *hctx; u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE]; u_int md_len; From nobody Thu Oct 28 21:31:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B80C9181B19C; Thu, 28 Oct 2021 21:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgJfB4vz4z4clg; Thu, 28 Oct 2021 21:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 887892F2B; Thu, 28 Oct 2021 21:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SLVUgP093028; Thu, 28 Oct 2021 21:31:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SLVUe8093027; Thu, 28 Oct 2021 21:31:30 GMT (envelope-from git) Date: Thu, 28 Oct 2021 21:31:30 GMT Message-Id: <202110282131.19SLVUe8093027@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: ae750fbac723 - main - kern_tc.c: Scaling/large delta recalculation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae750fbac72387c05c8e13623c2465b20497b4be Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ae750fbac72387c05c8e13623c2465b20497b4be commit ae750fbac72387c05c8e13623c2465b20497b4be Author: Sebastian Huber AuthorDate: 2021-10-28 08:22:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-28 21:31:14 +0000 kern_tc.c: Scaling/large delta recalculation This change is a slight performance optimization for systems with a slow 64-bit division. The th->th_scale and th->th_large_delta values only depend on the timecounter frequency and the th->th_adjustment. The timecounter frequency of a timehand only changes when a new timecounter is activated for the timehand. The th->th_adjustment is only changed by the NTP second update. The NTP second update is not done for every call of tc_windup(). Move the code block to recalculate the scaling factor and the large delta of a timehand to the new helper function recalculate_scaling_factor_and_large_delta(). Call recalculate_scaling_factor_and_large_delta() when a new timecounter is activated and a NTP second update occurred. MFC after: 1 week --- sys/kern/kern_tc.c | 88 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 9a928ca37aff..f7bd116dabe2 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1310,6 +1310,40 @@ tc_setclock(struct timespec *ts) } } +/* + * Recalculate the scaling factor. We want the number of 1/2^64 + * fractions of a second per period of the hardware counter, taking + * into account the th_adjustment factor which the NTP PLL/adjtime(2) + * processing provides us with. + * + * The th_adjustment is nanoseconds per second with 32 bit binary + * fraction and we want 64 bit binary fraction of second: + * + * x = a * 2^32 / 10^9 = a * 4.294967296 + * + * The range of th_adjustment is +/- 5000PPM so inside a 64bit int + * we can only multiply by about 850 without overflowing, that + * leaves no suitably precise fractions for multiply before divide. + * + * Divide before multiply with a fraction of 2199/512 results in a + * systematic undercompensation of 10PPM of th_adjustment. On a + * 5000PPM adjustment this is a 0.05PPM error. This is acceptable. + * + * We happily sacrifice the lowest of the 64 bits of our result + * to the goddess of code clarity. + */ +static void +recalculate_scaling_factor_and_large_delta(struct timehands *th) +{ + uint64_t scale; + + scale = (uint64_t)1 << 63; + scale += (th->th_adjustment / 1024) * 2199; + scale /= th->th_counter->tc_frequency; + th->th_scale = scale * 2; + th->th_large_delta = MIN(((uint64_t)1 << 63) / scale, UINT_MAX); +} + /* * Initialize the next struct timehands in the ring and make * it the active timehands. Along the way we might switch to a different @@ -1320,7 +1354,6 @@ tc_windup(struct bintime *new_boottimebin) { struct bintime bt; struct timehands *th, *tho; - uint64_t scale; u_int delta, ncount, ogen; int i; time_t t; @@ -1382,7 +1415,7 @@ tc_windup(struct bintime *new_boottimebin) tho->th_counter->tc_poll_pps(tho->th_counter); /* - * Deal with NTP second processing. The for loop normally + * Deal with NTP second processing. The loop normally * iterates at most once, but in extreme situations it might * keep NTP sane if timeouts are not run for several seconds. * At boot, the time step can be large when the TOD hardware @@ -1393,14 +1426,21 @@ tc_windup(struct bintime *new_boottimebin) bt = th->th_offset; bintime_add(&bt, &th->th_boottime); i = bt.sec - tho->th_microtime.tv_sec; - if (i > LARGE_STEP) - i = 2; - for (; i > 0; i--) { - t = bt.sec; - ntp_update_second(&th->th_adjustment, &bt.sec); - if (bt.sec != t) - th->th_boottime.sec += bt.sec - t; + if (i > 0) { + if (i > LARGE_STEP) + i = 2; + + do { + t = bt.sec; + ntp_update_second(&th->th_adjustment, &bt.sec); + if (bt.sec != t) + th->th_boottime.sec += bt.sec - t; + --i; + } while (i > 0); + + recalculate_scaling_factor_and_large_delta(th); } + /* Update the UTC timestamps used by the get*() functions. */ th->th_bintime = bt; bintime2timeval(&bt, &th->th_microtime); @@ -1418,40 +1458,12 @@ tc_windup(struct bintime *new_boottimebin) th->th_offset_count = ncount; tc_min_ticktock_freq = max(1, timecounter->tc_frequency / (((uint64_t)timecounter->tc_counter_mask + 1) / 3)); + recalculate_scaling_factor_and_large_delta(th); #ifdef FFCLOCK ffclock_change_tc(th); #endif } - /*- - * Recalculate the scaling factor. We want the number of 1/2^64 - * fractions of a second per period of the hardware counter, taking - * into account the th_adjustment factor which the NTP PLL/adjtime(2) - * processing provides us with. - * - * The th_adjustment is nanoseconds per second with 32 bit binary - * fraction and we want 64 bit binary fraction of second: - * - * x = a * 2^32 / 10^9 = a * 4.294967296 - * - * The range of th_adjustment is +/- 5000PPM so inside a 64bit int - * we can only multiply by about 850 without overflowing, that - * leaves no suitably precise fractions for multiply before divide. - * - * Divide before multiply with a fraction of 2199/512 results in a - * systematic undercompensation of 10PPM of th_adjustment. On a - * 5000PPM adjustment this is a 0.05PPM error. This is acceptable. - * - * We happily sacrifice the lowest of the 64 bits of our result - * to the goddess of code clarity. - * - */ - scale = (uint64_t)1 << 63; - scale += (th->th_adjustment / 1024) * 2199; - scale /= th->th_counter->tc_frequency; - th->th_scale = scale * 2; - th->th_large_delta = MIN(((uint64_t)1 << 63) / scale, UINT_MAX); - /* * Now that the struct timehands is again consistent, set the new * generation number, making sure to not make it zero. From nobody Thu Oct 28 22:35:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 761D318368E5; Thu, 28 Oct 2021 22:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgL4Q2vk3z3Bwj; Thu, 28 Oct 2021 22:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 440B93C7B; Thu, 28 Oct 2021 22:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SMZomJ076018; Thu, 28 Oct 2021 22:35:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SMZoAL076017; Thu, 28 Oct 2021 22:35:50 GMT (envelope-from git) Date: Thu, 28 Oct 2021 22:35:50 GMT Message-Id: <202110282235.19SMZoAL076017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 92b3e07229ba - main - Enable net.inet.tcp.nolocaltimewait. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92b3e07229baab17cbe258ff1081e66bb7913b31 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=92b3e07229baab17cbe258ff1081e66bb7913b31 commit 92b3e07229baab17cbe258ff1081e66bb7913b31 Author: Gleb Smirnoff AuthorDate: 2021-10-28 22:34:00 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-28 22:34:00 +0000 Enable net.inet.tcp.nolocaltimewait. This feature has been used for many years at large sites and didn't show any pitfalls. --- sys/netinet/tcp_timewait.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 5d4de222b802..9d397d62424f 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -176,10 +176,10 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, &maxtcptw, 0, sysctl_maxtcptw, "IU", "Maximum number of compressed TCP TIME_WAIT entries"); -VNET_DEFINE_STATIC(int, nolocaltimewait) = 0; +VNET_DEFINE_STATIC(bool, nolocaltimewait) = true; #define V_nolocaltimewait VNET(nolocaltimewait) -SYSCTL_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET | CTLFLAG_RW, - &VNET_NAME(nolocaltimewait), 0, +SYSCTL_BOOL(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(nolocaltimewait), true, "Do not create compressed TCP TIME_WAIT entries for local connections"); void From nobody Thu Oct 28 23:06:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5CC5A1824DAE; Thu, 28 Oct 2021 23:06:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgLlg27Xdz3MlQ; Thu, 28 Oct 2021 23:06:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 269644468; Thu, 28 Oct 2021 23:06:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19SN6NUa016478; Thu, 28 Oct 2021 23:06:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19SN6NWd016477; Thu, 28 Oct 2021 23:06:23 GMT (envelope-from git) Date: Thu, 28 Oct 2021 23:06:23 GMT Message-Id: <202110282306.19SN6NWd016477@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: 6940d0e4703e - main - Force WITHOUT_OPENSSL_KTLS off when WITHOUT_OPENSSL List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6940d0e4703e72b8ea445541567d0ef64c2bb94b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6940d0e4703e72b8ea445541567d0ef64c2bb94b commit 6940d0e4703e72b8ea445541567d0ef64c2bb94b Author: Ed Maste AuthorDate: 2021-10-28 21:07:34 +0000 Commit: Ed Maste CommitDate: 2021-10-28 23:04:14 +0000 Force WITHOUT_OPENSSL_KTLS off when WITHOUT_OPENSSL Discussed with: jhb MFC after: 1 week Reported by: Michael Dexter, Build Option Survey Sponsored by: The FreeBSD Foundation --- share/mk/src.opts.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index ff894d3b3517..3d8f7b071904 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -418,6 +418,7 @@ MK_NLS_CATALOGS:= no .if ${MK_OPENSSL} == "no" MK_DMAGENT:= no MK_OPENSSH:= no +MK_OPENSSL_KTLS:= no MK_KERBEROS:= no MK_KERBEROS_SUPPORT:= no MK_LDNS:= no From nobody Fri Oct 29 00:15:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 090C1183E1D3; Fri, 29 Oct 2021 00:15: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgNHk6pn0z3tyv; Fri, 29 Oct 2021 00:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C728A5436; Fri, 29 Oct 2021 00:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T0Fkfr009434; Fri, 29 Oct 2021 00:15:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T0FkCG009433; Fri, 29 Oct 2021 00:15:46 GMT (envelope-from git) Date: Fri, 29 Oct 2021 00:15:46 GMT Message-Id: <202110290015.19T0FkCG009433@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: 3bfc837685b8 - main - sinpi,cospi,tanpi: float.h needed for week reference List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bfc837685b8128067b946b31dfe2120dae0d003 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3bfc837685b8128067b946b31dfe2120dae0d003 commit 3bfc837685b8128067b946b31dfe2120dae0d003 Author: Steve Kargl AuthorDate: 2021-10-28 22:53:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-29 00:15:19 +0000 sinpi,cospi,tanpi: float.h needed for week reference The patch fixes the omission of '#include ', which is needed for the weak reference on systems with LDBL_MANT_DIG == DBL_MANT_DIG. PR: 218514 MFC after: 1 week --- lib/msun/src/s_cospi.c | 1 + lib/msun/src/s_sinpi.c | 1 + lib/msun/src/s_tanpi.c | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/msun/src/s_cospi.c b/lib/msun/src/s_cospi.c index 92a5f467c97f..860219efd3e4 100644 --- a/lib/msun/src/s_cospi.c +++ b/lib/msun/src/s_cospi.c @@ -60,6 +60,7 @@ * cospi(nan) = nan. Raises the "invalid" floating-point exception. */ +#include #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_sinpi.c b/lib/msun/src/s_sinpi.c index b9731112a7eb..858459a5fcb4 100644 --- a/lib/msun/src/s_sinpi.c +++ b/lib/msun/src/s_sinpi.c @@ -63,6 +63,7 @@ * sinpi(nan) = nan. Raises the "invalid" floating-point exception. */ +#include #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_tanpi.c b/lib/msun/src/s_tanpi.c index e01917c94c15..01d4c74367fd 100644 --- a/lib/msun/src/s_tanpi.c +++ b/lib/msun/src/s_tanpi.c @@ -63,6 +63,7 @@ * tanpi(nan) = NaN. Raises the "invalid" floating-point exception. */ +#include #include "math.h" #include "math_private.h" From nobody Fri Oct 29 02:39:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C4FE1182E440; Fri, 29 Oct 2021 02:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgRTY4RzPz3F60; Fri, 29 Oct 2021 02:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 74DFE729D; Fri, 29 Oct 2021 02:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T2dTfW095898; Fri, 29 Oct 2021 02:39:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T2dTP7095897; Fri, 29 Oct 2021 02:39:29 GMT (envelope-from git) Date: Fri, 29 Oct 2021 02:39:29 GMT Message-Id: <202110290239.19T2dTP7095897@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: a30e8044aa47 - main - wpa: Fix WITHOUT_CRYPT build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a30e8044aa4753858c189f3384dae2b2f25a150b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=a30e8044aa4753858c189f3384dae2b2f25a150b commit a30e8044aa4753858c189f3384dae2b2f25a150b Author: Cy Schubert AuthorDate: 2021-10-28 23:55:48 +0000 Commit: Cy Schubert CommitDate: 2021-10-29 02:38:12 +0000 wpa: Fix WITHOUT_CRYPT build PASN requires CRYPT and when built WITHOUT_CRYPT buildworld fails. Only enable PASN when MK_CRYPT is enabled (default). PR: 259517 Reported by: emaste Fixes: c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 MFC after: 1 week --- usr.sbin/wpa/Makefile.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/wpa/Makefile.inc b/usr.sbin/wpa/Makefile.inc index 915b5312f02f..e43a6f539d92 100644 --- a/usr.sbin/wpa/Makefile.inc +++ b/usr.sbin/wpa/Makefile.inc @@ -56,7 +56,6 @@ CFLAGS+=-DCONFIG_TDLS CFLAGS+=-DCONFIG_TERMINATE_ONLASTIF CFLAGS+=-DCONFIG_TLS=openssl CFLAGS+=-DCONFIG_MATCH_IFACE -CFLAGS+=-DCONFIG_PASN CFLAGS+=-DCONFIG_PTKSA_CACHE CFLAGS+=-DEAP_SERVER CFLAGS+=-DEAP_SERVER_GTC @@ -91,6 +90,10 @@ NEED_AES_ENCBLOCK=y NEED_AES_OMAC1=y .endif +.if ${MK_CRYPT} != "no" +CFLAGS+=-DCONFIG_PASN +.endif + .if !empty(CFLAGS:M*-DEAP_AKA) NEED_SIM_COMMON=y NEED_AES_CBC=y From nobody Fri Oct 29 03:20:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D78B3181DF0C; Fri, 29 Oct 2021 03:20:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgSPN5pnnz3QQX; Fri, 29 Oct 2021 03:20:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A76237AEE; Fri, 29 Oct 2021 03:20:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T3KuYu059697; Fri, 29 Oct 2021 03:20:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T3KusB059696; Fri, 29 Oct 2021 03:20:56 GMT (envelope-from git) Date: Fri, 29 Oct 2021 03:20:56 GMT Message-Id: <202110290320.19T3KusB059696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 618647d62dd8 - stable/13 - nfscl: Restructure nfscl_freeopen() slightly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 618647d62dd890d9d7e80cf21f1067b19f8403f8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=618647d62dd890d9d7e80cf21f1067b19f8403f8 commit 618647d62dd890d9d7e80cf21f1067b19f8403f8 Author: Rick Macklem AuthorDate: 2021-10-15 00:28:01 +0000 Commit: Rick Macklem CommitDate: 2021-10-29 03:16:48 +0000 nfscl: Restructure nfscl_freeopen() slightly This patch factors the unlinking of the nfsclopen structure out of nfscl_freeopen() into a separate function called nfscl_unlinkopen(). It also adds a new argument to nfscl_freeopen() to conditionally do the unlink. Since this new argument is always passed in as "true" at this time, no semantics change should occur. This is being done to prepare the code for a future patch that fixes the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation. (cherry picked from commit 6495766acfb242048a80d58956b2cebbd885d8cc) --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- sys/fs/nfsclient/nfs_clstate.c | 40 ++++++++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 04946d88c26b..b913664e6e6c 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -591,7 +591,7 @@ int nfscl_checkwritelocked(vnode_t, struct flock *, void nfscl_lockrelease(struct nfscllockowner *, int, int); void nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t); void nfscl_filllockowner(void *, u_int8_t *, int); -void nfscl_freeopen(struct nfsclopen *, int); +void nfscl_freeopen(struct nfsclopen *, int, bool); void nfscl_umount(struct nfsmount *, NFSPROC_T *); void nfscl_renewthread(struct nfsclclient *, NFSPROC_T *); void nfscl_initiate_recovery(struct nfsclclient *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 36ee7768686f..860e87405e86 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -848,7 +848,7 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) LIST_FOREACH_SAFE(lp, &op->nfso_lock, nfsl_list, nlp) nfscl_freelockowner(lp, 0); - nfscl_freeopen(op, 0); + nfscl_freeopen(op, 0, true); NFSUNLOCKCLSTATE(); NFSFREECRED(tcred); } diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 248725c668d7..3afc63fda2aa 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -107,6 +107,7 @@ static bool nfscl_checkown(struct nfsclowner *, struct nfsclopen *, uint8_t *, uint8_t *, struct nfscllockowner **, struct nfsclopen **, struct nfsclopen **); static void nfscl_clrelease(struct nfsclclient *); +static void nfscl_unlinkopen(struct nfsclopen *); static void nfscl_cleanclient(struct nfsclclient *); static void nfscl_expireclient(struct nfsclclient *, struct nfsmount *, struct ucred *, NFSPROC_T *); @@ -848,7 +849,7 @@ nfscl_openrelease(struct nfsmount *nmp, struct nfsclopen *op, int error, nfscl_lockunlock(&owp->nfsow_rwlock); clp = owp->nfsow_clp; if (error && candelete && op->nfso_opencnt == 0) - nfscl_freeopen(op, 0); + nfscl_freeopen(op, 0, true); nfscl_clrelease(clp); NFSUNLOCKCLSTATE(); } @@ -1542,15 +1543,26 @@ nfscl_lockrelease(struct nfscllockowner *lp, int error, int candelete) } /* - * Free up an open structure and any associated byte range lock structures. + * Unlink the open structure. */ -void -nfscl_freeopen(struct nfsclopen *op, int local) +static void +nfscl_unlinkopen(struct nfsclopen *op) { LIST_REMOVE(op, nfso_list); if (op->nfso_hash.le_prev != NULL) LIST_REMOVE(op, nfso_hash); +} + +/* + * Free up an open structure and any associated byte range lock structures. + */ +void +nfscl_freeopen(struct nfsclopen *op, int local, bool unlink) +{ + + if (unlink) + nfscl_unlinkopen(op); nfscl_freealllocks(&op->nfso_lock, local); free(op, M_NFSCLOPEN); if (local) @@ -1621,7 +1633,7 @@ nfscl_expireopen(struct nfsclclient *clp, struct nfsclopen *op, * If a byte range lock or Share deny or couldn't re-open, free it. */ if (mustdelete) - nfscl_freeopen(op, 0); + nfscl_freeopen(op, 0, true); return (mustdelete); } @@ -1688,7 +1700,7 @@ nfscl_cleandeleg(struct nfscldeleg *dp) if (op != NULL) { if (LIST_NEXT(op, nfso_list) != NULL) panic("nfscleandel"); - nfscl_freeopen(op, 1); + nfscl_freeopen(op, 1, true); } nfscl_freeopenowner(owp, 1); } @@ -1730,7 +1742,7 @@ nfscl_cleanclient(struct nfsclclient *clp) /* Now, all the OpenOwners, etc. */ LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { LIST_FOREACH_SAFE(op, &owp->nfsow_open, nfso_list, nop) { - nfscl_freeopen(op, 0); + nfscl_freeopen(op, 0, true); } nfscl_freeopenowner(owp, 0); } @@ -2269,7 +2281,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, } } if (error != 0 && error != NFSERR_BADSESSION) - nfscl_freeopen(op, 0); + nfscl_freeopen(op, 0, true); op = nop; } owp = nowp; @@ -3343,7 +3355,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) if (op != NULL) { KASSERT((op->nfso_opencnt == 0), ("nfscl: bad open cnt on deleg")); - nfscl_freeopen(op, 1); + nfscl_freeopen(op, 1, true); } nfscl_freeopenowner(owp, 1); } @@ -4189,7 +4201,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, ret == NFSERR_BADSESSION) return (ret); if (ret) { - nfscl_freeopen(lop, 1); + nfscl_freeopen(lop, 1, true); if (!error) error = ret; } @@ -4218,7 +4230,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, ret == NFSERR_BADSESSION) return (ret); if (ret) { - nfscl_freeopen(lop, 1); + nfscl_freeopen(lop, 1, true); if (!error) error = ret; } @@ -4270,7 +4282,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, op->nfso_fhlen == lop->nfso_fhlen && !NFSBCMP(op->nfso_fh, lop->nfso_fh, op->nfso_fhlen)) { op->nfso_opencnt += lop->nfso_opencnt; - nfscl_freeopen(lop, 1); + nfscl_freeopen(lop, 1, true); return (0); } } @@ -4289,11 +4301,11 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, NFS4NODENAME(np->n_v4), np->n_v4->n4_namelen, &ndp, 0, 0, cred, p); if (error) { if (newone) - nfscl_freeopen(op, 0); + nfscl_freeopen(op, 0, true); } else { op->nfso_mode |= lop->nfso_mode; op->nfso_opencnt += lop->nfso_opencnt; - nfscl_freeopen(lop, 1); + nfscl_freeopen(lop, 1, true); } if (nop != NULL) free(nop, M_NFSCLOPEN); From nobody Fri Oct 29 03:22:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 77ACD181EA34; Fri, 29 Oct 2021 03:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgSRF2z9tz3Qms; Fri, 29 Oct 2021 03:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4672F7958; Fri, 29 Oct 2021 03:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T3MXHx063038; Fri, 29 Oct 2021 03:22:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T3MXxn063037; Fri, 29 Oct 2021 03:22:33 GMT (envelope-from git) Date: Fri, 29 Oct 2021 03:22:33 GMT Message-Id: <202110290322.19T3MXxn063037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: c76eef47399f - stable/13 - nfscl: Add an argument to nfscl_tryclose() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c76eef47399f9c2d7551ea172b6cb08aab6a5b79 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c76eef47399f9c2d7551ea172b6cb08aab6a5b79 commit c76eef47399f9c2d7551ea172b6cb08aab6a5b79 Author: Rick Macklem AuthorDate: 2021-10-15 21:25:38 +0000 Commit: Rick Macklem CommitDate: 2021-10-29 03:19:11 +0000 nfscl: Add an argument to nfscl_tryclose() This patch adds a new argument to nfscl_tryclose() to indicate whether or not it should loop when a NFSERR_DELAY reply is received from the NFSv4 server. Since this new argument is always passed in as "true" at this time, no semantics change should occur. This is being done to prepare the code for a future patch that fixes the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation. (cherry picked from commit 77c595ce33a37d321ef35fd840948a2e5fd17c84) --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- sys/fs/nfsclient/nfs_clstate.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index b913664e6e6c..609debe9cc16 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -625,7 +625,7 @@ void nfscl_newnode(vnode_t); void nfscl_delegmodtime(vnode_t); void nfscl_deleggetmodtime(vnode_t, struct timespec *); int nfscl_tryclose(struct nfsclopen *, struct ucred *, - struct nfsmount *, NFSPROC_T *); + struct nfsmount *, NFSPROC_T *, bool); void nfscl_cleanup(NFSPROC_T *); int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t *, int, nfsv4stateid_t *, int, int, struct nfsclflayouthead *, struct nfscllayout **, struct ucred *, diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 860e87405e86..795eafabb6de 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -839,7 +839,7 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) nfscl_lockexcl(&op->nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR); NFSUNLOCKCLSTATE(); do { - error = nfscl_tryclose(op, tcred, nmp, p); + error = nfscl_tryclose(op, tcred, nmp, p, true); if (error == NFSERR_GRACE) (void) nfs_catnap(PZERO, error, "nfs_close"); } while (error == NFSERR_GRACE); diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 3afc63fda2aa..4c74963da747 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -2401,7 +2401,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, LIST_FOREACH_SAFE(op, &extra_open, nfso_list, nop) { do { newnfs_copycred(&op->nfso_cred, tcred); - error = nfscl_tryclose(op, tcred, nmp, p); + error = nfscl_tryclose(op, tcred, nmp, p, true); if (error == NFSERR_GRACE) (void) nfs_catnap(PZERO, error, "nfsexcls"); } while (error == NFSERR_GRACE); @@ -4508,24 +4508,24 @@ nfscl_trydelegreturn(struct nfscldeleg *dp, struct ucred *cred, */ int nfscl_tryclose(struct nfsclopen *op, struct ucred *cred, - struct nfsmount *nmp, NFSPROC_T *p) + struct nfsmount *nmp, NFSPROC_T *p, bool loop_on_delayed) { struct nfsrv_descript nfsd, *nd = &nfsd; int error; do { error = nfsrpc_closerpc(nd, nmp, op, cred, p, 0); - if (error == NFSERR_DELAY) + if (loop_on_delayed && error == NFSERR_DELAY) (void) nfs_catnap(PZERO, error, "nfstrycl"); - } while (error == NFSERR_DELAY); + } while (loop_on_delayed && error == NFSERR_DELAY); if (error == EAUTH || error == EACCES) { /* Try again using system credentials */ newnfs_setroot(cred); do { error = nfsrpc_closerpc(nd, nmp, op, cred, p, 1); - if (error == NFSERR_DELAY) + if (loop_on_delayed && error == NFSERR_DELAY) (void) nfs_catnap(PZERO, error, "nfstrycl"); - } while (error == NFSERR_DELAY); + } while (loop_on_delayed && error == NFSERR_DELAY); } return (error); } From nobody Fri Oct 29 05:52:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 61A07182FAA9; Fri, 29 Oct 2021 05:52: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgWm82Htsz4lGF; Fri, 29 Oct 2021 05:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 241CB11BEE; Fri, 29 Oct 2021 05:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T5qOFU061845; Fri, 29 Oct 2021 05:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T5qOjx061844; Fri, 29 Oct 2021 05:52:24 GMT (envelope-from git) Date: Fri, 29 Oct 2021 05:52:24 GMT Message-Id: <202110290552.19T5qOjx061844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 68bff4a07e3f - main - Allow GEOM utilities to specify a -v option. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72 commit 68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72 Author: Kirk McKusick AuthorDate: 2021-10-29 05:49:48 +0000 Commit: Kirk McKusick CommitDate: 2021-10-29 05:50:50 +0000 Allow GEOM utilities to specify a -v option. Geom utilities (geli(8), glabel(8), gmirror(8), gpart(8), gmirror(8), gmountver(8), etc) all use the geom(8) utility as their back end to process their commands and pass them into the kernel. Creating a new utility requires no more than filling out a template describing the commands and arguments that the utility supports. Consider the specification for the very simple gmountver(8) utility: struct g_command class_commands[] = { { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { G_OPT_SENTINEL }, "[-v] prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, "[-fv] name" }, G_CMD_SENTINEL }; It has just two commands of its own: "create" and "destroy" along with the four standard commands "list", "status", "load", and "unload" provided by the base geom(8) utility. The base geom(8) utility allows each command to use the G_FLAG_VERBOSE flag to specify that a command should accept the -v flag and when the -v flag is given the utility prints "Done." if the command completes successfully. In the above example, both of the commands set the G_FLAG_VERBOSE, so have the -v option available. In addition the "destroy" command accepts the -f boolean flag to force the destruction. If the "destroy" command wanted to also print out verbose information, it would need to explicitly declare its intent by adding a line: { 'v', "verbose", NULL, G_TYPE_BOOL }, Before this change, the geom utility would silently ignore the above line in the configuration file, so it was impossible for the utility to know that the -v flag had been set on the command. With this change a geom command can explicitly specify a -v option with a line as given above and handle it as it would any other option. If both a -v option and G_FLAG_VERBOSE are specified for a command then both types of verbose information will be output when that command is run with -v. MFC after: 1 week Sponsored by: Netflix --- sbin/geom/core/geom.c | 19 ++++++++++++------- sbin/geom/core/geom.h | 13 +++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index 58b33a067700..2e0d8683df49 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -314,7 +314,7 @@ parse_arguments(struct g_command *cmd, struct gctl_req *req, int *argc, struct g_option *opt; char opts[64]; unsigned i; - int ch; + int ch, vcount; *opts = '\0'; if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) @@ -336,17 +336,22 @@ parse_arguments(struct g_command *cmd, struct gctl_req *req, int *argc, /* * Add specified arguments. */ + vcount = 0; while ((ch = getopt(*argc, *argv, opts)) != -1) { /* Standard (not passed to kernel) options. */ - switch (ch) { - case 'v': + if (ch == 'v' && (cmd->gc_flags & G_FLAG_VERBOSE) != 0) verbose = 1; - continue; - } /* Options passed to kernel. */ opt = find_option(cmd, ch); - if (opt == NULL) + if (opt == NULL) { + if (ch == 'v' && (cmd->gc_flags & G_FLAG_VERBOSE) != 0){ + if (++vcount < 2) + continue; + else + warnx("Option 'v' specified twice."); + } usage(); + } if (!G_OPT_ISMULTI(opt) && G_OPT_ISDONE(opt)) { warnx("Option '%c' specified twice.", opt->go_char); usage(); @@ -440,7 +445,7 @@ set_flags(struct g_command *cmd) { unsigned flags = 0; - if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0 && verbose) + if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) flags |= G_FLAG_VERBOSE; return (flags); diff --git a/sbin/geom/core/geom.h b/sbin/geom/core/geom.h index 89c5828c6429..38a99032f692 100644 --- a/sbin/geom/core/geom.h +++ b/sbin/geom/core/geom.h @@ -32,6 +32,19 @@ #define _GEOM_H_ #define G_LIB_VERSION 5 +/* + * The G_FLAG_VERBOSE flag on a command specification means that the + * comand will accept a -v option and the GEOM framework will print + * out status information after the command when it is run with -v. + * Additionally a GEOM command can explicitly specify a -v option and + * handle it as it would any other option. If both a -v option and + * G_FLAG_VERBOSE are specified for a command then both types of verbose + * information will be output when that command is run with -v. + * + * When the G_FLAG_LOADKLD is specified for a command, the GEOM kernel + * module will be loaded when that command is run if it has not yet been + * loaded. This flag is typically specified for the `create' command. + */ #define G_FLAG_NONE 0x0000 #define G_FLAG_VERBOSE 0x0001 #define G_FLAG_LOADKLD 0x0002 From nobody Fri Oct 29 07:19:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6F01E18321F6; Fri, 29 Oct 2021 07:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgYhV2X2cz3QGw; Fri, 29 Oct 2021 07:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 367AB12E54; Fri, 29 Oct 2021 07:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T7JMBK069052; Fri, 29 Oct 2021 07:19:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T7JM26069051; Fri, 29 Oct 2021 07:19:22 GMT (envelope-from git) Date: Fri, 29 Oct 2021 07:19:22 GMT Message-Id: <202110290719.19T7JM26069051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: aeda85278255 - main - tcp: Rack at times can miscalculate the RTT from what it thinks is a persists probe respone. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aeda8527825525cfd75bfbcae7bc895cee17f04b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=aeda8527825525cfd75bfbcae7bc895cee17f04b commit aeda8527825525cfd75bfbcae7bc895cee17f04b Author: Randall Stewart AuthorDate: 2021-10-29 07:17:43 +0000 Commit: Randall Stewart CommitDate: 2021-10-29 07:17:43 +0000 tcp: Rack at times can miscalculate the RTT from what it thinks is a persists probe respone. Turns out that if a peer sends in a window update right after rack fires off a persists probe, we can mis-interpret the window update and calculate a bogus RTT (very short). We still process the window update and send the data but we incorrectly generate an RTT. We should be only doing the RTT stuff if the rwnd is still small and has not changed. Reviewed by: Michael Tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32717 --- sys/netinet/tcp_stacks/rack.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index a92e43205f09..04252511ad18 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -5363,8 +5363,6 @@ rack_get_persists_timer_val(struct tcpcb *tp, struct tcp_rack *rack) t = (tp->t_srtt + (tp->t_rttvar << 2)); RACK_TCPT_RANGESET(tt, t * tcp_backoff[tp->t_rxtshift], rack_persist_min, rack_persist_max, rack->r_ctl.timer_slop); - if (tp->t_rxtshift < TCP_MAXRXTSHIFT) - tp->t_rxtshift++; rack->r_ctl.rc_hpts_flags |= PACE_TMR_PERSIT; ret_val = (uint32_t)tt; return (ret_val); @@ -14448,11 +14446,20 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, * at least use timestamps if available to validate). */ rack->forced_ack = 0; - us_rtt = us_cts - rack->r_ctl.forced_ack_ts; - if (us_rtt == 0) - us_rtt = 1; - rack_apply_updated_usrtt(rack, us_rtt, us_cts); - tcp_rack_xmit_timer(rack, us_rtt, 0, us_rtt, 3, NULL, 1); + if (tiwin == tp->snd_wnd) { + /* + * Only apply the RTT update if this is + * a response to our window probe. And that + * means the rwnd sent must match the current + * snd_wnd. If it does not, then we got a + * window update ack instead. + */ + us_rtt = us_cts - rack->r_ctl.forced_ack_ts; + if (us_rtt == 0) + us_rtt = 1; + rack_apply_updated_usrtt(rack, us_rtt, us_cts); + tcp_rack_xmit_timer(rack, us_rtt, 0, us_rtt, 3, NULL, 1); + } } /* * This is the one exception case where we set the rack state From nobody Fri Oct 29 07:52:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5C11C183E506; Fri, 29 Oct 2021 07:52: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgZRC25nLz3nhM; Fri, 29 Oct 2021 07:52:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 28575130FE; Fri, 29 Oct 2021 07:52:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T7qtld021099; Fri, 29 Oct 2021 07:52:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T7qtkm021098; Fri, 29 Oct 2021 07:52:55 GMT (envelope-from git) Date: Fri, 29 Oct 2021 07:52:55 GMT Message-Id: <202110290752.19T7qtkm021098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: ccfa9ac5ac12 - main - NXP: Add ls1028a SPI clock driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccfa9ac5ac128fa59291fb99dcae27e890c58cbc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=ccfa9ac5ac128fa59291fb99dcae27e890c58cbc commit ccfa9ac5ac128fa59291fb99dcae27e890c58cbc Author: Wojciech Macek AuthorDate: 2021-10-22 08:12:09 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 07:52:20 +0000 NXP: Add ls1028a SPI clock driver Provide driver for LS1028A and LX2160 SPI clock modules. Obtained from: Semihalf Sponsored by: Alstom Differential revision: https://reviews.freebsd.org/D32689 --- sys/arm64/qoriq/clk/ls1028a_flexspi_clk.c | 310 ++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 1 + 2 files changed, 311 insertions(+) diff --git a/sys/arm64/qoriq/clk/ls1028a_flexspi_clk.c b/sys/arm64/qoriq/clk/ls1028a_flexspi_clk.c new file mode 100644 index 000000000000..5ecefa197ad3 --- /dev/null +++ b/sys/arm64/qoriq/clk/ls1028a_flexspi_clk.c @@ -0,0 +1,310 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "clkdev_if.h" +#include "syscon_if.h" + + +struct ls1028a_flexspi_clk_softc { + device_t dev; + struct clkdom *clkdom; + uint64_t reg_offset; + struct syscon *syscon; + struct clk_div_def clk_def; + struct mtx mtx; +}; + +static struct clk_div_table ls1028a_flexspi_div_tbl[] = { + { .value = 0, .divider = 1, }, + { .value = 1, .divider = 2, }, + { .value = 2, .divider = 3, }, + { .value = 3, .divider = 4, }, + { .value = 4, .divider = 5, }, + { .value = 5, .divider = 6, }, + { .value = 6, .divider = 7, }, + { .value = 7, .divider = 8, }, + { .value = 11, .divider = 12, }, + { .value = 15, .divider = 16, }, + { .value = 16, .divider = 20, }, + { .value = 17, .divider = 24, }, + { .value = 18, .divider = 28, }, + { .value = 19, .divider = 32, }, + { .value = 20, .divider = 80, }, + {} +}; +static struct clk_div_table lx2160a_flexspi_div_tbl[] = { + { .value = 1, .divider = 2, }, + { .value = 3, .divider = 4, }, + { .value = 5, .divider = 6, }, + { .value = 7, .divider = 8, }, + { .value = 11, .divider = 12, }, + { .value = 15, .divider = 16, }, + { .value = 16, .divider = 20, }, + { .value = 17, .divider = 24, }, + { .value = 18, .divider = 28, }, + { .value = 19, .divider = 32, }, + { .value = 20, .divider = 80, }, + {} +}; + +static struct ofw_compat_data compat_data[] = { + { "fsl,ls1028a-flexspi-clk", (uintptr_t)ls1028a_flexspi_div_tbl }, + { "fsl,lx2160a-flexspi-clk", (uintptr_t)lx2160a_flexspi_div_tbl }, + { NULL, 0 } +}; + +static int +ls1028a_flexspi_clk_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "NXP FlexSPI clock driver"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +ls1028a_flexspi_clk_attach(device_t dev) +{ + struct ls1028a_flexspi_clk_softc *sc; + const char *oclkname = NULL; + const char *pclkname[1]; + uint32_t acells; + uint32_t scells; + pcell_t cells[4]; + phandle_t node; + uint64_t reg_size; + int ret; + clk_t clk; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* Parse address-cells and size-cells from the parent node as a fallback */ + if (OF_getencprop(node, "#address-cells", &acells, + sizeof(acells)) == -1) { + if (OF_getencprop(OF_parent(node), "#address-cells", &acells, + sizeof(acells)) == -1) { + acells = 2; + } + } + if (OF_getencprop(node, "#size-cells", &scells, + sizeof(scells)) == -1) { + if (OF_getencprop(OF_parent(node), "#size-cells", &scells, + sizeof(scells)) == -1) { + scells = 1; + } + } + ret = OF_getencprop(node, "reg", cells, (acells + scells) * sizeof(pcell_t)); + if (ret < 0) { + device_printf(dev, "ERROR: failed to read REG property\n"); + return (ENOMEM); + } + sc->reg_offset = (uint64_t)cells[0]; + if (acells == 2) + sc->reg_offset = (sc->reg_offset << 32) | (uint64_t)cells[1]; + reg_size = (uint64_t)cells[acells]; + if (scells == 2) + reg_size = (reg_size << 32) | (uint64_t)cells[acells + 1]; + + if (reg_size != 4) { + device_printf(dev, "ERROR, expected only single register\n"); + return (EINVAL); + } + if (sc->reg_offset >> 32UL) { + device_printf(dev, "ERROR, only 32-bit address offset is supported\n"); + return (EINVAL); + } + + /* Get syscon handle */ + ret = SYSCON_GET_HANDLE(dev, &sc->syscon); + if ((ret != 0) || (sc->syscon == NULL)) { + device_printf(dev, "ERROR: failed to get syscon\n"); + return (EFAULT); + } + + /* Initialize access mutex */ + mtx_init(&sc->mtx, "FSL clock mtx", NULL, MTX_DEF); + + /* Get clock names */ + ret = clk_get_by_ofw_index(dev, node, 0, &clk); + if (ret) { + device_printf(dev, "ERROR: failed to get parent clock\n"); + return (EINVAL); + } + pclkname[0] = clk_get_name(clk); + ret = clk_parse_ofw_clk_name(dev, node, &oclkname); + if (ret) { + device_printf(dev, "ERROR: failed to get output clock name\n"); + return (EINVAL); + } + +#ifdef DEBUG + device_printf(dev, "INFO: pclkname %s, oclkname %s\n", pclkname[0], oclkname); +#endif + + /* Fixup CLK structure */ + sc->clk_def.clkdef.name = oclkname; + sc->clk_def.clkdef.parent_names = (const char **)pclkname; + sc->clk_def.offset = (uint32_t)sc->reg_offset; + sc->clk_def.clkdef.id = 1; + sc->clk_def.clkdef.parent_cnt = 1; + sc->clk_def.clkdef.flags = 0; + sc->clk_def.div_flags = CLK_DIV_WITH_TABLE; + sc->clk_def.i_shift = 0; + sc->clk_def.i_width = 5; + sc->clk_def.div_table = (struct clk_div_table*)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + + /* Create clock */ + sc->clkdom = clkdom_create(dev); + if (sc->clkdom == NULL) + panic("clkdom == NULL"); + ret = clknode_div_register(sc->clkdom, &sc->clk_def); + if (ret) { + device_printf(dev, "ERROR: unable to register clock\n"); + return (EINVAL); + } + clkdom_finit(sc->clkdom); + + if (bootverbose) + clkdom_dump(sc->clkdom); + + return (0); +} + +static int +ls1028a_flexspi_clk_detach(device_t dev) +{ + + /* Clock detaching is not supported */ + return (EACCES); +} + +static int +ls1028a_flexspi_clk_read_4(device_t dev, bus_addr_t addr, uint32_t *val) +{ + struct ls1028a_flexspi_clk_softc *sc; + sc = device_get_softc(dev); + + *val = SYSCON_READ_4(sc->syscon, addr); + + return (0); +} + +static int +ls1028a_flexspi_clk_write_4(device_t dev, bus_addr_t addr, uint32_t val) +{ + struct ls1028a_flexspi_clk_softc *sc; + int ret; + + sc = device_get_softc(dev); + + ret = SYSCON_WRITE_4(sc->syscon, addr, val); + + return (ret); +} + +static int +ls1028a_flexspi_clk_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set) +{ + struct ls1028a_flexspi_clk_softc *sc; + int ret; + + sc = device_get_softc(dev); + + ret = SYSCON_MODIFY_4(sc->syscon, addr, clr, set); + + return (ret); +} + +static void +ls1028a_flexspi_clk_device_lock(device_t dev) +{ + struct ls1028a_flexspi_clk_softc *sc; + sc = device_get_softc(dev); + + mtx_lock(&sc->mtx); +} + +static void +ls1028a_flexspi_clk_device_unlock(device_t dev) +{ + struct ls1028a_flexspi_clk_softc *sc; + + sc = device_get_softc(dev); + + mtx_unlock(&sc->mtx); +} + +static device_method_t ls1028a_flexspi_clk_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ls1028a_flexspi_clk_probe), + DEVMETHOD(device_attach, ls1028a_flexspi_clk_attach), + DEVMETHOD(device_detach, ls1028a_flexspi_clk_detach), + + DEVMETHOD(clkdev_read_4, ls1028a_flexspi_clk_read_4), + DEVMETHOD(clkdev_write_4, ls1028a_flexspi_clk_write_4), + DEVMETHOD(clkdev_modify_4, ls1028a_flexspi_clk_modify_4), + DEVMETHOD(clkdev_device_lock, ls1028a_flexspi_clk_device_lock), + DEVMETHOD(clkdev_device_unlock, ls1028a_flexspi_clk_device_unlock), + + DEVMETHOD_END +}; + +static devclass_t ls1028a_flexspi_clk_devclass; +static DEFINE_CLASS_0(fspi_clk, ls1028a_flexspi_clk_driver, ls1028a_flexspi_clk_methods, + sizeof(struct ls1028a_flexspi_clk_softc)); +EARLY_DRIVER_MODULE(ls1028a_flexspi_clk, simple_mfd, ls1028a_flexspi_clk_driver, + ls1028a_flexspi_clk_devclass, NULL, NULL, BUS_PASS_TIMER); diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 5fdf2d6ee648..3a41554eaea7 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -521,6 +521,7 @@ arm64/qoriq/qoriq_dw_pci.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm_if.m optional pci fdt SOC_NXP_LS arm64/qoriq/clk/ls1028a_clkgen.c optional clk SOC_NXP_LS +arm64/qoriq/clk/ls1028a_flexspi_clk.c optional clk SOC_NXP_LS arm64/qoriq/clk/ls1046a_clkgen.c optional clk SOC_NXP_LS arm64/qoriq/clk/lx2160a_clkgen.c optional clk SOC_NXP_LS arm64/qoriq/clk/qoriq_clk_pll.c optional clk SOC_NXP_LS From nobody Fri Oct 29 08:31:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 85CDD1826847; Fri, 29 Oct 2021 08:31: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgbHv3MjSz4SpZ; Fri, 29 Oct 2021 08:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 53F831401A; Fri, 29 Oct 2021 08:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T8Vdil073735; Fri, 29 Oct 2021 08:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T8Vdcl073734; Fri, 29 Oct 2021 08:31:39 GMT (envelope-from git) Date: Fri, 29 Oct 2021 08:31:39 GMT Message-Id: <202110290831.19T8Vdcl073734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 3c02da8096b1 - main - dmar: Don't try to reserve PCI regions for non-existing devices List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c02da8096b142ef243da8da667c3a5a7d591105 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=3c02da8096b142ef243da8da667c3a5a7d591105 commit 3c02da8096b142ef243da8da667c3a5a7d591105 Author: Kornel Duleba AuthorDate: 2021-10-21 12:46:51 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:08:25 +0000 dmar: Don't try to reserve PCI regions for non-existing devices In some cases we might have to create DMAR context before the corresponding device has been enumerated by the PCI bus. In that case we get called with NULL dev, because of that trying to reserve PCI regions causes a NULL pointer dereference in pci_find_pcie_root_port. Sponsored by: Stormshield Obtained from: Semihalf MFC after: 2 weeks Reviewed by: kib, rlibby Differential revision: https://reviews.freebsd.org/D32589 --- sys/x86/iommu/intel_ctx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index 34730306000b..7aedbf159ac7 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -561,7 +561,7 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid, error = domain_init_rmrr(domain1, dev, bus, slot, func, dev_domain, dev_busno, dev_path, dev_path_len); - if (error == 0) + if (error == 0 && dev != NULL) error = dmar_reserve_pci_regions(domain1, dev); if (error != 0) { dmar_domain_destroy(domain1); From nobody Fri Oct 29 08:31:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D6D171826578; Fri, 29 Oct 2021 08:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgbHw58sCz4SRv; Fri, 29 Oct 2021 08:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7AA7114204; Fri, 29 Oct 2021 08:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T8Vex2073761; Fri, 29 Oct 2021 08:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T8Vew6073760; Fri, 29 Oct 2021 08:31:40 GMT (envelope-from git) Date: Fri, 29 Oct 2021 08:31:40 GMT Message-Id: <202110290831.19T8Vew6073760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 06e6ca6dd350 - main - dmar: Disable protected memory regions after initialization List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06e6ca6dd3508866b584942a6a40739e09453cc6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=06e6ca6dd3508866b584942a6a40739e09453cc6 commit 06e6ca6dd3508866b584942a6a40739e09453cc6 Author: Kornel Duleba AuthorDate: 2021-10-21 14:02:26 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:08:25 +0000 dmar: Disable protected memory regions after initialization Some BIOSes protect memory region they reside in by using DMAR to prevent devices from doing any DMA transactions to that part of RAM. AMI refers to this as "DMA Control Guarantee". Disable the protection when address translation is enabled. I stumbled upon this while investigation a failing coredump on a device which has this feature enabled. Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: kib Differential revision: https://reviews.freebsd.org/D32591 --- sys/x86/iommu/intel_ctx.c | 4 ++++ sys/x86/iommu/intel_dmar.h | 1 + sys/x86/iommu/intel_drv.c | 4 ++++ sys/x86/iommu/intel_utils.c | 27 +++++++++++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index 7aedbf159ac7..815dc6146b00 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -631,6 +631,10 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid, * to avoid unneeded command. */ if (enable && !rmrr_init && (dmar->hw_gcmd & DMAR_GCMD_TE) == 0) { + error = dmar_disable_protected_regions(dmar); + if (error != 0) + printf("dmar%d: Failed to disable protected regions\n", + dmar->iommu.unit); error = dmar_enable_translation(dmar); if (error == 0) { if (bootverbose) { diff --git a/sys/x86/iommu/intel_dmar.h b/sys/x86/iommu/intel_dmar.h index 0ad94dbf4123..b34505a4e5d0 100644 --- a/sys/x86/iommu/intel_dmar.h +++ b/sys/x86/iommu/intel_dmar.h @@ -227,6 +227,7 @@ int dmar_flush_write_bufs(struct dmar_unit *unit); void dmar_flush_pte_to_ram(struct dmar_unit *unit, dmar_pte_t *dst); void dmar_flush_ctx_to_ram(struct dmar_unit *unit, dmar_ctx_entry_t *dst); void dmar_flush_root_to_ram(struct dmar_unit *unit, dmar_root_entry_t *dst); +int dmar_disable_protected_regions(struct dmar_unit *unit); int dmar_enable_translation(struct dmar_unit *unit); int dmar_disable_translation(struct dmar_unit *unit); int dmar_load_irt_ptr(struct dmar_unit *unit); diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index 0b470d7bbf7a..66849dd43053 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -1065,6 +1065,10 @@ dmar_instantiate_rmrr_ctxs(struct iommu_unit *unit) KASSERT((dmar->hw_gcmd & DMAR_GCMD_TE) == 0, ("dmar%d: RMRR not handled but translation is already enabled", dmar->iommu.unit)); + error = dmar_disable_protected_regions(dmar); + if (error != 0) + printf("dmar%d: Failed to disable protected regions\n", + dmar->iommu.unit); error = dmar_enable_translation(dmar); if (bootverbose) { if (error == 0) { diff --git a/sys/x86/iommu/intel_utils.c b/sys/x86/iommu/intel_utils.c index 152c7cac3a7d..4511cceb6444 100644 --- a/sys/x86/iommu/intel_utils.c +++ b/sys/x86/iommu/intel_utils.c @@ -489,6 +489,33 @@ dmar_flush_write_bufs(struct dmar_unit *unit) return (error); } +/* + * Some BIOSes protect memory region they reside in by using DMAR to + * prevent devices from doing any DMA transactions to that part of RAM. + * AMI refers to this as "DMA Control Guarantee". + * We need to disable this when address translation is enabled. + */ +int +dmar_disable_protected_regions(struct dmar_unit *unit) +{ + uint32_t reg; + int error; + + DMAR_ASSERT_LOCKED(unit); + + /* Check if we support the feature. */ + if ((unit->hw_cap & (DMAR_CAP_PLMR | DMAR_CAP_PHMR)) == 0) + return (0); + + reg = dmar_read4(unit, DMAR_PMEN_REG); + reg &= ~DMAR_PMEN_EPM; + dmar_write4(unit, DMAR_PMEN_REG, reg); + DMAR_WAIT_UNTIL(((dmar_read4(unit, DMAR_PMEN_REG) & DMAR_PMEN_PRS) + != 0)); + + return (error); +} + int dmar_enable_translation(struct dmar_unit *unit) { From nobody Fri Oct 29 08:31:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5CF831826659; Fri, 29 Oct 2021 08:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgbHx742Hz4SmT; Fri, 29 Oct 2021 08:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 ADB2A140F6; Fri, 29 Oct 2021 08:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T8Vfa2073800; Fri, 29 Oct 2021 08:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T8VfNl073799; Fri, 29 Oct 2021 08:31:41 GMT (envelope-from git) Date: Fri, 29 Oct 2021 08:31:41 GMT Message-Id: <202110290831.19T8VfNl073799@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 29cf6a79acb7 - main - felix: Use internal MDIO regs for PHY communication List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29cf6a79acb7c28586ce39473e9ea1f2f1cd1ed4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=29cf6a79acb7c28586ce39473e9ea1f2f1cd1ed4 commit 29cf6a79acb7c28586ce39473e9ea1f2f1cd1ed4 Author: Kornel Duleba AuthorDate: 2021-10-26 08:36:35 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:08:26 +0000 felix: Use internal MDIO regs for PHY communication Previously we would use an external MDIO device found on the PCI bus. Switch to using MDIO mapped in a separate BAR of the switch device. It is much easier this way since we don't have to depend on another driver anymore. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/dev/etherswitch/felix/felix.c | 70 +++++++++++++++-------------------- sys/dev/etherswitch/felix/felix_reg.h | 2 + sys/dev/etherswitch/felix/felix_var.h | 2 + sys/modules/felix/Makefile | 3 +- 4 files changed, 35 insertions(+), 42 deletions(-) diff --git a/sys/dev/etherswitch/felix/felix.c b/sys/dev/etherswitch/felix/felix.c index 1cd1e0e29ca7..f57a6e1daa0c 100644 --- a/sys/dev/etherswitch/felix/felix.c +++ b/sys/dev/etherswitch/felix/felix.c @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -124,6 +126,10 @@ static device_method_t felix_methods[] = { DEVMETHOD(etherswitch_setvgroup, felix_setvgroup), DEVMETHOD(etherswitch_getvgroup, felix_getvgroup), + /* miibus interface */ + DEVMETHOD(miibus_readreg, felix_readphy), + DEVMETHOD(miibus_writereg, felix_writephy), + DEVMETHOD_END }; @@ -131,15 +137,16 @@ static devclass_t felix_devclass; DEFINE_CLASS_0(felix, felix_driver, felix_methods, sizeof(struct felix_softc)); -DRIVER_MODULE(felix, pci, felix_driver, felix_devclass, NULL, NULL); +DRIVER_MODULE_ORDERED(felix, pci, felix_driver, felix_devclass, + NULL, NULL, SI_ORDER_ANY); +DRIVER_MODULE(miibus, felix, miibus_driver, miibus_devclass, + NULL, NULL); DRIVER_MODULE(etherswitch, felix, etherswitch_driver, etherswitch_devclass, NULL, NULL); MODULE_VERSION(felix, 1); MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, felix, felix_pci_ids, nitems(felix_pci_ids) - 1); -MODULE_DEPEND(felix, enetc_mdio, 1, 1, 1); - static int felix_probe(device_t dev) { @@ -324,7 +331,6 @@ felix_attach(device_t dev) phandle_t child, ports, node; int error, port, rid; felix_softc_t sc; - device_t mdio_dev; uint32_t phy_addr; ssize_t size; @@ -333,12 +339,21 @@ felix_attach(device_t dev) sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q; strlcpy(sc->info.es_name, "Felix TSN Switch", sizeof(sc->info.es_name)); + rid = PCIR_BAR(FELIX_BAR_MDIO); + sc->mdio = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mdio == NULL) { + device_printf(dev, "Failed to allocate MDIO registers.\n"); + return (ENXIO); + } + rid = PCIR_BAR(FELIX_BAR_REGS); sc->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->regs == NULL) { device_printf(dev, "Failed to allocate registers BAR.\n"); - return (ENXIO); + error = ENXIO; + goto out_fail; } mtx_init(&sc->mtx, "felix lock", NULL, MTX_DEF); @@ -396,25 +411,9 @@ felix_attach(device_t dev) goto out_fail; } - node = OF_parent(node); - if (node <= 0) { - device_printf(sc->dev, - "Failed to obtain MDIO node.\n"); - error = ENXIO; - goto out_fail; - } - - mdio_dev = OF_device_from_xref(node); - if (mdio_dev == NULL) { - device_printf(sc->dev, - "Failed to obtain MDIO driver handle.\n"); - error = ENXIO; - goto out_fail; - } - sc->ports[port].phyaddr = phy_addr; sc->ports[port].miibus = NULL; - error = mii_attach(mdio_dev, &sc->ports[port].miibus, sc->ports[port].ifp, + error = mii_attach(dev, &sc->ports[port].miibus, sc->ports[port].ifp, felix_ifmedia_upd, felix_ifmedia_sts, BMSR_DEFCAPMASK, phy_addr, MII_OFFSET_ANY, 0); if (error != 0) @@ -447,7 +446,6 @@ static int felix_detach(device_t dev) { felix_softc_t sc; - device_t mdio_dev; int error; int i; @@ -468,10 +466,8 @@ felix_detach(device_t dev) felix_setup(sc); for (i = 0; i < sc->info.es_nports; i++) { - if (sc->ports[i].miibus != NULL) { - mdio_dev = device_get_parent(sc->ports[i].miibus); - device_delete_child(mdio_dev, sc->ports[i].miibus); - } + if (sc->ports[i].miibus != NULL) + device_delete_child(dev, sc->ports[i].miibus); if (sc->ports[i].ifp != NULL) if_free(sc->ports[i].ifp); if (sc->ports[i].ifname != NULL) @@ -482,6 +478,10 @@ felix_detach(device_t dev) error = bus_release_resource(sc->dev, SYS_RES_MEMORY, rman_get_rid(sc->regs), sc->regs); + if (sc->mdio != NULL) + error = bus_release_resource(sc->dev, SYS_RES_MEMORY, + rman_get_rid(sc->mdio), sc->mdio); + return (error); } @@ -759,32 +759,20 @@ static int felix_readphy(device_t dev, int phy, int reg) { felix_softc_t sc; - device_t mdio_dev; - int port; sc = device_get_softc(dev); - port = felix_phyforport(sc, phy); - if (port < 0) - return (UINT32_MAX); /* Can't return errors here. */ - mdio_dev = device_get_parent(sc->ports[port].miibus); - return (MIIBUS_READREG(mdio_dev, phy, reg)); + return (enetc_mdio_read(sc->mdio, FELIX_MDIO_BASE, phy, reg)); } static int felix_writephy(device_t dev, int phy, int reg, int data) { felix_softc_t sc; - device_t mdio_dev; - int port; sc = device_get_softc(dev); - port = felix_phyforport(sc, phy); - if (port < 0) - return (ENXIO); - mdio_dev = device_get_parent(sc->ports[port].miibus); - return (MIIBUS_WRITEREG(mdio_dev, phy, reg, data)); + return (enetc_mdio_write(sc->mdio, FELIX_MDIO_BASE, phy, reg, data)); } static int diff --git a/sys/dev/etherswitch/felix/felix_reg.h b/sys/dev/etherswitch/felix/felix_reg.h index 3474da72a456..eae3ebc135eb 100644 --- a/sys/dev/etherswitch/felix/felix_reg.h +++ b/sys/dev/etherswitch/felix/felix_reg.h @@ -31,6 +31,8 @@ #define BIT(x) (1UL << (x)) +#define FELIX_MDIO_BASE 0x1C00 + #define FELIX_DEVCPU_GCB_RST 0x70004 #define FELIX_DEVCPU_GCB_RST_EN BIT(0) diff --git a/sys/dev/etherswitch/felix/felix_var.h b/sys/dev/etherswitch/felix/felix_var.h index 1bdbc35e6116..d891419793b7 100644 --- a/sys/dev/etherswitch/felix/felix_var.h +++ b/sys/dev/etherswitch/felix/felix_var.h @@ -38,6 +38,7 @@ #define PCI_VENDOR_FREESCALE 0x1957 #define FELIX_DEV_ID 0xEEF0 +#define FELIX_BAR_MDIO 0 #define FELIX_BAR_REGS 4 #define FELIX_LOCK(_sc) mtx_lock(&(_sc)->mtx) @@ -92,6 +93,7 @@ struct felix_port { typedef struct felix_softc { device_t dev; struct resource *regs; + struct resource *mdio; etherswitch_info_t info; struct callout tick_callout; diff --git a/sys/modules/felix/Makefile b/sys/modules/felix/Makefile index 8f30a0e72a45..4bbca5046e0a 100644 --- a/sys/modules/felix/Makefile +++ b/sys/modules/felix/Makefile @@ -27,9 +27,10 @@ # .PATH: ${SRCTOP}/sys/dev/etherswitch/felix +.PATH: ${SRCTOP}/sys/dev/enetc KMOD = felix -SRCS = felix.c +SRCS = felix.c enetc_mdio.c SRCS += bus_if.h device_if.h etherswitch_if.h miibus_if.h ofw_bus_if.h pci_if.h .include From nobody Fri Oct 29 08:31:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A47DF1826663; Fri, 29 Oct 2021 08:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgbHz28RYz4SVj; Fri, 29 Oct 2021 08:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BBA1813F79; Fri, 29 Oct 2021 08:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T8VgRf073824; Fri, 29 Oct 2021 08:31:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T8Vgn1073823; Fri, 29 Oct 2021 08:31:42 GMT (envelope-from git) Date: Fri, 29 Oct 2021 08:31:42 GMT Message-Id: <202110290831.19T8Vgn1073823@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 8c5fead10590 - main - Remove enetc_mdio driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c5fead105905ffb8cdcf255c08a63ee440b223e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=8c5fead105905ffb8cdcf255c08a63ee440b223e commit 8c5fead105905ffb8cdcf255c08a63ee440b223e Author: Kornel Duleba AuthorDate: 2021-10-26 08:41:09 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:08:26 +0000 Remove enetc_mdio driver It was previously used by felix(4) for PHY communication. Since that is not the case anymore this driver is now left unused. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/conf/files.arm64 | 3 +- sys/dev/enetc/enetc_mdio_pci.c | 191 ---------------------------------------- sys/modules/Makefile | 2 - sys/modules/enetc_mdio/Makefile | 8 -- 4 files changed, 1 insertion(+), 203 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 3a41554eaea7..2d98568b3d9f 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -176,8 +176,7 @@ dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 -dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls | enetc_mdio soc_nxp_ls -dev/enetc/enetc_mdio_pci.c optional enetc_mdio pci soc_nxp_ls +dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls dev/enetc/if_enetc.c optional enetc iflib pci fdt soc_nxp_ls dev/etherswitch/felix/felix.c optional enetc etherswitch fdt felix pci soc_nxp_ls diff --git a/sys/dev/enetc/enetc_mdio_pci.c b/sys/dev/enetc/enetc_mdio_pci.c deleted file mode 100644 index 517efa9b9598..000000000000 --- a/sys/dev/enetc/enetc_mdio_pci.c +++ /dev/null @@ -1,191 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2021 Alstom Group. - * Copyright (c) 2021 Semihalf. - * - * 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 ``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 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "miibus_if.h" - -#define ENETC_MDIO_DEV_ID 0xee01 -#define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO" - -static struct entec_mdio_pci_id { - uint16_t vendor; - uint16_t device; - const char *desc; -} enetc_mdio_pci_ids[] = { - {PCI_VENDOR_FREESCALE, ENETC_MDIO_DEV_ID, ENETC_MDIO_DEV_NAME}, -}; -MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, enetc_mdio_pci, - enetc_mdio_pci_ids, nitems(enetc_mdio_pci_ids)); - -struct enetc_mdio_pci_softc { - device_t sc_dev; - struct mtx sc_lock; - struct resource *sc_regs; -}; - -static device_attach_t enetc_mdio_pci_attach; -static device_detach_t enetc_mdio_pci_detach; -static device_probe_t enetc_mdio_pci_probe; - -static int -enetc_mdio_pci_readreg(device_t dev, int phy, int reg) -{ - struct enetc_mdio_pci_softc *sc; - uint32_t ret; - - sc = device_get_softc(dev); - - mtx_lock(&sc->sc_lock); - ret = enetc_mdio_read(sc->sc_regs, ENETC_EMDIO_BASE, phy, reg); - mtx_unlock(&sc->sc_lock); - - return (ret); -} - -static int -enetc_mdio_pci_writereg(device_t dev, int phy, int reg, int data) -{ - struct enetc_mdio_pci_softc *sc; - int err; - - sc = device_get_softc(dev); - - mtx_lock(&sc->sc_lock); - err = enetc_mdio_write(sc->sc_regs, ENETC_EMDIO_BASE, phy, reg, data); - mtx_unlock(&sc->sc_lock); - if (err != 0) - return (err); - - return (0); -} - -static int -enetc_mdio_pci_probe(device_t dev) -{ - struct entec_mdio_pci_id *id; - - for (id = enetc_mdio_pci_ids; id->vendor != 0; ++id) { - if (pci_get_device(dev) != id->device || - pci_get_vendor(dev) != id->vendor) - continue; - - device_set_desc(dev, id->desc); - - return (BUS_PROBE_DEFAULT); - } - - return (ENXIO); -} - -static int -enetc_mdio_pci_attach(device_t dev) -{ - struct enetc_mdio_pci_softc *sc; - int rid; - - sc = device_get_softc(dev); - sc->sc_dev = dev; - - /* Init locks */ - mtx_init(&sc->sc_lock, device_get_nameunit(dev), "MDIO lock", MTX_DEF); - - rid = PCIR_BAR(0); - sc->sc_regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->sc_regs == NULL) { - device_printf(dev, "can't allocate resources for PCI MDIO \n"); - return (ENXIO); - } - - OF_device_register_xref(ofw_bus_get_node(dev), dev); - - return (0); -} - -static int -enetc_mdio_pci_detach(device_t dev) -{ - struct enetc_mdio_pci_softc *sc; - - sc = device_get_softc(dev); - - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->sc_regs); - mtx_destroy(&sc->sc_lock); - - return (0); -} - -static device_method_t enetc_mdio_pci_methods[] ={ - DEVMETHOD(device_probe, enetc_mdio_pci_probe), - DEVMETHOD(device_attach, enetc_mdio_pci_attach), - DEVMETHOD(device_detach, enetc_mdio_pci_detach), - - DEVMETHOD(miibus_readreg, enetc_mdio_pci_readreg), - DEVMETHOD(miibus_writereg, enetc_mdio_pci_writereg), - - DEVMETHOD_END -}; - -static driver_t enetc_mdio_pci_driver = { - "enetc_mdio", - enetc_mdio_pci_methods, - sizeof(struct enetc_mdio_pci_softc), -}; - -static devclass_t enetc_mdio_pci_devclass; - -DRIVER_MODULE(enetc_mdio, pci, enetc_mdio_pci_driver, - enetc_mdio_pci_devclass, 0, 0); -DRIVER_MODULE(miibus, enetc_mdio, miibus_driver, miibus_devclass, - 0, 0); -MODULE_VERSION(enetc_mdio, 1); diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 6cfeba3f45a7..724dcb694d97 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -110,7 +110,6 @@ SUBDIR= \ ${_em} \ ${_ena} \ ${_enetc} \ - ${_enetc_mdio} \ esp \ ${_et} \ evdev \ @@ -615,7 +614,6 @@ _armv8crypto= armv8crypto _dwwdt= dwwdt _em= em _enetc= enetc -_enetc_mdio= enetc_mdio _felix= felix _rockchip= rockchip .endif diff --git a/sys/modules/enetc_mdio/Makefile b/sys/modules/enetc_mdio/Makefile deleted file mode 100644 index f448fc526705..000000000000 --- a/sys/modules/enetc_mdio/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -#$FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/enetc - -KMOD = enetc_mdio -SRCS = enetc_mdio_pci.c enetc_mdio.c - -.include From nobody Fri Oct 29 08:31:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 560CD1826A79; Fri, 29 Oct 2021 08:31:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgbJ13VqGz4Ssf; Fri, 29 Oct 2021 08:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 152F913F9D; Fri, 29 Oct 2021 08:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T8ViFt073873; Fri, 29 Oct 2021 08:31:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T8Vi7W073872; Fri, 29 Oct 2021 08:31:44 GMT (envelope-from git) Date: Fri, 29 Oct 2021 08:31:44 GMT Message-Id: <202110290831.19T8Vi7W073872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 027a58aab2ce - main - qoriq_gpio: Implement interrupt controller functionality List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 027a58aab2cee5589a3a639afb77ecbb607f8fee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=027a58aab2cee5589a3a639afb77ecbb607f8fee commit 027a58aab2cee5589a3a639afb77ecbb607f8fee Author: Kornel Duleba AuthorDate: 2021-09-28 15:09:41 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:08:26 +0000 qoriq_gpio: Implement interrupt controller functionality The pic_* interface was used. Only edge interrupts are supported by this controller. Driver mutex had to be converted to a spin lock so that it can be used in the interrupt filter context. Two types of intr_map_data are supported - INTR_MAP_DATA_GPIO and INTR_MAP_DATA_FDT. This way interrupts can be allocated using the userspace gpio interrupt allocation method, as well as directly from simplebus. The latter can be used by devices that have its irq routed to a GPIO pin. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D32587 --- sys/dev/gpio/qoriq_gpio.c | 352 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 339 insertions(+), 13 deletions(-) diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c index dc4813e07b8e..0a78adbecb0f 100644 --- a/sys/dev/gpio/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -49,19 +50,25 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "gpio_if.h" +#include "pic_if.h" +#define BIT(x) (1 << (x)) #define MAXPIN (31) #define VALID_PIN(u) ((u) >= 0 && (u) <= MAXPIN) #define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ - GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL) + GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL | \ + GPIO_INTR_EDGE_FALLING | GPIO_INTR_EDGE_BOTH | \ + GPIO_PIN_PULLUP) -#define GPIO_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define GPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) +#define GPIO_LOCK(sc) mtx_lock_spin(&(sc)->sc_mtx) +#define GPIO_UNLOCK(sc) mtx_unlock_spin(&(sc)->sc_mtx) #define GPIO_LOCK_INIT(sc) \ mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ - "gpio", MTX_DEF) + "gpio", MTX_SPIN) #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define GPIO_GPDIR 0x0 @@ -72,12 +79,21 @@ __FBSDID("$FreeBSD$"); #define GPIO_GPICR 0x14 #define GPIO_GPIBE 0x18 +struct qoriq_gpio_irqsrc { + struct intr_irqsrc isrc; + int pin; +}; + struct qoriq_gpio_softc { device_t dev; device_t busdev; struct mtx sc_mtx; struct resource *sc_mem; /* Memory resource */ + struct resource *sc_intr; + void *intr_cookie; struct gpio_pin sc_pins[MAXPIN + 1]; + struct qoriq_gpio_irqsrc sc_isrcs[MAXPIN + 1]; + struct intr_map_data_gpio gdata; }; static device_t @@ -260,6 +276,254 @@ qoriq_gpio_pin_toggle(device_t dev, uint32_t pin) return (0); } +static void +qoriq_gpio_set_intr(struct qoriq_gpio_softc *sc, int pin, bool enable) +{ + uint32_t reg; + + reg = bus_read_4(sc->sc_mem, GPIO_GPIMR); + if (enable) + reg |= BIT(31 - pin); + else + reg &= ~BIT(31 - pin); + bus_write_4(sc->sc_mem, GPIO_GPIMR, reg); +} + +static void +qoriq_gpio_ack_intr(struct qoriq_gpio_softc *sc, int pin) +{ + uint32_t reg; + + reg = BIT(31 - pin); + bus_write_4(sc->sc_mem, GPIO_GPIER, reg); +} + +static int +qoriq_gpio_intr(void *arg) +{ + struct qoriq_gpio_softc *sc; + struct trapframe *tf; + uint32_t status; + int pin; + + sc = (struct qoriq_gpio_softc *)arg; + tf = curthread->td_intr_frame; + + status = bus_read_4(sc->sc_mem, GPIO_GPIER); + status &= bus_read_4(sc->sc_mem, GPIO_GPIMR); + while (status != 0) { + pin = ffs(status) - 1; + status &= ~BIT(pin); + pin = 31 - pin; + + if (intr_isrc_dispatch(&sc->sc_isrcs[pin].isrc, tf) != 0) { + GPIO_LOCK(sc); + qoriq_gpio_set_intr(sc, pin, false); + qoriq_gpio_ack_intr(sc, pin); + GPIO_UNLOCK(sc); + device_printf(sc->dev, + "Masking spurious pin interrupt %d\n", + pin); + } + } + + return (FILTER_HANDLED); +} + +static void +qoriq_gpio_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_softc *sc; + struct qoriq_gpio_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + GPIO_LOCK(sc); + qoriq_gpio_set_intr(sc, qisrc->pin, false); + GPIO_UNLOCK(sc); +} + +static void +qoriq_gpio_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_softc *sc; + struct qoriq_gpio_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + GPIO_LOCK(sc); + qoriq_gpio_set_intr(sc, qisrc->pin, true); + GPIO_UNLOCK(sc); +} + +static struct intr_map_data_gpio* +qoriq_gpio_convert_map_data(struct qoriq_gpio_softc *sc, struct intr_map_data *data) +{ + struct intr_map_data_gpio *gdata; + struct intr_map_data_fdt *daf; + + switch (data->type) { + case INTR_MAP_DATA_GPIO: + gdata = (struct intr_map_data_gpio *)data; + break; + case INTR_MAP_DATA_FDT: + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 2) + return (NULL); + + gdata = &sc->gdata; + gdata->gpio_pin_num = daf->cells[0]; + switch (daf->cells[1]) { + case IRQ_TYPE_LEVEL_LOW: + gdata->gpio_intr_mode = GPIO_INTR_LEVEL_LOW; + break; + case IRQ_TYPE_LEVEL_HIGH: + gdata->gpio_intr_mode = GPIO_INTR_LEVEL_HIGH; + break; + case IRQ_TYPE_EDGE_RISING: + gdata->gpio_intr_mode = GPIO_INTR_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_FALLING: + gdata->gpio_intr_mode = GPIO_INTR_EDGE_FALLING; + break; + case IRQ_TYPE_EDGE_BOTH: + gdata->gpio_intr_mode = GPIO_INTR_EDGE_BOTH; + break; + default: + return (NULL); + } + break; + default: + return (NULL); + } + + return (gdata); +} + + +static int +qoriq_gpio_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct qoriq_gpio_softc *sc; + struct intr_map_data_gpio *gdata; + int pin; + + sc = device_get_softc(dev); + + gdata = qoriq_gpio_convert_map_data(sc, data); + if (gdata == NULL) + return (EINVAL); + + pin = gdata->gpio_pin_num; + if (pin > MAXPIN) + return (EINVAL); + + *isrcp = &sc->sc_isrcs[pin].isrc; + return (0); +} + +static int +qoriq_gpio_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct qoriq_gpio_softc *sc; + struct intr_map_data_gpio *gdata; + struct qoriq_gpio_irqsrc *qisrc; + bool falling; + uint32_t reg; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + gdata = qoriq_gpio_convert_map_data(sc, data); + if (gdata == NULL) + return (EINVAL); + + if (gdata->gpio_intr_mode & GPIO_INTR_EDGE_BOTH) + falling = false; + else if (gdata->gpio_intr_mode & GPIO_INTR_EDGE_FALLING) + falling = true; + else + return (EOPNOTSUPP); + + GPIO_LOCK(sc); + reg = bus_read_4(sc->sc_mem, GPIO_GPICR); + if (falling) + reg |= BIT(31 - qisrc->pin); + else + reg &= ~BIT(31 - qisrc->pin); + bus_write_4(sc->sc_mem, GPIO_GPICR, reg); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +qoriq_gpio_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct qoriq_gpio_softc *sc; + struct qoriq_gpio_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + if (isrc->isrc_handlers > 0) + return (0); + + GPIO_LOCK(sc); + qoriq_gpio_set_intr(sc, qisrc->pin, false); + GPIO_UNLOCK(sc); + return (0); +} + +static void +qoriq_gpio_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_softc *sc; + struct qoriq_gpio_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + GPIO_LOCK(sc); + qoriq_gpio_ack_intr(sc, qisrc->pin); + GPIO_UNLOCK(sc); +} + + +static void +qoriq_gpio_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_softc *sc; + struct qoriq_gpio_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + GPIO_LOCK(sc); + qoriq_gpio_ack_intr(sc, qisrc->pin); + qoriq_gpio_set_intr(sc, qisrc->pin, true); + GPIO_UNLOCK(sc); +} + +static void +qoriq_gpio_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_softc *sc; + struct qoriq_gpio_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_irqsrc *)isrc; + + GPIO_LOCK(sc); + qoriq_gpio_set_intr(sc, qisrc->pin, false); + GPIO_UNLOCK(sc); +} + static struct ofw_compat_data gpio_matches[] = { {"fsl,qoriq-gpio", 1}, {"fsl,pq3-gpio", 1}, @@ -385,7 +649,9 @@ static int qoriq_gpio_attach(device_t dev) { struct qoriq_gpio_softc *sc = device_get_softc(dev); - int i, rid; + int i, rid, error; + const char *name; + intptr_t xref; sc->dev = dev; @@ -397,17 +663,46 @@ qoriq_gpio_attach(device_t dev) SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem == NULL) { device_printf(dev, "Can't allocate memory for device output port"); - qoriq_gpio_detach(dev); - return (ENOMEM); + error = ENOMEM; + goto fail; + } + + rid = 0; + sc->sc_intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->sc_intr == NULL) { + device_printf(dev, "Can't allocate interrupt resource.\n"); + error = ENOMEM; + goto fail; + } + + error = bus_setup_intr(dev, sc->sc_intr, INTR_TYPE_MISC | INTR_MPSAFE, + qoriq_gpio_intr, NULL, sc, &sc->intr_cookie); + if (error != 0) { + device_printf(dev, "Failed to setup interrupt.\n"); + goto fail; } - for (i = 0; i <= MAXPIN; i++) + name = device_get_nameunit(dev); + for (i = 0; i <= MAXPIN; i++) { sc->sc_pins[i].gp_caps = DEFAULT_CAPS; + sc->sc_isrcs[i].pin = i; + error = intr_isrc_register(&sc->sc_isrcs[i].isrc, + dev, 0, "%s,%u", name, i); + if (error != 0) + goto fail; + } + + xref = OF_xref_from_node(ofw_bus_get_node(dev)); + if (intr_pic_register(dev, xref) == NULL) { + error = ENXIO; + goto fail; + } sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { - qoriq_gpio_detach(dev); - return (ENOMEM); + error = ENXIO; + goto fail; } /* * Enable the GPIO Input Buffer for all GPIOs. @@ -419,7 +714,13 @@ qoriq_gpio_attach(device_t dev) OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); + bus_write_4(sc->sc_mem, GPIO_GPIER, 0xffffffff); + bus_write_4(sc->sc_mem, GPIO_GPIMR, 0); + return (0); +fail: + qoriq_gpio_detach(dev); + return (error); } static int @@ -435,6 +736,13 @@ qoriq_gpio_detach(device_t dev) rman_get_rid(sc->sc_mem), sc->sc_mem); } + if (sc->intr_cookie != NULL) + bus_teardown_intr(dev, sc->sc_intr, sc->intr_cookie); + + if (sc->sc_intr != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_intr), sc->sc_intr); + GPIO_LOCK_DESTROY(sc); return (0); @@ -446,6 +754,11 @@ static device_method_t qoriq_gpio_methods[] = { DEVMETHOD(device_attach, qoriq_gpio_attach), DEVMETHOD(device_detach, qoriq_gpio_detach), + /* Bus interface */ + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + /* GPIO protocol */ DEVMETHOD(gpio_get_bus, qoriq_gpio_get_bus), DEVMETHOD(gpio_pin_max, qoriq_gpio_pin_max), @@ -461,6 +774,16 @@ static device_method_t qoriq_gpio_methods[] = { DEVMETHOD(gpio_pin_access_32, qoriq_gpio_pin_access_32), DEVMETHOD(gpio_pin_config_32, qoriq_gpio_pin_config_32), + /* Interrupt controller */ + DEVMETHOD(pic_disable_intr, qoriq_gpio_disable_intr), + DEVMETHOD(pic_enable_intr, qoriq_gpio_enable_intr), + DEVMETHOD(pic_map_intr, qoriq_gpio_map_intr), + DEVMETHOD(pic_setup_intr, qoriq_gpio_setup_intr), + DEVMETHOD(pic_teardown_intr, qoriq_gpio_teardown_intr), + DEVMETHOD(pic_post_filter, qoriq_gpio_post_filter), + DEVMETHOD(pic_post_ithread, qoriq_gpio_post_ithread), + DEVMETHOD(pic_pre_ithread, qoriq_gpio_pre_ithread), + DEVMETHOD_END }; @@ -471,6 +794,9 @@ static driver_t qoriq_gpio_driver = { }; static devclass_t qoriq_gpio_devclass; -EARLY_DRIVER_MODULE(qoriq_gpio, simplebus, qoriq_gpio_driver, - qoriq_gpio_devclass, NULL, NULL, - BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +/* + * This needs to be loaded after interrupts are available and + * before consumers need it. + */ +EARLY_DRIVER_MODULE(qoriq_gpio, simplebus, qoriq_gpio_driver, qoriq_gpio_devclass, + NULL, NULL, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); From nobody Fri Oct 29 08:31:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4E17D18268BE; Fri, 29 Oct 2021 08:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgbJ13Swyz4SSM; Fri, 29 Oct 2021 08:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E63D614195; Fri, 29 Oct 2021 08:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T8Vhuo073849; Fri, 29 Oct 2021 08:31:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T8Vh5A073848; Fri, 29 Oct 2021 08:31:43 GMT (envelope-from git) Date: Fri, 29 Oct 2021 08:31:43 GMT Message-Id: <202110290831.19T8Vh5A073848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: d88aecce69c8 - main - felix: Add a sysctl to control timer routine frequency List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d88aecce69c82e9312c4e5e4e9eab4c56284925f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=d88aecce69c82e9312c4e5e4e9eab4c56284925f commit d88aecce69c82e9312c4e5e4e9eab4c56284925f Author: Kornel Duleba AuthorDate: 2021-10-25 13:18:27 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:08:26 +0000 felix: Add a sysctl to control timer routine frequency Driver polls status of all PHYs connected to the switch in a fixed interval. Add a sysctl that allows to control frequency of that. The value is expressed in ticks and defaults to "hz", or 1 second. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/dev/etherswitch/felix/felix.c | 38 ++++++++++++++++++++++++++++++++++- sys/dev/etherswitch/felix/felix_var.h | 2 ++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/sys/dev/etherswitch/felix/felix.c b/sys/dev/etherswitch/felix/felix.c index f57a6e1daa0c..a80f4f8d15ae 100644 --- a/sys/dev/etherswitch/felix/felix.c +++ b/sys/dev/etherswitch/felix/felix.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -325,6 +326,33 @@ felix_setup(felix_softc_t sc) return (0); } +static int +felix_timer_rate(SYSCTL_HANDLER_ARGS) +{ + felix_softc_t sc; + int error, value, old; + + sc = arg1; + + old = value = sc->timer_ticks; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + if (value < 0) + return (EINVAL); + + if (value == old) + return (0); + + FELIX_LOCK(sc); + sc->timer_ticks = value; + callout_reset(&sc->tick_callout, sc->timer_ticks, felix_tick, sc); + FELIX_UNLOCK(sc); + + return (0); +} + static int felix_attach(device_t dev) { @@ -426,6 +454,13 @@ felix_attach(device_t dev) if (error != 0) goto out_fail; + sc->timer_ticks = hz; /* Default to 1s. */ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "timer_ticks", CTLTYPE_INT | CTLFLAG_RW, + sc, 0, felix_timer_rate, "I", + "Number of ticks between timer invocations"); + /* The tick routine has to be called with the lock held. */ FELIX_LOCK(sc); felix_tick(sc); @@ -922,7 +957,8 @@ felix_tick(void *arg) MPASS(mii != NULL); mii_tick(mii); } - callout_reset(&sc->tick_callout, hz, felix_tick, sc); + if (sc->timer_ticks != 0) + callout_reset(&sc->tick_callout, sc->timer_ticks, felix_tick, sc); } static int diff --git a/sys/dev/etherswitch/felix/felix_var.h b/sys/dev/etherswitch/felix/felix_var.h index d891419793b7..15f43ec6a3d2 100644 --- a/sys/dev/etherswitch/felix/felix_var.h +++ b/sys/dev/etherswitch/felix/felix_var.h @@ -102,6 +102,8 @@ typedef struct felix_softc { int vlan_mode; int vlans[FELIX_NUM_VLANS]; + + uint32_t timer_ticks; } *felix_softc_t; #endif From nobody Fri Oct 29 09:00:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 07BC01832796; Fri, 29 Oct 2021 09:00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgbwp6vBzz4d0W; Fri, 29 Oct 2021 09:00:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CD21014369; Fri, 29 Oct 2021 09:00:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T90A8b005686; Fri, 29 Oct 2021 09:00:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T90AlT005679; Fri, 29 Oct 2021 09:00:10 GMT (envelope-from git) Date: Fri, 29 Oct 2021 09:00:10 GMT Message-Id: <202110290900.19T90AlT005679@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: f5639a06b80c - main - mvneta: fix encap property List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5639a06b80caf363a28f9b99e0ee697bb32b555 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=f5639a06b80caf363a28f9b99e0ee697bb32b555 commit f5639a06b80caf363a28f9b99e0ee697bb32b555 Author: Wojciech Macek AuthorDate: 2021-10-29 08:56:57 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 08:56:57 +0000 mvneta: fix encap property Fix MVNETA encap property. --- sys/dev/neta/if_mvneta_fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/neta/if_mvneta_fdt.c b/sys/dev/neta/if_mvneta_fdt.c index 85948adb69d4..102ee1f1c884 100644 --- a/sys/dev/neta/if_mvneta_fdt.c +++ b/sys/dev/neta/if_mvneta_fdt.c @@ -133,7 +133,7 @@ mvneta_fdt_attach(device_t dev) } if (ofw_bus_has_prop(dev, "tx-csum-limit")) { - err = OF_getprop(ofw_bus_get_node(dev), "tx-csum-limit", + err = OF_getencprop(ofw_bus_get_node(dev), "tx-csum-limit", &tx_csum_limit, sizeof(tx_csum_limit)); if (err <= 0) { device_printf(dev, From nobody Fri Oct 29 09:05:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EDE1F1835318; Fri, 29 Oct 2021 09:05: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgc2d6Pl7z4fgD; Fri, 29 Oct 2021 09:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BBF8414889; Fri, 29 Oct 2021 09:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19T95D9p015616; Fri, 29 Oct 2021 09:05:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19T95Dhi015615; Fri, 29 Oct 2021 09:05:13 GMT (envelope-from git) Date: Fri, 29 Oct 2021 09:05:13 GMT Message-Id: <202110290905.19T95Dhi015615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 97a74bbe38eb - main - stress2: Added a regression test List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97a74bbe38ebdf682e583d8b92f49e137fa2b7c4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=97a74bbe38ebdf682e583d8b92f49e137fa2b7c4 commit 97a74bbe38ebdf682e583d8b92f49e137fa2b7c4 Author: Peter Holm AuthorDate: 2021-10-29 09:04:49 +0000 Commit: Peter Holm CommitDate: 2021-10-29 09:04:49 +0000 stress2: Added a regression test --- tools/test/stress2/misc/execpath.sh | 105 ++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/tools/test/stress2/misc/execpath.sh b/tools/test/stress2/misc/execpath.sh new file mode 100755 index 000000000000..4323e3b7d505 --- /dev/null +++ b/tools/test/stress2/misc/execpath.sh @@ -0,0 +1,105 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# 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. +# + +# Bug 248184 - readlink("/proc/curproc/file") returns arbitrary correct name for programs with more than one link (name) +# Test scenario for D32611 "exec: provide right hardlink name in AT_EXECPATH" + +. ../default.cfg +[ `id -u` -ne 0 ] && echo "Must be root!" && exit 1 + +dir=/tmp +odir=`pwd` +cd $dir +sed '1,/^EOF/d' < $odir/$0 > $dir/execpath.c +mycc -o execpath -Wall -Wextra -O0 -g execpath.c || exit 1 +rm -f execpath.c +cd $odir + +set -e +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +[ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 2g -u $mdstart +bsdlabel -w md$mdstart auto +newfs $newfs_flags md${mdstart}$part > /dev/null +mount /dev/md${mdstart}$part $mntpoint +set +e + +cd $mntpoint +mkdir d1 d2 +cp /bin/sleep . +ln sleep d1/sleep +ln sleep d2/sleep +s=0 +for p in $mntpoint/sleep $mntpoint/d1/sleep $mntpoint/d2/sleep; do + (cd `dirname $p`; ./`basename $p` 10) & + /bin/sleep .2 + path=`procstat binary $! | awk "/$!/ {print \\$NF}"` + kill $! + wait + [ "$path" != "$p" ] && { s=1; echo "fail path=$path : prog=$p"; } +done +mv /tmp/execpath d1 +ln d1/execpath d2/execpath + +r=`./d1/execpath` +echo $r | grep -q "/d1/" || { s=1; echo "fail: $r. Expected d1 @ 1"; } +r=`./d2/execpath` +echo $r | grep -q "/d2/" || { s=1; echo "fail: $r. Expected d2 @ 2"; } +r=`(cd d1; ./execpath)` +echo $r | grep -q "/d1/" || { s=1; echo "fail: $r. Expected d1 @ 3"; } +r=`(cd d2; ./execpath)` +echo $r | grep -q "/d2/" || { s=1; echo "fail: $r. Expected d2 @ 4"; } + +cd $odir + +for i in `jot 6`; do + mount | grep -q "on $mntpoint " || break + umount $mntpoint && break || sleep 10 + [ $i -eq 6 ] && + { echo FATAL; fstat -mf $mntpoint; exit 1; } +done +mdconfig -d -u $mdstart +exit $s + +EOF +/* Test scenario by Tobias Kortkamp */ + +#include +#include +#include + +int +main(void) +{ + char pathname[PATH_MAX]; + + elf_aux_info(AT_EXECPATH, pathname, PATH_MAX); + puts(pathname); + return 0; +} From nobody Fri Oct 29 10:06:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 494E8182D199; Fri, 29 Oct 2021 10:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgdP71WZ0z4tvv; Fri, 29 Oct 2021 10:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 14B3A15338; Fri, 29 Oct 2021 10:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TA6IrD096797; Fri, 29 Oct 2021 10:06:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TA6ILG096796; Fri, 29 Oct 2021 10:06:18 GMT (envelope-from git) Date: Fri, 29 Oct 2021 10:06:18 GMT Message-Id: <202110291006.19TA6ILG096796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 680920237bdd - main - Revert "qoriq_gpio: Implement interrupt controller functionality" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 680920237bddaa38da55d2a67e8daf080a38b1dc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=680920237bddaa38da55d2a67e8daf080a38b1dc commit 680920237bddaa38da55d2a67e8daf080a38b1dc Author: Wojciech Macek AuthorDate: 2021-10-29 10:05:55 +0000 Commit: Wojciech Macek CommitDate: 2021-10-29 10:05:55 +0000 Revert "qoriq_gpio: Implement interrupt controller functionality" This reverts commit 027a58aab2cee5589a3a639afb77ecbb607f8fee. --- sys/dev/gpio/qoriq_gpio.c | 352 ++-------------------------------------------- 1 file changed, 13 insertions(+), 339 deletions(-) diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c index 0a78adbecb0f..dc4813e07b8e 100644 --- a/sys/dev/gpio/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -50,25 +49,19 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include "gpio_if.h" -#include "pic_if.h" -#define BIT(x) (1 << (x)) #define MAXPIN (31) #define VALID_PIN(u) ((u) >= 0 && (u) <= MAXPIN) #define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ - GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL | \ - GPIO_INTR_EDGE_FALLING | GPIO_INTR_EDGE_BOTH | \ - GPIO_PIN_PULLUP) + GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL) -#define GPIO_LOCK(sc) mtx_lock_spin(&(sc)->sc_mtx) -#define GPIO_UNLOCK(sc) mtx_unlock_spin(&(sc)->sc_mtx) +#define GPIO_LOCK(sc) mtx_lock(&(sc)->sc_mtx) +#define GPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define GPIO_LOCK_INIT(sc) \ mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ - "gpio", MTX_SPIN) + "gpio", MTX_DEF) #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define GPIO_GPDIR 0x0 @@ -79,21 +72,12 @@ __FBSDID("$FreeBSD$"); #define GPIO_GPICR 0x14 #define GPIO_GPIBE 0x18 -struct qoriq_gpio_irqsrc { - struct intr_irqsrc isrc; - int pin; -}; - struct qoriq_gpio_softc { device_t dev; device_t busdev; struct mtx sc_mtx; struct resource *sc_mem; /* Memory resource */ - struct resource *sc_intr; - void *intr_cookie; struct gpio_pin sc_pins[MAXPIN + 1]; - struct qoriq_gpio_irqsrc sc_isrcs[MAXPIN + 1]; - struct intr_map_data_gpio gdata; }; static device_t @@ -276,254 +260,6 @@ qoriq_gpio_pin_toggle(device_t dev, uint32_t pin) return (0); } -static void -qoriq_gpio_set_intr(struct qoriq_gpio_softc *sc, int pin, bool enable) -{ - uint32_t reg; - - reg = bus_read_4(sc->sc_mem, GPIO_GPIMR); - if (enable) - reg |= BIT(31 - pin); - else - reg &= ~BIT(31 - pin); - bus_write_4(sc->sc_mem, GPIO_GPIMR, reg); -} - -static void -qoriq_gpio_ack_intr(struct qoriq_gpio_softc *sc, int pin) -{ - uint32_t reg; - - reg = BIT(31 - pin); - bus_write_4(sc->sc_mem, GPIO_GPIER, reg); -} - -static int -qoriq_gpio_intr(void *arg) -{ - struct qoriq_gpio_softc *sc; - struct trapframe *tf; - uint32_t status; - int pin; - - sc = (struct qoriq_gpio_softc *)arg; - tf = curthread->td_intr_frame; - - status = bus_read_4(sc->sc_mem, GPIO_GPIER); - status &= bus_read_4(sc->sc_mem, GPIO_GPIMR); - while (status != 0) { - pin = ffs(status) - 1; - status &= ~BIT(pin); - pin = 31 - pin; - - if (intr_isrc_dispatch(&sc->sc_isrcs[pin].isrc, tf) != 0) { - GPIO_LOCK(sc); - qoriq_gpio_set_intr(sc, pin, false); - qoriq_gpio_ack_intr(sc, pin); - GPIO_UNLOCK(sc); - device_printf(sc->dev, - "Masking spurious pin interrupt %d\n", - pin); - } - } - - return (FILTER_HANDLED); -} - -static void -qoriq_gpio_disable_intr(device_t dev, struct intr_irqsrc *isrc) -{ - struct qoriq_gpio_softc *sc; - struct qoriq_gpio_irqsrc *qisrc; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - GPIO_LOCK(sc); - qoriq_gpio_set_intr(sc, qisrc->pin, false); - GPIO_UNLOCK(sc); -} - -static void -qoriq_gpio_enable_intr(device_t dev, struct intr_irqsrc *isrc) -{ - struct qoriq_gpio_softc *sc; - struct qoriq_gpio_irqsrc *qisrc; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - GPIO_LOCK(sc); - qoriq_gpio_set_intr(sc, qisrc->pin, true); - GPIO_UNLOCK(sc); -} - -static struct intr_map_data_gpio* -qoriq_gpio_convert_map_data(struct qoriq_gpio_softc *sc, struct intr_map_data *data) -{ - struct intr_map_data_gpio *gdata; - struct intr_map_data_fdt *daf; - - switch (data->type) { - case INTR_MAP_DATA_GPIO: - gdata = (struct intr_map_data_gpio *)data; - break; - case INTR_MAP_DATA_FDT: - daf = (struct intr_map_data_fdt *)data; - if (daf->ncells != 2) - return (NULL); - - gdata = &sc->gdata; - gdata->gpio_pin_num = daf->cells[0]; - switch (daf->cells[1]) { - case IRQ_TYPE_LEVEL_LOW: - gdata->gpio_intr_mode = GPIO_INTR_LEVEL_LOW; - break; - case IRQ_TYPE_LEVEL_HIGH: - gdata->gpio_intr_mode = GPIO_INTR_LEVEL_HIGH; - break; - case IRQ_TYPE_EDGE_RISING: - gdata->gpio_intr_mode = GPIO_INTR_EDGE_RISING; - break; - case IRQ_TYPE_EDGE_FALLING: - gdata->gpio_intr_mode = GPIO_INTR_EDGE_FALLING; - break; - case IRQ_TYPE_EDGE_BOTH: - gdata->gpio_intr_mode = GPIO_INTR_EDGE_BOTH; - break; - default: - return (NULL); - } - break; - default: - return (NULL); - } - - return (gdata); -} - - -static int -qoriq_gpio_map_intr(device_t dev, struct intr_map_data *data, - struct intr_irqsrc **isrcp) -{ - struct qoriq_gpio_softc *sc; - struct intr_map_data_gpio *gdata; - int pin; - - sc = device_get_softc(dev); - - gdata = qoriq_gpio_convert_map_data(sc, data); - if (gdata == NULL) - return (EINVAL); - - pin = gdata->gpio_pin_num; - if (pin > MAXPIN) - return (EINVAL); - - *isrcp = &sc->sc_isrcs[pin].isrc; - return (0); -} - -static int -qoriq_gpio_setup_intr(device_t dev, struct intr_irqsrc *isrc, - struct resource *res, struct intr_map_data *data) -{ - struct qoriq_gpio_softc *sc; - struct intr_map_data_gpio *gdata; - struct qoriq_gpio_irqsrc *qisrc; - bool falling; - uint32_t reg; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - gdata = qoriq_gpio_convert_map_data(sc, data); - if (gdata == NULL) - return (EINVAL); - - if (gdata->gpio_intr_mode & GPIO_INTR_EDGE_BOTH) - falling = false; - else if (gdata->gpio_intr_mode & GPIO_INTR_EDGE_FALLING) - falling = true; - else - return (EOPNOTSUPP); - - GPIO_LOCK(sc); - reg = bus_read_4(sc->sc_mem, GPIO_GPICR); - if (falling) - reg |= BIT(31 - qisrc->pin); - else - reg &= ~BIT(31 - qisrc->pin); - bus_write_4(sc->sc_mem, GPIO_GPICR, reg); - GPIO_UNLOCK(sc); - - return (0); -} - -static int -qoriq_gpio_teardown_intr(device_t dev, struct intr_irqsrc *isrc, - struct resource *res, struct intr_map_data *data) -{ - struct qoriq_gpio_softc *sc; - struct qoriq_gpio_irqsrc *qisrc; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - if (isrc->isrc_handlers > 0) - return (0); - - GPIO_LOCK(sc); - qoriq_gpio_set_intr(sc, qisrc->pin, false); - GPIO_UNLOCK(sc); - return (0); -} - -static void -qoriq_gpio_post_filter(device_t dev, struct intr_irqsrc *isrc) -{ - struct qoriq_gpio_softc *sc; - struct qoriq_gpio_irqsrc *qisrc; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - GPIO_LOCK(sc); - qoriq_gpio_ack_intr(sc, qisrc->pin); - GPIO_UNLOCK(sc); -} - - -static void -qoriq_gpio_post_ithread(device_t dev, struct intr_irqsrc *isrc) -{ - struct qoriq_gpio_softc *sc; - struct qoriq_gpio_irqsrc *qisrc; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - GPIO_LOCK(sc); - qoriq_gpio_ack_intr(sc, qisrc->pin); - qoriq_gpio_set_intr(sc, qisrc->pin, true); - GPIO_UNLOCK(sc); -} - -static void -qoriq_gpio_pre_ithread(device_t dev, struct intr_irqsrc *isrc) -{ - struct qoriq_gpio_softc *sc; - struct qoriq_gpio_irqsrc *qisrc; - - sc = device_get_softc(dev); - qisrc = (struct qoriq_gpio_irqsrc *)isrc; - - GPIO_LOCK(sc); - qoriq_gpio_set_intr(sc, qisrc->pin, false); - GPIO_UNLOCK(sc); -} - static struct ofw_compat_data gpio_matches[] = { {"fsl,qoriq-gpio", 1}, {"fsl,pq3-gpio", 1}, @@ -649,9 +385,7 @@ static int qoriq_gpio_attach(device_t dev) { struct qoriq_gpio_softc *sc = device_get_softc(dev); - int i, rid, error; - const char *name; - intptr_t xref; + int i, rid; sc->dev = dev; @@ -663,46 +397,17 @@ qoriq_gpio_attach(device_t dev) SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem == NULL) { device_printf(dev, "Can't allocate memory for device output port"); - error = ENOMEM; - goto fail; - } - - rid = 0; - sc->sc_intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE | RF_SHAREABLE); - if (sc->sc_intr == NULL) { - device_printf(dev, "Can't allocate interrupt resource.\n"); - error = ENOMEM; - goto fail; - } - - error = bus_setup_intr(dev, sc->sc_intr, INTR_TYPE_MISC | INTR_MPSAFE, - qoriq_gpio_intr, NULL, sc, &sc->intr_cookie); - if (error != 0) { - device_printf(dev, "Failed to setup interrupt.\n"); - goto fail; + qoriq_gpio_detach(dev); + return (ENOMEM); } - name = device_get_nameunit(dev); - for (i = 0; i <= MAXPIN; i++) { + for (i = 0; i <= MAXPIN; i++) sc->sc_pins[i].gp_caps = DEFAULT_CAPS; - sc->sc_isrcs[i].pin = i; - error = intr_isrc_register(&sc->sc_isrcs[i].isrc, - dev, 0, "%s,%u", name, i); - if (error != 0) - goto fail; - } - - xref = OF_xref_from_node(ofw_bus_get_node(dev)); - if (intr_pic_register(dev, xref) == NULL) { - error = ENXIO; - goto fail; - } sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { - error = ENXIO; - goto fail; + qoriq_gpio_detach(dev); + return (ENOMEM); } /* * Enable the GPIO Input Buffer for all GPIOs. @@ -714,13 +419,7 @@ qoriq_gpio_attach(device_t dev) OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); - bus_write_4(sc->sc_mem, GPIO_GPIER, 0xffffffff); - bus_write_4(sc->sc_mem, GPIO_GPIMR, 0); - return (0); -fail: - qoriq_gpio_detach(dev); - return (error); } static int @@ -736,13 +435,6 @@ qoriq_gpio_detach(device_t dev) rman_get_rid(sc->sc_mem), sc->sc_mem); } - if (sc->intr_cookie != NULL) - bus_teardown_intr(dev, sc->sc_intr, sc->intr_cookie); - - if (sc->sc_intr != NULL) - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(sc->sc_intr), sc->sc_intr); - GPIO_LOCK_DESTROY(sc); return (0); @@ -754,11 +446,6 @@ static device_method_t qoriq_gpio_methods[] = { DEVMETHOD(device_attach, qoriq_gpio_attach), DEVMETHOD(device_detach, qoriq_gpio_detach), - /* Bus interface */ - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - /* GPIO protocol */ DEVMETHOD(gpio_get_bus, qoriq_gpio_get_bus), DEVMETHOD(gpio_pin_max, qoriq_gpio_pin_max), @@ -774,16 +461,6 @@ static device_method_t qoriq_gpio_methods[] = { DEVMETHOD(gpio_pin_access_32, qoriq_gpio_pin_access_32), DEVMETHOD(gpio_pin_config_32, qoriq_gpio_pin_config_32), - /* Interrupt controller */ - DEVMETHOD(pic_disable_intr, qoriq_gpio_disable_intr), - DEVMETHOD(pic_enable_intr, qoriq_gpio_enable_intr), - DEVMETHOD(pic_map_intr, qoriq_gpio_map_intr), - DEVMETHOD(pic_setup_intr, qoriq_gpio_setup_intr), - DEVMETHOD(pic_teardown_intr, qoriq_gpio_teardown_intr), - DEVMETHOD(pic_post_filter, qoriq_gpio_post_filter), - DEVMETHOD(pic_post_ithread, qoriq_gpio_post_ithread), - DEVMETHOD(pic_pre_ithread, qoriq_gpio_pre_ithread), - DEVMETHOD_END }; @@ -794,9 +471,6 @@ static driver_t qoriq_gpio_driver = { }; static devclass_t qoriq_gpio_devclass; -/* - * This needs to be loaded after interrupts are available and - * before consumers need it. - */ -EARLY_DRIVER_MODULE(qoriq_gpio, simplebus, qoriq_gpio_driver, qoriq_gpio_devclass, - NULL, NULL, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); +EARLY_DRIVER_MODULE(qoriq_gpio, simplebus, qoriq_gpio_driver, + qoriq_gpio_devclass, NULL, NULL, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); From nobody Fri Oct 29 13:56:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 355ED18203E6; Fri, 29 Oct 2021 13:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgkVS0btMz4tTh; Fri, 29 Oct 2021 13:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E4ACE1837D; Fri, 29 Oct 2021 13:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TDuFtd001325; Fri, 29 Oct 2021 13:56:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TDuFgx001324; Fri, 29 Oct 2021 13:56:15 GMT (envelope-from git) Date: Fri, 29 Oct 2021 13:56:15 GMT Message-Id: <202110291356.19TDuFgx001324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 6547153e4618 - main - linux: Fix ptrace panic with ERESTART List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6547153e4618c3b57e5f76062de006a04ecbd64b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6547153e4618c3b57e5f76062de006a04ecbd64b commit 6547153e4618c3b57e5f76062de006a04ecbd64b Author: Edward Tomasz Napierala AuthorDate: 2021-10-29 13:21:21 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-29 13:55:59 +0000 linux: Fix ptrace panic with ERESTART Translate ERESTART into Linux "internal" errno ERESTARTSYS. This fixes the erestartsys.gen.test from strace(1). Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32623 --- sys/amd64/linux/linux_ptrace.c | 4 ++++ sys/compat/linux/linux_errno.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index b7d0838fb054..d16e875ba5cf 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -639,6 +640,9 @@ linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, * the ptracing process fall back to another method. */ si.op = LINUX_PTRACE_SYSCALL_INFO_NONE; + } else if (sr.sr_error == ERESTART) { + si.exit.rval = -LINUX_ERESTARTSYS; + si.exit.is_error = 1; } else { si.exit.rval = bsd_to_linux_errno(sr.sr_error); si.exit.is_error = 1; diff --git a/sys/compat/linux/linux_errno.h b/sys/compat/linux/linux_errno.h index 46e6f46e202b..0eae6684ce44 100644 --- a/sys/compat/linux/linux_errno.h +++ b/sys/compat/linux/linux_errno.h @@ -182,4 +182,10 @@ #define LINUX_ELAST LINUX_EHWPOISON +/* + * This is a special "internal" errno that must never be returned + * to a Linux process, but might be observed via ptrace(2). + */ +#define LINUX_ERESTARTSYS 512 + #endif /* _LINUX_ERRNO_H_ */ From nobody Fri Oct 29 14:06:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BF96718238E0; Fri, 29 Oct 2021 14:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgkjk52J4z4wYD; Fri, 29 Oct 2021 14:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8D10C180E9; Fri, 29 Oct 2021 14:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TE628a015950; Fri, 29 Oct 2021 14:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TE622d015949; Fri, 29 Oct 2021 14:06:02 GMT (envelope-from git) Date: Fri, 29 Oct 2021 14:06:02 GMT Message-Id: <202110291406.19TE622d015949@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: ad09e2c8cfbc - main - Don't build sanitizer runtimes under WITHOUT_CXX List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad09e2c8cfbc2cf6f2b8826c121d6de8b3bfe96d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ad09e2c8cfbc2cf6f2b8826c121d6de8b3bfe96d commit ad09e2c8cfbc2cf6f2b8826c121d6de8b3bfe96d Author: Ed Maste AuthorDate: 2021-10-29 00:49:12 +0000 Commit: Ed Maste CommitDate: 2021-10-29 14:05:49 +0000 Don't build sanitizer runtimes under WITHOUT_CXX In the past we built the sanitizer runtimes when building Clang (and using Clang as the compiler) but 7676b388adbc changed this to be conditional only on using Clang, to make the runtimes available for external Clang. They fail to build when WITHOUT_CXX is set though, so add MK_CXX as part of the condition. Reported by: Michael Dexter, Build Option Survey Reviewed by: imp, jrtc27 Fixes: 7676b388adbc ("Always build the sanitizer runtimes...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32731 --- lib/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 3f30917173af..93761cc06b21 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -176,10 +176,9 @@ SUBDIR.${MK_KERBEROS_SUPPORT}+= libcom_err SUBDIR.${MK_LDNS}+= libldns SUBDIR.${MK_STATS}+= libstats -# The libraries under libclang_rt can only be built by clang, and only make -# sense to build when clang is enabled at all. Furthermore, they can only be -# built for certain architectures. -.if ${COMPILER_TYPE} == "clang" && \ +# The libraries under libclang_rt can only be built by clang and when we enable +# C++ support. Furthermore, they can only be built for certain architectures. +.if ${COMPILER_TYPE} == "clang" && ${MK_CXX} != "no" && \ (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \ ${MACHINE_CPUARCH} == "powerpc") From nobody Fri Oct 29 14:10:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0D5701826675; Fri, 29 Oct 2021 14:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgkpw6mW8z4xvN; Fri, 29 Oct 2021 14:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C8B641855F; Fri, 29 Oct 2021 14:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TEAWFa024581; Fri, 29 Oct 2021 14:10:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TEAWfa024580; Fri, 29 Oct 2021 14:10:32 GMT (envelope-from git) Date: Fri, 29 Oct 2021 14:10:32 GMT Message-Id: <202110291410.19TEAWfa024580@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: 0e1c864898c1 - main - src.opts.mk: Add WITHOUT_CXX dependencies List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e1c864898c1803835b1be0d59342ca761051db8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0e1c864898c1803835b1be0d59342ca761051db8 commit 0e1c864898c1803835b1be0d59342ca761051db8 Author: Ed Maste AuthorDate: 2021-10-29 01:43:33 +0000 Commit: Ed Maste CommitDate: 2021-10-29 14:06:27 +0000 src.opts.mk: Add WITHOUT_CXX dependencies OFED, OPENMP, and PMC depend on C++ support. Force them off when building WITHOUT_CXX. Reported by: Michael Dexter, Build Option Survey Reviewed by: imp, jrtc27 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32730 --- share/mk/src.opts.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 3d8f7b071904..4b9a9953f8ee 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -393,6 +393,9 @@ MK_KERBEROS_SUPPORT:= no .if ${MK_CXX} == "no" MK_CLANG:= no MK_GOOGLETEST:= no +MK_OFED:= no +MK_OPENMP:= no +MK_PMC:= no MK_TESTS:= no .endif From nobody Fri Oct 29 14:10:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 845F518267CB; Fri, 29 Oct 2021 14:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgkpy1RD0z4y4j; Fri, 29 Oct 2021 14:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0045E18637; Fri, 29 Oct 2021 14:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TEAX53024605; Fri, 29 Oct 2021 14:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TEAXDh024604; Fri, 29 Oct 2021 14:10:33 GMT (envelope-from git) Date: Fri, 29 Oct 2021 14:10:33 GMT Message-Id: <202110291410.19TEAXDh024604@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: 6ce99625ca7a - main - Do not build libatf-c++ when WITHOUT_CXX List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ce99625ca7acecaa64723f0440007eb3f60f53d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6ce99625ca7acecaa64723f0440007eb3f60f53d commit 6ce99625ca7acecaa64723f0440007eb3f60f53d Author: Ed Maste AuthorDate: 2021-10-29 03:01:21 +0000 Commit: Ed Maste CommitDate: 2021-10-29 14:08:24 +0000 Do not build libatf-c++ when WITHOUT_CXX libatf-c++ requires C++ support. From jrtc27: bit slightly odd this isn't gated by MK_TESTS (which itself depends on MK_CXX), but this makes sense given the current behaviour. Reported by: Michael Dexter, Build Option Survey Reviewed by: imp, jrtc27 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32732 --- lib/atf/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/atf/Makefile b/lib/atf/Makefile index baadf535b424..05c7973fdc02 100644 --- a/lib/atf/Makefile +++ b/lib/atf/Makefile @@ -27,8 +27,8 @@ .include -SUBDIR= libatf-c \ - libatf-c++ \ +SUBDIR= libatf-c +SUBDIR.${MK_CXX}+= libatf-c++ SUBDIR.${MK_TESTS}+= tests From nobody Fri Oct 29 14:28:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ED201182CAE5; Fri, 29 Oct 2021 14:28: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HglCR6SHdz53V5; Fri, 29 Oct 2021 14:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BB45018A2A; Fri, 29 Oct 2021 14:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TESJCR042184; Fri, 29 Oct 2021 14:28:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TESJgh042183; Fri, 29 Oct 2021 14:28:19 GMT (envelope-from git) Date: Fri, 29 Oct 2021 14:28:19 GMT Message-Id: <202110291428.19TESJgh042183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: c8c93b151678 - main - linux: Also translate the signal if the code is CLD_KILLED List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8c93b151678b57d86cd50509c9cbb863bbe9e57 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=c8c93b151678b57d86cd50509c9cbb863bbe9e57 commit c8c93b151678b57d86cd50509c9cbb863bbe9e57 Author: Edward Tomasz Napierala AuthorDate: 2021-10-29 13:56:43 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-29 14:28:00 +0000 linux: Also translate the signal if the code is CLD_KILLED This fixes ./waitid.gen.test from the strace(1) test suite. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32617 --- sys/compat/linux/linux_signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 0c71d510e0f2..786bcab2bf5e 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -688,7 +688,7 @@ siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig) lsi->lsi_pid = si->si_pid; lsi->lsi_uid = si->si_uid; - if (si->si_code == CLD_STOPPED) + if (si->si_code == CLD_STOPPED || si->si_code == CLD_KILLED) lsi->lsi_status = bsd_to_linux_signal(si->si_status); else if (si->si_code == CLD_CONTINUED) lsi->lsi_status = bsd_to_linux_signal(SIGCONT); From nobody Fri Oct 29 15:04:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CE689183B8F2; Fri, 29 Oct 2021 15:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgm1F5Wgzz3FN6; Fri, 29 Oct 2021 15:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 99EE419516; Fri, 29 Oct 2021 15:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TF4XEE095347; Fri, 29 Oct 2021 15:04:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TF4XpF095346; Fri, 29 Oct 2021 15:04:33 GMT (envelope-from git) Date: Fri, 29 Oct 2021 15:04:33 GMT Message-Id: <202110291504.19TF4XpF095346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: f939dccfd770 - main - linux: Make PTRACE_GETREGSET return proper buffer size List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f939dccfd770df2f9070cd30aa52105b7afe1bde Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=f939dccfd770df2f9070cd30aa52105b7afe1bde commit f939dccfd770df2f9070cd30aa52105b7afe1bde Author: Edward Tomasz Napierala AuthorDate: 2021-10-29 14:28:56 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-29 14:31:33 +0000 linux: Make PTRACE_GETREGSET return proper buffer size This fixes Chrome warning: [1022/152319.328632:ERROR:ptracer.cc(476)] Unexpected registers size 0 != 216, 68 Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32616 --- sys/amd64/linux/linux_ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index d16e875ba5cf..275450d63b2d 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -540,7 +540,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) return (error); } - iov.iov_len -= len; + iov.iov_len = len; error = copyout(&iov, (void *)data, sizeof(iov)); if (error != 0) { linux_msg(td, "iov copyout error %d", error); From nobody Fri Oct 29 16:34:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1E08718371BB; Fri, 29 Oct 2021 16:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgp1F0LfQz3tXX; Fri, 29 Oct 2021 16:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DFDE51A74E; Fri, 29 Oct 2021 16:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TGYeLN015353; Fri, 29 Oct 2021 16:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TGYeDc015352; Fri, 29 Oct 2021 16:34:40 GMT (envelope-from git) Date: Fri, 29 Oct 2021 16:34:40 GMT Message-Id: <202110291634.19TGYeDc015352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: ad0379660d0c - main - linux: make PTRACE_GETREGS return correct struct List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad0379660d0c77aaf0ca6ec19472b7bb173c5794 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=ad0379660d0c77aaf0ca6ec19472b7bb173c5794 commit ad0379660d0c77aaf0ca6ec19472b7bb173c5794 Author: Edward Tomasz Napierala AuthorDate: 2021-10-29 15:18:13 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-29 15:18:28 +0000 linux: make PTRACE_GETREGS return correct struct Previously it returned a shorter struct. I can't find any modern software that uses it, but tests/ptrace from strace(1) repo complained. Differential Revision: https://reviews.freebsd.org/D32601 --- sys/amd64/linux/linux_ptrace.c | 62 ++++++++++++------------------------------ 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 275450d63b2d..0f06f2aa9c5c 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -214,38 +214,6 @@ struct syscall_info { }; }; -/* - * Translate amd64 ptrace registers between Linux and FreeBSD formats. - * The translation is pretty straighforward, for all registers but - * orig_rax on Linux side and r_trapno and r_err in FreeBSD. - */ -static void -map_regs_to_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) -{ - - l_reg->r15 = b_reg->r_r15; - l_reg->r14 = b_reg->r_r14; - l_reg->r13 = b_reg->r_r13; - l_reg->r12 = b_reg->r_r12; - l_reg->rbp = b_reg->r_rbp; - l_reg->rbx = b_reg->r_rbx; - l_reg->r11 = b_reg->r_r11; - l_reg->r10 = b_reg->r_r10; - l_reg->r9 = b_reg->r_r9; - l_reg->r8 = b_reg->r_r8; - l_reg->rax = b_reg->r_rax; - l_reg->rcx = b_reg->r_rcx; - l_reg->rdx = b_reg->r_rdx; - l_reg->rsi = b_reg->r_rsi; - l_reg->rdi = b_reg->r_rdi; - l_reg->orig_rax = b_reg->r_rax; - l_reg->rip = b_reg->r_rip; - l_reg->cs = b_reg->r_cs; - l_reg->eflags = b_reg->r_rflags; - l_reg->rsp = b_reg->r_rsp; - l_reg->ss = b_reg->r_ss; -} - static void map_regs_from_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) { @@ -434,14 +402,21 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) { struct ptrace_lwpinfo lwpinfo; struct reg b_reg; - struct linux_pt_reg l_reg; + struct linux_pt_regset l_regset; + struct pcb *pcb; int error; error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0); if (error != 0) return (error); - map_regs_to_linux(&b_reg, &l_reg); + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + + bsd_to_linux_regset(&b_reg, &l_regset); + l_regset.fs_base = pcb->pcb_fsbase; + l_regset.gs_base = pcb->pcb_gsbase; error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { @@ -450,21 +425,20 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) } if (lwpinfo.pl_flags & PL_FLAG_SCE) { /* - * The strace(1) utility depends on RAX being set to -ENOSYS - * on syscall entry; otherwise it loops printing those: - * - * [ Process PID=928 runs in 64 bit mode. ] - * [ Process PID=928 runs in x32 mode. ] + * Undo the mangling done in exception.S:fast_syscall_common(). */ - l_reg.rax = -38; /* -ENOSYS */ - + l_regset.r10 = l_regset.rcx; + } + if (lwpinfo.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)) { /* - * Undo the mangling done in exception.S:fast_syscall_common(). + * In Linux, the syscall number - passed to the syscall + * as rax - is preserved in orig_rax; rax gets overwritten + * with syscall return value. */ - l_reg.r10 = l_reg.rcx; + l_regset.orig_rax = lwpinfo.pl_syscall_code; } - error = copyout(&l_reg, (void *)data, sizeof(l_reg)); + error = copyout(&l_regset, (void *)data, sizeof(l_regset)); return (error); } From nobody Fri Oct 29 17:27:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C04AF182F1B0 for ; Fri, 29 Oct 2021 17:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgqB1552Fz4g91; Fri, 29 Oct 2021 17:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9043D1B0C2; Fri, 29 Oct 2021 17:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19THRLOm083324; Fri, 29 Oct 2021 17:27:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19THRL4u083323; Fri, 29 Oct 2021 17:27:21 GMT (envelope-from git) Date: Fri, 29 Oct 2021 17:27:21 GMT Message-Id: <202110291727.19THRL4u083323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Olivier Houchard Subject: git: d6ec751d4e33 - Create tag vendor/ck/2021029 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/tags/vendor/ck/2021029 X-Git-Reftype: annotated tag X-Git-Commit: d6ec751d4e333e1c46c8ff09c1420e290c652d2b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The annotated tag vendor/ck/2021029 has been created by cognet: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/ck/2021029 tag vendor/ck/2021029 Tagger: Olivier Houchard TaggerDate: 2021-10-29 17:03:55 +0000 Import CK as of 2265c7846f4ce667f5216456afe2779b23c3e5f7 commit ce929fe84f9c453263af379f3b255ff8eca01d48 Author: Olivier Houchard AuthorDate: 2021-10-29 17:01:15 +0000 Commit: Olivier Houchard CommitDate: 2021-10-29 17:01:15 +0000 Import CK as of commit 2265c7846f4ce667f5216456afe2779b23c3e5f7. From nobody Fri Oct 29 17:27:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B3057182F05B for ; Fri, 29 Oct 2021 17:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgqB14ky1z4g2k; Fri, 29 Oct 2021 17:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A1131B292; Fri, 29 Oct 2021 17:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19THRLZs083300; Fri, 29 Oct 2021 17:27:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19THRLl5083299; Fri, 29 Oct 2021 17:27:21 GMT (envelope-from git) Date: Fri, 29 Oct 2021 17:27:21 GMT Message-Id: <202110291727.19THRLl5083299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Olivier Houchard Subject: git: 48289654a0ac..ce929fe84f9c - vendor/ck - vendor branch updated List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/vendor/ck X-Git-Reftype: branch X-Git-Commit: ce929fe84f9c453263af379f3b255ff8eca01d48 X-Git-Oldrev: 48289654a0ac91e3c29f25461373b3f1b7c82095 X-Git-Newrev: ce929fe84f9c453263af379f3b255ff8eca01d48 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch vendor/ck has been updated by cognet: URL: https://cgit.FreeBSD.org/src/log/?id=48289654a0ac..ce929fe84f9c ce929fe84f9c Import CK as of commit 2265c7846f4ce667f5216456afe2779b23c3e5f7. From nobody Fri Oct 29 17:27:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 59ACA182F845; Fri, 29 Oct 2021 17:27:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgqBg4Vhpz4gZK; Fri, 29 Oct 2021 17:27:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 338F11AEB5; Fri, 29 Oct 2021 17:27:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19THRt8J083487; Fri, 29 Oct 2021 17:27:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19THRsBj083486; Fri, 29 Oct 2021 17:27:54 GMT (envelope-from git) Date: Fri, 29 Oct 2021 17:27:54 GMT Message-Id: <202110291727.19THRsBj083486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 74e9b5f29ad0 - main - Merge commit 'ce929fe84f9c453263af379f3b255ff8eca01d48' List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74e9b5f29ad0056bbe11a30c91dfa0705fa19cd5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=74e9b5f29ad0056bbe11a30c91dfa0705fa19cd5 commit 74e9b5f29ad0056bbe11a30c91dfa0705fa19cd5 Merge: ad0379660d0c ce929fe84f9c Author: Olivier Houchard AuthorDate: 2021-10-29 17:18:03 +0000 Commit: Olivier Houchard CommitDate: 2021-10-29 17:18:03 +0000 Merge commit 'ce929fe84f9c453263af379f3b255ff8eca01d48' Import CK as of commit 2265c7846f4ce667f5216456afe2779b23c3e5f7. sys/contrib/ck/include/ck_backoff.h | 2 +- sys/contrib/ck/include/ck_cc.h | 2 + sys/contrib/ck/include/ck_ec.h | 945 ++++++++++++++++++++++++ sys/contrib/ck/include/ck_fifo.h | 2 +- sys/contrib/ck/include/ck_hs.h | 8 + sys/contrib/ck/include/ck_pr.h | 15 +- sys/contrib/ck/include/ck_queue.h | 20 +- sys/contrib/ck/include/ck_ring.h | 672 +++++++++++++---- sys/contrib/ck/include/gcc/aarch64/ck_pr.h | 12 +- sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h | 106 +-- sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h | 37 +- sys/contrib/ck/include/gcc/ck_cc.h | 9 + sys/contrib/ck/include/gcc/x86/ck_pr.h | 109 +-- sys/contrib/ck/include/gcc/x86_64/ck_pr.h | 87 ++- sys/contrib/ck/include/spinlock/fas.h | 9 +- sys/contrib/ck/src/ck_ec.c | 425 +++++++++++ sys/contrib/ck/src/ck_ec_timeutil.h | 150 ++++ sys/contrib/ck/src/ck_hs.c | 7 +- sys/contrib/ck/src/ck_ht.c | 3 - 19 files changed, 2272 insertions(+), 348 deletions(-) diff --cc sys/contrib/ck/include/ck_ec.h index 000000000000,cd2a36813a79..cd2a36813a79 mode 000000,100644..100644 --- a/sys/contrib/ck/include/ck_ec.h +++ b/sys/contrib/ck/include/ck_ec.h diff --cc sys/contrib/ck/src/ck_ec.c index 000000000000,9b24e762947c..9b24e762947c mode 000000,100644..100644 --- a/sys/contrib/ck/src/ck_ec.c +++ b/sys/contrib/ck/src/ck_ec.c diff --cc sys/contrib/ck/src/ck_ec_timeutil.h index 000000000000,50cfb67bf4a4..50cfb67bf4a4 mode 000000,100644..100644 --- a/sys/contrib/ck/src/ck_ec_timeutil.h +++ b/sys/contrib/ck/src/ck_ec_timeutil.h From nobody Fri Oct 29 18:31:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4C6D61821A84; Fri, 29 Oct 2021 18:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgrc31l1Lz3Gms; Fri, 29 Oct 2021 18:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1BF571BDBE; Fri, 29 Oct 2021 18:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TIVVgq075299; Fri, 29 Oct 2021 18:31:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TIVVVx075290; Fri, 29 Oct 2021 18:31:31 GMT (envelope-from git) Date: Fri, 29 Oct 2021 18:31:31 GMT Message-Id: <202110291831.19TIVVVx075290@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: e9bfb50d5e7a - main - sort: Fix random sort List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9bfb50d5e7aa5d673a5a35318820320c4190d33 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e9bfb50d5e7aa5d673a5a35318820320c4190d33 commit e9bfb50d5e7aa5d673a5a35318820320c4190d33 Author: Mark Johnston AuthorDate: 2021-10-29 18:25:42 +0000 Commit: Mark Johnston CommitDate: 2021-10-29 18:29:50 +0000 sort: Fix random sort bwsrawdata() is supposed to return the string buffer. PR: 259451 Reported by: sigsys@gmail.com Fixes: d053fb22f6d3 ("usr.bin/sort: Avoid UBSan errors") MFC after: 3 days Sponsored by: The FreeBSD Foundation --- usr.bin/sort/bwstring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index c31cb859cb37..2f2737e94314 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -152,7 +152,7 @@ bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) const void* bwsrawdata(const struct bwstring *bws) { - return (&(bws->wdata)); + return (bws->wdata.str); } size_t bwsrawlen(const struct bwstring *bws) From nobody Fri Oct 29 18:31:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 70CDB1821835; Fri, 29 Oct 2021 18:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgrc42V7rz3Gpr; Fri, 29 Oct 2021 18:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 35BAA1C157; Fri, 29 Oct 2021 18:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TIVWTH075461; Fri, 29 Oct 2021 18:31:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TIVWPe075460; Fri, 29 Oct 2021 18:31:32 GMT (envelope-from git) Date: Fri, 29 Oct 2021 18:31:32 GMT Message-Id: <202110291831.19TIVWPe075460@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: 26f76aea2d27 - main - timecounter: Load the currently selected tc once in tc_windup() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26f76aea2d276aacb69a1f9d78558d6107155aed Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=26f76aea2d276aacb69a1f9d78558d6107155aed commit 26f76aea2d276aacb69a1f9d78558d6107155aed Author: Mark Johnston AuthorDate: 2021-10-29 18:29:22 +0000 Commit: Mark Johnston CommitDate: 2021-10-29 18:30:15 +0000 timecounter: Load the currently selected tc once in tc_windup() Reported by: Sebastian Huber Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32729 --- sys/kern/kern_tc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index f7bd116dabe2..f760d8ab34e3 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1353,6 +1353,7 @@ static void tc_windup(struct bintime *new_boottimebin) { struct bintime bt; + struct timecounter *tc; struct timehands *th, *tho; u_int delta, ncount, ogen; int i; @@ -1381,9 +1382,10 @@ tc_windup(struct bintime *new_boottimebin) * changing timecounters, a counter value from the new timecounter. * Update the offset fields accordingly. */ + tc = atomic_load_ptr(&timecounter); delta = tc_delta(th); - if (th->th_counter != timecounter) - ncount = timecounter->tc_get_timecount(timecounter); + if (th->th_counter != tc) + ncount = tc->tc_get_timecount(tc); else ncount = 0; #ifdef FFCLOCK @@ -1447,17 +1449,17 @@ tc_windup(struct bintime *new_boottimebin) bintime2timespec(&bt, &th->th_nanotime); /* Now is a good time to change timecounters. */ - if (th->th_counter != timecounter) { + if (th->th_counter != tc) { #ifndef __arm__ - if ((timecounter->tc_flags & TC_FLAGS_C2STOP) != 0) + if ((tc->tc_flags & TC_FLAGS_C2STOP) != 0) cpu_disable_c2_sleep++; if ((th->th_counter->tc_flags & TC_FLAGS_C2STOP) != 0) cpu_disable_c2_sleep--; #endif - th->th_counter = timecounter; + th->th_counter = tc; th->th_offset_count = ncount; - tc_min_ticktock_freq = max(1, timecounter->tc_frequency / - (((uint64_t)timecounter->tc_counter_mask + 1) / 3)); + tc_min_ticktock_freq = max(1, tc->tc_frequency / + (((uint64_t)tc->tc_counter_mask + 1) / 3)); recalculate_scaling_factor_and_large_delta(th); #ifdef FFCLOCK ffclock_change_tc(th); From nobody Fri Oct 29 20:12:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 53A95182BF44; Fri, 29 Oct 2021 20:12:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgtrj22Yjz4XJm; Fri, 29 Oct 2021 20:12:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 1217D27814; Fri, 29 Oct 2021 20:12:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 885DC2C5AF; Fri, 29 Oct 2021 22:12:34 +0200 (CEST) From: Kristof Provost To: Kirk McKusick Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 68bff4a07e3f - main - Allow GEOM utilities to specify a -v option. Date: Fri, 29 Oct 2021 22:12:30 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: <5C3D57AA-5771-42FF-924B-3A09818F869D@FreeBSD.org> In-Reply-To: <202110290552.19T5qOjx061844@gitrepo.freebsd.org> References: <202110290552.19T5qOjx061844@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On 29 Oct 2021, at 7:52, Kirk McKusick wrote: > The branch main has been updated by mckusick: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D68bff4a07e3fa6c30a0c0ff6= cf5f0bef95dcbd72 > > commit 68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72 > Author: Kirk McKusick > AuthorDate: 2021-10-29 05:49:48 +0000 > Commit: Kirk McKusick > CommitDate: 2021-10-29 05:50:50 +0000 > > Allow GEOM utilities to specify a -v option. > > Geom utilities (geli(8), glabel(8), gmirror(8), gpart(8), gmirror(8= ), > gmountver(8), etc) all use the geom(8) utility as their back end > to process their commands and pass them into the kernel. Creating > a new utility requires no more than filling out a template describi= ng > the commands and arguments that the utility supports. Consider the > specification for the very simple gmountver(8) utility: > > struct g_command class_commands[] =3D { > { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, > { > G_OPT_SENTINEL > }, > "[-v] prov ..." > }, > { "destroy", G_FLAG_VERBOSE, NULL, > { > { 'f', "force", NULL, G_TYPE_BOOL }, > G_OPT_SENTINEL > }, > "[-fv] name" > }, > G_CMD_SENTINEL > }; > > It has just two commands of its own: "create" and "destroy" along > with the four standard commands "list", "status", "load", and > "unload" provided by the base geom(8) utility. The base geom(8) > utility allows each command to use the G_FLAG_VERBOSE flag to speci= fy > that a command should accept the -v flag and when the -v flag is > given the utility prints "Done." if the command completes successfu= lly. > In the above example, both of the commands set the G_FLAG_VERBOSE, > so have the -v option available. In addition the "destroy" command > accepts the -f boolean flag to force the destruction. > > If the "destroy" command wanted to also print out verbose informati= on, > it would need to explicitly declare its intent by adding a line: > > { 'v', "verbose", NULL, G_TYPE_BOOL }, > > Before this change, the geom utility would silently ignore the abov= e > line in the configuration file, so it was impossible for the utilit= y > to know that the -v flag had been set on the command. With this > change a geom command can explicitly specify a -v option with a > line as given above and handle it as it would any other option. If > both a -v option and G_FLAG_VERBOSE are specified for a command > then both types of verbose information will be output when that > command is run with -v. > > MFC after: 1 week > Sponsored by: Netflix > --- > sbin/geom/core/geom.c | 19 ++++++++++++------- > sbin/geom/core/geom.h | 13 +++++++++++++ > 2 files changed, 25 insertions(+), 7 deletions(-) > > diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c > index 58b33a067700..2e0d8683df49 100644 > --- a/sbin/geom/core/geom.c > +++ b/sbin/geom/core/geom.c > @@ -440,7 +445,7 @@ set_flags(struct g_command *cmd) > { > unsigned flags =3D 0; > > - if ((cmd->gc_flags & G_FLAG_VERBOSE) !=3D 0 && verbose) > + if ((cmd->gc_flags & G_FLAG_VERBOSE) !=3D 0) > flags |=3D G_FLAG_VERBOSE; > > return (flags); Given https://reviews.freebsd.org/D32736 I wonder if the removal of the v= erbose check here was correct. If I'm reading this code right we now always set the verbose flag for any= subcommand that supports it (i.e. has G_FLAG_VERBOSE set). That leads to commands such as glabel always acting as if '-v' was specif= ied. The set_flags() output is only used if g_func is set, which isn't the cas= e in any of the examples in the commit message, so I wonder if that case = was overlooked. Best regards, Kristof From nobody Fri Oct 29 21:39:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 174F6182DF75; Fri, 29 Oct 2021 21:39: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgwmj75cLz4tTd; Fri, 29 Oct 2021 21:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CFFB91E79C; Fri, 29 Oct 2021 21:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TLdHlX017759; Fri, 29 Oct 2021 21:39:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TLdH30017758; Fri, 29 Oct 2021 21:39:17 GMT (envelope-from git) Date: Fri, 29 Oct 2021 21:39:17 GMT Message-Id: <202110292139.19TLdH30017758@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 141a53cd58cd - main - tcp: Rack might retransmit forever. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 141a53cd58cdf0681f800bb98ed5718f32ea7909 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=141a53cd58cdf0681f800bb98ed5718f32ea7909 commit 141a53cd58cdf0681f800bb98ed5718f32ea7909 Author: Randall Stewart AuthorDate: 2021-10-29 21:37:49 +0000 Commit: Randall Stewart CommitDate: 2021-10-29 21:37:49 +0000 tcp: Rack might retransmit forever. If we get a Sacked peer with an MTU change we can retransmit forever if the last bytes are sacked and the client goes away (think power off). Then we never see the end condition and continually retransmit. Reviewed by: Michael Tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32671 --- sys/netinet/tcp_stacks/rack.c | 66 ++++++++++++++++++++++++++++++--------- sys/netinet/tcp_stacks/tcp_rack.h | 38 +++++++++++----------- 2 files changed, 71 insertions(+), 33 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 04252511ad18..616e079df60c 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -2422,7 +2422,8 @@ rack_log_rtt_upd(struct tcpcb *tp, struct tcp_rack *rack, uint32_t t, uint32_t l log.u_bbr.pkt_epoch = rsm->r_start; log.u_bbr.lost = rsm->r_end; log.u_bbr.cwnd_gain = rsm->r_rtr_cnt; - log.u_bbr.pacing_gain = rsm->r_flags; + /* We loose any upper of the 24 bits */ + log.u_bbr.pacing_gain = (uint16_t)rsm->r_flags; } else { /* Its a SYN */ log.u_bbr.pkt_epoch = rack->rc_tp->iss; @@ -6670,6 +6671,7 @@ rack_remxt_tmr(struct tcpcb *tp) if (rsm->r_flags & RACK_ACKED) rsm->r_flags |= RACK_WAS_ACKED; rsm->r_flags &= ~(RACK_ACKED | RACK_SACK_PASSED | RACK_WAS_SACKPASS); + rsm->r_flags |= RACK_MUST_RXT; } /* Clear the count (we just un-acked them) */ rack->r_ctl.rc_last_timeout_snduna = tp->snd_una; @@ -7257,7 +7259,6 @@ rack_update_rsm(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm, uint64_t ts, uint16_t add_flag) { int32_t idx; - uint16_t stripped_flags; rsm->r_rtr_cnt++; rack_log_retran_reason(rack, rsm, __LINE__, 0, 2); @@ -7278,7 +7279,6 @@ rack_update_rsm(struct tcpcb *tp, struct tcp_rack *rack, */ rsm->r_fas = ctf_flight_size(rack->rc_tp, rack->r_ctl.rc_sacked); - stripped_flags = rsm->r_flags & ~(RACK_SENT_SP|RACK_SENT_FP); if (rsm->r_flags & RACK_ACKED) { /* Problably MTU discovery messing with us */ rsm->r_flags &= ~RACK_ACKED; @@ -16112,12 +16112,25 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma rack_start_hpts_timer(rack, tp, cts, slot, len, 0); if (rack->r_must_retran) { rack->r_ctl.rc_out_at_rto -= (rsm->r_end - rsm->r_start); - if (SEQ_GEQ(rsm->r_end, rack->r_ctl.rc_snd_max_at_rto)) { + if ((SEQ_GEQ(rsm->r_end, rack->r_ctl.rc_snd_max_at_rto)) || + ((rsm->r_flags & RACK_MUST_RXT) == 0)) { /* - * We have retransmitted all we need. + * We have retransmitted all we need. If + * RACK_MUST_RXT is not set then we need to + * not retransmit this guy. */ rack->r_must_retran = 0; rack->r_ctl.rc_out_at_rto = 0; + if ((rsm->r_flags & RACK_MUST_RXT) == 0) { + /* Not one we should rxt */ + goto failed; + } else { + /* Clear the flag */ + rsm->r_flags &= ~RACK_MUST_RXT; + } + } else { + /* Remove the flag */ + rsm->r_flags &= ~RACK_MUST_RXT; } } #ifdef TCP_ACCOUNTING @@ -17004,8 +17017,8 @@ again: if (rack->r_must_retran && (rsm == NULL)) { /* - * Non-Sack and we had a RTO or MTU change, we - * need to retransmit until we reach + * Non-Sack and we had a RTO or Sack/non-Sack and a + * MTU change, we need to retransmit until we reach * the former snd_max (rack->r_ctl.rc_snd_max_at_rto). */ if (SEQ_GT(tp->snd_max, tp->snd_una)) { @@ -17028,12 +17041,24 @@ again: sb = &so->so_snd; goto just_return_nolock; } - sack_rxmit = 1; - len = rsm->r_end - rsm->r_start; - sendalot = 0; - sb_offset = rsm->r_start - tp->snd_una; - if (len >= segsiz) - len = segsiz; + if ((rsm->r_flags & RACK_MUST_RXT) == 0) { + /* It does not have the flag, we are done */ + rack->r_must_retran = 0; + rack->r_ctl.rc_out_at_rto = 0; + } else { + sack_rxmit = 1; + len = rsm->r_end - rsm->r_start; + sendalot = 0; + sb_offset = rsm->r_start - tp->snd_una; + if (len >= segsiz) + len = segsiz; + /* + * Delay removing the flag RACK_MUST_RXT so + * that the fastpath for retransmit will + * work with this rsm. + */ + + } } else { /* We must be done if there is nothing outstanding */ rack->r_must_retran = 0; @@ -17080,6 +17105,15 @@ again: if (ret == 0) return (0); } + if (rsm && (rsm->r_flags & RACK_MUST_RXT)) { + /* + * Clear the flag in prep for the send + * note that if we can't get an mbuf + * and fail, we won't retransmit this + * rsm but that should be ok (its rare). + */ + rsm->r_flags &= ~RACK_MUST_RXT; + } so = inp->inp_socket; sb = &so->so_snd; if (do_a_prefetch == 0) { @@ -19313,6 +19347,7 @@ rack_mtu_change(struct tcpcb *tp) * The MSS may have changed */ struct tcp_rack *rack; + struct rack_sendmap *rsm; rack = (struct tcp_rack *)tp->t_fb_ptr; if (rack->r_ctl.rc_pace_min_segs != ctf_fixed_maxseg(tp)) { @@ -19329,7 +19364,10 @@ rack_mtu_change(struct tcpcb *tp) rack->r_ctl.rc_sacked); rack->r_ctl.rc_snd_max_at_rto = tp->snd_max; rack->r_must_retran = 1; - + /* Mark all inflight to needing to be rxt'd */ + TAILQ_FOREACH(rsm, &rack->r_ctl.rc_tmap, r_tnext) { + rsm->r_flags |= RACK_MUST_RXT; + } } sack_filter_clear(&rack->r_ctl.rack_sf, tp->snd_una); /* We don't use snd_nxt to retransmit */ diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 0ada2116dc6f..0893237e92f9 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -28,22 +28,23 @@ #ifndef _NETINET_TCP_RACK_H_ #define _NETINET_TCP_RACK_H_ -#define RACK_ACKED 0x0001/* The remote endpoint acked this */ -#define RACK_TO_REXT 0x0002/* A timeout occured on this sendmap entry */ -#define RACK_DEFERRED 0x0004/* We can't use this for RTT calc - not used */ -#define RACK_OVERMAX 0x0008/* We have more retran's then we can fit */ -#define RACK_SACK_PASSED 0x0010/* A sack was done above this block */ -#define RACK_WAS_SACKPASS 0x0020/* We retransmitted due to SACK pass */ -#define RACK_HAS_FIN 0x0040/* segment is sent with fin */ -#define RACK_TLP 0x0080/* segment sent as tail-loss-probe */ -#define RACK_RWND_COLLAPSED 0x0100/* The peer collapsed the rwnd on the segment */ -#define RACK_APP_LIMITED 0x0200/* We went app limited after this send */ -#define RACK_WAS_ACKED 0x0400/* a RTO undid the ack, but it already had a rtt calc done */ -#define RACK_HAS_SYN 0x0800/* SYN is on this guy */ -#define RACK_SENT_W_DSACK 0x1000/* Sent with a dsack */ -#define RACK_SENT_SP 0x2000/* sent in slow path */ -#define RACK_SENT_FP 0x4000/* sent in fast path */ -#define RACK_HAD_PUSH 0x8000/* Push was sent on original send */ +#define RACK_ACKED 0x000001/* The remote endpoint acked this */ +#define RACK_TO_REXT 0x000002/* A timeout occured on this sendmap entry */ +#define RACK_DEFERRED 0x000004/* We can't use this for RTT calc - not used */ +#define RACK_OVERMAX 0x000008/* We have more retran's then we can fit */ +#define RACK_SACK_PASSED 0x000010/* A sack was done above this block */ +#define RACK_WAS_SACKPASS 0x000020/* We retransmitted due to SACK pass */ +#define RACK_HAS_FIN 0x000040/* segment is sent with fin */ +#define RACK_TLP 0x000080/* segment sent as tail-loss-probe */ +#define RACK_RWND_COLLAPSED 0x000100/* The peer collapsed the rwnd on the segment */ +#define RACK_APP_LIMITED 0x000200/* We went app limited after this send */ +#define RACK_WAS_ACKED 0x000400/* a RTO undid the ack, but it already had a rtt calc done */ +#define RACK_HAS_SYN 0x000800/* SYN is on this guy */ +#define RACK_SENT_W_DSACK 0x001000/* Sent with a dsack */ +#define RACK_SENT_SP 0x002000/* sent in slow path */ +#define RACK_SENT_FP 0x004000/* sent in fast path */ +#define RACK_HAD_PUSH 0x008000/* Push was sent on original send */ +#define RACK_MUST_RXT 0x010000/* We must retransmit this rsm (non-sack/mtu chg)*/ #define RACK_NUM_OF_RETRANS 3 #define RACK_INITIAL_RTO 1000000 /* 1 second in microseconds */ @@ -55,9 +56,8 @@ struct rack_sendmap { uint32_t r_start; /* Sequence number of the segment */ uint32_t r_end; /* End seq, this is 1 beyond actually */ uint32_t r_rtr_bytes; /* How many bytes have been retransmitted */ - uint16_t r_rtr_cnt; /* Retran count, index this -1 to get time - * sent */ - uint16_t r_flags; /* Flags as defined above */ + uint32_t r_flags : 24, /* Flags as defined above */ + r_rtr_cnt : 8; /* Retran count, index this -1 to get time */ struct mbuf *m; uint32_t soff; uint32_t orig_m_len; From nobody Fri Oct 29 23:58:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3BBBA181CE01; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrn0tPTz4VCV; Fri, 29 Oct 2021 23:58:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F1ABE2023D; Fri, 29 Oct 2021 23:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw0lS003184; Fri, 29 Oct 2021 23:58:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw0Ra003183; Fri, 29 Oct 2021 23:58:00 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:00 GMT Message-Id: <202110292358.19TNw0Ra003183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7e60a7e31843 - stable/13 - cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e60a7e318439a49fbecff97701865f31e7f4c31 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7e60a7e318439a49fbecff97701865f31e7f4c31 commit 7e60a7e318439a49fbecff97701865f31e7f4c31 Author: John Baldwin AuthorDate: 2021-05-14 19:16:33 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:24:27 +0000 cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29903 (cherry picked from commit 4b6ed0758dc6fad17081d7bd791cb0edbddbddb8) (cherry picked from commit a9f0cf4838cb1991707fa32e1cf363ea18076249) --- sys/dev/cxgbe/adapter.h | 7 +++- sys/dev/cxgbe/cxgbei/cxgbei.c | 83 +++------------------------------------ sys/dev/cxgbe/cxgbei/cxgbei.h | 6 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 10 +++-- sys/dev/cxgbe/t4_main.c | 8 ++++ sys/dev/cxgbe/t4_sge.c | 32 ++++++++++++++- 6 files changed, 55 insertions(+), 91 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index a394e8f11017..7909e0b108b2 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -664,11 +664,16 @@ iq_to_rxq(struct sge_iq *iq) return (__containerof(iq, struct sge_rxq, iq)); } - /* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */ struct sge_ofld_rxq { struct sge_iq iq; /* MUST be first */ struct sge_fl fl; /* MUST follow iq */ + counter_u64_t rx_iscsi_ddp_setup_ok; + counter_u64_t rx_iscsi_ddp_setup_error; + uint64_t rx_iscsi_ddp_pdus; + uint64_t rx_iscsi_ddp_octets; + uint64_t rx_iscsi_fl_pdus; + uint64_t rx_iscsi_fl_octets; u_long rx_toe_tls_records; u_long rx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 4acdc726e75c..07f704752305 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -96,50 +96,6 @@ static int worker_thread_count; static struct cxgbei_worker_thread_softc *cwt_softc; static struct proc *cxgbei_proc; -static void -free_ci_counters(struct cxgbei_data *ci) -{ - -#define FREE_CI_COUNTER(x) do { \ - if (ci->x != NULL) { \ - counter_u64_free(ci->x); \ - ci->x = NULL; \ - } \ -} while (0) - - FREE_CI_COUNTER(ddp_setup_ok); - FREE_CI_COUNTER(ddp_setup_error); - FREE_CI_COUNTER(ddp_bytes); - FREE_CI_COUNTER(ddp_pdus); - FREE_CI_COUNTER(fl_bytes); - FREE_CI_COUNTER(fl_pdus); -#undef FREE_CI_COUNTER -} - -static int -alloc_ci_counters(struct cxgbei_data *ci) -{ - -#define ALLOC_CI_COUNTER(x) do { \ - ci->x = counter_u64_alloc(M_WAITOK); \ - if (ci->x == NULL) \ - goto fail; \ -} while (0) - - ALLOC_CI_COUNTER(ddp_setup_ok); - ALLOC_CI_COUNTER(ddp_setup_error); - ALLOC_CI_COUNTER(ddp_bytes); - ALLOC_CI_COUNTER(ddp_pdus); - ALLOC_CI_COUNTER(fl_bytes); - ALLOC_CI_COUNTER(fl_pdus); -#undef ALLOC_CI_COUNTER - - return (0); -fail: - free_ci_counters(ci); - return (ENOMEM); -} - static void read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, uint32_t *max_rx_pdu_len) @@ -182,10 +138,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) MPASS(sc->vres.iscsi.size > 0); MPASS(ci != NULL); - rc = alloc_ci_counters(ci); - if (rc != 0) - return (rc); - read_pdu_limits(sc, &ci->max_tx_pdu_len, &ci->max_rx_pdu_len); pr = &ci->pr; @@ -195,7 +147,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) device_printf(sc->dev, "%s: failed to initialize the iSCSI page pod region: %u.\n", __func__, rc); - free_ci_counters(ci); return (rc); } @@ -219,30 +170,9 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) children = SYSCTL_CHILDREN(oid); oid = SYSCTL_ADD_NODE(&ci->ctx, children, OID_AUTO, "iscsi", - CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP statistics"); + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP settings"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_setup_ok", - CTLFLAG_RD, &ci->ddp_setup_ok, - "# of times DDP buffer was setup successfully."); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_setup_error", - CTLFLAG_RD, &ci->ddp_setup_error, - "# of times DDP buffer setup failed."); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_bytes", - CTLFLAG_RD, &ci->ddp_bytes, "# of bytes placed directly"); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_pdus", - CTLFLAG_RD, &ci->ddp_pdus, "# of PDUs with data placed directly."); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "fl_bytes", - CTLFLAG_RD, &ci->fl_bytes, "# of data bytes delivered in freelist"); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "fl_pdus", - CTLFLAG_RD, &ci->fl_pdus, - "# of PDUs with data delivered in freelist"); - ci->ddp_threshold = 2048; SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "ddp_threshold", CTLFLAG_RW, &ci->ddp_threshold, 0, "Rx zero copy threshold"); @@ -291,7 +221,6 @@ static int do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; - struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct cpl_iscsi_data *cpl = mtod(m, struct cpl_iscsi_data *); u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); @@ -311,8 +240,8 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m icp->icp_flags |= ICPF_RX_FLBUF; icp->ip.ip_data_mbuf = m; - counter_u64_add(ci->fl_pdus, 1); - counter_u64_add(ci->fl_bytes, m->m_pkthdr.len); + toep->ofld_rxq->rx_iscsi_fl_pdus++; + toep->ofld_rxq->rx_iscsi_fl_octets += m->m_pkthdr.len; #if 0 CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid, @@ -326,7 +255,6 @@ static int do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; - struct cxgbei_data *ci = sc->iscsi_ulp_softc; const struct cpl_rx_data_ddp *cpl = (const void *)(rss + 1); u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); @@ -369,8 +297,8 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); MPASS(ip->ip_data_len > 0); icp->icp_flags |= ICPF_RX_DDP; - counter_u64_add(ci->ddp_pdus, 1); - counter_u64_add(ci->ddp_bytes, ip->ip_data_len); + toep->ofld_rxq->rx_iscsi_ddp_pdus++; + toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len; } INP_WLOCK(inp); @@ -527,7 +455,6 @@ cxgbei_deactivate(struct adapter *sc) if (ci != NULL) { sysctl_ctx_free(&ci->ctx); t4_free_ppod_region(&ci->pr); - free_ci_counters(ci); free(ci, M_CXGBE); sc->iscsi_ulp_softc = NULL; } diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index b0369b974136..3b17a4f2b36a 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -113,12 +113,6 @@ struct cxgbei_data { struct ppod_region pr; struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */ - counter_u64_t ddp_setup_ok; - counter_u64_t ddp_setup_error; - counter_u64_t ddp_bytes; - counter_u64_t ddp_pdus; - counter_u64_t fl_bytes; - counter_u64_t fl_pdus; }; /* cxgbei.c */ diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 94963f13b601..961acfb31987 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -819,7 +819,8 @@ no_ddp: *ittp = htobe32(itt); MPASS(*arg == NULL); /* State is maintained for DDP only. */ if (rc != 0) - counter_u64_add(ci->ddp_setup_error, 1); + counter_u64_add( + toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1); return (0); } @@ -853,7 +854,7 @@ no_ddp: *ittp = htobe32(prsv->prsv_tag); *arg = prsv; - counter_u64_add(ci->ddp_setup_ok, 1); + counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); } @@ -922,7 +923,8 @@ no_ddp: *tttp = htobe32(ttt); MPASS(io_to_ppod_reservation(io) == NULL); if (rc != 0) - counter_u64_add(ci->ddp_setup_error, 1); + counter_u64_add( + toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1); return (0); } @@ -968,7 +970,7 @@ no_ddp: *tttp = htobe32(prsv->prsv_tag); io_to_ppod_reservation(io) = prsv; *arg = ctsio; - counter_u64_add(ci->ddp_setup_ok, 1); + counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); } diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index eebba8afcb8c..bb8b9a4d78fb 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -11909,6 +11909,14 @@ clear_stats(struct adapter *sc, u_int port_id) ofld_rxq->fl.cl_allocated = 0; ofld_rxq->fl.cl_recycled = 0; ofld_rxq->fl.cl_fast_recycled = 0; + counter_u64_zero( + ofld_rxq->rx_iscsi_ddp_setup_ok); + counter_u64_zero( + ofld_rxq->rx_iscsi_ddp_setup_error); + ofld_rxq->rx_iscsi_ddp_pdus = 0; + ofld_rxq->rx_iscsi_ddp_octets = 0; + ofld_rxq->rx_iscsi_fl_pdus = 0; + ofld_rxq->rx_iscsi_fl_octets = 0; ofld_rxq->rx_toe_tls_records = 0; ofld_rxq->rx_toe_tls_octets = 0; } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 3134542b1b87..3679bbf84f2f 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4082,6 +4082,9 @@ alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq, int idx, return (rc); } MPASS(ofld_rxq->iq.flags & IQ_SW_ALLOCATED); + ofld_rxq->rx_iscsi_ddp_setup_ok = counter_u64_alloc(M_WAITOK); + ofld_rxq->rx_iscsi_ddp_setup_error = + counter_u64_alloc(M_WAITOK); add_ofld_rxq_sysctls(&vi->ctx, oid, ofld_rxq); } @@ -4114,6 +4117,8 @@ free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq) MPASS(!(ofld_rxq->iq.flags & IQ_HW_ALLOCATED)); free_iq_fl(vi->adapter, &ofld_rxq->iq, &ofld_rxq->fl); MPASS(!(ofld_rxq->iq.flags & IQ_SW_ALLOCATED)); + counter_u64_free(ofld_rxq->rx_iscsi_ddp_setup_ok); + counter_u64_free(ofld_rxq->rx_iscsi_ddp_setup_error); bzero(ofld_rxq, sizeof(*ofld_rxq)); } } @@ -4128,12 +4133,35 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, return; children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_records", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_records, "# of TOE TLS records received"); - SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_octets", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_octets, "# of payload octets in received TOE TLS records"); + + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "iscsi", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TOE iSCSI statistics"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_ok", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_ok, + "# of times DDP buffer was setup successfully."); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_error", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_error, + "# of times DDP buffer setup failed."); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "ddp_octets", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_octets, 0, + "# of octets placed directly"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "ddp_pdus", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_pdus, 0, + "# of PDUs with data placed directly."); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_octets", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_octets, 0, + "# of data octets delivered in freelist"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_pdus", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_pdus, 0, + "# of PDUs with data delivered in freelist"); } #endif From nobody Fri Oct 29 23:58:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 61523181CD8D; Fri, 29 Oct 2021 23:58:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrp1d0bz4V2h; Fri, 29 Oct 2021 23:58:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 10E39205AE; Fri, 29 Oct 2021 23:58:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw2Rd003208; Fri, 29 Oct 2021 23:58:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw2Xp003207; Fri, 29 Oct 2021 23:58:02 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:02 GMT Message-Id: <202110292358.19TNw2Xp003207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8e90bce009bb - stable/13 - cxgbe tom: Set the tid in the work requests to program page pods for iSCSI. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8e90bce009bb6d931e7e259fd25cbd277d863fc5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8e90bce009bb6d931e7e259fd25cbd277d863fc5 commit 8e90bce009bb6d931e7e259fd25cbd277d863fc5 Author: John Baldwin AuthorDate: 2021-05-14 19:16:40 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:40:55 +0000 cxgbe tom: Set the tid in the work requests to program page pods for iSCSI. As a result, CPL_FW4_ACK now returns credits for these work requests. To support this, page pod work requests are now constructed in special mbufs similar to "raw" mbufs used for NIC TLS in plain TX queues. These special mbufs are stored in the ulp_pduq and dispatched in order with PDU work requests. Sponsored by: Chelsio Communications Discussed with: np Differential Revision: https://reviews.freebsd.org/D29904 (cherry picked from commit 4427ac3675f91df039d54a23518132e0e0fede86) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 +- sys/dev/cxgbe/tom/t4_cpl_io.c | 243 ++++++++++++++++++++++---------------- sys/dev/cxgbe/tom/t4_ddp.c | 48 ++++++-- sys/dev/cxgbe/tom/t4_tom.h | 18 ++- 4 files changed, 198 insertions(+), 118 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 961acfb31987..4e168a33e2ca 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -844,8 +844,8 @@ no_ddp: goto no_ddp; } - rc = t4_write_page_pods_for_buf(sc, &toep->ofld_txq->wrq, toep->tid, - prsv, (vm_offset_t)csio->data_ptr, csio->dxfer_len); + rc = t4_write_page_pods_for_buf(sc, toep, prsv, + (vm_offset_t)csio->data_ptr, csio->dxfer_len); if (rc != 0) { t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); @@ -959,8 +959,7 @@ no_ddp: goto no_ddp; } - rc = t4_write_page_pods_for_buf(sc, &toep->ofld_txq->wrq, - toep->tid, prsv, buf, xferlen); + rc = t4_write_page_pods_for_buf(sc, toep, prsv, buf, xferlen); if (rc != 0) { t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 9168547494f1..b2150558165d 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -927,10 +927,10 @@ rqdrop_locked(struct mbufq *q, int plen) } } -void -t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) +static struct wrqe * +write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) { - struct mbuf *sndptr, *m; + struct mbuf *m; struct fw_ofld_tx_data_wr *txwr; struct wrqe *wr; u_int plen, nsegs, credits, max_imm, max_nsegs, max_nsegs_1mbuf; @@ -938,9 +938,131 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) struct inpcb *inp = toep->inp; struct tcpcb *tp = intotcpcb(inp); int tx_credits, shove; + static const u_int ulp_extra_len[] = {0, 4, 4, 8}; + + M_ASSERTPKTHDR(sndptr); + + tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); + if (mbuf_raw_wr(sndptr)) { + plen = sndptr->m_pkthdr.len; + KASSERT(plen <= SGE_MAX_WR_LEN, + ("raw WR len %u is greater than max WR len", plen)); + if (plen > tx_credits * 16) + return (NULL); + + wr = alloc_wrqe(roundup2(plen, 16), &toep->ofld_txq->wrq); + if (__predict_false(wr == NULL)) + return (NULL); + + m_copydata(sndptr, 0, plen, wrtod(wr)); + return (wr); + } + + max_imm = max_imm_payload(tx_credits); + max_nsegs = max_dsgl_nsegs(tx_credits); + + plen = 0; + nsegs = 0; + max_nsegs_1mbuf = 0; /* max # of SGL segments in any one mbuf */ + for (m = sndptr; m != NULL; m = m->m_next) { + int n = sglist_count(mtod(m, void *), m->m_len); + + nsegs += n; + plen += m->m_len; + + /* + * This mbuf would send us _over_ the nsegs limit. + * Suspend tx because the PDU can't be sent out. + */ + if (plen > max_imm && nsegs > max_nsegs) + return (NULL); + + if (max_nsegs_1mbuf < n) + max_nsegs_1mbuf = n; + } + + if (__predict_false(toep->flags & TPF_FIN_SENT)) + panic("%s: excess tx.", __func__); + + /* + * We have a PDU to send. All of it goes out in one WR so 'm' + * is NULL. A PDU's length is always a multiple of 4. + */ + MPASS(m == NULL); + MPASS((plen & 3) == 0); + MPASS(sndptr->m_pkthdr.len == plen); + + shove = !(tp->t_flags & TF_MORETOCOME); + ulp_submode = mbuf_ulp_submode(sndptr); + MPASS(ulp_submode < nitems(ulp_extra_len)); + + /* + * plen doesn't include header and data digests, which are + * generated and inserted in the right places by the TOE, but + * they do occupy TCP sequence space and need to be accounted + * for. + */ + adjusted_plen = plen + ulp_extra_len[ulp_submode]; + if (plen <= max_imm) { + + /* Immediate data tx */ + + wr = alloc_wrqe(roundup2(sizeof(*txwr) + plen, 16), + &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX: how will we recover from this? */ + return (NULL); + } + txwr = wrtod(wr); + credits = howmany(wr->wr_len, 16); + write_tx_wr(txwr, toep, plen, adjusted_plen, credits, + shove, ulp_submode); + m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); + nsegs = 0; + } else { + int wr_len; + + /* DSGL tx */ + wr_len = sizeof(*txwr) + sizeof(struct ulptx_sgl) + + ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; + wr = alloc_wrqe(roundup2(wr_len, 16), + &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX: how will we recover from this? */ + return (NULL); + } + txwr = wrtod(wr); + credits = howmany(wr_len, 16); + write_tx_wr(txwr, toep, 0, adjusted_plen, credits, + shove, ulp_submode); + write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); + if (wr_len & 0xf) { + uint64_t *pad = (uint64_t *)((uintptr_t)txwr + wr_len); + *pad = 0; + } + } + + tp->snd_nxt += adjusted_plen; + tp->snd_max += adjusted_plen; + + counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1); + counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen); + + return (wr); +} + +void +t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) +{ + struct mbuf *sndptr, *m; + struct fw_wr_hdr *wrhdr; + struct wrqe *wr; + u_int plen, credits; +#ifdef INVARIANTS + struct inpcb *inp = toep->inp; +#endif struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; struct mbufq *pduq = &toep->ulp_pduq; - static const u_int ulp_extra_len[] = {0, 4, 4, 8}; INP_WLOCK_ASSERT(inp); KASSERT(toep->flags & TPF_FLOWC_WR_SENT, @@ -965,99 +1087,14 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) rqdrop_locked(&toep->ulp_pdu_reclaimq, drop); while ((sndptr = mbufq_first(pduq)) != NULL) { - M_ASSERTPKTHDR(sndptr); - - tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); - max_imm = max_imm_payload(tx_credits); - max_nsegs = max_dsgl_nsegs(tx_credits); - - plen = 0; - nsegs = 0; - max_nsegs_1mbuf = 0; /* max # of SGL segments in any one mbuf */ - for (m = sndptr; m != NULL; m = m->m_next) { - int n = sglist_count(mtod(m, void *), m->m_len); - - nsegs += n; - plen += m->m_len; - - /* - * This mbuf would send us _over_ the nsegs limit. - * Suspend tx because the PDU can't be sent out. - */ - if (plen > max_imm && nsegs > max_nsegs) { - toep->flags |= TPF_TX_SUSPENDED; - return; - } - - if (max_nsegs_1mbuf < n) - max_nsegs_1mbuf = n; - } - - if (__predict_false(toep->flags & TPF_FIN_SENT)) - panic("%s: excess tx.", __func__); - - /* - * We have a PDU to send. All of it goes out in one WR so 'm' - * is NULL. A PDU's length is always a multiple of 4. - */ - MPASS(m == NULL); - MPASS((plen & 3) == 0); - MPASS(sndptr->m_pkthdr.len == plen); - - shove = !(tp->t_flags & TF_MORETOCOME); - ulp_submode = mbuf_ulp_submode(sndptr); - MPASS(ulp_submode < nitems(ulp_extra_len)); - - /* - * plen doesn't include header and data digests, which are - * generated and inserted in the right places by the TOE, but - * they do occupy TCP sequence space and need to be accounted - * for. - */ - adjusted_plen = plen + ulp_extra_len[ulp_submode]; - if (plen <= max_imm) { - - /* Immediate data tx */ - - wr = alloc_wrqe(roundup2(sizeof(*txwr) + plen, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - toep->flags |= TPF_TX_SUSPENDED; - return; - } - txwr = wrtod(wr); - credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, adjusted_plen, credits, - shove, ulp_submode); - m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); - nsegs = 0; - } else { - int wr_len; - - /* DSGL tx */ - wr_len = sizeof(*txwr) + sizeof(struct ulptx_sgl) + - ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; - wr = alloc_wrqe(roundup2(wr_len, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - toep->flags |= TPF_TX_SUSPENDED; - return; - } - txwr = wrtod(wr); - credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, adjusted_plen, credits, - shove, ulp_submode); - write_tx_sgl(txwr + 1, sndptr, m, nsegs, - max_nsegs_1mbuf); - if (wr_len & 0xf) { - uint64_t *pad = (uint64_t *) - ((uintptr_t)txwr + wr_len); - *pad = 0; - } + wr = write_iscsi_mbuf_wr(toep, sndptr); + if (wr == NULL) { + toep->flags |= TPF_TX_SUSPENDED; + return; } + plen = sndptr->m_pkthdr.len; + credits = howmany(wr->wr_len, 16); KASSERT(toep->tx_credits >= credits, ("%s: not enough credits", __func__)); @@ -1068,16 +1105,19 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) toep->tx_credits -= credits; toep->tx_nocompl += credits; toep->plen_nocompl += plen; - if (toep->tx_credits <= toep->tx_total * 3 / 8 && + + /* + * Ensure there are enough credits for a full-sized WR + * as page pod WRs can be full-sized. + */ + if (toep->tx_credits <= SGE_MAX_WR_LEN * 5 / 4 && toep->tx_nocompl >= toep->tx_total / 4) { - txwr->op_to_immdlen |= htobe32(F_FW_WR_COMPL); + wrhdr = wrtod(wr); + wrhdr->hi |= htobe32(F_FW_WR_COMPL); toep->tx_nocompl = 0; toep->plen_nocompl = 0; } - tp->snd_nxt += adjusted_plen; - tp->snd_max += adjusted_plen; - toep->flags |= TPF_TX_DATA_SENT; if (toep->tx_credits < MIN_OFLD_TX_CREDITS) toep->flags |= TPF_TX_SUSPENDED; @@ -1092,9 +1132,6 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) } toep->txsd_avail--; - counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1); - counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen); - t4_l2t_send(sc, wr, toep->l2te); } diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index b0d53dd63997..e87d013a0453 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -1081,11 +1081,30 @@ t4_write_page_pods_for_ps(struct adapter *sc, struct sge_wrq *wrq, int tid, return (0); } +static struct mbuf * +alloc_raw_wr_mbuf(int len) +{ + struct mbuf *m; + + if (len <= MHLEN) + m = m_gethdr(M_NOWAIT, MT_DATA); + else if (len <= MCLBYTES) + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + else + m = NULL; + if (m == NULL) + return (NULL); + m->m_pkthdr.len = len; + m->m_len = len; + set_mbuf_raw_wr(m, true); + return (m); +} + int -t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, +t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, struct ppod_reservation *prsv, vm_offset_t buf, int buflen) { - struct wrqe *wr; + struct inpcb *inp = toep->inp; struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; @@ -1094,6 +1113,8 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, uint32_t cmd; struct ppod_region *pr = prsv->prsv_pr; uintptr_t end_pva, pva, pa; + struct mbuf *m; + struct mbufq wrq; cmd = htobe32(V_ULPTX_CMD(ULP_TX_MEM_WRITE)); if (is_t4(sc)) @@ -1105,6 +1126,7 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); pva = trunc_page(buf); end_pva = trunc_page(buf + buflen - 1); + mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { /* How many page pods are we writing in this cycle */ @@ -1113,12 +1135,14 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, chunk = PPOD_SZ(n); len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); - wr = alloc_wrqe(len, wrq); - if (wr == NULL) - return (ENOMEM); /* ok to just bail out */ - ulpmc = wrtod(wr); + m = alloc_raw_wr_mbuf(len); + if (m == NULL) { + mbufq_drain(&wrq); + return (ENOMEM); + } + ulpmc = mtod(m, struct ulp_mem_io *); - INIT_ULPTX_WR(ulpmc, len, 0, 0); + INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); ulpmc->cmd = cmd; ulpmc->dlen = htobe32(V_ULP_MEMIO_DATA_LEN(chunk / 32)); ulpmc->len16 = htobe32(howmany(len - sizeof(ulpmc->wr), 16)); @@ -1131,7 +1155,7 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, ppod = (struct pagepod *)(ulpsc + 1); for (j = 0; j < n; i++, j++, ppod++) { ppod->vld_tid_pgsz_tag_color = htobe64(F_PPOD_VALID | - V_PPOD_TID(tid) | + V_PPOD_TID(toep->tid) | (prsv->prsv_tag & ~V_PPOD_PGSZ(M_PPOD_PGSZ))); ppod->len_offset = htobe64(V_PPOD_LEN(buflen) | V_PPOD_OFST(offset)); @@ -1148,7 +1172,7 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, #if 0 CTR5(KTR_CXGBE, "%s: tid %d ppod[%d]->addr[%d] = %p", - __func__, tid, i, k, + __func__, toep->tid, i, k, htobe64(ppod->addr[k])); #endif } @@ -1161,9 +1185,13 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, pva -= ddp_pgsz; } - t4_wrq_tx(sc, wr); + mbufq_enqueue(&wrq, m); } + INP_WLOCK(inp); + mbufq_concat(&toep->ulp_pduq, &wrq); + INP_WUNLOCK(inp); + MPASS(pva <= end_pva); return (0); diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 68b3d29295f8..f1129b47cbcf 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -330,6 +330,22 @@ td_adapter(struct tom_data *td) return (td->tod.tod_softc); } +static inline void +set_mbuf_raw_wr(struct mbuf *m, bool raw) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.eight[6] = raw; +} + +static inline bool +mbuf_raw_wr(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.eight[6]); +} + static inline void set_mbuf_ulp_submode(struct mbuf *m, uint8_t ulp_submode) { @@ -423,7 +439,7 @@ int t4_alloc_page_pods_for_buf(struct ppod_region *, vm_offset_t, int, struct ppod_reservation *); int t4_write_page_pods_for_ps(struct adapter *, struct sge_wrq *, int, struct pageset *); -int t4_write_page_pods_for_buf(struct adapter *, struct sge_wrq *, int, +int t4_write_page_pods_for_buf(struct adapter *, struct toepcb *, struct ppod_reservation *, vm_offset_t, int); void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, From nobody Fri Oct 29 23:58:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 89380181CD1C; Fri, 29 Oct 2021 23:58:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrq2rpgz4VFT; Fri, 29 Oct 2021 23:58:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3B82F2006C; Fri, 29 Oct 2021 23:58:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw3Hw003232; Fri, 29 Oct 2021 23:58:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw3MY003231; Fri, 29 Oct 2021 23:58:03 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:03 GMT Message-Id: <202110292358.19TNw3MY003231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4a0500122092 - stable/13 - cxgbei: Use hardware RX flow control for offloaded iSCSI connections. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4a0500122092b500f79d3fd8bd2620474630d659 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4a0500122092b500f79d3fd8bd2620474630d659 commit 4a0500122092b500f79d3fd8bd2620474630d659 Author: John Baldwin AuthorDate: 2021-05-14 19:16:51 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:41:29 +0000 cxgbei: Use hardware RX flow control for offloaded iSCSI connections. Forthcoming T6 iSCSI DDP support requires hardware RX flow control. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29905 (cherry picked from commit 87bb5ed606fc02f6520bbb8f9dfe2bc834a50d4d) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 8 ++++---- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 07f704752305..7027e6428515 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -315,13 +315,13 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tp = intotcpcb(inp); MPASS(icp->icp_seq == tp->rcv_nxt); - MPASS(tp->rcv_wnd >= pdu_len); tp->rcv_nxt += pdu_len; - tp->rcv_wnd -= pdu_len; tp->t_rcvtime = ticks; - /* update rx credits */ - t4_rcvd(&toep->td->tod, tp); /* XXX: sc->tom_softc.tod */ + /* + * Don't update the window size or return credits since RX + * flow control is disabled. + */ so = inp->inp_socket; sb = &so->so_rcv; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4e168a33e2ca..9ee31616b873 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -591,6 +591,9 @@ set_ulp_mode_iscsi(struct adapter *sc, struct toepcb *toep, u_int ulp_submode) t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_ULP_TYPE, V_TCB_ULP_TYPE(M_TCB_ULP_TYPE) | V_TCB_ULP_RAW(M_TCB_ULP_RAW), val, 0, 0); + + val = V_TF_RX_FLOW_CONTROL_DISABLE(1ULL); + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_T_FLAGS, val, val, 0, 0); } /* From nobody Fri Oct 29 23:58:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 25A89181CD9D; Fri, 29 Oct 2021 23:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrr5ZPDz4VLn; Fri, 29 Oct 2021 23:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 53A6C1FF77; Fri, 29 Oct 2021 23:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw4pd003263; Fri, 29 Oct 2021 23:58:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw403003262; Fri, 29 Oct 2021 23:58:04 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:04 GMT Message-Id: <202110292358.19TNw403003262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: e6779ba75bf8 - stable/13 - cxgbei: Whitespace fixes, comment typo, and rewrap a comment. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e6779ba75bf8d85c8b11d639421759210825e7b7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e6779ba75bf8d85c8b11d639421759210825e7b7 commit e6779ba75bf8d85c8b11d639421759210825e7b7 Author: John Baldwin AuthorDate: 2021-05-14 19:16:57 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:43:30 +0000 cxgbei: Whitespace fixes, comment typo, and rewrap a comment. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29906 (cherry picked from commit 91ca7b0954088f882e55e0ece6f456ca172ebcf5) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 2 +- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 12 ++++++------ sys/dev/cxgbe/tom/t4_cpl_io.c | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 7027e6428515..419293ec9cdf 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #include "common/common.h" #include "common/t4_msg.h" -#include "common/t4_regs.h" /* for PCIE_MEM_ACCESS */ +#include "common/t4_regs.h" /* for PCIE_MEM_ACCESS */ #include "tom/t4_tom.h" #include "cxgbei.h" diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 9ee31616b873..655cc1de1478 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -280,7 +280,7 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) last = m_last(m); /* - * Round up the data segment to a 4B boundary. Pad with 0 if + * Round up the data segment to a 4B boundary. Pad with 0 if * necessary. There will definitely be room in the mbuf. */ padding = roundup2(ip->ip_data_len, 4) - ip->ip_data_len; @@ -306,7 +306,7 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) bhs->bhs_data_segment_len[1] = ip->ip_data_len >> 8; bhs->bhs_data_segment_len[0] = ip->ip_data_len >> 16; - /* "Convert" PDU to mbuf chain. Do not use icp/ip after this. */ + /* "Convert" PDU to mbuf chain. Do not use icp/ip after this. */ m->m_pkthdr.len = sizeof(struct iscsi_bhs) + ip->ip_data_len + padding; m->m_next = ip->ip_data_mbuf; set_mbuf_ulp_submode(m, ulp_submode); @@ -347,7 +347,7 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); return (0); } else { - if (flags & M_WAITOK) { + if (flags & M_WAITOK) { CXGBE_UNIMPLEMENTED("fail safe append"); } ip->ip_data_len = m_length(m, NULL); @@ -576,7 +576,7 @@ send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen) toep->txsd_pidx = 0; toep->txsd_avail--; - t4_wrq_tx(sc, wr); + t4_wrq_tx(sc, wr); } static void @@ -813,7 +813,7 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, csio->dxfer_len < ci->ddp_threshold) { no_ddp: /* - * No DDP for this I/O. Allocate an ITT (based on the one + * No DDP for this I/O. Allocate an ITT (based on the one * passed in) that cannot be a valid hardware DDP tag in the * iSCSI region. */ @@ -1049,7 +1049,7 @@ static int icl_cxgbei_limits(struct icl_drv_limits *idl) { - /* Maximum allowed by the RFC. cxgbei_limits will clip them. */ + /* Maximum allowed by the RFC. cxgbei_limits will clip them. */ idl->idl_max_recv_data_segment_length = (1 << 24) - 1; idl->idl_max_send_data_segment_length = (1 << 24) - 1; diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index b2150558165d..0d37804c4f8e 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1821,13 +1821,12 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) SOCKBUF_LOCK(sb); sbu = sbused(sb); if (ulp_mode(toep) == ULP_MODE_ISCSI) { - if (__predict_false(sbu > 0)) { /* - * The data trasmitted before the tid's ULP mode - * changed to ISCSI is still in so_snd. - * Incoming credits should account for so_snd - * first. + * The data transmitted before the + * tid's ULP mode changed to ISCSI is + * still in so_snd. Incoming credits + * should account for so_snd first. */ sbdrop_locked(sb, min(sbu, plen)); plen -= min(sbu, plen); From nobody Fri Oct 29 23:58:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E0EB8181CCCA; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrv16jkz4VJH; Fri, 29 Oct 2021 23:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 960ED1FF78; Fri, 29 Oct 2021 23:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw6h9003311; Fri, 29 Oct 2021 23:58:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw6ms003310; Fri, 29 Oct 2021 23:58:06 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:06 GMT Message-Id: <202110292358.19TNw6ms003310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 68e46643065b - stable/13 - cxgbei: Support DDP for target I/O S/G lists with more than one entry. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 68e46643065b08e01d5640723c7aefc02aebcf3f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=68e46643065b08e01d5640723c7aefc02aebcf3f commit 68e46643065b08e01d5640723c7aefc02aebcf3f Author: John Baldwin AuthorDate: 2021-05-14 19:17:06 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:53:37 +0000 cxgbei: Support DDP for target I/O S/G lists with more than one entry. A CAM target layer I/O CCB can use a S/G list of virtual address ranges to describe its data buffer. This change adds zero-copy receive support for such requests. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29908 (cherry picked from commit 46bee8043ee2bd352d420cd573e0364ca45f813e) (cherry picked from commit 8d2b4b2e7c1e0b10c4d49963753db31c4794dbc4) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 50 +++++++--- sys/dev/cxgbe/tom/t4_ddp.c | 191 ++++++++++++++++++++++++++++++++++++++ sys/dev/cxgbe/tom/t4_tom.h | 5 + 3 files changed, 232 insertions(+), 14 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 655cc1de1478..5770599eeeef 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -873,6 +873,28 @@ icl_cxgbei_conn_task_done(struct icl_conn *ic, void *arg) } } +static inline bool +ddp_sgl_check(struct ctl_sg_entry *sg, int entries, int xferlen) +{ + int total_len = 0; + + MPASS(entries > 0); + if (((vm_offset_t)sg[--entries].addr & 3U) != 0) + return (false); + + total_len += sg[entries].len; + + while (--entries >= 0) { + if (((vm_offset_t)sg[entries].addr & PAGE_MASK) != 0 || + (sg[entries].len % PAGE_SIZE) != 0) + return (false); + total_len += sg[entries].len; + } + + MPASS(total_len == xferlen); + return (true); +} + /* XXXNP: PDU should be passed in as parameter, like on the initiator. */ #define io_to_request_pdu(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr) #define io_to_ppod_reservation(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr) @@ -888,6 +910,8 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct ppod_region *pr = &ci->pr; struct ppod_reservation *prsv; + struct ctl_sg_entry *sgl, sg_entry; + int sg_entries = ctsio->kern_sg_entries; uint32_t ttt; int xferlen, rc = 0, alias; @@ -898,7 +922,6 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, if (ctsio->ext_data_filled == 0) { int first_burst; struct icl_pdu *ip = io_to_request_pdu(io); - vm_offset_t buf; #ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); @@ -931,18 +954,16 @@ no_ddp: return (0); } - if (ctsio->kern_sg_entries == 0) - buf = (vm_offset_t)ctsio->kern_data_ptr; - else if (ctsio->kern_sg_entries == 1) { - struct ctl_sg_entry *sgl = (void *)ctsio->kern_data_ptr; + if (sg_entries == 0) { + sgl = &sg_entry; + sgl->len = xferlen; + sgl->addr = (void *)ctsio->kern_data_ptr; + sg_entries = 1; + } else + sgl = (void *)ctsio->kern_data_ptr; - MPASS(sgl->len == xferlen); - buf = (vm_offset_t)sgl->addr; - } else { - rc = EAGAIN; /* XXX implement */ + if (!ddp_sgl_check(sgl, sg_entries, xferlen)) goto no_ddp; - } - /* * Reserve resources for DDP, update the ttt that should be used @@ -956,14 +977,15 @@ no_ddp: goto no_ddp; } - rc = t4_alloc_page_pods_for_buf(pr, buf, xferlen, prsv); + rc = t4_alloc_page_pods_for_sgl(pr, sgl, sg_entries, prsv); if (rc != 0) { uma_zfree(prsv_zone, prsv); goto no_ddp; } - rc = t4_write_page_pods_for_buf(sc, toep, prsv, buf, xferlen); - if (rc != 0) { + rc = t4_write_page_pods_for_sgl(sc, toep, prsv, sgl, sg_entries, + xferlen); + if (__predict_false(rc != 0)) { t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); goto no_ddp; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index e87d013a0453..34c01674659a 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #ifdef TCP_OFFLOAD #include "common/common.h" #include "common/t4_msg.h" @@ -981,6 +984,76 @@ have_pgsz: return (0); } +int +t4_alloc_page_pods_for_sgl(struct ppod_region *pr, struct ctl_sg_entry *sgl, + int entries, struct ppod_reservation *prsv) +{ + int hcf, seglen, idx = 0, npages, nppods, i, len; + uintptr_t start_pva, end_pva, pva, p1 ; + vm_offset_t buf; + struct ctl_sg_entry *sge; + + MPASS(entries > 0); + MPASS(sgl); + + /* + * The DDP page size is unrelated to the VM page size. We combine + * contiguous physical pages into larger segments to get the best DDP + * page size possible. This is the largest of the four sizes in + * A_ULP_RX_ISCSI_PSZ that evenly divides the HCF of the segment sizes + * in the page list. + */ + hcf = 0; + for (i = entries - 1; i >= 0; i--) { + sge = sgl + i; + buf = (vm_offset_t)sge->addr; + len = sge->len; + start_pva = trunc_page(buf); + end_pva = trunc_page(buf + len - 1); + pva = start_pva; + while (pva <= end_pva) { + seglen = PAGE_SIZE; + p1 = pmap_kextract(pva); + pva += PAGE_SIZE; + while (pva <= end_pva && p1 + seglen == + pmap_kextract(pva)) { + seglen += PAGE_SIZE; + pva += PAGE_SIZE; + } + + hcf = calculate_hcf(hcf, seglen); + if (hcf < (1 << pr->pr_page_shift[1])) { + idx = 0; + goto have_pgsz; /* give up, short circuit */ + } + } + } +#define PR_PAGE_MASK(x) ((1 << pr->pr_page_shift[(x)]) - 1) + MPASS((hcf & PR_PAGE_MASK(0)) == 0); /* PAGE_SIZE is >= 4K everywhere */ + for (idx = nitems(pr->pr_page_shift) - 1; idx > 0; idx--) { + if ((hcf & PR_PAGE_MASK(idx)) == 0) + break; + } +#undef PR_PAGE_MASK + +have_pgsz: + MPASS(idx <= M_PPOD_PGSZ); + + npages = 0; + while (entries--) { + npages++; + start_pva = trunc_page((vm_offset_t)sgl->addr); + end_pva = trunc_page((vm_offset_t)sgl->addr + sgl->len - 1); + npages += (end_pva - start_pva) >> pr->pr_page_shift[idx]; + sgl = sgl + 1; + } + nppods = howmany(npages, PPOD_PAGES); + if (alloc_page_pods(pr, nppods, idx, prsv) != 0) + return (ENOMEM); + MPASS(prsv->prsv_nppods > 0); + return (0); +} + void t4_free_page_pods(struct ppod_reservation *prsv) { @@ -1197,6 +1270,124 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, return (0); } +int +t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, + struct ppod_reservation *prsv, struct ctl_sg_entry *sgl, int entries, + int xferlen) +{ + struct inpcb *inp = toep->inp; + struct ulp_mem_io *ulpmc; + struct ulptx_idata *ulpsc; + struct pagepod *ppod; + int i, j, k, n, chunk, len, ddp_pgsz; + u_int ppod_addr, offset, sg_offset = 0; + uint32_t cmd; + struct ppod_region *pr = prsv->prsv_pr; + uintptr_t pva, pa; + struct mbuf *m; + struct mbufq wrq; + + MPASS(sgl != NULL); + MPASS(entries > 0); + cmd = htobe32(V_ULPTX_CMD(ULP_TX_MEM_WRITE)); + if (is_t4(sc)) + cmd |= htobe32(F_ULP_MEMIO_ORDER); + else + cmd |= htobe32(F_T5_ULP_MEMIO_IMM); + ddp_pgsz = 1 << pr->pr_page_shift[G_PPOD_PGSZ(prsv->prsv_tag)]; + offset = (vm_offset_t)sgl->addr & PAGE_MASK; + ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); + pva = trunc_page((vm_offset_t)sgl->addr); + mbufq_init(&wrq, INT_MAX); + for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { + + /* How many page pods are we writing in this cycle */ + n = min(prsv->prsv_nppods - i, NUM_ULP_TX_SC_IMM_PPODS); + MPASS(n > 0); + chunk = PPOD_SZ(n); + len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); + + m = alloc_raw_wr_mbuf(len); + if (m == NULL) { + mbufq_drain(&wrq); + return (ENOMEM); + } + ulpmc = mtod(m, struct ulp_mem_io *); + + INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); + ulpmc->cmd = cmd; + ulpmc->dlen = htobe32(V_ULP_MEMIO_DATA_LEN(chunk / 32)); + ulpmc->len16 = htobe32(howmany(len - sizeof(ulpmc->wr), 16)); + ulpmc->lock_addr = htobe32(V_ULP_MEMIO_ADDR(ppod_addr >> 5)); + + ulpsc = (struct ulptx_idata *)(ulpmc + 1); + ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); + ulpsc->len = htobe32(chunk); + + ppod = (struct pagepod *)(ulpsc + 1); + for (j = 0; j < n; i++, j++, ppod++) { + ppod->vld_tid_pgsz_tag_color = htobe64(F_PPOD_VALID | + V_PPOD_TID(toep->tid) | + (prsv->prsv_tag & ~V_PPOD_PGSZ(M_PPOD_PGSZ))); + ppod->len_offset = htobe64(V_PPOD_LEN(xferlen) | + V_PPOD_OFST(offset)); + ppod->rsvd = 0; + + for (k = 0; k < nitems(ppod->addr); k++) { + if (entries != 0) { + pa = pmap_kextract(pva + sg_offset); + ppod->addr[k] = htobe64(pa); + } else + ppod->addr[k] = 0; + +#if 0 + CTR5(KTR_CXGBE, + "%s: tid %d ppod[%d]->addr[%d] = %p", + __func__, toep->tid, i, k, + htobe64(ppod->addr[k])); +#endif + + /* + * If this is the last entry in a pod, + * reuse the same entry for first address + * in the next pod. + */ + if (k + 1 == nitems(ppod->addr)) + break; + + /* + * Don't move to the next DDP page if the + * sgl is already finished. + */ + if (entries == 0) + continue; + + sg_offset += ddp_pgsz; + if (sg_offset == sgl->len) { + /* + * This sgl entry is done. Go + * to the next. + */ + entries--; + sgl++; + sg_offset = 0; + if (entries != 0) + pva = trunc_page( + (vm_offset_t)sgl->addr); + } + } + } + + mbufq_enqueue(&wrq, m); + } + + INP_WLOCK(inp); + mbufq_concat(&toep->ulp_pduq, &wrq); + INP_WUNLOCK(inp); + + return (0); +} + /* * Prepare a pageset for DDP. This sets up page pods. */ diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index f1129b47cbcf..c7984f838735 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -88,6 +88,7 @@ enum { DDP_DEAD = (1 << 6), /* toepcb is shutting down */ }; +struct ctl_sg_entry; struct sockopt; struct offload_settings; @@ -437,10 +438,14 @@ void t4_free_ppod_region(struct ppod_region *); int t4_alloc_page_pods_for_ps(struct ppod_region *, struct pageset *); int t4_alloc_page_pods_for_buf(struct ppod_region *, vm_offset_t, int, struct ppod_reservation *); +int t4_alloc_page_pods_for_sgl(struct ppod_region *, struct ctl_sg_entry *, int, + struct ppod_reservation *); int t4_write_page_pods_for_ps(struct adapter *, struct sge_wrq *, int, struct pageset *); int t4_write_page_pods_for_buf(struct adapter *, struct toepcb *, struct ppod_reservation *, vm_offset_t, int); +int t4_write_page_pods_for_sgl(struct adapter *, struct toepcb *, + struct ppod_reservation *, struct ctl_sg_entry *, int, int); void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, struct mbuf **, struct mbuf **, int *); From nobody Fri Oct 29 23:58:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 661B5181CCC1; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrt6vsWz4V6k; Fri, 29 Oct 2021 23:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 73F9F2023E; Fri, 29 Oct 2021 23:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw5Su003287; Fri, 29 Oct 2021 23:58:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw5Ym003286; Fri, 29 Oct 2021 23:58:05 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:05 GMT Message-Id: <202110292358.19TNw5Ym003286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cdb8017d0bb1 - stable/13 - cxgbe tom: Account for pre-iSCSI mode data on suspended connections. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cdb8017d0bb1e6cdf28555108b86968e17d0178b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cdb8017d0bb1e6cdf28555108b86968e17d0178b commit cdb8017d0bb1e6cdf28555108b86968e17d0178b Author: John Baldwin AuthorDate: 2021-05-14 19:17:02 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:48:44 +0000 cxgbe tom: Account for pre-iSCSI mode data on suspended connections. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29907 (cherry picked from commit 23b209ee885b7891f806ecfe1bb944e40b3b4728) --- sys/dev/cxgbe/tom/t4_cpl_io.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 0d37804c4f8e..acb2d3408244 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1058,9 +1058,7 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) struct fw_wr_hdr *wrhdr; struct wrqe *wr; u_int plen, credits; -#ifdef INVARIANTS struct inpcb *inp = toep->inp; -#endif struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; struct mbufq *pduq = &toep->ulp_pduq; @@ -1083,8 +1081,34 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) return; } - if (drop) + if (drop) { + struct socket *so = inp->inp_socket; + struct sockbuf *sb = &so->so_snd; + int sbu; + + /* + * An unlocked read is ok here as the data should only + * transition from a non-zero value to either another + * non-zero value or zero. Once it is zero it should + * stay zero. + */ + if (__predict_false(sbused(sb)) > 0) { + SOCKBUF_LOCK(sb); + sbu = sbused(sb); + if (sbu > 0) { + /* + * The data transmitted before the + * tid's ULP mode changed to ISCSI is + * still in so_snd. Incoming credits + * should account for so_snd first. + */ + sbdrop_locked(sb, min(sbu, drop)); + drop -= min(sbu, drop); + } + sowwakeup_locked(so); /* unlocks so_snd */ + } rqdrop_locked(&toep->ulp_pdu_reclaimq, drop); + } while ((sndptr = mbufq_first(pduq)) != NULL) { wr = write_iscsi_mbuf_wr(toep, sndptr); From nobody Fri Oct 29 23:58:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9C2A5181D0E5; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzs44kPWz4VRc; Fri, 29 Oct 2021 23:58:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9D2AD2023F; Fri, 29 Oct 2021 23:58:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwFqD003519; Fri, 29 Oct 2021 23:58:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwFuX003518; Fri, 29 Oct 2021 23:58:15 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:15 GMT Message-Id: <202110292358.19TNwFuX003518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4aa41b1e7685 - stable/13 - cxgbei: Add tunable sysctls for the FirstBurstLength and MaxBurstLength. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4aa41b1e768545fd7fde1cb9509f412a76483f62 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4aa41b1e768545fd7fde1cb9509f412a76483f62 commit 4aa41b1e768545fd7fde1cb9509f412a76483f62 Author: John Baldwin AuthorDate: 2021-05-19 22:56:54 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:03:04 +0000 cxgbei: Add tunable sysctls for the FirstBurstLength and MaxBurstLength. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30269 (cherry picked from commit 3bede2908acc6cbc8e809d63d7c9b5fd95932dfb) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index d54464b63542..fce593b54032 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -104,6 +104,12 @@ static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Chelsio iSCSI offload"); +static int first_burst_length = 8192; +SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, first_burst_length, CTLFLAG_RWTUN, + &first_burst_length, 0, "First burst length"); +static int max_burst_length = 2 * 1024 * 1024; +SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, max_burst_length, CTLFLAG_RWTUN, + &max_burst_length, 0, "Maximum burst length"); static int sendspace = 1048576; SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, sendspace, CTLFLAG_RWTUN, &sendspace, 0, "Default send socket buffer size"); @@ -1206,8 +1212,8 @@ icl_cxgbei_limits(struct icl_drv_limits *idl) idl->idl_max_send_data_segment_length = (1 << 24) - 1; /* These are somewhat arbitrary. */ - idl->idl_max_burst_length = 2 * 1024 * 1024; - idl->idl_first_burst_length = 8192; + idl->idl_max_burst_length = max_burst_length; + idl->idl_first_burst_length = first_burst_length; t4_iterate(cxgbei_limits, idl); From nobody Fri Oct 29 23:58:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A3950181D3B9; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsF0hwfz4VQ0; Fri, 29 Oct 2021 23:58:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 68C181FF7C; Fri, 29 Oct 2021 23:58:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwMea003678; Fri, 29 Oct 2021 23:58:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwMdN003677; Fri, 29 Oct 2021 23:58:22 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:22 GMT Message-Id: <202110292358.19TNwMdN003677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f0334cb8d345 - stable/13 - cxgbei: Better handle new tasks and transfers when disconnecting. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f0334cb8d345da6039d76ed6be9790aba0e94b34 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f0334cb8d345da6039d76ed6be9790aba0e94b34 commit f0334cb8d345da6039d76ed6be9790aba0e94b34 Author: John Baldwin AuthorDate: 2021-06-18 23:15:50 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:10:14 +0000 cxgbei: Better handle new tasks and transfers when disconnecting. If the connection is in the process of disconnecting, ic_socket can be NULL. For icl_cxgbei_conn_transfer_setup(), lock the connection and check ic_socket before using it. For icl_cxgbei_conn_task_setup(), the caller already holds the connection lock, so assert it and bail early with ECONNRESET if the connection is disconnecting. Reported by: Jithesh Arakkan @ Chelsio Fixes: f949967c8eb3 cxgbei: Fix a race between transfer setup and a peer reset. (cherry picked from commit abc273a2901b116cc98a1fb506c75ac1b0a14cd3) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 01759d929c0e..e974ad73a935 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -988,10 +988,15 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, uint32_t itt; int rc = 0; + ICL_CONN_LOCK_ASSERT(ic); + /* This is for the offload driver's state. Must not be set already. */ MPASS(arg != NULL); MPASS(*arg == NULL); + if (ic->ic_disconnecting || ic->ic_socket == NULL) + return (ECONNRESET); + if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_IN || csio->dxfer_len < ci->ddp_threshold) { no_ddp: @@ -1209,8 +1214,17 @@ no_ddp: * Do not get inp from toep->inp as the toepcb might * have detached already. */ + ICL_CONN_LOCK(ic); + if (ic->ic_disconnecting || ic->ic_socket == NULL) { + ICL_CONN_UNLOCK(ic); + mbufq_drain(&mq); + t4_free_page_pods(prsv); + free(ddp, M_CXGBEI); + return (ECONNRESET); + } inp = sotoinpcb(ic->ic_socket); INP_WLOCK(inp); + ICL_CONN_UNLOCK(ic); if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { INP_WUNLOCK(inp); mbufq_drain(&mq); From nobody Fri Oct 29 23:58:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 50D1D181D0C3; Fri, 29 Oct 2021 23:58:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzs16zJGz4VMX; Fri, 29 Oct 2021 23:58:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4AE1C2006F; Fri, 29 Oct 2021 23:58:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwChO003439; Fri, 29 Oct 2021 23:58:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwCir003438; Fri, 29 Oct 2021 23:58:12 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:12 GMT Message-Id: <202110292358.19TNwCir003438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5013fe43c85e - stable/13 - cxgbei: Explicitly clear the page pode reservation pointer after freeing it. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5013fe43c85ec39cb7d6ce9386074125e24211c2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5013fe43c85ec39cb7d6ce9386074125e24211c2 commit 5013fe43c85ec39cb7d6ce9386074125e24211c2 Author: John Baldwin AuthorDate: 2021-05-14 19:20:51 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:00:13 +0000 cxgbei: Explicitly clear the page pode reservation pointer after freeing it. A single union ctl_io can be reused across multiple transfers (in particular by the ramdisk backend). On a reuse, the reservation pointer would retain its value from the previous transfer tripping an assertion. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29939 (cherry picked from commit e894e3adb206815c2acff17a4011becb166c2f66) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index e3dc05645732..7f638c96483a 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1162,6 +1162,7 @@ icl_cxgbei_conn_transfer_done(struct icl_conn *ic, void *arg) t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); + io_to_ppod_reservation(ctsio) = NULL; } } From nobody Fri Oct 29 23:58:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7B778181CD6C; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrw1mJDz4VM4; Fri, 29 Oct 2021 23:58:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B8B052006D; Fri, 29 Oct 2021 23:58:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw7Al003336; Fri, 29 Oct 2021 23:58:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw7jr003335; Fri, 29 Oct 2021 23:58:07 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:07 GMT Message-Id: <202110292358.19TNw7jr003335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 19224c9f8477 - stable/13 - cxgbei: Rework the pdu_append_data hook to support M_WAITOK. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 19224c9f8477c73776664ee9fca7e119db364e00 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=19224c9f8477c73776664ee9fca7e119db364e00 commit 19224c9f8477c73776664ee9fca7e119db364e00 Author: John Baldwin AuthorDate: 2021-05-14 19:17:14 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:54:22 +0000 cxgbei: Rework the pdu_append_data hook to support M_WAITOK. - Only allocate 16K jumbo mbufs if the region of data to be appended is sufficiently large, and use a loop. - Use m_getm2() to allocate a chain for data less than 16K, or if m_getjcl() fails. - Use ENOMEM as the return value instead of '1' if the hook fails due to a memory allocation error. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29909 (cherry picked from commit 31df8ff73e3aa809146fae9baa6a96e1adf8526b) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 65 ++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 5770599eeeef..f91b9ee38616 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -324,35 +324,70 @@ int icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, const void *addr, size_t len, int flags) { - struct mbuf *m; #ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); #endif + struct mbuf *m, *m_tail; + const char *src; MPASS(icp->icp_signature == CXGBEI_PDU_SIGNATURE); MPASS(ic == ip->ip_conn); KASSERT(len > 0, ("%s: len is %jd", __func__, (intmax_t)len)); - m = ip->ip_data_mbuf; - if (m == NULL) { + m_tail = ip->ip_data_mbuf; + if (m_tail != NULL) + for (; m_tail->m_next != NULL; m_tail = m_tail->m_next) + ; + + src = (const char *)addr; + + /* Allocate as jumbo mbufs of size MJUM16BYTES. */ + while (len >= MJUM16BYTES) { m = m_getjcl(M_NOWAIT, MT_DATA, 0, MJUM16BYTES); - if (__predict_false(m == NULL)) + if (__predict_false(m == NULL)) { + if ((flags & M_WAITOK) != 0) { + /* Fall back to non-jumbo mbufs. */ + break; + } return (ENOMEM); - - ip->ip_data_mbuf = m; + } + memcpy(mtod(m, void *), src, MJUM16BYTES); + m->m_len = MJUM16BYTES; + if (ip->ip_data_mbuf == NULL) { + ip->ip_data_mbuf = m_tail = m; + ip->ip_data_len = MJUM16BYTES; + } else { + m_tail->m_next = m; + m_tail = m_tail->m_next; + ip->ip_data_len += MJUM16BYTES; + } + src += MJUM16BYTES; + len -= MJUM16BYTES; } - if (__predict_true(m_append(m, len, addr) != 0)) { - ip->ip_data_len += len; - MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); - return (0); - } else { - if (flags & M_WAITOK) { - CXGBE_UNIMPLEMENTED("fail safe append"); + /* Allocate mbuf chain for the remaining data. */ + if (len != 0) { + m = m_getm2(NULL, len, flags, MT_DATA, 0); + if (__predict_false(m == NULL)) + return (ENOMEM); + if (ip->ip_data_mbuf == NULL) { + ip->ip_data_mbuf = m; + ip->ip_data_len = len; + } else { + m_tail->m_next = m; + ip->ip_data_len += len; } - ip->ip_data_len = m_length(m, NULL); - return (1); + for (; m != NULL; m = m->m_next) { + m->m_len = min(len, M_SIZE(m)); + memcpy(mtod(m, void *), src, m->m_len); + src += m->m_len; + len -= m->m_len; + } + MPASS(len == 0); } + MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); + + return (0); } void From nobody Fri Oct 29 23:58:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0AC53181D4D5; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsF1XVJz4VS0; Fri, 29 Oct 2021 23:58:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4C26420241; Fri, 29 Oct 2021 23:58:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwLDZ003653; Fri, 29 Oct 2021 23:58:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwLsK003646; Fri, 29 Oct 2021 23:58:21 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:21 GMT Message-Id: <202110292358.19TNwLsK003646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 0d4f552d49d2 - stable/13 - cxgbe tom: Free pending iSCSI mbufs on connection shutdown. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0d4f552d49d2a8cda225955860d4a365fc2a9fbe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0d4f552d49d2a8cda225955860d4a365fc2a9fbe commit 0d4f552d49d2a8cda225955860d4a365fc2a9fbe Author: John Baldwin AuthorDate: 2021-05-21 00:16:23 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:09:15 +0000 cxgbe tom: Free pending iSCSI mbufs on connection shutdown. If an iSCSI connection is shutdown abruptly (e.g. by a RST from the peer), pending iSCSI PDUs and page pod work requests can be in the ulp_pduq when the final CPL is received indicating the death of the connection. Reported by: Jithesh Arakkan @ Chelsio (cherry picked from commit 677cb9722a64d3f944d3e374e0ef1bb0e45644b5) --- sys/dev/cxgbe/tom/t4_tom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index fe0ebfbd832b..f3cd8270d24d 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -863,6 +863,7 @@ final_cpl_received(struct toepcb *toep) tls_detach(toep); toep->inp = NULL; toep->flags &= ~TPF_CPL_PENDING; + mbufq_drain(&toep->ulp_pduq); mbufq_drain(&toep->ulp_pdu_reclaimq); if (!(toep->flags & TPF_ATTACHED)) From nobody Fri Oct 29 23:58:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2D909181D010; Fri, 29 Oct 2021 23:58:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrz2pYpz4VGD; Fri, 29 Oct 2021 23:58:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 245FF201ED; Fri, 29 Oct 2021 23:58:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwBiC003414; Fri, 29 Oct 2021 23:58:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwBY7003413; Fri, 29 Oct 2021 23:58:11 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:11 GMT Message-Id: <202110292358.19TNwBY7003413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a780968e04ba - stable/13 - cxgbei: Don't clamp iSCSI PDUs to 8K. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a780968e04ba763cef66e98a9be5b8d6d7426365 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a780968e04ba763cef66e98a9be5b8d6d7426365 commit a780968e04ba763cef66e98a9be5b8d6d7426365 Author: John Baldwin AuthorDate: 2021-05-14 19:17:31 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:59:26 +0000 cxgbei: Don't clamp iSCSI PDUs to 8K. The firmware no longer requires this workaround. Discussed with: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29912 (cherry picked from commit 1ad32ad0bed40be5deb87a36a0564adc994ad47a) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 419293ec9cdf..f95c9f60163f 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -114,9 +114,6 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, rx_len = min(rx_len, v); tx_len = min(tx_len, v); - /* Remove after FW_FLOWC_MNEM_TXDATAPLEN_MAX fix in firmware. */ - tx_len = min(tx_len, 3 * 4096); - *max_tx_pdu_len = rounddown2(tx_len, 512); *max_rx_pdu_len = rounddown2(rx_len, 512); } From nobody Fri Oct 29 23:58:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5BFD1181D241; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsC4HqJz4V8C; Fri, 29 Oct 2021 23:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 24F3820240; Fri, 29 Oct 2021 23:58:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwKlj003615; Fri, 29 Oct 2021 23:58:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwK66003614; Fri, 29 Oct 2021 23:58:20 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:20 GMT Message-Id: <202110292358.19TNwK66003614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 0695b57a9875 - stable/13 - cxgbei: Fix a race between transfer setup and a peer reset. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0695b57a987591b7b5e5ac0e78365c69faf11216 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0695b57a987591b7b5e5ac0e78365c69faf11216 commit 0695b57a987591b7b5e5ac0e78365c69faf11216 Author: John Baldwin AuthorDate: 2021-05-20 23:03:19 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:08:09 +0000 cxgbei: Fix a race between transfer setup and a peer reset. In 4427ac3675f9, the TOM driver stopped sending work requests to program iSCSI page pods directly and instead queued them to be written asynchronously with iSCSI PDUs. The queue of mbufs to send is protected by the inp lock. However, the inp cannot be safely obtained from the toep since a RST from the remote peer might have cleared toep->inp asynchronously in an ithread. To fix, obtain the inp from the socket as is already done in icl_cxgbei_conn_pdu_queue_cb() and fail the new transfer setup with ECONNRESET if the connection has been reset. To avoid passing sockets or inps into the page pod routines, pull the mbufq out of the two relevant page pod routines such that the routines queue new work request mbufs to a caller-supplied mbufq. Reported by: Jithesh Arakkan @ Chelsio Fixes: 4427ac3675f91df039d54a23518132e0e0fede86 (cherry picked from commit f949967c8eb3ab5e5a965e3cf07a726dfdc81263) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 44 +++++++++++++++++++++++++++++++++++++-- sys/dev/cxgbe/tom/t4_ddp.c | 31 +++++++-------------------- sys/dev/cxgbe/tom/t4_tom.h | 4 ++-- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index b9f7c6355b6f..01759d929c0e 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -983,6 +983,8 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, struct ppod_region *pr = &ci->pr; struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; + struct inpcb *inp; + struct mbufq mq; uint32_t itt; int rc = 0; @@ -1028,14 +1030,32 @@ no_ddp: goto no_ddp; } + mbufq_init(&mq, INT_MAX); rc = t4_write_page_pods_for_buf(sc, toep, prsv, - (vm_offset_t)csio->data_ptr, csio->dxfer_len); + (vm_offset_t)csio->data_ptr, csio->dxfer_len, &mq); if (__predict_false(rc != 0)) { + mbufq_drain(&mq); t4_free_page_pods(prsv); free(ddp, M_CXGBEI); goto no_ddp; } + /* + * Do not get inp from toep->inp as the toepcb might have + * detached already. + */ + inp = sotoinpcb(ic->ic_socket); + INP_WLOCK(inp); + if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + INP_WUNLOCK(inp); + mbufq_drain(&mq); + t4_free_page_pods(prsv); + free(ddp, M_CXGBEI); + return (ECONNRESET); + } + mbufq_concat(&toep->ulp_pduq, &mq); + INP_WUNLOCK(inp); + ddp->cmp.last_datasn = -1; cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *ittp = htobe32(prsv->prsv_tag); @@ -1096,6 +1116,8 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; struct ctl_sg_entry *sgl, sg_entry; + struct inpcb *inp; + struct mbufq mq; int sg_entries = ctsio->kern_sg_entries; uint32_t ttt; int xferlen, rc = 0, alias; @@ -1173,14 +1195,32 @@ no_ddp: goto no_ddp; } + mbufq_init(&mq, INT_MAX); rc = t4_write_page_pods_for_sgl(sc, toep, prsv, sgl, sg_entries, - xferlen); + xferlen, &mq); if (__predict_false(rc != 0)) { + mbufq_drain(&mq); t4_free_page_pods(prsv); free(ddp, M_CXGBEI); goto no_ddp; } + /* + * Do not get inp from toep->inp as the toepcb might + * have detached already. + */ + inp = sotoinpcb(ic->ic_socket); + INP_WLOCK(inp); + if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + INP_WUNLOCK(inp); + mbufq_drain(&mq); + t4_free_page_pods(prsv); + free(ddp, M_CXGBEI); + return (ECONNRESET); + } + mbufq_concat(&toep->ulp_pduq, &mq); + INP_WUNLOCK(inp); + ddp->cmp.next_buffer_offset = ctsio->kern_rel_offset + first_burst; ddp->cmp.last_datasn = -1; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 34c01674659a..2b58cb60d4fd 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -1175,9 +1175,9 @@ alloc_raw_wr_mbuf(int len) int t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, - struct ppod_reservation *prsv, vm_offset_t buf, int buflen) + struct ppod_reservation *prsv, vm_offset_t buf, int buflen, + struct mbufq *wrq) { - struct inpcb *inp = toep->inp; struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; @@ -1187,7 +1187,6 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, struct ppod_region *pr = prsv->prsv_pr; uintptr_t end_pva, pva, pa; struct mbuf *m; - struct mbufq wrq; cmd = htobe32(V_ULPTX_CMD(ULP_TX_MEM_WRITE)); if (is_t4(sc)) @@ -1199,7 +1198,6 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); pva = trunc_page(buf); end_pva = trunc_page(buf + buflen - 1); - mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { /* How many page pods are we writing in this cycle */ @@ -1209,10 +1207,8 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); m = alloc_raw_wr_mbuf(len); - if (m == NULL) { - mbufq_drain(&wrq); + if (m == NULL) return (ENOMEM); - } ulpmc = mtod(m, struct ulp_mem_io *); INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); @@ -1258,13 +1254,9 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, pva -= ddp_pgsz; } - mbufq_enqueue(&wrq, m); + mbufq_enqueue(wrq, m); } - INP_WLOCK(inp); - mbufq_concat(&toep->ulp_pduq, &wrq); - INP_WUNLOCK(inp); - MPASS(pva <= end_pva); return (0); @@ -1273,9 +1265,8 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, int t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, struct ppod_reservation *prsv, struct ctl_sg_entry *sgl, int entries, - int xferlen) + int xferlen, struct mbufq *wrq) { - struct inpcb *inp = toep->inp; struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; @@ -1285,7 +1276,6 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, struct ppod_region *pr = prsv->prsv_pr; uintptr_t pva, pa; struct mbuf *m; - struct mbufq wrq; MPASS(sgl != NULL); MPASS(entries > 0); @@ -1298,7 +1288,6 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, offset = (vm_offset_t)sgl->addr & PAGE_MASK; ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); pva = trunc_page((vm_offset_t)sgl->addr); - mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { /* How many page pods are we writing in this cycle */ @@ -1308,10 +1297,8 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); m = alloc_raw_wr_mbuf(len); - if (m == NULL) { - mbufq_drain(&wrq); + if (m == NULL) return (ENOMEM); - } ulpmc = mtod(m, struct ulp_mem_io *); INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); @@ -1378,13 +1365,9 @@ t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, } } - mbufq_enqueue(&wrq, m); + mbufq_enqueue(wrq, m); } - INP_WLOCK(inp); - mbufq_concat(&toep->ulp_pduq, &wrq); - INP_WUNLOCK(inp); - return (0); } diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index c7984f838735..21cfb1df6e16 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -443,9 +443,9 @@ int t4_alloc_page_pods_for_sgl(struct ppod_region *, struct ctl_sg_entry *, int, int t4_write_page_pods_for_ps(struct adapter *, struct sge_wrq *, int, struct pageset *); int t4_write_page_pods_for_buf(struct adapter *, struct toepcb *, - struct ppod_reservation *, vm_offset_t, int); + struct ppod_reservation *, vm_offset_t, int, struct mbufq *); int t4_write_page_pods_for_sgl(struct adapter *, struct toepcb *, - struct ppod_reservation *, struct ctl_sg_entry *, int, int); + struct ppod_reservation *, struct ctl_sg_entry *, int, int, struct mbufq *); void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, struct mbuf **, struct mbuf **, int *); From nobody Fri Oct 29 23:58:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9567E181D35D; Fri, 29 Oct 2021 23:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsB3fqmz4VPs; Fri, 29 Oct 2021 23:58:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 00DAB1FF7B; Fri, 29 Oct 2021 23:58:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwIcA003591; Fri, 29 Oct 2021 23:58:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwIx7003590; Fri, 29 Oct 2021 23:58:18 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:18 GMT Message-Id: <202110292358.19TNwIx7003590@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cc44e4e55b4a - stable/13 - cxgbei: Support iSCSI offload on T6. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc44e4e55b4acb7556b7004db72784cd04916630 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cc44e4e55b4acb7556b7004db72784cd04916630 commit cc44e4e55b4acb7556b7004db72784cd04916630 Author: John Baldwin AuthorDate: 2021-05-28 23:45:29 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:07:26 +0000 cxgbei: Support iSCSI offload on T6. T6 makes several changes relative to T5 for receive of iSCSI PDUs. First, earlier adapters issue either 2 or 3 messages to the host for each PDU received: CPL_ISCSI_HDR contains the BHS of the PDU, CPL_ISCSI_DATA (when DDP is not used for zero-copy receive) contains the PDU data as buffers on the freelist, and CPL_RX_ISCSI_DDP with status of the PDU such as result of CRC checks. In T6, a new CPL_RX_ISCSI_CMP combines CPL_ISCSI_HDR and CPL_RX_ISCSI_DDP. Data PDUs which are directly placed via DDP only report a single CPL_RX_ISCSI_CMP message. Data PDUs received on the free lists are reported as CPL_ISCSI_DATA followed by CPL_RX_ISCSI_CMP. Control PDUs such as R2T are still reported via CPL_ISCSI_HDR and CPL_RX_ISCSI_DDP. Supporting this requires changing the CPL_ISCSI_DATA handler to allocate a PDU structure if it is not preceded by a CPL_ISCSI_HDR as well as support for the new CPL_RX_ISCSI_CMP. Second, when using DDP for zero-copy receive, T6 will only issue a CPL_RX_ISCSI_CMP after a burst of PDUs have been received (indicated by the F flag in the BHS). In this case, the CPL_RX_ISCSI_CMP can reflect the completion of multiple PDUs and the BHS and TCP sequence number included in the message are from the last PDU received in the burst. Notably, the message does not include any information about earlier PDUs received as part of the burst. Instead, the driver must track the amount of data already received for a given transfer and use this to compute the amount of data received in a burst. In addition, the iSCSI layer currently has no way to permit receiving a logical PDU which spans multiple PDUs. Instead, the driver presents each burst as a single, "large" PDU to the iSCSI target and initiators. This is done by rewriting the buffer offset and data length fields in the BHS of the final PDU as well as rewriting the DataSN so that the received PDUs appear to be in order. To track all this, cxgbei maintains a hash table of 'cxgbei_cmp' structures indexed by transfer tags for each offloaded iSCSI connection. When a SCSI_DATA_IN message is received, the ITT from the received BHS is used to find the necessary state in the hash table, whereas SCSI_DATA_OUT replies use the TTT as the key. The structure tracks the expected starting offset and DataSN of the next burst as well as the rewritten DataSN value used for the previously received PDU. Discussed with: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30458 (cherry picked from commit 67360f7bb0bb575d823c21420abaf165ecf62066) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 280 ++++++++++++++++++++++++++++++++++++-- sys/dev/cxgbe/cxgbei/cxgbei.h | 16 +++ sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 154 +++++++++++++++------ 3 files changed, 395 insertions(+), 55 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index f95c9f60163f..c70bda7e0436 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -222,27 +222,47 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); struct icl_cxgbei_pdu *icp = toep->ulpcb2; + struct icl_pdu *ip; M_ASSERTPKTHDR(m); MPASS(m->m_pkthdr.len == be16toh(cpl->len) + sizeof(*cpl)); - /* Must already have received the header (but not the data). */ - MPASS(icp != NULL); - MPASS(icp->icp_flags == ICPF_RX_HDR); - MPASS(icp->ip.ip_data_mbuf == NULL); - + if (icp == NULL) { + /* + * T6 completion enabled, start of a new pdu. Header + * will come in completion CPL. + */ + ip = icl_cxgbei_new_pdu(M_NOWAIT); + if (ip == NULL) + CXGBE_UNIMPLEMENTED("PDU allocation failure"); + icp = ip_to_icp(ip); + } else { + /* T5 mode, header is already received. */ + MPASS(icp->icp_flags == ICPF_RX_HDR); + MPASS(icp->ip.ip_data_mbuf == NULL); + MPASS(icp->ip.ip_data_len == m->m_pkthdr.len - sizeof(*cpl)); + } + /* Trim the cpl header from mbuf. */ m_adj(m, sizeof(*cpl)); - MPASS(icp->ip.ip_data_len == m->m_pkthdr.len); icp->icp_flags |= ICPF_RX_FLBUF; icp->ip.ip_data_mbuf = m; toep->ofld_rxq->rx_iscsi_fl_pdus++; toep->ofld_rxq->rx_iscsi_fl_octets += m->m_pkthdr.len; + /* + * For T6, save the icp for further processing in the + * completion handler. + */ + if (icp->icp_flags == ICPF_RX_FLBUF) { + MPASS(toep->ulpcb2 == NULL); + toep->ulpcb2 = icp; + } + #if 0 - CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid, - be16toh(cpl->len)); + CTR4(KTR_CXGBE, "%s: tid %u, cpl->len %u, icp %p", __func__, tid, + be16toh(cpl->len), icp); #endif return (0); @@ -304,15 +324,17 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) __func__, tid, pdu_len, inp->inp_flags); INP_WUNLOCK(inp); icl_cxgbei_conn_pdu_free(NULL, ip); -#ifdef INVARIANTS toep->ulpcb2 = NULL; -#endif return (0); } + /* + * T6+ does not report data PDUs received via DDP without F + * set. This can result in gaps in the TCP sequence space. + */ tp = intotcpcb(inp); - MPASS(icp->icp_seq == tp->rcv_nxt); - tp->rcv_nxt += pdu_len; + MPASS(chip_id(sc) >= CHELSIO_T6 || icp->icp_seq == tp->rcv_nxt); + tp->rcv_nxt = icp->icp_seq + pdu_len; tp->t_rcvtime = ticks; /* @@ -342,9 +364,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) CURVNET_RESTORE(); icl_cxgbei_conn_pdu_free(NULL, ip); -#ifdef INVARIANTS toep->ulpcb2 = NULL; -#endif return (0); } MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); @@ -399,10 +419,238 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) SOCKBUF_UNLOCK(sb); INP_WUNLOCK(inp); -#ifdef INVARIANTS toep->ulpcb2 = NULL; + + return (0); +} + +static int +do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) +{ + struct epoch_tracker et; + struct adapter *sc = iq->adapter; + struct cpl_rx_iscsi_cmp *cpl = mtod(m, struct cpl_rx_iscsi_cmp *); + u_int tid = GET_TID(cpl); + struct toepcb *toep = lookup_tid(sc, tid); + struct icl_cxgbei_pdu *icp = toep->ulpcb2; + struct icl_pdu *ip; + struct cxgbei_cmp *cmp; + struct inpcb *inp = toep->inp; +#ifdef INVARIANTS + uint16_t len = be16toh(cpl->len); +#endif + struct socket *so; + struct sockbuf *sb; + struct tcpcb *tp; + struct icl_cxgbei_conn *icc; + struct icl_conn *ic; + struct iscsi_bhs_data_out *bhsdo; + u_int val = be32toh(cpl->ddpvld); + u_int npdus, pdu_len, data_digest_len, hdr_digest_len; + uint32_t prev_seg_len; + + M_ASSERTPKTHDR(m); + MPASS(m->m_pkthdr.len == len + sizeof(*cpl)); + + if ((val & F_DDP_PDU) == 0) { + MPASS(icp != NULL); + MPASS((icp->icp_flags & ICPF_RX_STATUS) == 0); + ip = &icp->ip; + } + + if (icp == NULL) { + /* T6 completion enabled, start of a new PDU. */ + ip = icl_cxgbei_new_pdu(M_NOWAIT); + if (ip == NULL) + CXGBE_UNIMPLEMENTED("PDU allocation failure"); + icp = ip_to_icp(ip); + } + pdu_len = G_ISCSI_PDU_LEN(be16toh(cpl->pdu_len_ddp)); + +#if 0 + CTR5(KTR_CXGBE, + "%s: tid %u, cpl->len %u, ddpvld 0x%08x, icp %p", + __func__, tid, pdu_len, val, icp); #endif + /* Copy header */ + m_copydata(m, sizeof(*cpl), ISCSI_BHS_SIZE, (caddr_t)ip->ip_bhs); + bhsdo = (struct iscsi_bhs_data_out *)ip->ip_bhs; + ip->ip_data_len = bhsdo->bhsdo_data_segment_len[0] << 16 | + bhsdo->bhsdo_data_segment_len[1] << 8 | + bhsdo->bhsdo_data_segment_len[2]; + icp->icp_seq = ntohl(cpl->seq); + icp->icp_flags |= ICPF_RX_HDR; + icp->icp_flags |= ICPF_RX_STATUS; + + if (val & F_DDP_PADDING_ERR) + icp->icp_flags |= ICPF_PAD_ERR; + if (val & F_DDP_HDRCRC_ERR) + icp->icp_flags |= ICPF_HCRC_ERR; + if (val & F_DDP_DATACRC_ERR) + icp->icp_flags |= ICPF_DCRC_ERR; + + INP_WLOCK(inp); + if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { + CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", + __func__, tid, pdu_len, inp->inp_flags); + INP_WUNLOCK(inp); + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + return (0); + } + + tp = intotcpcb(inp); + + /* + * If icc is NULL, the connection is being closed in + * icl_cxgbei_conn_close(), just drop this data. + */ + icc = toep->ulpcb; + if (__predict_false(icc == NULL)) { + CTR4(KTR_CXGBE, "%s: tid %u, excess rx (%d bytes), icc %p", + __func__, tid, pdu_len, icc); + + /* + * Update rcv_nxt so the sequence number of the FIN + * doesn't appear wrong. + */ + tp->rcv_nxt = icp->icp_seq + pdu_len; + tp->t_rcvtime = ticks; + INP_WUNLOCK(inp); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + return (0); + } + + data_digest_len = (icc->ulp_submode & ULP_CRC_DATA) ? + ISCSI_DATA_DIGEST_SIZE : 0; + hdr_digest_len = (icc->ulp_submode & ULP_CRC_HEADER) ? + ISCSI_HEADER_DIGEST_SIZE : 0; + MPASS(roundup2(ip->ip_data_len, 4) == pdu_len - len - data_digest_len); + + if (val & F_DDP_PDU && ip->ip_data_mbuf == NULL) { + MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); + MPASS(ip->ip_data_len > 0); + icp->icp_flags |= ICPF_RX_DDP; + bhsdo = (struct iscsi_bhs_data_out *)ip->ip_bhs; + + switch (ip->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) { + case ISCSI_BHS_OPCODE_SCSI_DATA_IN: + cmp = cxgbei_find_cmp(icc, + be32toh(bhsdo->bhsdo_initiator_task_tag)); + break; + case ISCSI_BHS_OPCODE_SCSI_DATA_OUT: + cmp = cxgbei_find_cmp(icc, + be32toh(bhsdo->bhsdo_target_transfer_tag)); + break; + default: + __assert_unreachable(); + } + MPASS(cmp != NULL); + + /* Must be the final PDU. */ + MPASS(bhsdo->bhsdo_flags & BHSDO_FLAGS_F); + + /* + * The difference between the end of the last burst + * and the offset of the last PDU in this burst is + * the additional data received via DDP. + */ + prev_seg_len = be32toh(bhsdo->bhsdo_buffer_offset) - + cmp->next_buffer_offset; + + if (prev_seg_len != 0) { + /* + * Since cfiscsi doesn't know about previous + * headers, pretend that the entire r2t data + * length was received in this single segment. + */ + ip->ip_data_len += prev_seg_len; + bhsdo->bhsdo_data_segment_len[2] = ip->ip_data_len; + bhsdo->bhsdo_data_segment_len[1] = ip->ip_data_len >> 8; + bhsdo->bhsdo_data_segment_len[0] = ip->ip_data_len >> 16; + bhsdo->bhsdo_buffer_offset = + htobe32(cmp->next_buffer_offset); + + npdus = htobe32(bhsdo->bhsdo_datasn) - cmp->last_datasn; + } else { + MPASS(htobe32(bhsdo->bhsdo_datasn) == + cmp->last_datasn + 1); + npdus = 1; + } + + cmp->next_buffer_offset += ip->ip_data_len; + cmp->last_datasn = htobe32(bhsdo->bhsdo_datasn); + bhsdo->bhsdo_datasn = htobe32(cmp->next_datasn); + cmp->next_datasn++; + toep->ofld_rxq->rx_iscsi_ddp_pdus += npdus; + toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len; + } else { + MPASS(icp->icp_flags & (ICPF_RX_FLBUF)); + MPASS(ip->ip_data_len == ip->ip_data_mbuf->m_pkthdr.len); + MPASS(icp->icp_seq == tp->rcv_nxt); + } + + tp->rcv_nxt = icp->icp_seq + pdu_len; + tp->t_rcvtime = ticks; + + /* + * Don't update the window size or return credits since RX + * flow control is disabled. + */ + + so = inp->inp_socket; + sb = &so->so_rcv; + SOCKBUF_LOCK(sb); + if (__predict_false(sb->sb_state & SBS_CANTRCVMORE)) { + CTR5(KTR_CXGBE, + "%s: tid %u, excess rx (%d bytes), icc %p, sb_state 0x%x", + __func__, tid, pdu_len, icc, sb->sb_state); + SOCKBUF_UNLOCK(sb); + INP_WUNLOCK(inp); + + CURVNET_SET(so->so_vnet); + NET_EPOCH_ENTER(et); + INP_WLOCK(inp); + tp = tcp_drop(tp, ECONNRESET); + if (tp != NULL) + INP_WUNLOCK(inp); + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + return (0); + } + MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); + ic = &icc->ic; + icl_cxgbei_new_pdu_set_conn(ip, ic); + + /* Enqueue the PDU to the received pdus queue. */ + STAILQ_INSERT_TAIL(&icc->rcvd_pdus, ip, ip_next); + if ((icc->rx_flags & RXF_ACTIVE) == 0) { + struct cxgbei_worker_thread_softc *cwt = &cwt_softc[icc->cwt]; + + mtx_lock(&cwt->cwt_lock); + icc->rx_flags |= RXF_ACTIVE; + TAILQ_INSERT_TAIL(&cwt->rx_head, icc, rx_link); + if (cwt->cwt_state == CWT_SLEEPING) { + cwt->cwt_state = CWT_RUNNING; + cv_signal(&cwt->cwt_cv); + } + mtx_unlock(&cwt->cwt_lock); + } + SOCKBUF_UNLOCK(sb); + INP_WUNLOCK(inp); + + toep->ulpcb2 = NULL; + m_freem(m); + return (0); } @@ -669,6 +917,7 @@ cxgbei_mod_load(void) t4_register_cpl_handler(CPL_ISCSI_HDR, do_rx_iscsi_hdr); t4_register_cpl_handler(CPL_ISCSI_DATA, do_rx_iscsi_data); t4_register_cpl_handler(CPL_RX_ISCSI_DDP, do_rx_iscsi_ddp); + t4_register_cpl_handler(CPL_RX_ISCSI_CMP, do_rx_iscsi_cmp); rc = start_worker_threads(); if (rc != 0) @@ -699,6 +948,7 @@ cxgbei_mod_unload(void) t4_register_cpl_handler(CPL_ISCSI_HDR, NULL); t4_register_cpl_handler(CPL_ISCSI_DATA, NULL); t4_register_cpl_handler(CPL_RX_ISCSI_DDP, NULL); + t4_register_cpl_handler(CPL_RX_ISCSI_CMP, NULL); return (0); } diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 9941e817b9cb..45d3398d545c 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -53,6 +53,17 @@ enum { RXF_ACTIVE = 1 << 0, /* In the worker thread's queue */ }; +struct cxgbei_cmp { + LIST_ENTRY(cxgbei_cmp) link; + + uint32_t tt; /* Transfer tag. */ + + uint32_t next_datasn; + uint32_t next_buffer_offset; + uint32_t last_datasn; +}; +LIST_HEAD(cxgbei_cmp_head, cxgbei_cmp); + struct icl_cxgbei_conn { struct icl_conn ic; @@ -67,6 +78,10 @@ struct icl_cxgbei_conn { u_int cwt; STAILQ_HEAD(, icl_pdu) rcvd_pdus; /* protected by so_rcv lock */ TAILQ_ENTRY(icl_cxgbei_conn) rx_link; /* protected by cwt lock */ + + struct cxgbei_cmp_head *cmp_table; /* protected by cmp_lock */ + struct mtx cmp_lock; + unsigned long cmp_hash_mask; }; static inline struct icl_cxgbei_conn * @@ -128,5 +143,6 @@ int icl_cxgbei_mod_unload(void); struct icl_pdu *icl_cxgbei_new_pdu(int); void icl_cxgbei_new_pdu_set_conn(struct icl_pdu *, struct icl_conn *); void icl_cxgbei_conn_pdu_free(struct icl_conn *, struct icl_pdu *); +struct cxgbei_cmp *cxgbei_find_cmp(struct icl_cxgbei_conn *, uint32_t); #endif diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 17d5685f1c1a..b9f7c6355b6f 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -100,6 +99,16 @@ __FBSDID("$FreeBSD$"); #include "tom/t4_tom.h" #include "cxgbei.h" +/* + * Use the page pod tag for the TT hash. + */ +#define TT_HASH(icc, tt) (G_PPOD_TAG(tt) & (icc)->cmp_hash_mask) + +struct cxgbei_ddp_state { + struct ppod_reservation prsv; + struct cxgbei_cmp cmp; +}; + static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -117,7 +126,6 @@ static int recvspace = 1048576; SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, recvspace, CTLFLAG_RWTUN, &recvspace, 0, "Default receive socket buffer size"); -static uma_zone_t prsv_zone; static volatile u_int icl_cxgbei_ncons; #define ICL_CONN_LOCK(X) mtx_lock(X->ic_lock) @@ -555,6 +563,9 @@ icl_cxgbei_new_conn(const char *name, struct mtx *lock) icc->icc_signature = CXGBEI_CONN_SIGNATURE; STAILQ_INIT(&icc->rcvd_pdus); + icc->cmp_table = hashinit(64, M_CXGBEI, &icc->cmp_hash_mask); + mtx_init(&icc->cmp_lock, "cxgbei_cmp", NULL, MTX_DEF); + ic = &icc->ic; ic->ic_lock = lock; @@ -586,6 +597,8 @@ icl_cxgbei_conn_free(struct icl_conn *ic) cv_destroy(&ic->ic_send_cv); cv_destroy(&ic->ic_receive_cv); + mtx_destroy(&icc->cmp_lock); + hashdestroy(icc->cmp_table, M_CXGBEI, icc->cmp_hash_mask); kobj_delete((struct kobj *)icc, M_CXGBE); refcount_release(&icl_cxgbei_ncons); } @@ -904,6 +917,61 @@ icl_cxgbei_conn_close(struct icl_conn *ic) soclose(so); } +static void +cxgbei_insert_cmp(struct icl_cxgbei_conn *icc, struct cxgbei_cmp *cmp, + uint32_t tt) +{ +#ifdef INVARIANTS + struct cxgbei_cmp *cmp2; +#endif + + cmp->tt = tt; + + mtx_lock(&icc->cmp_lock); +#ifdef INVARIANTS + LIST_FOREACH(cmp2, &icc->cmp_table[TT_HASH(icc, tt)], link) { + KASSERT(cmp2->tt != tt, ("%s: duplicate cmp", __func__)); + } +#endif + LIST_INSERT_HEAD(&icc->cmp_table[TT_HASH(icc, tt)], cmp, link); + mtx_unlock(&icc->cmp_lock); +} + +struct cxgbei_cmp * +cxgbei_find_cmp(struct icl_cxgbei_conn *icc, uint32_t tt) +{ + struct cxgbei_cmp *cmp; + + mtx_lock(&icc->cmp_lock); + LIST_FOREACH(cmp, &icc->cmp_table[TT_HASH(icc, tt)], link) { + if (cmp->tt == tt) + break; + } + mtx_unlock(&icc->cmp_lock); + return (cmp); +} + +static void +cxgbei_rm_cmp(struct icl_cxgbei_conn *icc, struct cxgbei_cmp *cmp) +{ +#ifdef INVARIANTS + struct cxgbei_cmp *cmp2; +#endif + + mtx_lock(&icc->cmp_lock); + +#ifdef INVARIANTS + LIST_FOREACH(cmp2, &icc->cmp_table[TT_HASH(icc, cmp->tt)], link) { + if (cmp2 == cmp) + goto found; + } + panic("%s: could not find cmp", __func__); +found: +#endif + LIST_REMOVE(cmp, link); + mtx_unlock(&icc->cmp_lock); +} + int icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, struct ccb_scsiio *csio, uint32_t *ittp, void **arg) @@ -913,6 +981,7 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, struct adapter *sc = icc->sc; struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct ppod_region *pr = &ci->pr; + struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; uint32_t itt; int rc = 0; @@ -943,30 +1012,32 @@ no_ddp: * Reserve resources for DDP, update the itt that should be used in the * PDU, and save DDP specific state for this I/O in *arg. */ - - prsv = uma_zalloc(prsv_zone, M_NOWAIT); - if (prsv == NULL) { + ddp = malloc(sizeof(*ddp), M_CXGBEI, M_NOWAIT | M_ZERO); + if (ddp == NULL) { rc = ENOMEM; goto no_ddp; } + prsv = &ddp->prsv; /* XXX add support for all CAM_DATA_ types */ MPASS((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR); rc = t4_alloc_page_pods_for_buf(pr, (vm_offset_t)csio->data_ptr, csio->dxfer_len, prsv); if (rc != 0) { - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } rc = t4_write_page_pods_for_buf(sc, toep, prsv, (vm_offset_t)csio->data_ptr, csio->dxfer_len); - if (rc != 0) { + if (__predict_false(rc != 0)) { t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } + ddp->cmp.last_datasn = -1; + cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *ittp = htobe32(prsv->prsv_tag); *arg = prsv; counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); @@ -978,10 +1049,11 @@ icl_cxgbei_conn_task_done(struct icl_conn *ic, void *arg) { if (arg != NULL) { - struct ppod_reservation *prsv = arg; + struct cxgbei_ddp_state *ddp = arg; - t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); + cxgbei_rm_cmp(ic_to_icc(ic), &ddp->cmp); + t4_free_page_pods(&ddp->prsv); + free(ddp, M_CXGBEI); } } @@ -1009,7 +1081,7 @@ ddp_sgl_check(struct ctl_sg_entry *sg, int entries, int xferlen) /* XXXNP: PDU should be passed in as parameter, like on the initiator. */ #define io_to_request_pdu(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr) -#define io_to_ppod_reservation(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr) +#define io_to_ddp_state(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr) int icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, @@ -1021,6 +1093,7 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, struct adapter *sc = icc->sc; struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct ppod_region *pr = &ci->pr; + struct cxgbei_ddp_state *ddp; struct ppod_reservation *prsv; struct ctl_sg_entry *sgl, sg_entry; int sg_entries = ctsio->kern_sg_entries; @@ -1064,7 +1137,7 @@ no_ddp: ttt = *tttp & M_PPOD_TAG; ttt = V_PPOD_TAG(ttt) | pr->pr_invalid_bit; *tttp = htobe32(ttt); - MPASS(io_to_ppod_reservation(io) == NULL); + MPASS(io_to_ddp_state(io) == NULL); if (rc != 0) counter_u64_add( toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1); @@ -1086,17 +1159,17 @@ no_ddp: * Reserve resources for DDP, update the ttt that should be used * in the PDU, and save DDP specific state for this I/O. */ - - MPASS(io_to_ppod_reservation(io) == NULL); - prsv = uma_zalloc(prsv_zone, M_NOWAIT); - if (prsv == NULL) { + MPASS(io_to_ddp_state(io) == NULL); + ddp = malloc(sizeof(*ddp), M_CXGBEI, M_NOWAIT | M_ZERO); + if (ddp == NULL) { rc = ENOMEM; goto no_ddp; } + prsv = &ddp->prsv; rc = t4_alloc_page_pods_for_sgl(pr, sgl, sg_entries, prsv); if (rc != 0) { - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } @@ -1104,12 +1177,16 @@ no_ddp: xferlen); if (__predict_false(rc != 0)) { t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); + free(ddp, M_CXGBEI); goto no_ddp; } + ddp->cmp.next_buffer_offset = ctsio->kern_rel_offset + + first_burst; + ddp->cmp.last_datasn = -1; + cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *tttp = htobe32(prsv->prsv_tag); - io_to_ppod_reservation(io) = prsv; + io_to_ddp_state(io) = ddp; *arg = ctsio; counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); @@ -1119,16 +1196,19 @@ no_ddp: * In the middle of an I/O. A non-NULL page pod reservation indicates * that a DDP buffer is being used for the I/O. */ - - prsv = io_to_ppod_reservation(ctsio); - if (prsv == NULL) + ddp = io_to_ddp_state(ctsio); + if (ddp == NULL) goto no_ddp; + prsv = &ddp->prsv; alias = (prsv->prsv_tag & pr->pr_alias_mask) >> pr->pr_alias_shift; alias++; prsv->prsv_tag &= ~pr->pr_alias_mask; prsv->prsv_tag |= alias << pr->pr_alias_shift & pr->pr_alias_mask; + ddp->cmp.next_datasn = 0; + ddp->cmp.last_datasn = -1; + cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *tttp = htobe32(prsv->prsv_tag); *arg = ctsio; @@ -1140,16 +1220,19 @@ icl_cxgbei_conn_transfer_done(struct icl_conn *ic, void *arg) { struct ctl_scsiio *ctsio = arg; - if (ctsio != NULL && (ctsio->kern_data_len == ctsio->ext_data_filled || - ic->ic_disconnecting)) { - struct ppod_reservation *prsv; + if (ctsio != NULL) { + struct cxgbei_ddp_state *ddp; - prsv = io_to_ppod_reservation(ctsio); - MPASS(prsv != NULL); + ddp = io_to_ddp_state(ctsio); + MPASS(ddp != NULL); - t4_free_page_pods(prsv); - uma_zfree(prsv_zone, prsv); - io_to_ppod_reservation(ctsio) = NULL; + cxgbei_rm_cmp(ic_to_icc(ic), &ddp->cmp); + if (ctsio->kern_data_len == ctsio->ext_data_filled || + ic->ic_disconnecting) { + t4_free_page_pods(&ddp->prsv); + free(ddp, M_CXGBEI); + io_to_ddp_state(ctsio) = NULL; + } } } @@ -1208,13 +1291,6 @@ icl_cxgbei_mod_load(void) { int rc; - /* - * Space to track pagepod reservations. - */ - prsv_zone = uma_zcreate("Pagepod reservations", - sizeof(struct ppod_reservation), NULL, NULL, NULL, NULL, - UMA_ALIGN_CACHE, 0); - refcount_init(&icl_cxgbei_ncons, 0); rc = icl_register("cxgbei", false, -100, icl_cxgbei_limits, @@ -1232,8 +1308,6 @@ icl_cxgbei_mod_unload(void) icl_unregister("cxgbei", false); - uma_zdestroy(prsv_zone); - return (0); } #endif From nobody Fri Oct 29 23:58:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E4666181CC76; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrx0r4cz4VJS; Fri, 29 Oct 2021 23:58:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D8F501FF79; Fri, 29 Oct 2021 23:58:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw8WJ003360; Fri, 29 Oct 2021 23:58:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw87e003359; Fri, 29 Oct 2021 23:58:08 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:08 GMT Message-Id: <202110292358.19TNw87e003359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 80458e3874ea - stable/13 - cxgbei: Add support for zero-copy iSCSI target transmission/read. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 80458e3874eaa92c704b2196fb2987deed55207e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=80458e3874eaa92c704b2196fb2987deed55207e commit 80458e3874eaa92c704b2196fb2987deed55207e Author: John Baldwin AuthorDate: 2021-05-14 19:17:20 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:55:20 +0000 cxgbei: Add support for zero-copy iSCSI target transmission/read. - Switch to allocating the cxgbei version of icl_pdu explicitly as a separate refcounted object allocated via malloc/free instead of storing it in the bhs mbuf prior to the bhs. - Support the icl_conn_pdu_queue_cb() method to set a callback on a PDU to be invoked when the PDU is freed. - For ICL_NOCOPY buffers, use an external mbuf to manage the storage for the buffer via m_extaddref(). Each external mbuf holds a reference on the associated PDU, so the callback is invoked once all of the external mbufs have been freed. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29910 (cherry picked from commit a1c687347a7f983dadec10949938ee4d1b321120) --- sys/dev/cxgbe/cxgbei/cxgbei.h | 4 + sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 161 ++++++++++++++++++++++++++++++-------- 2 files changed, 132 insertions(+), 33 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 3b17a4f2b36a..9941e817b9cb 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -96,6 +96,10 @@ struct icl_cxgbei_pdu { uint32_t icp_signature; uint32_t icp_seq; /* For debug only */ u_int icp_flags; + + u_int ref_cnt; + icl_pdu_cb cb; + int error; }; static inline struct icl_cxgbei_pdu * diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index f91b9ee38616..f661d0a9d7d7 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -100,6 +100,8 @@ __FBSDID("$FreeBSD$"); #include "tom/t4_tom.h" #include "cxgbei.h" +static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); + SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Chelsio iSCSI offload"); static int coalesce = 1; @@ -130,6 +132,7 @@ static icl_conn_pdu_data_segment_length_t static icl_conn_pdu_append_data_t icl_cxgbei_conn_pdu_append_data; static icl_conn_pdu_get_data_t icl_cxgbei_conn_pdu_get_data; static icl_conn_pdu_queue_t icl_cxgbei_conn_pdu_queue; +static icl_conn_pdu_queue_cb_t icl_cxgbei_conn_pdu_queue_cb; static icl_conn_handoff_t icl_cxgbei_conn_handoff; static icl_conn_free_t icl_cxgbei_conn_free; static icl_conn_close_t icl_cxgbei_conn_close; @@ -146,6 +149,7 @@ static kobj_method_t icl_cxgbei_methods[] = { KOBJMETHOD(icl_conn_pdu_append_data, icl_cxgbei_conn_pdu_append_data), KOBJMETHOD(icl_conn_pdu_get_data, icl_cxgbei_conn_pdu_get_data), KOBJMETHOD(icl_conn_pdu_queue, icl_cxgbei_conn_pdu_queue), + KOBJMETHOD(icl_conn_pdu_queue_cb, icl_cxgbei_conn_pdu_queue_cb), KOBJMETHOD(icl_conn_handoff, icl_cxgbei_conn_handoff), KOBJMETHOD(icl_conn_free, icl_cxgbei_conn_free), KOBJMETHOD(icl_conn_close, icl_cxgbei_conn_close), @@ -161,54 +165,108 @@ DEFINE_CLASS(icl_cxgbei, icl_cxgbei_methods, sizeof(struct icl_cxgbei_conn)); void icl_cxgbei_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) { -#ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); -#endif + KASSERT(icp->ref_cnt != 0, ("freeing deleted PDU")); MPASS(icp->icp_signature == CXGBEI_PDU_SIGNATURE); MPASS(ic == ip->ip_conn); - MPASS(ip->ip_bhs_mbuf != NULL); m_freem(ip->ip_ahs_mbuf); m_freem(ip->ip_data_mbuf); - m_freem(ip->ip_bhs_mbuf); /* storage for icl_cxgbei_pdu itself */ + m_freem(ip->ip_bhs_mbuf); + + KASSERT(ic != NULL || icp->ref_cnt == 1, + ("orphaned PDU has oustanding references")); + if (atomic_fetchadd_int(&icp->ref_cnt, -1) != 1) + return; + + free(icp, M_CXGBEI); #ifdef DIAGNOSTIC if (__predict_true(ic != NULL)) refcount_release(&ic->ic_outstanding_pdus); #endif } +static void +icl_cxgbei_pdu_call_cb(struct icl_pdu *ip) +{ + struct icl_cxgbei_pdu *icp = ip_to_icp(ip); + + MPASS(icp->icp_signature == CXGBEI_PDU_SIGNATURE); + + if (icp->cb != NULL) + icp->cb(ip, icp->error); +#ifdef DIAGNOSTIC + if (__predict_true(ip->ip_conn != NULL)) + refcount_release(&ip->ip_conn->ic_outstanding_pdus); +#endif + free(icp, M_CXGBEI); +} + +static void +icl_cxgbei_pdu_done(struct icl_pdu *ip, int error) +{ + struct icl_cxgbei_pdu *icp = ip_to_icp(ip); + + if (error != 0) + icp->error = error; + + m_freem(ip->ip_ahs_mbuf); + ip->ip_ahs_mbuf = NULL; + m_freem(ip->ip_data_mbuf); + ip->ip_data_mbuf = NULL; + m_freem(ip->ip_bhs_mbuf); + ip->ip_bhs_mbuf = NULL; + + /* + * All other references to this PDU should have been dropped + * by the m_freem() of ip_data_mbuf. + */ + if (atomic_fetchadd_int(&icp->ref_cnt, -1) == 1) + icl_cxgbei_pdu_call_cb(ip); + else + __assert_unreachable(); +} + +static void +icl_cxgbei_mbuf_done(struct mbuf *mb) +{ + + struct icl_cxgbei_pdu *icp = (struct icl_cxgbei_pdu *)mb->m_ext.ext_arg1; + + /* + * NB: mb_free_mext() might leave ref_cnt as 1 without + * decrementing it if it hits the fast path in the ref_cnt + * check. + */ + icl_cxgbei_pdu_call_cb(&icp->ip); +} + struct icl_pdu * icl_cxgbei_new_pdu(int flags) { struct icl_cxgbei_pdu *icp; struct icl_pdu *ip; struct mbuf *m; - uintptr_t a; - m = m_gethdr(flags, MT_DATA); - if (__predict_false(m == NULL)) + icp = malloc(sizeof(*icp), M_CXGBEI, flags | M_ZERO); + if (__predict_false(icp == NULL)) return (NULL); - a = roundup2(mtod(m, uintptr_t), _Alignof(struct icl_cxgbei_pdu)); - icp = (struct icl_cxgbei_pdu *)a; - bzero(icp, sizeof(*icp)); - icp->icp_signature = CXGBEI_PDU_SIGNATURE; + icp->ref_cnt = 1; ip = &icp->ip; - ip->ip_bhs_mbuf = m; - a = roundup2((uintptr_t)(icp + 1), _Alignof(struct iscsi_bhs *)); - ip->ip_bhs = (struct iscsi_bhs *)a; -#ifdef INVARIANTS - /* Everything must fit entirely in the mbuf. */ - a = (uintptr_t)(ip->ip_bhs + 1); - MPASS(a <= (uintptr_t)m + MSIZE); -#endif - bzero(ip->ip_bhs, sizeof(*ip->ip_bhs)); + m = m_gethdr(flags, MT_DATA); + if (__predict_false(m == NULL)) { + free(icp, M_CXGBEI); + return (NULL); + } - m->m_data = (void *)ip->ip_bhs; + ip->ip_bhs_mbuf = m; + ip->ip_bhs = mtod(m, struct iscsi_bhs *); + memset(ip->ip_bhs, 0, sizeof(*ip->ip_bhs)); m->m_len = sizeof(struct iscsi_bhs); m->m_pkthdr.len = m->m_len; @@ -306,16 +364,22 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) bhs->bhs_data_segment_len[1] = ip->ip_data_len >> 8; bhs->bhs_data_segment_len[0] = ip->ip_data_len >> 16; - /* "Convert" PDU to mbuf chain. Do not use icp/ip after this. */ - m->m_pkthdr.len = sizeof(struct iscsi_bhs) + ip->ip_data_len + padding; + /* + * Extract mbuf chain from PDU. + */ + m->m_pkthdr.len += ip->ip_data_len + padding; m->m_next = ip->ip_data_mbuf; set_mbuf_ulp_submode(m, ulp_submode); -#ifdef INVARIANTS - bzero(icp, sizeof(*icp)); -#endif -#ifdef DIAGNOSTIC - refcount_release(&icc->ic.ic_outstanding_pdus); -#endif + ip->ip_bhs_mbuf = NULL; + ip->ip_data_mbuf = NULL; + ip->ip_bhs = NULL; + + /* + * Drop PDU reference on icp. Additional references might + * still be held by zero-copy PDU buffers (ICL_NOCOPY). + */ + if (atomic_fetchadd_int(&icp->ref_cnt, -1) == 1) + icl_cxgbei_pdu_call_cb(ip); return (m); } @@ -324,9 +388,7 @@ int icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, const void *addr, size_t len, int flags) { -#ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); -#endif struct mbuf *m, *m_tail; const char *src; @@ -339,6 +401,29 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, for (; m_tail->m_next != NULL; m_tail = m_tail->m_next) ; + if (flags & ICL_NOCOPY) { + m = m_get(flags & ~ICL_NOCOPY, MT_DATA); + if (m == NULL) { + ICL_WARN("failed to allocate mbuf"); + return (ENOMEM); + } + + m->m_flags |= M_RDONLY; + m_extaddref(m, __DECONST(char *, addr), len, &icp->ref_cnt, + icl_cxgbei_mbuf_done, icp, NULL); + m->m_len = len; + if (ip->ip_data_mbuf == NULL) { + ip->ip_data_mbuf = m; + ip->ip_data_len = len; + } else { + m_tail->m_next = m; + m_tail = m_tail->m_next; + ip->ip_data_len += len; + } + + return (0); + } + src = (const char *)addr; /* Allocate as jumbo mbufs of size MJUM16BYTES. */ @@ -403,6 +488,13 @@ icl_cxgbei_conn_pdu_get_data(struct icl_conn *ic, struct icl_pdu *ip, void icl_cxgbei_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) +{ + icl_cxgbei_conn_pdu_queue_cb(ic, ip, NULL); +} + +void +icl_cxgbei_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, + icl_pdu_cb cb) { struct epoch_tracker et; struct icl_cxgbei_conn *icc = ic_to_icc(ic); @@ -418,9 +510,12 @@ icl_cxgbei_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) MPASS(ip->ip_ahs_mbuf == NULL && ip->ip_ahs_len == 0); ICL_CONN_LOCK_ASSERT(ic); + + icp->cb = cb; + /* NOTE: sowriteable without so_snd lock is a mostly harmless race. */ if (ic->ic_disconnecting || so == NULL || !sowriteable(so)) { - icl_cxgbei_conn_pdu_free(ic, ip); + icl_cxgbei_pdu_done(ip, ENOTCONN); return; } @@ -809,7 +904,7 @@ icl_cxgbei_conn_close(struct icl_conn *ic) while (!STAILQ_EMPTY(&icc->rcvd_pdus)) { ip = STAILQ_FIRST(&icc->rcvd_pdus); STAILQ_REMOVE_HEAD(&icc->rcvd_pdus, ip_next); - icl_cxgbei_conn_pdu_free(ic, ip); + icl_cxgbei_pdu_done(ip, ENOTCONN); } SOCKBUF_UNLOCK(sb); } From nobody Fri Oct 29 23:58:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 11839181D08F; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzry1hYtz4V6w; Fri, 29 Oct 2021 23:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 08BA92006E; Fri, 29 Oct 2021 23:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw9cM003390; Fri, 29 Oct 2021 23:58:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw9O5003389; Fri, 29 Oct 2021 23:58:09 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:09 GMT Message-Id: <202110292358.19TNw9O5003389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 15e2528c6b4c - stable/13 - cxgbei: Don't leak resources for an aborted target transfer. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 15e2528c6b4ca83a3eedceb6c0306d7d5992075c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=15e2528c6b4ca83a3eedceb6c0306d7d5992075c commit 15e2528c6b4ca83a3eedceb6c0306d7d5992075c Author: John Baldwin AuthorDate: 2021-05-14 19:17:26 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:57:37 +0000 cxgbei: Don't leak resources for an aborted target transfer. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29911 (cherry picked from commit 4add8e4c89915dc0018a8480c63b6d6031d31295) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index f661d0a9d7d7..e3dc05645732 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1153,7 +1153,8 @@ icl_cxgbei_conn_transfer_done(struct icl_conn *ic, void *arg) { struct ctl_scsiio *ctsio = arg; - if (ctsio != NULL && ctsio->kern_data_len == ctsio->ext_data_filled) { + if (ctsio != NULL && (ctsio->kern_data_len == ctsio->ext_data_filled || + ic->ic_disconnecting)) { struct ppod_reservation *prsv; prsv = io_to_ppod_reservation(ctsio); From nobody Fri Oct 29 23:58:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1A76181D145; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzs56vJ4z4VPS; Fri, 29 Oct 2021 23:58:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CC242203AF; Fri, 29 Oct 2021 23:58:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwGch003543; Fri, 29 Oct 2021 23:58:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwGdW003542; Fri, 29 Oct 2021 23:58:16 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:16 GMT Message-Id: <202110292358.19TNwGdW003542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: b77045f1ca6a - stable/13 - iscsi: Always free a cdw before its associated ctl_io. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b77045f1ca6ae553ed5ca6fc0f16953854593369 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b77045f1ca6ae553ed5ca6fc0f16953854593369 commit b77045f1ca6ae553ed5ca6fc0f16953854593369 Author: John Baldwin AuthorDate: 2021-05-20 16:58:59 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:03:54 +0000 iscsi: Always free a cdw before its associated ctl_io. cxgbei stores state about a target transfer in the ctl_private[] array of a ctl_io that is freed when a target transfer (represented by the cdw) is freed. As such, freeing a ctl_io before a cdw that references it can result in a use after free in cxgbei. Two of the four places freed the cdw first, and the other two freed the ctl_io first. Fix the latter two places to free the cdw first. Reported by: Jithesh Arakkan @ Chelsio Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D30270 (cherry picked from commit 71e3d1b3a0ee4080c53615167bde4d93efe103fe) --- sys/cam/ctl/ctl_frontend_iscsi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index fdbc06150f93..a5a80848c763 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1112,7 +1112,7 @@ static void cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) { struct cfiscsi_data_wait *cdw; - union ctl_io *io; + union ctl_io *io, *cdw_io; int error, last, wait; if (cs->cs_target == NULL) @@ -1144,10 +1144,11 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) * assuming that the data transfer actually succeeded * and writing uninitialized data to disk. */ - cdw->cdw_ctl_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; - ctl_datamove_done(cdw->cdw_ctl_io, false); + cdw_io = cdw->cdw_ctl_io; + cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; + cdw_io->scsiio.io_hdr.port_status = 42; cfiscsi_data_wait_free(cs, cdw); + ctl_datamove_done(cdw_io, false); CFISCSI_SESSION_LOCK(cs); } CFISCSI_SESSION_UNLOCK(cs); @@ -2920,6 +2921,7 @@ cfiscsi_task_management_done(union ctl_io *io) struct cfiscsi_data_wait *cdw, *tmpcdw; struct cfiscsi_session *cs, *tcs; struct cfiscsi_softc *softc; + union ctl_io *cdw_io; int cold_reset = 0; request = PRIV_REQUEST(io); @@ -2953,10 +2955,11 @@ cfiscsi_task_management_done(union ctl_io *io) #endif TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); - io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 43; - ctl_datamove_done(cdw->cdw_ctl_io, false); + cdw_io = cdw->cdw_ctl_io; + cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; + cdw_io->scsiio.io_hdr.port_status = 43; cfiscsi_data_wait_free(cs, cdw); + ctl_datamove_done(cdw_io, false); } CFISCSI_SESSION_UNLOCK(cs); } From nobody Fri Oct 29 23:58:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A028C181D19C; Fri, 29 Oct 2021 23:58:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzs35x4jz4VRY; Fri, 29 Oct 2021 23:58:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7F06D1FF7A; Fri, 29 Oct 2021 23:58:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwEOM003489; Fri, 29 Oct 2021 23:58:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwEZS003488; Fri, 29 Oct 2021 23:58:14 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:14 GMT Message-Id: <202110292358.19TNwEZS003488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 864d66638d33 - stable/13 - cxgbei: Remove unused sysctls. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 864d66638d33cb9726758a6c1abc19fefa6ba006 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=864d66638d33cb9726758a6c1abc19fefa6ba006 commit 864d66638d33cb9726758a6c1abc19fefa6ba006 Author: John Baldwin AuthorDate: 2021-05-19 22:56:45 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:02:11 +0000 cxgbei: Remove unused sysctls. These were seemingly copied over from icl_soft. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30268 (cherry picked from commit 671fd0ec8dbe5fb9c02e4d9cb7080e427dc1048b) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index c4eb4a35ad31..d54464b63542 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -104,13 +104,6 @@ static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Chelsio iSCSI offload"); -static int coalesce = 1; -SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, coalesce, CTLFLAG_RWTUN, - &coalesce, 0, "Try to coalesce PDUs before sending"); -static int partial_receive_len = 128 * 1024; -SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, partial_receive_len, CTLFLAG_RWTUN, - &partial_receive_len, 0, "Minimum read size for partially received " - "data segment"); static int sendspace = 1048576; SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, sendspace, CTLFLAG_RWTUN, &sendspace, 0, "Default send socket buffer size"); From nobody Fri Oct 29 23:58:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ACC8E181D05A; Fri, 29 Oct 2021 23:58:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzs24CMzz4VDM; Fri, 29 Oct 2021 23:58:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 675A7201EE; Fri, 29 Oct 2021 23:58:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwDXK003465; Fri, 29 Oct 2021 23:58:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwDcT003464; Fri, 29 Oct 2021 23:58:13 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:13 GMT Message-Id: <202110292358.19TNwDcT003464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5174a367009f - stable/13 - cxgbei: Handle target transfers with excess unsolicited data. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5174a367009fec93f77653f5c237864c9c4d2ff3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5174a367009fec93f77653f5c237864c9c4d2ff3 commit 5174a367009fec93f77653f5c237864c9c4d2ff3 Author: John Baldwin AuthorDate: 2021-05-14 19:20:57 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:01:09 +0000 cxgbei: Handle target transfers with excess unsolicited data. The CTL frontend might have provided a buffer that is smaller than the FirstBurstLength and thus smaller than the amount of unsolicited data included in the request PDU. Treat these transfers as an empty transfer. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29940 (cherry picked from commit e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 7f638c96483a..c4eb4a35ad31 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1064,10 +1064,15 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, /* * Note that ICL calls conn_transfer_setup even if the first * burst had everything and there's nothing left to transfer. + * + * NB: The CTL frontend might have provided a buffer + * whose length (kern_data_len) is smaller than the + * FirstBurstLength of unsolicited data. Treat those + * as an empty transfer. */ - MPASS(ctsio->kern_data_len >= first_burst); xferlen = ctsio->kern_data_len; - if (xferlen - first_burst < ci->ddp_threshold) { + if (xferlen < first_burst || + xferlen - first_burst < ci->ddp_threshold) { no_ddp: /* * No DDP for this transfer. Allocate a TTT (based on From nobody Fri Oct 29 23:58:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F6F5181D5A9; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsF1MfHz4VF6; Fri, 29 Oct 2021 23:58:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7EDBB201F0; Fri, 29 Oct 2021 23:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwN6E003702; Fri, 29 Oct 2021 23:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwN4v003701; Fri, 29 Oct 2021 23:58:23 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:23 GMT Message-Id: <202110292358.19TNwN4v003701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4415ec04a461 - stable/13 - cxgbei: Remove invalid assertion. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4415ec04a4615ac4a0322ead183d97d06c955059 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4415ec04a4615ac4a0322ead183d97d06c955059 commit 4415ec04a4615ac4a0322ead183d97d06c955059 Author: John Baldwin AuthorDate: 2021-07-19 22:36:31 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:11:34 +0000 cxgbei: Remove invalid assertion. A non-placed PDU can be delivered by CPL_RX_ISCSI_CMP in the middle of a burst of placed PDUs (received via DDP) in which case the rcv_nxt will not match the start of the non-placed PDU. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit 4a7d15ebb6afe1b662afd2fde0ed2725790a1ba1) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index c70bda7e0436..5135fc68d197 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -592,7 +592,6 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) } else { MPASS(icp->icp_flags & (ICPF_RX_FLBUF)); MPASS(ip->ip_data_len == ip->ip_data_mbuf->m_pkthdr.len); - MPASS(icp->icp_seq == tp->rcv_nxt); } tp->rcv_nxt = icp->icp_seq + pdu_len; From nobody Fri Oct 29 23:58:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2D591181D2A5; Fri, 29 Oct 2021 23:58:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzs645FCz4VGl; Fri, 29 Oct 2021 23:58:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E3CD1201EF; Fri, 29 Oct 2021 23:58:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwHpJ003567; Fri, 29 Oct 2021 23:58:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwHXh003566; Fri, 29 Oct 2021 23:58:17 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:17 GMT Message-Id: <202110292358.19TNwHXh003566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 76dacfc99ebf - stable/13 - iscsi: Move the maximum data segment limits into 'struct icl_conn'. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 76dacfc99ebfd87ed918b16ceb832e1fa4b94ed4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=76dacfc99ebfd87ed918b16ceb832e1fa4b94ed4 commit 76dacfc99ebfd87ed918b16ceb832e1fa4b94ed4 Author: John Baldwin AuthorDate: 2021-05-20 16:59:11 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:05:13 +0000 iscsi: Move the maximum data segment limits into 'struct icl_conn'. This fixes a few bugs in iSCSI backends where the backends were using the limits they advertised initially during the login phase as the final values instead of the values negotiated with the other end. Reported by: Jithesh Arakkan @ Chelsio Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D30271 (cherry picked from commit 0cc7d64a2a37533afe03d2b640dc107be41b5f56) --- sys/cam/ctl/ctl_frontend_iscsi.c | 23 ++++++++++++-------- sys/cam/ctl/ctl_frontend_iscsi.h | 2 -- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 23 +++----------------- sys/dev/iscsi/icl.h | 3 ++- sys/dev/iscsi/icl_soft.c | 9 +++++--- sys/dev/iscsi/iscsi.c | 44 +++++++++++++++++++-------------------- sys/dev/iscsi/iscsi.h | 2 -- 7 files changed, 47 insertions(+), 59 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index a5a80848c763..b3cd8ab79d76 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1568,8 +1568,10 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) */ cs->cs_cmdsn = cihp->cmdsn; cs->cs_statsn = cihp->statsn; - cs->cs_max_recv_data_segment_length = cihp->max_recv_data_segment_length; - cs->cs_max_send_data_segment_length = cihp->max_send_data_segment_length; + cs->cs_conn->ic_max_recv_data_segment_length = + cihp->max_recv_data_segment_length; + cs->cs_conn->ic_max_send_data_segment_length = + cihp->max_send_data_segment_length; cs->cs_max_burst_length = cihp->max_burst_length; cs->cs_first_burst_length = cihp->first_burst_length; cs->cs_immediate_data = !!cihp->immediate_data; @@ -1734,8 +1736,8 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci) cs->cs_target->ct_tag, cs->cs_conn->ic_header_crc32c ? "CRC32C" : "None", cs->cs_conn->ic_data_crc32c ? "CRC32C" : "None", - cs->cs_max_recv_data_segment_length, - cs->cs_max_send_data_segment_length, + cs->cs_conn->ic_max_recv_data_segment_length, + cs->cs_conn->ic_max_send_data_segment_length, cs->cs_max_burst_length, cs->cs_first_burst_length, cs->cs_immediate_data, @@ -2534,12 +2536,14 @@ cfiscsi_datamove_in(union ctl_io *io) /* * Truncate to maximum data segment length. */ - KASSERT(response->ip_data_len < cs->cs_max_send_data_segment_length, + KASSERT(response->ip_data_len < + cs->cs_conn->ic_max_send_data_segment_length, ("ip_data_len %zd >= max_send_data_segment_length %d", - response->ip_data_len, cs->cs_max_send_data_segment_length)); + response->ip_data_len, + cs->cs_conn->ic_max_send_data_segment_length)); if (response->ip_data_len + len > - cs->cs_max_send_data_segment_length) { - len = cs->cs_max_send_data_segment_length - + cs->cs_conn->ic_max_send_data_segment_length) { + len = cs->cs_conn->ic_max_send_data_segment_length - response->ip_data_len; KASSERT(len <= sg_len, ("len %zd > sg_len %zd", len, sg_len)); @@ -2599,7 +2603,8 @@ cfiscsi_datamove_in(union ctl_io *io) i++; } - if (response->ip_data_len == cs->cs_max_send_data_segment_length) { + if (response->ip_data_len == + cs->cs_conn->ic_max_send_data_segment_length) { /* * Can't stuff more data into the current PDU; * queue it. Note that's not enough to check diff --git a/sys/cam/ctl/ctl_frontend_iscsi.h b/sys/cam/ctl/ctl_frontend_iscsi.h index a1c857231428..7c7f422a8d1f 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.h +++ b/sys/cam/ctl/ctl_frontend_iscsi.h @@ -86,8 +86,6 @@ struct cfiscsi_session { bool cs_terminating; bool cs_handoff_in_progress; bool cs_tasks_aborted; - int cs_max_recv_data_segment_length; - int cs_max_send_data_segment_length; int cs_max_burst_length; int cs_first_burst_length; bool cs_immediate_data; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index fce593b54032..17d5685f1c1a 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -469,7 +469,7 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, } MPASS(len == 0); } - MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); + MPASS(ip->ip_data_len <= ic->ic_max_send_data_segment_length); return (0); } @@ -565,8 +565,6 @@ icl_cxgbei_new_conn(const char *name, struct mtx *lock) #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif - /* This is a stop-gap value that will be corrected during handoff. */ - ic->ic_max_data_segment_length = 16384; ic->ic_name = name; ic->ic_offload = "cxgbei"; ic->ic_unmapped = false; @@ -806,26 +804,11 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) icc->toep = toep; icc->cwt = cxgbei_select_worker_thread(icc); - /* - * We maintain the _send_ DSL in this field just to have a - * convenient way to assert that the kernel never sends - * oversized PDUs. This field is otherwise unused in the driver - * or the kernel. - */ - ic->ic_max_data_segment_length = ci->max_tx_pdu_len - - ISCSI_BHS_SIZE; - icc->ulp_submode = 0; - if (ic->ic_header_crc32c) { + if (ic->ic_header_crc32c) icc->ulp_submode |= ULP_CRC_HEADER; - ic->ic_max_data_segment_length -= - ISCSI_HEADER_DIGEST_SIZE; - } - if (ic->ic_data_crc32c) { + if (ic->ic_data_crc32c) icc->ulp_submode |= ULP_CRC_DATA; - ic->ic_max_data_segment_length -= - ISCSI_DATA_DIGEST_SIZE; - } so->so_options |= SO_NO_DDP; toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index 0b897a50302a..94600c0edad1 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -109,7 +109,8 @@ struct icl_conn { bool ic_data_crc32c; bool ic_send_running; bool ic_receive_running; - size_t ic_max_data_segment_length; + uint32_t ic_max_recv_data_segment_length; + uint32_t ic_max_send_data_segment_length; size_t ic_maxtags; bool ic_disconnecting; bool ic_iser; diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index a48ad53d70d7..001c595af7ec 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -573,7 +573,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) */ len = icl_pdu_data_segment_length(request); - if (len > ic->ic_max_data_segment_length) { + if (len > ic->ic_max_recv_data_segment_length) { ICL_WARN("received data segment " "length %zd is larger than negotiated; " "dropping connection", len); @@ -1154,7 +1154,6 @@ icl_soft_new_conn(const char *name, struct mtx *lock) #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif - ic->ic_max_data_segment_length = max_data_segment_length; ic->ic_name = name; ic->ic_offload = "None"; ic->ic_unmapped = false; @@ -1205,13 +1204,17 @@ icl_conn_start(struct icl_conn *ic) * send a PDU in pieces; thus, the minimum buffer size is equal * to the maximum PDU size. "+4" is to account for possible padding. */ - minspace = sizeof(struct iscsi_bhs) + ic->ic_max_data_segment_length + + minspace = sizeof(struct iscsi_bhs) + + ic->ic_max_send_data_segment_length + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4; if (sendspace < minspace) { ICL_WARN("kern.icl.sendspace too low; must be at least %zd", minspace); sendspace = minspace; } + minspace = sizeof(struct iscsi_bhs) + + ic->ic_max_recv_data_segment_length + + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4; if (recvspace < minspace) { ICL_WARN("kern.icl.recvspace too low; must be at least %zd", minspace); diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 13a35c371c40..7ddb5a9ce1ec 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1206,8 +1206,8 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) for (;;) { len = total_len; - if (len > is->is_max_send_data_segment_length) - len = is->is_max_send_data_segment_length; + if (len > is->is_conn->ic_max_send_data_segment_length) + len = is->is_conn->ic_max_send_data_segment_length; if (off + len > csio->dxfer_len) { ISCSI_SESSION_WARN(is, "target requested invalid " @@ -1433,9 +1433,9 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc, is->is_initial_r2t = handoff->idh_initial_r2t; is->is_immediate_data = handoff->idh_immediate_data; - is->is_max_recv_data_segment_length = + ic->ic_max_recv_data_segment_length = handoff->idh_max_recv_data_segment_length; - is->is_max_send_data_segment_length = + ic->ic_max_send_data_segment_length = handoff->idh_max_send_data_segment_length; is->is_max_burst_length = handoff->idh_max_burst_length; is->is_first_burst_length = handoff->idh_first_burst_length; @@ -1648,7 +1648,7 @@ iscsi_ioctl_daemon_send(struct iscsi_softc *sc, return (EIO); datalen = ids->ids_data_segment_len; - if (datalen > is->is_max_send_data_segment_length) + if (datalen > is->is_conn->ic_max_send_data_segment_length) return (EINVAL); if (datalen > 0) { data = malloc(datalen, M_ISCSI, M_WAITOK); @@ -1793,18 +1793,6 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa) is = malloc(sizeof(*is), M_ISCSI, M_ZERO | M_WAITOK); memcpy(&is->is_conf, &isa->isa_conf, sizeof(is->is_conf)); - /* - * Set some default values, from RFC 3720, section 12. - * - * These values are updated by the handoff IOCTL, but are - * needed prior to the handoff to support sending the ISER - * login PDU. - */ - is->is_max_recv_data_segment_length = 8192; - is->is_max_send_data_segment_length = 8192; - is->is_max_burst_length = 262144; - is->is_first_burst_length = 65536; - sx_xlock(&sc->sc_lock); /* @@ -1847,6 +1835,18 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa) cv_init(&is->is_login_cv, "iscsi_login"); #endif + /* + * Set some default values, from RFC 3720, section 12. + * + * These values are updated by the handoff IOCTL, but are + * needed prior to the handoff to support sending the ISER + * login PDU. + */ + is->is_conn->ic_max_recv_data_segment_length = 8192; + is->is_conn->ic_max_send_data_segment_length = 8192; + is->is_max_burst_length = 262144; + is->is_first_burst_length = 65536; + is->is_softc = sc; sc->sc_last_session_id++; is->is_id = sc->sc_last_session_id; @@ -1960,9 +1960,9 @@ iscsi_ioctl_session_list(struct iscsi_softc *sc, struct iscsi_session_list *isl) iss.iss_data_digest = ISCSI_DIGEST_NONE; iss.iss_max_send_data_segment_length = - is->is_max_send_data_segment_length; + is->is_conn->ic_max_send_data_segment_length; iss.iss_max_recv_data_segment_length = - is->is_max_recv_data_segment_length; + is->is_conn->ic_max_recv_data_segment_length; iss.iss_max_burst_length = is->is_max_burst_length; iss.iss_first_burst_length = is->is_first_burst_length; iss.iss_immediate_data = is->is_immediate_data; @@ -2330,10 +2330,10 @@ iscsi_action_scsiio(struct iscsi_session *is, union ccb *ccb) ISCSI_SESSION_DEBUG(is, "len %zd -> %d", len, is->is_first_burst_length); len = is->is_first_burst_length; } - if (len > is->is_max_send_data_segment_length) { + if (len > is->is_conn->ic_max_send_data_segment_length) { ISCSI_SESSION_DEBUG(is, "len %zd -> %d", len, - is->is_max_send_data_segment_length); - len = is->is_max_send_data_segment_length; + is->is_conn->ic_max_send_data_segment_length); + len = is->is_conn->ic_max_send_data_segment_length; } error = icl_pdu_append_data(request, csio->data_ptr, len, M_NOWAIT); diff --git a/sys/dev/iscsi/iscsi.h b/sys/dev/iscsi/iscsi.h index 793b7529c7c0..fe1cc64f88db 100644 --- a/sys/dev/iscsi/iscsi.h +++ b/sys/dev/iscsi/iscsi.h @@ -67,8 +67,6 @@ struct iscsi_session { uint8_t is_isid[6]; uint16_t is_tsih; bool is_immediate_data; - int is_max_recv_data_segment_length; - int is_max_send_data_segment_length; char is_target_alias[ISCSI_ALIAS_LEN]; TAILQ_HEAD(, iscsi_outstanding) is_outstanding; From nobody Fri Oct 29 23:58:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 464C5181D685; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsG5p6bz4VQ3; Fri, 29 Oct 2021 23:58:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9837B201F1; Fri, 29 Oct 2021 23:58:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwO8I003726; Fri, 29 Oct 2021 23:58:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwOiO003725; Fri, 29 Oct 2021 23:58:24 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:24 GMT Message-Id: <202110292358.19TNwOiO003725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a47b1c6f8fbe - stable/13 - cxgbei: Don't assert F for data completion PDUs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a47b1c6f8fbe02862e1a263c92a4a0fcd54dff4d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a47b1c6f8fbe02862e1a263c92a4a0fcd54dff4d commit a47b1c6f8fbe02862e1a263c92a4a0fcd54dff4d Author: John Baldwin AuthorDate: 2021-07-19 22:36:31 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:13:31 +0000 cxgbei: Don't assert F for data completion PDUs. If a data PDU encounters an error such as a digest error, the firmware will report that data PDU when completion moderation is active even if it is not the final data PDU in a burst. Sponsored by: Chelsio Communications (cherry picked from commit b5e73dd952f9d5224e9e076bb9719f7bcec871b0) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 5135fc68d197..5cce7d3fce05 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -552,9 +552,6 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) } MPASS(cmp != NULL); - /* Must be the final PDU. */ - MPASS(bhsdo->bhsdo_flags & BHSDO_FLAGS_F); - /* * The difference between the end of the last burst * and the offset of the last PDU in this burst is From nobody Fri Oct 29 23:58:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B9A70181D6A8; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsJ0svtz4VNM; Fri, 29 Oct 2021 23:58:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C098C201F2; Fri, 29 Oct 2021 23:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwPAj003750; Fri, 29 Oct 2021 23:58:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwPAt003749; Fri, 29 Oct 2021 23:58:25 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:25 GMT Message-Id: <202110292358.19TNwPAt003749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a2bd630ca784 - stable/13 - cxgbei: Wait for socket to close in icl_cxgbei_conn_close. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a2bd630ca7845120c45f2196bad870588beef16d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a2bd630ca7845120c45f2196bad870588beef16d commit a2bd630ca7845120c45f2196bad870588beef16d Author: John Baldwin AuthorDate: 2021-07-29 23:34:46 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:14:16 +0000 cxgbei: Wait for socket to close in icl_cxgbei_conn_close. This ensures the TOE has finished processing any in-flight received data before returning to the caller. The caller assumes it is safe to free any open tasks or transfers (and associated buffers) after this function returns. Previously, data placed directly via DDP could be written to buffers after the caller had freed the buffers. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit 67495c13d0bc25c57ebf0103e9d2af7c4a3088c9) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index e974ad73a935..4a6cf0a19d44 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -881,7 +881,14 @@ icl_cxgbei_conn_close(struct icl_conn *ic) INP_WLOCK(inp); if (toep != NULL) { /* NULL if connection was never offloaded. */ toep->ulpcb = NULL; + + /* Discard PDUs queued for TX. */ mbufq_drain(&toep->ulp_pduq); + + /* + * Wait for the cwt threads to stop processing this + * connection. + */ SOCKBUF_LOCK(sb); if (icc->rx_flags & RXF_ACTIVE) { volatile u_int *p = &icc->rx_flags; @@ -896,6 +903,10 @@ icl_cxgbei_conn_close(struct icl_conn *ic) SOCKBUF_LOCK(sb); } + /* + * Discard received PDUs not passed to the iSCSI + * layer. + */ while (!STAILQ_EMPTY(&icc->rcvd_pdus)) { ip = STAILQ_FIRST(&icc->rcvd_pdus); STAILQ_REMOVE_HEAD(&icc->rcvd_pdus, ip_next); @@ -914,7 +925,22 @@ icl_cxgbei_conn_close(struct icl_conn *ic) * queues were purged instead of delivered reliably but soabort isn't * really general purpose and wouldn't do the right thing here. */ + soref(so); soclose(so); + + /* + * Wait for the socket to fully close. This ensures any + * pending received data has been received (and in particular, + * any data that would be received by DDP has been handled). + * Callers assume that it is safe to free buffers for tasks + * and transfers after this function returns. + */ + SOCK_LOCK(so); + while ((so->so_state & SS_ISDISCONNECTED) == 0) + mtx_sleep(&so->so_timeo, SOCK_MTX(so), PSOCK, "conclo2", 0); + CURVNET_SET(so->so_vnet); + sorele(so); + CURVNET_RESTORE(); } static void From nobody Fri Oct 29 23:58:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 60C86181D79F; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsK1q58z4VQ9; Fri, 29 Oct 2021 23:58:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EAD8D1FF7D; Fri, 29 Oct 2021 23:58:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwQfL003778; Fri, 29 Oct 2021 23:58:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwQP4003777; Fri, 29 Oct 2021 23:58:26 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:26 GMT Message-Id: <202110292358.19TNwQP4003777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7f82047ec961 - stable/13 - cxgbei: Round up the maximum PDU data length by the MSS for TXDATAPLEN_MAX. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f82047ec961383a0f8c11f9943522831f590f97 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7f82047ec961383a0f8c11f9943522831f590f97 commit 7f82047ec961383a0f8c11f9943522831f590f97 Author: John Baldwin AuthorDate: 2021-07-29 21:17:45 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:15:44 +0000 cxgbei: Round up the maximum PDU data length by the MSS for TXDATAPLEN_MAX. Recent firmware versions round down the value passed here by the MSS and subsequently mishandle transmitted PDUs larger than the rounded down value. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit d0d631d5f4437223664f7bbdfdb421ec05cf9657) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4a6cf0a19d44..7d8ebd1e040f 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -826,7 +826,8 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; - send_iscsi_flowc_wr(icc->sc, toep, ci->max_tx_pdu_len); + send_iscsi_flowc_wr(icc->sc, toep, roundup(ci->max_tx_pdu_len, + tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); error = 0; } From nobody Fri Oct 29 23:58:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6FB33181D5F9; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsL3gBkz4VVR; Fri, 29 Oct 2021 23:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 10274201F3; Fri, 29 Oct 2021 23:58:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwRgK003804; Fri, 29 Oct 2021 23:58:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwRf7003803; Fri, 29 Oct 2021 23:58:27 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:27 GMT Message-Id: <202110292358.19TNwRf7003803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 202f2c169bec - stable/13 - cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 202f2c169bec8a0fc5d1981980b1388e9912201b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=202f2c169bec8a0fc5d1981980b1388e9912201b commit 202f2c169bec8a0fc5d1981980b1388e9912201b Author: John Baldwin AuthorDate: 2021-08-02 16:41:27 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:17:31 +0000 cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. The remote peer might send a FIN in the middle of a burst of data PDUs. In the case of T6 with data PDU completion moderation, the driver would not have seen these PDUs since the final PDU in the burst was never received resulting in a stale rcv_nxt when the FIN is received. While here, invert the logic in the condition to be more readable and always set tp->rcv_nxt from the sequence number in the CPL. This sets the proper value of rcv_nxt for FINs on connections with data received but not reported via a CPL (e.g. a partial iSCSI PDU burst interrupted by a FIN). Reported by: Jithesh Arakkan @ Chelsio Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30871 (cherry picked from commit d59f1c49e26ba29e7583019bb5d6aa029466fdb6) cxgbe tom: Update rcv_nxt for a FIN after handle_ddp_close(). For TCP DDP, handle_ddp_close() needs to see the pre-FIN rcv_nxt to determine how much data was placed in the local buffer before the FIN was received. The changes in d59f1c49e26b broke this by updating rcv_nxt before calling handle_ddp_close(). Fixes: d59f1c49e26b cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. Sponsored by: Chelsio Communications (cherry picked from commit 5dbf8c1588da167c17c45bdf78de51fcb4929504) --- sys/dev/cxgbe/tom/t4_cpl_io.c | 20 ++++++++++++++------ sys/dev/cxgbe/tom/t4_ddp.c | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index acb2d3408244..66e3955445f9 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1292,8 +1292,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) if (toep->flags & TPF_ABORT_SHUTDOWN) goto done; - tp->rcv_nxt++; /* FIN */ - so = inp->inp_socket; socantrcvmore(so); if (ulp_mode(toep) == ULP_MODE_TCPDDP) { @@ -1304,12 +1302,22 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) DDP_UNLOCK(toep); } - if (ulp_mode(toep) != ULP_MODE_RDMA) { - KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt), - ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt, - be32toh(cpl->rcv_nxt))); + if (ulp_mode(toep) == ULP_MODE_RDMA || + (ulp_mode(toep) == ULP_MODE_ISCSI && chip_id(sc) >= CHELSIO_T6)) { + /* + * There might be data received via DDP before the FIN + * not reported to the driver. Just assume the + * sequence number in the CPL is correct as the + * sequence number of the FIN. + */ + } else { + KASSERT(tp->rcv_nxt + 1 == be32toh(cpl->rcv_nxt), + ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt, + be32toh(cpl->rcv_nxt))); } + tp->rcv_nxt = be32toh(cpl->rcv_nxt); + switch (tp->t_state) { case TCPS_SYN_RECEIVED: tp->t_starttime = ticks; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 2b58cb60d4fd..be142ffb9e4f 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -700,7 +700,8 @@ handle_ddp_close(struct toepcb *toep, struct tcpcb *tp, __be32 rcv_nxt) INP_WLOCK_ASSERT(toep->inp); DDP_ASSERT_LOCKED(toep); - len = be32toh(rcv_nxt) - tp->rcv_nxt; + /* - 1 is to ignore the byte for FIN */ + len = be32toh(rcv_nxt) - tp->rcv_nxt - 1; tp->rcv_nxt += len; while (toep->ddp.active_count > 0) { From nobody Fri Oct 29 23:58:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DA544181D9A0; Fri, 29 Oct 2021 23:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsM74g3z4VLH; Fri, 29 Oct 2021 23:58:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 23530205AF; Fri, 29 Oct 2021 23:58:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwTwo003828; Fri, 29 Oct 2021 23:58:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwTXr003827; Fri, 29 Oct 2021 23:58:29 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:29 GMT Message-Id: <202110292358.19TNwTXr003827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: bb34f3bce4c5 - stable/13 - iscsi: Remove icl_soft-only fields from struct icl_conn. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb34f3bce4c5641a1917ee33535c3fbf9d2075cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bb34f3bce4c5641a1917ee33535c3fbf9d2075cc commit bb34f3bce4c5641a1917ee33535c3fbf9d2075cc Author: John Baldwin AuthorDate: 2021-08-05 19:05:30 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:19:43 +0000 iscsi: Remove icl_soft-only fields from struct icl_conn. Create a struct icl_soft_conn which extends struct icl_conn and move fields only used by icl_soft from struct icl_conn to struct icl_soft_conn. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31414 (cherry picked from commit 87322a907545fa76fbaf7949f80e85b1377a53ad) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 11 -- sys/dev/iscsi/icl.h | 20 +--- sys/dev/iscsi/icl_soft.c | 218 ++++++++++++++++++++++---------------- 3 files changed, 128 insertions(+), 121 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 7d8ebd1e040f..d5b13fb5c3ea 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -569,10 +569,6 @@ icl_cxgbei_new_conn(const char *name, struct mtx *lock) ic = &icc->ic; ic->ic_lock = lock; - /* XXXNP: review. Most of these icl_conn fields aren't really used */ - STAILQ_INIT(&ic->ic_to_send); - cv_init(&ic->ic_send_cv, "icl_cxgbei_tx"); - cv_init(&ic->ic_receive_cv, "icl_cxgbei_rx"); #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif @@ -594,9 +590,6 @@ icl_cxgbei_conn_free(struct icl_conn *ic) CTR2(KTR_CXGBE, "%s: icc %p", __func__, icc); - cv_destroy(&ic->ic_send_cv); - cv_destroy(&ic->ic_receive_cv); - mtx_destroy(&icc->cmp_lock); hashdestroy(icc->cmp_table, M_CXGBEI, icc->cmp_hash_mask); kobj_delete((struct kobj *)icc, M_CXGBE); @@ -864,10 +857,6 @@ icl_cxgbei_conn_close(struct icl_conn *ic) } ic->ic_disconnecting = true; - /* These are unused in this driver right now. */ - MPASS(STAILQ_EMPTY(&ic->ic_to_send)); - MPASS(ic->ic_receive_pdu == NULL); - #ifdef DIAGNOSTIC KASSERT(ic->ic_outstanding_pdus == 0, ("destroying session with %d outstanding PDUs", diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index 94600c0edad1..adcd580f299b 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -82,13 +82,6 @@ struct icl_pdu { void *ip_prv1; }; -#define ICL_CONN_STATE_INVALID 0 -#define ICL_CONN_STATE_BHS 1 -#define ICL_CONN_STATE_AHS 2 -#define ICL_CONN_STATE_HEADER_DIGEST 3 -#define ICL_CONN_STATE_DATA 4 -#define ICL_CONN_STATE_DATA_DIGEST 5 - #define ICL_NOCOPY (1 << 30) struct icl_conn { @@ -98,20 +91,11 @@ struct icl_conn { #ifdef DIAGNOSTIC volatile u_int ic_outstanding_pdus; #endif - STAILQ_HEAD(, icl_pdu) ic_to_send; - bool ic_check_send_space; - size_t ic_receive_len; - int ic_receive_state; - struct icl_pdu *ic_receive_pdu; - struct cv ic_send_cv; - struct cv ic_receive_cv; - bool ic_header_crc32c; - bool ic_data_crc32c; - bool ic_send_running; - bool ic_receive_running; uint32_t ic_max_recv_data_segment_length; uint32_t ic_max_send_data_segment_length; size_t ic_maxtags; + bool ic_header_crc32c; + bool ic_data_crc32c; bool ic_disconnecting; bool ic_iser; bool ic_unmapped; diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 001c595af7ec..95c4c87dd6f3 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -63,6 +63,27 @@ __FBSDID("$FreeBSD$"); #include #include +#define ICL_CONN_STATE_BHS 1 +#define ICL_CONN_STATE_AHS 2 +#define ICL_CONN_STATE_HEADER_DIGEST 3 +#define ICL_CONN_STATE_DATA 4 +#define ICL_CONN_STATE_DATA_DIGEST 5 + +struct icl_soft_conn { + struct icl_conn ic; + + /* soft specific stuff goes here. */ + STAILQ_HEAD(, icl_pdu) to_send; + struct cv send_cv; + struct cv receive_cv; + struct icl_pdu *receive_pdu; + size_t receive_len; + int receive_state; + bool receive_running; + bool check_send_space; + bool send_running; +}; + struct icl_soft_pdu { struct icl_pdu ip; @@ -150,7 +171,7 @@ static kobj_method_t icl_soft_methods[] = { { 0, 0 } }; -DEFINE_CLASS(icl_soft, icl_soft_methods, sizeof(struct icl_conn)); +DEFINE_CLASS(icl_soft, icl_soft_methods, sizeof(struct icl_soft_conn)); static void icl_conn_fail(struct icl_conn *ic) @@ -441,14 +462,14 @@ static int icl_pdu_receive_data_segment(struct icl_pdu *request, struct mbuf **r, size_t *rs, bool *more_neededp) { - struct icl_conn *ic; + struct icl_soft_conn *isc; size_t len, padding = 0; struct mbuf *m; - ic = request->ip_conn; + isc = (struct icl_soft_conn *)request->ip_conn; *more_neededp = false; - ic->ic_receive_len = 0; + isc->receive_len = 0; len = icl_pdu_data_segment_length(request); if (len == 0) @@ -497,8 +518,7 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, struct mbuf **r, ICL_DEBUG("len 0"); if (*more_neededp) - ic->ic_receive_len = - icl_pdu_data_segment_receive_len(request); + isc->receive_len = icl_pdu_data_segment_receive_len(request); return (0); } @@ -537,16 +557,17 @@ icl_pdu_check_data_digest(struct icl_pdu *request, struct mbuf **r, size_t *rs) * "part" of PDU at a time; call it repeatedly until it returns non-NULL. */ static struct icl_pdu * -icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) +icl_conn_receive_pdu(struct icl_soft_conn *isc, struct mbuf **r, size_t *rs) { + struct icl_conn *ic = &isc->ic; struct icl_pdu *request; size_t len; int error = 0; bool more_needed; - if (ic->ic_receive_state == ICL_CONN_STATE_BHS) { - KASSERT(ic->ic_receive_pdu == NULL, - ("ic->ic_receive_pdu != NULL")); + if (isc->receive_state == ICL_CONN_STATE_BHS) { + KASSERT(isc->receive_pdu == NULL, + ("isc->receive_pdu != NULL")); request = icl_soft_conn_new_pdu(ic, M_NOWAIT); if (request == NULL) { ICL_DEBUG("failed to allocate PDU; " @@ -554,14 +575,14 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) icl_conn_fail(ic); return (NULL); } - ic->ic_receive_pdu = request; + isc->receive_pdu = request; } else { - KASSERT(ic->ic_receive_pdu != NULL, - ("ic->ic_receive_pdu == NULL")); - request = ic->ic_receive_pdu; + KASSERT(isc->receive_pdu != NULL, + ("isc->receive_pdu == NULL")); + request = isc->receive_pdu; } - switch (ic->ic_receive_state) { + switch (isc->receive_state) { case ICL_CONN_STATE_BHS: //ICL_DEBUG("receiving BHS"); icl_soft_receive_buf(r, rs, request->ip_bhs, @@ -581,18 +602,18 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) break; } - ic->ic_receive_state = ICL_CONN_STATE_AHS; - ic->ic_receive_len = icl_pdu_ahs_length(request); + isc->receive_state = ICL_CONN_STATE_AHS; + isc->receive_len = icl_pdu_ahs_length(request); break; case ICL_CONN_STATE_AHS: //ICL_DEBUG("receiving AHS"); icl_pdu_receive_ahs(request, r, rs); - ic->ic_receive_state = ICL_CONN_STATE_HEADER_DIGEST; + isc->receive_state = ICL_CONN_STATE_HEADER_DIGEST; if (ic->ic_header_crc32c == false) - ic->ic_receive_len = 0; + isc->receive_len = 0; else - ic->ic_receive_len = ISCSI_HEADER_DIGEST_SIZE; + isc->receive_len = ISCSI_HEADER_DIGEST_SIZE; break; case ICL_CONN_STATE_HEADER_DIGEST: @@ -604,9 +625,8 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) break; } - ic->ic_receive_state = ICL_CONN_STATE_DATA; - ic->ic_receive_len = - icl_pdu_data_segment_receive_len(request); + isc->receive_state = ICL_CONN_STATE_DATA; + isc->receive_len = icl_pdu_data_segment_receive_len(request); break; case ICL_CONN_STATE_DATA: @@ -622,11 +642,11 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) if (more_needed) break; - ic->ic_receive_state = ICL_CONN_STATE_DATA_DIGEST; + isc->receive_state = ICL_CONN_STATE_DATA_DIGEST; if (request->ip_data_len == 0 || ic->ic_data_crc32c == false) - ic->ic_receive_len = 0; + isc->receive_len = 0; else - ic->ic_receive_len = ISCSI_DATA_DIGEST_SIZE; + isc->receive_len = ISCSI_DATA_DIGEST_SIZE; break; case ICL_CONN_STATE_DATA_DIGEST: @@ -642,18 +662,18 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) * We've received complete PDU; reset the receive state machine * and return the PDU. */ - ic->ic_receive_state = ICL_CONN_STATE_BHS; - ic->ic_receive_len = sizeof(struct iscsi_bhs); - ic->ic_receive_pdu = NULL; + isc->receive_state = ICL_CONN_STATE_BHS; + isc->receive_len = sizeof(struct iscsi_bhs); + isc->receive_pdu = NULL; return (request); default: - panic("invalid ic_receive_state %d\n", ic->ic_receive_state); + panic("invalid receive_state %d\n", isc->receive_state); } if (error != 0) { /* - * Don't free the PDU; it's pointed to by ic->ic_receive_pdu + * Don't free the PDU; it's pointed to by isc->receive_pdu * and will get freed in icl_soft_conn_close(). */ icl_conn_fail(ic); @@ -663,8 +683,9 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) } static void -icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) +icl_conn_receive_pdus(struct icl_soft_conn *isc, struct mbuf **r, size_t *rs) { + struct icl_conn *ic = &isc->ic; struct icl_pdu *response; for (;;) { @@ -675,15 +696,15 @@ icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) * Loop until we have a complete PDU or there is not enough * data in the socket buffer. */ - if (*rs < ic->ic_receive_len) { + if (*rs < isc->receive_len) { #if 0 ICL_DEBUG("not enough data; have %zd, need %zd", - *rs, ic->ic_receive_len); + *rs, isc->receive_len); #endif return; } - response = icl_conn_receive_pdu(ic, r, rs); + response = icl_conn_receive_pdu(isc, r, rs); if (response == NULL) continue; @@ -703,14 +724,14 @@ icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) static void icl_receive_thread(void *arg) { - struct icl_conn *ic; + struct icl_soft_conn *isc = arg; + struct icl_conn *ic = &isc->ic; size_t available, read = 0; struct socket *so; struct mbuf *m, *r = NULL; struct uio uio; int error, flags; - ic = arg; so = ic->ic_socket; for (;;) { @@ -727,9 +748,9 @@ icl_receive_thread(void *arg) * is enough data received to read the PDU. */ available = sbavail(&so->so_rcv); - if (read + available < ic->ic_receive_len) { - so->so_rcv.sb_lowat = ic->ic_receive_len - read; - cv_wait(&ic->ic_receive_cv, SOCKBUF_MTX(&so->so_rcv)); + if (read + available < isc->receive_len) { + so->so_rcv.sb_lowat = isc->receive_len - read; + cv_wait(&isc->receive_cv, SOCKBUF_MTX(&so->so_rcv)); so->so_rcv.sb_lowat = so->so_rcv.sb_hiwat + 1; available = sbavail(&so->so_rcv); } @@ -764,15 +785,15 @@ icl_receive_thread(void *arg) r = m; read += available; - icl_conn_receive_pdus(ic, &r, &read); + icl_conn_receive_pdus(isc, &r, &read); } if (r) m_freem(r); ICL_CONN_LOCK(ic); - ic->ic_receive_running = false; - cv_signal(&ic->ic_send_cv); + isc->receive_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); kthread_exit(); } @@ -780,13 +801,13 @@ icl_receive_thread(void *arg) static int icl_soupcall_receive(struct socket *so, void *arg, int waitflag) { - struct icl_conn *ic; + struct icl_soft_conn *isc; if (!soreadable(so)) return (SU_OK); - ic = arg; - cv_signal(&ic->ic_receive_cv); + isc = arg; + cv_signal(&isc->receive_cv); return (SU_OK); } @@ -846,8 +867,9 @@ icl_pdu_finalize(struct icl_pdu *request) } static void -icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) +icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue) { + struct icl_conn *ic = &isc->ic; struct icl_pdu *request, *request2; struct mbuf *m; struct socket *so; @@ -866,7 +888,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) * of error. */ available = sbspace(&so->so_snd); - ic->ic_check_send_space = false; + isc->check_send_space = false; /* * Notify the socket upcall that we don't need wakeups @@ -961,10 +983,12 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) static void icl_send_thread(void *arg) { + struct icl_soft_conn *isc; struct icl_conn *ic; struct icl_pdu_stailq queue; - ic = arg; + isc = arg; + ic = &isc->ic; STAILQ_INIT(&queue); @@ -976,18 +1000,18 @@ icl_send_thread(void *arg) * This way the icl_conn_send_pdus() can go through * all the queued PDUs without holding any locks. */ - if (STAILQ_EMPTY(&queue) || ic->ic_check_send_space) - STAILQ_CONCAT(&queue, &ic->ic_to_send); + if (STAILQ_EMPTY(&queue) || isc->check_send_space) + STAILQ_CONCAT(&queue, &isc->to_send); ICL_CONN_UNLOCK(ic); - icl_conn_send_pdus(ic, &queue); + icl_conn_send_pdus(isc, &queue); ICL_CONN_LOCK(ic); /* * The icl_soupcall_send() was called since the last * call to sbspace(); go around; */ - if (ic->ic_check_send_space) + if (isc->check_send_space) continue; /* @@ -995,7 +1019,7 @@ icl_send_thread(void *arg) * in the main one; go around. */ if (STAILQ_EMPTY(&queue) && - !STAILQ_EMPTY(&ic->ic_to_send)) + !STAILQ_EMPTY(&isc->to_send)) continue; /* @@ -1011,17 +1035,17 @@ icl_send_thread(void *arg) break; } - cv_wait(&ic->ic_send_cv, ic->ic_lock); + cv_wait(&isc->send_cv, ic->ic_lock); } /* * We're exiting; move PDUs back to the main queue, so they can * get freed properly. At this point ordering doesn't matter. */ - STAILQ_CONCAT(&ic->ic_to_send, &queue); + STAILQ_CONCAT(&isc->to_send, &queue); - ic->ic_send_running = false; - cv_signal(&ic->ic_send_cv); + isc->send_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); kthread_exit(); } @@ -1029,18 +1053,20 @@ icl_send_thread(void *arg) static int icl_soupcall_send(struct socket *so, void *arg, int waitflag) { + struct icl_soft_conn *isc; struct icl_conn *ic; if (!sowriteable(so)) return (SU_OK); - ic = arg; + isc = arg; + ic = &isc->ic; ICL_CONN_LOCK(ic); - ic->ic_check_send_space = true; + isc->check_send_space = true; ICL_CONN_UNLOCK(ic); - cv_signal(&ic->ic_send_cv); + cv_signal(&isc->send_cv); return (SU_OK); } @@ -1112,6 +1138,7 @@ static void icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, icl_pdu_cb cb) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; struct icl_soft_pdu *isp = (struct icl_soft_pdu *)ip; ICL_CONN_LOCK_ASSERT(ic); @@ -1124,8 +1151,8 @@ icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, return; } - if (!STAILQ_EMPTY(&ic->ic_to_send)) { - STAILQ_INSERT_TAIL(&ic->ic_to_send, ip, ip_next); + if (!STAILQ_EMPTY(&isc->to_send)) { + STAILQ_INSERT_TAIL(&isc->to_send, ip, ip_next); /* * If the queue is not empty, someone else had already * signaled the send thread; no need to do that again, @@ -1134,23 +1161,27 @@ icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, return; } - STAILQ_INSERT_TAIL(&ic->ic_to_send, ip, ip_next); - cv_signal(&ic->ic_send_cv); + STAILQ_INSERT_TAIL(&isc->to_send, ip, ip_next); + cv_signal(&isc->send_cv); } static struct icl_conn * icl_soft_new_conn(const char *name, struct mtx *lock) { + struct icl_soft_conn *isc; struct icl_conn *ic; refcount_acquire(&icl_ncons); - ic = (struct icl_conn *)kobj_create(&icl_soft_class, M_ICL_SOFT, M_WAITOK | M_ZERO); + isc = (struct icl_soft_conn *)kobj_create(&icl_soft_class, M_ICL_SOFT, + M_WAITOK | M_ZERO); + + STAILQ_INIT(&isc->to_send); + cv_init(&isc->send_cv, "icl_tx"); + cv_init(&isc->receive_cv, "icl_rx"); - STAILQ_INIT(&ic->ic_to_send); + ic = &isc->ic; ic->ic_lock = lock; - cv_init(&ic->ic_send_cv, "icl_tx"); - cv_init(&ic->ic_receive_cv, "icl_rx"); #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif @@ -1164,21 +1195,23 @@ icl_soft_new_conn(const char *name, struct mtx *lock) void icl_soft_conn_free(struct icl_conn *ic) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; #ifdef DIAGNOSTIC KASSERT(ic->ic_outstanding_pdus == 0, ("destroying session with %d outstanding PDUs", ic->ic_outstanding_pdus)); #endif - cv_destroy(&ic->ic_send_cv); - cv_destroy(&ic->ic_receive_cv); - kobj_delete((struct kobj *)ic, M_ICL_SOFT); + cv_destroy(&isc->send_cv); + cv_destroy(&isc->receive_cv); + kobj_delete((struct kobj *)isc, M_ICL_SOFT); refcount_release(&icl_ncons); } static int icl_conn_start(struct icl_conn *ic) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; size_t minspace; struct sockopt opt; int error, one = 1; @@ -1193,8 +1226,8 @@ icl_conn_start(struct icl_conn *ic) return (EINVAL); } - ic->ic_receive_state = ICL_CONN_STATE_BHS; - ic->ic_receive_len = sizeof(struct iscsi_bhs); + isc->receive_state = ICL_CONN_STATE_BHS; + isc->receive_len = sizeof(struct iscsi_bhs); ic->ic_disconnecting = false; ICL_CONN_UNLOCK(ic); @@ -1251,25 +1284,25 @@ icl_conn_start(struct icl_conn *ic) * and free space to send outgoing ones. */ SOCKBUF_LOCK(&ic->ic_socket->so_snd); - soupcall_set(ic->ic_socket, SO_SND, icl_soupcall_send, ic); + soupcall_set(ic->ic_socket, SO_SND, icl_soupcall_send, isc); SOCKBUF_UNLOCK(&ic->ic_socket->so_snd); SOCKBUF_LOCK(&ic->ic_socket->so_rcv); - soupcall_set(ic->ic_socket, SO_RCV, icl_soupcall_receive, ic); + soupcall_set(ic->ic_socket, SO_RCV, icl_soupcall_receive, isc); SOCKBUF_UNLOCK(&ic->ic_socket->so_rcv); /* * Start threads. */ ICL_CONN_LOCK(ic); - ic->ic_send_running = ic->ic_receive_running = true; + isc->send_running = isc->receive_running = true; ICL_CONN_UNLOCK(ic); error = kthread_add(icl_send_thread, ic, NULL, NULL, 0, 0, "%stx", ic->ic_name); if (error != 0) { ICL_WARN("kthread_add(9) failed with error %d", error); ICL_CONN_LOCK(ic); - ic->ic_send_running = ic->ic_receive_running = false; - cv_signal(&ic->ic_send_cv); + isc->send_running = isc->receive_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); icl_soft_conn_close(ic); return (error); @@ -1279,8 +1312,8 @@ icl_conn_start(struct icl_conn *ic) if (error != 0) { ICL_WARN("kthread_add(9) failed with error %d", error); ICL_CONN_LOCK(ic); - ic->ic_receive_running = false; - cv_signal(&ic->ic_send_cv); + isc->receive_running = false; + cv_signal(&isc->send_cv); ICL_CONN_UNLOCK(ic); icl_soft_conn_close(ic); return (error); @@ -1355,6 +1388,7 @@ icl_soft_conn_handoff(struct icl_conn *ic, int fd) void icl_soft_conn_close(struct icl_conn *ic) { + struct icl_soft_conn *isc = (struct icl_soft_conn *)ic; struct icl_pdu *pdu; struct socket *so; @@ -1371,10 +1405,10 @@ icl_soft_conn_close(struct icl_conn *ic) if (so) SOCKBUF_UNLOCK(&so->so_rcv); } - while (ic->ic_receive_running || ic->ic_send_running) { - cv_signal(&ic->ic_receive_cv); - cv_signal(&ic->ic_send_cv); - cv_wait(&ic->ic_send_cv, ic->ic_lock); + while (isc->receive_running || isc->send_running) { + cv_signal(&isc->receive_cv); + cv_signal(&isc->send_cv); + cv_wait(&isc->send_cv, ic->ic_lock); } /* Some other thread could close the connection same time. */ @@ -1400,22 +1434,22 @@ icl_soft_conn_close(struct icl_conn *ic) soclose(so); ICL_CONN_LOCK(ic); - if (ic->ic_receive_pdu != NULL) { + if (isc->receive_pdu != NULL) { //ICL_DEBUG("freeing partially received PDU"); - icl_soft_conn_pdu_free(ic, ic->ic_receive_pdu); - ic->ic_receive_pdu = NULL; + icl_soft_conn_pdu_free(ic, isc->receive_pdu); + isc->receive_pdu = NULL; } /* * Remove any outstanding PDUs from the send queue. */ - while (!STAILQ_EMPTY(&ic->ic_to_send)) { - pdu = STAILQ_FIRST(&ic->ic_to_send); - STAILQ_REMOVE_HEAD(&ic->ic_to_send, ip_next); + while (!STAILQ_EMPTY(&isc->to_send)) { + pdu = STAILQ_FIRST(&isc->to_send); + STAILQ_REMOVE_HEAD(&isc->to_send, ip_next); icl_soft_pdu_done(pdu, ENOTCONN); } - KASSERT(STAILQ_EMPTY(&ic->ic_to_send), + KASSERT(STAILQ_EMPTY(&isc->to_send), ("destroying session with non-empty send queue")); ICL_CONN_UNLOCK(ic); } From nobody Fri Oct 29 23:58:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2899E181D8D7; Fri, 29 Oct 2021 23:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsQ2gS5z4Vh7; Fri, 29 Oct 2021 23:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4DA7B205B0; Fri, 29 Oct 2021 23:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwUvN003852; Fri, 29 Oct 2021 23:58:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwUY7003851; Fri, 29 Oct 2021 23:58:30 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:30 GMT Message-Id: <202110292358.19TNwUY7003851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: e508e93f36f4 - stable/13 - iSCSI: Add support for segmentation offload for hardware offloads. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e508e93f36f4a1c7506e927407943001089a28c3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e508e93f36f4a1c7506e927407943001089a28c3 commit e508e93f36f4a1c7506e927407943001089a28c3 Author: John Baldwin AuthorDate: 2021-08-06 21:03:00 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:20:35 +0000 iSCSI: Add support for segmentation offload for hardware offloads. Similar to TSO, iSCSI segmentation offload permits the upper layers to submit a "large" virtual PDU which is split up into multiple segments (PDUs) on the wire. Similar to how the TCP/IP headers are used as templates for TSO, the BHS at the start of a large PDU is used as a template to construct the specific BHS at the start of each PDU. In particular, the DataSN is incremented for each subsequent PDU, and the 'F' flag is only set on the last PDU. struct icl_conn has a new 'ic_hw_isomax' field which defaults to 0, but can be set to the largest virtual PDU a backend supports. If this value is non-zero, the iSCSI target and initiator use this size instead of 'ic_max_send_data_segment_length' to determine the maximum size for SCSI Data-In and SCSI Data-Out PDUs. Note that since PDUs can be constructed from multiple buffers before being dispatched, the target and initiator must wait for the PDU to be fully constructed before determining the number of DataSN values were consumed (and thus updating the per-transfer DataSN value used for the start of the next PDU). The target generates large PDUs for SCSI Data-In PDUs in cfiscsi_datamove_in(). The initiator generates large PDUs for SCSI Data-Out PDUs generated in response to an R2T. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31222 (cherry picked from commit f0594f52f6fdabecee134dd5700bf936283959ad) --- sys/cam/ctl/ctl_frontend_iscsi.c | 29 +++++++++++++++++------------ sys/dev/iscsi/icl.h | 1 + sys/dev/iscsi/iscsi.c | 15 +++++++++++---- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index b3cd8ab79d76..b8fafcea69ed 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2447,6 +2447,7 @@ cfiscsi_datamove_in(union ctl_io *io) struct iscsi_bhs_data_in *bhsdi; struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; size_t len, expected_len, sg_len, buffer_offset; + size_t max_send_data_segment_length; const char *sg_addr; icl_pdu_cb cb; int ctl_sg_count, error, i; @@ -2504,6 +2505,11 @@ cfiscsi_datamove_in(union ctl_io *io) sg_len = 0; response = NULL; bhsdi = NULL; + if (cs->cs_conn->ic_hw_isomax != 0) + max_send_data_segment_length = cs->cs_conn->ic_hw_isomax; + else + max_send_data_segment_length = + cs->cs_conn->ic_max_send_data_segment_length; for (;;) { if (response == NULL) { response = cfiscsi_pdu_new_response(request, M_NOWAIT); @@ -2520,7 +2526,7 @@ cfiscsi_datamove_in(union ctl_io *io) bhsdi->bhsdi_initiator_task_tag = bhssc->bhssc_initiator_task_tag; bhsdi->bhsdi_target_transfer_tag = 0xffffffff; - bhsdi->bhsdi_datasn = htonl(PRIV_EXPDATASN(io)++); + bhsdi->bhsdi_datasn = htonl(PRIV_EXPDATASN(io)); bhsdi->bhsdi_buffer_offset = htonl(buffer_offset); } @@ -2536,15 +2542,11 @@ cfiscsi_datamove_in(union ctl_io *io) /* * Truncate to maximum data segment length. */ - KASSERT(response->ip_data_len < - cs->cs_conn->ic_max_send_data_segment_length, - ("ip_data_len %zd >= max_send_data_segment_length %d", - response->ip_data_len, - cs->cs_conn->ic_max_send_data_segment_length)); - if (response->ip_data_len + len > - cs->cs_conn->ic_max_send_data_segment_length) { - len = cs->cs_conn->ic_max_send_data_segment_length - - response->ip_data_len; + KASSERT(response->ip_data_len < max_send_data_segment_length, + ("ip_data_len %zd >= max_send_data_segment_length %zd", + response->ip_data_len, max_send_data_segment_length)); + if (response->ip_data_len + len > max_send_data_segment_length) { + len = max_send_data_segment_length - response->ip_data_len; KASSERT(len <= sg_len, ("len %zd > sg_len %zd", len, sg_len)); } @@ -2603,8 +2605,7 @@ cfiscsi_datamove_in(union ctl_io *io) i++; } - if (response->ip_data_len == - cs->cs_conn->ic_max_send_data_segment_length) { + if (response->ip_data_len == max_send_data_segment_length) { /* * Can't stuff more data into the current PDU; * queue it. Note that's not enough to check @@ -2619,6 +2620,8 @@ cfiscsi_datamove_in(union ctl_io *io) buffer_offset -= response->ip_data_len; break; } + PRIV_EXPDATASN(io) += howmany(response->ip_data_len, + cs->cs_conn->ic_max_send_data_segment_length); if (cb != NULL) { response->ip_prv0 = io->scsiio.kern_data_ref; response->ip_prv1 = io->scsiio.kern_data_arg; @@ -2654,6 +2657,8 @@ cfiscsi_datamove_in(union ctl_io *io) } } KASSERT(response->ip_data_len > 0, ("sending empty Data-In")); + PRIV_EXPDATASN(io) += howmany(response->ip_data_len, + cs->cs_conn->ic_max_send_data_segment_length); if (cb != NULL) { response->ip_prv0 = io->scsiio.kern_data_ref; response->ip_prv1 = io->scsiio.kern_data_arg; diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index adcd580f299b..bd12569a8957 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -93,6 +93,7 @@ struct icl_conn { #endif uint32_t ic_max_recv_data_segment_length; uint32_t ic_max_send_data_segment_length; + size_t ic_hw_isomax; size_t ic_maxtags; bool ic_header_crc32c; bool ic_data_crc32c; diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 7ddb5a9ce1ec..f60904bb3de0 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1154,7 +1154,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) struct iscsi_bhs_data_out *bhsdo; struct iscsi_outstanding *io; struct ccb_scsiio *csio; - size_t off, len, total_len; + size_t off, len, max_send_data_segment_length, total_len; int error; uint32_t datasn = 0; @@ -1203,11 +1203,16 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) //ISCSI_SESSION_DEBUG(is, "r2t; off %zd, len %zd", off, total_len); + if (is->is_conn->ic_hw_isomax != 0) + max_send_data_segment_length = is->is_conn->ic_hw_isomax; + else + max_send_data_segment_length = + is->is_conn->ic_max_send_data_segment_length; for (;;) { len = total_len; - if (len > is->is_conn->ic_max_send_data_segment_length) - len = is->is_conn->ic_max_send_data_segment_length; + if (len > max_send_data_segment_length) + len = max_send_data_segment_length; if (off + len > csio->dxfer_len) { ISCSI_SESSION_WARN(is, "target requested invalid " @@ -1232,7 +1237,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) bhsr2t->bhsr2t_initiator_task_tag; bhsdo->bhsdo_target_transfer_tag = bhsr2t->bhsr2t_target_transfer_tag; - bhsdo->bhsdo_datasn = htonl(datasn++); + bhsdo->bhsdo_datasn = htonl(datasn); bhsdo->bhsdo_buffer_offset = htonl(off); error = icl_pdu_append_data(request, csio->data_ptr + off, len, M_NOWAIT); @@ -1245,6 +1250,8 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) return; } + datasn += howmany(len, + is->is_conn->ic_max_send_data_segment_length); off += len; total_len -= len; From nobody Fri Oct 29 23:58:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9DB4E181DA9D; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsQ3Kysz4Vh8; Fri, 29 Oct 2021 23:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6740C20242; Fri, 29 Oct 2021 23:58:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwVOO003876; Fri, 29 Oct 2021 23:58:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwVDj003875; Fri, 29 Oct 2021 23:58:31 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:31 GMT Message-Id: <202110292358.19TNwVDj003875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 132894ca4beb - stable/13 - cxgbei: Support for ISO (iSCSI segmentation offload). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 132894ca4bebe54854c414e46d3d1312b47a8f46 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=132894ca4bebe54854c414e46d3d1312b47a8f46 commit 132894ca4bebe54854c414e46d3d1312b47a8f46 Author: John Baldwin AuthorDate: 2021-08-06 21:21:37 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:27:10 +0000 cxgbei: Support for ISO (iSCSI segmentation offload). ISO can be disabled before establishing a connection by setting dev.tNnex.N.toe.iso to 0. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31223 (cherry picked from commit 5b27e4b27caae840bd79ccc5cb7811a0c9acc656) --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/cxgbei/cxgbei.h | 2 + sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 62 +++++++++++-- sys/dev/cxgbe/offload.h | 1 + sys/dev/cxgbe/t4_main.c | 5 ++ sys/dev/cxgbe/t4_sge.c | 5 ++ sys/dev/cxgbe/tom/t4_cpl_io.c | 184 ++++++++++++++++++++++++++++---------- sys/dev/cxgbe/tom/t4_tom.h | 52 +++++++++++ 8 files changed, 254 insertions(+), 58 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 7909e0b108b2..c5a10c563e87 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -739,6 +739,7 @@ struct sge_ofld_txq { struct sge_wrq wrq; counter_u64_t tx_iscsi_pdus; counter_u64_t tx_iscsi_octets; + counter_u64_t tx_iscsi_iso_wrs; counter_u64_t tx_toe_tls_records; counter_u64_t tx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 45d3398d545c..433f15b743fe 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -134,6 +134,8 @@ struct cxgbei_data { struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */ }; +#define CXGBEI_MAX_ISO_PAYLOAD 65535 + /* cxgbei.c */ u_int cxgbei_select_worker_thread(struct icl_cxgbei_conn *); diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index d5b13fb5c3ea..a57d26ae21b8 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -335,13 +335,14 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) uint8_t ulp_submode, padding; struct mbuf *m, *last; struct iscsi_bhs *bhs; + int data_len; /* * Fix up the data segment mbuf first. */ m = ip->ip_data_mbuf; ulp_submode = icc->ulp_submode; - if (m) { + if (m != NULL) { last = m_last(m); /* @@ -349,7 +350,8 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) * necessary. There will definitely be room in the mbuf. */ padding = roundup2(ip->ip_data_len, 4) - ip->ip_data_len; - if (padding) { + if (padding != 0) { + MPASS(padding <= M_TRAILINGSPACE(last)); bzero(mtod(last, uint8_t *) + last->m_len, padding); last->m_len += padding; } @@ -367,9 +369,41 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) MPASS(m->m_len == sizeof(struct iscsi_bhs)); bhs = ip->ip_bhs; - bhs->bhs_data_segment_len[2] = ip->ip_data_len; - bhs->bhs_data_segment_len[1] = ip->ip_data_len >> 8; - bhs->bhs_data_segment_len[0] = ip->ip_data_len >> 16; + data_len = ip->ip_data_len; + if (data_len > icc->ic.ic_max_send_data_segment_length) { + struct iscsi_bhs_data_in *bhsdi; + int flags; + + KASSERT(padding == 0, ("%s: ISO with padding %d for icp %p", + __func__, padding, icp)); + switch (bhs->bhs_opcode) { + case ISCSI_BHS_OPCODE_SCSI_DATA_OUT: + flags = 1; + break; + case ISCSI_BHS_OPCODE_SCSI_DATA_IN: + flags = 2; + break; + default: + panic("invalid opcode %#x for ISO", bhs->bhs_opcode); + } + data_len = icc->ic.ic_max_send_data_segment_length; + bhsdi = (struct iscsi_bhs_data_in *)bhs; + if (bhsdi->bhsdi_flags & BHSDI_FLAGS_F) { + /* + * Firmware will set F on the final PDU in the + * burst. + */ + flags |= CXGBE_ISO_F; + bhsdi->bhsdi_flags &= ~BHSDI_FLAGS_F; + } + set_mbuf_iscsi_iso(m, true); + set_mbuf_iscsi_iso_flags(m, flags); + set_mbuf_iscsi_iso_mss(m, data_len); + } + + bhs->bhs_data_segment_len[2] = data_len; + bhs->bhs_data_segment_len[1] = data_len >> 8; + bhs->bhs_data_segment_len[0] = data_len >> 16; /* * Extract mbuf chain from PDU. @@ -477,7 +511,8 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, } MPASS(len == 0); } - MPASS(ip->ip_data_len <= ic->ic_max_send_data_segment_length); + MPASS(ip->ip_data_len <= max(ic->ic_max_send_data_segment_length, + ic->ic_hw_isomax)); return (0); } @@ -748,7 +783,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) struct tcpcb *tp; struct toepcb *toep; cap_rights_t rights; - int error; + int error, max_iso_pdus; MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); ICL_CONN_LOCK_ASSERT_NOT(ic); @@ -815,12 +850,21 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) icc->ulp_submode |= ULP_CRC_HEADER; if (ic->ic_data_crc32c) icc->ulp_submode |= ULP_CRC_DATA; + + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) { + max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / + ci->max_tx_pdu_len; + ic->ic_hw_isomax = max_iso_pdus * + ic->ic_max_send_data_segment_length; + } else + max_iso_pdus = 1; + so->so_options |= SO_NO_DDP; toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; - send_iscsi_flowc_wr(icc->sc, toep, roundup(ci->max_tx_pdu_len, - tp->t_maxseg)); + send_iscsi_flowc_wr(icc->sc, toep, + roundup(max_iso_pdus * ci->max_tx_pdu_len, tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); error = 0; } diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h index e264882fb5b4..81ed08f2e412 100644 --- a/sys/dev/cxgbe/offload.h +++ b/sys/dev/cxgbe/offload.h @@ -232,6 +232,7 @@ struct tom_tunables { int tx_zcopy; int cop_managed_offloading; int autorcvbuf_inc; + int iso; }; /* iWARP driver tunables */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index bb8b9a4d78fb..71877a571982 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -7585,6 +7585,10 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RW, &sc->tt.autorcvbuf_inc, 0, "autorcvbuf increment"); + sc->tt.iso = 1; + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "iso", CTLFLAG_RW, + &sc->tt.iso, 0, "Enable iSCSI segmentation offload"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "timer_tick", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_tp_tick, "A", "TP timer tick (us)"); @@ -11900,6 +11904,7 @@ clear_stats(struct adapter *sc, u_int port_id) ofld_txq->wrq.tx_wrs_copied = 0; counter_u64_zero(ofld_txq->tx_iscsi_pdus); counter_u64_zero(ofld_txq->tx_iscsi_octets); + counter_u64_zero(ofld_txq->tx_iscsi_iso_wrs); counter_u64_zero(ofld_txq->tx_toe_tls_records); counter_u64_zero(ofld_txq->tx_toe_tls_octets); } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 3679bbf84f2f..6b40a23516d7 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4786,6 +4786,7 @@ alloc_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq, int idx) ofld_txq->tx_iscsi_pdus = counter_u64_alloc(M_WAITOK); ofld_txq->tx_iscsi_octets = counter_u64_alloc(M_WAITOK); + ofld_txq->tx_iscsi_iso_wrs = counter_u64_alloc(M_WAITOK); ofld_txq->tx_toe_tls_records = counter_u64_alloc(M_WAITOK); ofld_txq->tx_toe_tls_octets = counter_u64_alloc(M_WAITOK); add_ofld_txq_sysctls(&vi->ctx, oid, ofld_txq); @@ -4823,6 +4824,7 @@ free_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq) MPASS(!(eq->flags & EQ_HW_ALLOCATED)); counter_u64_free(ofld_txq->tx_iscsi_pdus); counter_u64_free(ofld_txq->tx_iscsi_octets); + counter_u64_free(ofld_txq->tx_iscsi_iso_wrs); counter_u64_free(ofld_txq->tx_toe_tls_records); counter_u64_free(ofld_txq->tx_toe_tls_octets); free_wrq(sc, &ofld_txq->wrq); @@ -4847,6 +4849,9 @@ add_ofld_txq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_iscsi_octets", CTLFLAG_RD, &ofld_txq->tx_iscsi_octets, "# of payload octets in transmitted iSCSI PDUs"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_iscsi_iso_wrs", + CTLFLAG_RD, &ofld_txq->tx_iscsi_iso_wrs, + "# of iSCSI segmentation offload work requests"); SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_toe_tls_records", CTLFLAG_RD, &ofld_txq->tx_toe_tls_records, "# of TOE TLS records transmitted"); diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 66e3955445f9..f61fe557635c 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -67,6 +67,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" @@ -516,38 +518,44 @@ t4_close_conn(struct adapter *sc, struct toepcb *toep) #define MAX_OFLD_TX_CREDITS (SGE_MAX_WR_LEN / 16) #define MIN_OFLD_TX_CREDITS (howmany(sizeof(struct fw_ofld_tx_data_wr) + 1, 16)) +#define MIN_ISO_TX_CREDITS (howmany(sizeof(struct cpl_tx_data_iso), 16)) +#define MIN_TX_CREDITS(iso) \ + (MIN_OFLD_TX_CREDITS + ((iso) ? MIN_ISO_TX_CREDITS : 0)) /* Maximum amount of immediate data we could stuff in a WR */ static inline int -max_imm_payload(int tx_credits) +max_imm_payload(int tx_credits, int iso) { + const int iso_cpl_size = iso ? sizeof(struct cpl_tx_data_iso) : 0; const int n = 1; /* Use no more than one desc for imm. data WR */ KASSERT(tx_credits >= 0 && tx_credits <= MAX_OFLD_TX_CREDITS, ("%s: %d credits", __func__, tx_credits)); - if (tx_credits < MIN_OFLD_TX_CREDITS) + if (tx_credits < MIN_TX_CREDITS(iso)) return (0); if (tx_credits >= (n * EQ_ESIZE) / 16) - return ((n * EQ_ESIZE) - sizeof(struct fw_ofld_tx_data_wr)); + return ((n * EQ_ESIZE) - sizeof(struct fw_ofld_tx_data_wr) - + iso_cpl_size); else - return (tx_credits * 16 - sizeof(struct fw_ofld_tx_data_wr)); + return (tx_credits * 16 - sizeof(struct fw_ofld_tx_data_wr) - + iso_cpl_size); } /* Maximum number of SGL entries we could stuff in a WR */ static inline int -max_dsgl_nsegs(int tx_credits) +max_dsgl_nsegs(int tx_credits, int iso) { int nseg = 1; /* ulptx_sgl has room for 1, rest ulp_tx_sge_pair */ - int sge_pair_credits = tx_credits - MIN_OFLD_TX_CREDITS; + int sge_pair_credits = tx_credits - MIN_TX_CREDITS(iso); KASSERT(tx_credits >= 0 && tx_credits <= MAX_OFLD_TX_CREDITS, ("%s: %d credits", __func__, tx_credits)); - if (tx_credits < MIN_OFLD_TX_CREDITS) + if (tx_credits < MIN_TX_CREDITS(iso)) return (0); nseg += 2 * (sge_pair_credits * 16 / 24); @@ -558,12 +566,13 @@ max_dsgl_nsegs(int tx_credits) } static inline void -write_tx_wr(void *dst, struct toepcb *toep, unsigned int immdlen, - unsigned int plen, uint8_t credits, int shove, int ulp_submode) +write_tx_wr(void *dst, struct toepcb *toep, int fw_wr_opcode, + unsigned int immdlen, unsigned int plen, uint8_t credits, int shove, + int ulp_submode) { struct fw_ofld_tx_data_wr *txwr = dst; - txwr->op_to_immdlen = htobe32(V_WR_OP(FW_OFLD_TX_DATA_WR) | + txwr->op_to_immdlen = htobe32(V_WR_OP(fw_wr_opcode) | V_FW_WR_IMMDLEN(immdlen)); txwr->flowid_len16 = htobe32(V_FW_WR_FLOWID(toep->tid) | V_FW_WR_LEN16(credits)); @@ -707,8 +716,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) txsd = &toep->txsd[toep->txsd_pidx]; do { tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); - max_imm = max_imm_payload(tx_credits); - max_nsegs = max_dsgl_nsegs(tx_credits); + max_imm = max_imm_payload(tx_credits, 0); + max_nsegs = max_dsgl_nsegs(tx_credits, 0); SOCKBUF_LOCK(sb); sowwakeup = drop; @@ -832,7 +841,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) } txwr = wrtod(wr); credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, plen, credits, shove, 0); + write_tx_wr(txwr, toep, FW_OFLD_TX_DATA_WR, plen, plen, + credits, shove, 0); m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); nsegs = 0; } else { @@ -851,7 +861,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) } txwr = wrtod(wr); credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, plen, credits, shove, 0); + write_tx_wr(txwr, toep, FW_OFLD_TX_DATA_WR, 0, plen, + credits, shove, 0); write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { @@ -927,18 +938,71 @@ rqdrop_locked(struct mbufq *q, int plen) } } +/* + * Not a bit in the TCB, but is a bit in the ulp_submode field of the + * CPL_TX_DATA flags field in FW_ISCSI_TX_DATA_WR. + */ +#define ULP_ISO G_TX_ULP_SUBMODE(F_FW_ISCSI_TX_DATA_WR_ULPSUBMODE_ISO) + +static void +write_tx_data_iso(void *dst, u_int ulp_submode, uint8_t flags, uint16_t mss, + int len, int npdu) +{ + struct cpl_tx_data_iso *cpl; + unsigned int burst_size; + unsigned int last; + + /* + * The firmware will set the 'F' bit on the last PDU when + * either condition is true: + * + * - this large PDU is marked as the "last" slice + * + * - the amount of data payload bytes equals the burst_size + * + * The strategy used here is to always set the burst_size + * artificially high (len includes the size of the template + * BHS) and only set the "last" flag if the original PDU had + * 'F' set. + */ + burst_size = len; + last = !!(flags & CXGBE_ISO_F); + + cpl = (struct cpl_tx_data_iso *)dst; + cpl->op_to_scsi = htonl(V_CPL_TX_DATA_ISO_OP(CPL_TX_DATA_ISO) | + V_CPL_TX_DATA_ISO_FIRST(1) | V_CPL_TX_DATA_ISO_LAST(last) | + V_CPL_TX_DATA_ISO_CPLHDRLEN(0) | + V_CPL_TX_DATA_ISO_HDRCRC(!!(ulp_submode & ULP_CRC_HEADER)) | + V_CPL_TX_DATA_ISO_PLDCRC(!!(ulp_submode & ULP_CRC_DATA)) | + V_CPL_TX_DATA_ISO_IMMEDIATE(0) | + V_CPL_TX_DATA_ISO_SCSI(CXGBE_ISO_TYPE(flags))); + + cpl->ahs_len = 0; + cpl->mpdu = htons(DIV_ROUND_UP(mss, 4)); + cpl->burst_size = htonl(DIV_ROUND_UP(burst_size, 4)); + cpl->len = htonl(len); + cpl->reserved2_seglen_offset = htonl(0); + cpl->datasn_offset = htonl(0); + cpl->buffer_offset = htonl(0); + cpl->reserved3 = 0; +} + static struct wrqe * write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) { struct mbuf *m; struct fw_ofld_tx_data_wr *txwr; + struct cpl_tx_data_iso *cpl_iso; + void *p; struct wrqe *wr; u_int plen, nsegs, credits, max_imm, max_nsegs, max_nsegs_1mbuf; - u_int adjusted_plen, ulp_submode; + u_int adjusted_plen, imm_data, ulp_submode; struct inpcb *inp = toep->inp; struct tcpcb *tp = intotcpcb(inp); - int tx_credits, shove; + int tx_credits, shove, npdu, wr_len; + uint16_t iso_mss; static const u_int ulp_extra_len[] = {0, 4, 4, 8}; + bool iso; M_ASSERTPKTHDR(sndptr); @@ -958,8 +1022,10 @@ write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) return (wr); } - max_imm = max_imm_payload(tx_credits); - max_nsegs = max_dsgl_nsegs(tx_credits); + iso = mbuf_iscsi_iso(sndptr); + max_imm = max_imm_payload(tx_credits, iso); + max_nsegs = max_dsgl_nsegs(tx_credits, iso); + iso_mss = mbuf_iscsi_iso_mss(sndptr); plen = 0; nsegs = 0; @@ -993,8 +1059,6 @@ write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) MPASS(sndptr->m_pkthdr.len == plen); shove = !(tp->t_flags & TF_MORETOCOME); - ulp_submode = mbuf_ulp_submode(sndptr); - MPASS(ulp_submode < nitems(ulp_extra_len)); /* * plen doesn't include header and data digests, which are @@ -1002,51 +1066,73 @@ write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) * they do occupy TCP sequence space and need to be accounted * for. */ - adjusted_plen = plen + ulp_extra_len[ulp_submode]; + ulp_submode = mbuf_ulp_submode(sndptr); + MPASS(ulp_submode < nitems(ulp_extra_len)); + npdu = iso ? howmany(plen - ISCSI_BHS_SIZE, iso_mss) : 1; + adjusted_plen = plen + ulp_extra_len[ulp_submode] * npdu; + if (iso) + adjusted_plen += ISCSI_BHS_SIZE * (npdu - 1); + wr_len = sizeof(*txwr); + if (iso) + wr_len += sizeof(struct cpl_tx_data_iso); if (plen <= max_imm) { - /* Immediate data tx */ - - wr = alloc_wrqe(roundup2(sizeof(*txwr) + plen, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - return (NULL); - } - txwr = wrtod(wr); - credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, adjusted_plen, credits, - shove, ulp_submode); - m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); + imm_data = plen; + wr_len += plen; nsegs = 0; } else { - int wr_len; - /* DSGL tx */ - wr_len = sizeof(*txwr) + sizeof(struct ulptx_sgl) + + imm_data = 0; + wr_len += sizeof(struct ulptx_sgl) + ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; - wr = alloc_wrqe(roundup2(wr_len, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - return (NULL); - } - txwr = wrtod(wr); - credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, adjusted_plen, credits, - shove, ulp_submode); - write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); + } + + wr = alloc_wrqe(roundup2(wr_len, 16), &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX: how will we recover from this? */ + return (NULL); + } + txwr = wrtod(wr); + credits = howmany(wr->wr_len, 16); + + if (iso) { + write_tx_wr(txwr, toep, FW_ISCSI_TX_DATA_WR, + imm_data + sizeof(struct cpl_tx_data_iso), + adjusted_plen, credits, shove, ulp_submode | ULP_ISO); + cpl_iso = (struct cpl_tx_data_iso *)(txwr + 1); + MPASS(plen == sndptr->m_pkthdr.len); + write_tx_data_iso(cpl_iso, ulp_submode, + mbuf_iscsi_iso_flags(sndptr), iso_mss, plen, npdu); + p = cpl_iso + 1; + } else { + write_tx_wr(txwr, toep, FW_OFLD_TX_DATA_WR, imm_data, + adjusted_plen, credits, shove, ulp_submode); + p = txwr + 1; + } + + if (imm_data != 0) { + m_copydata(sndptr, 0, plen, p); + } else { + write_tx_sgl(p, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { uint64_t *pad = (uint64_t *)((uintptr_t)txwr + wr_len); *pad = 0; } } + KASSERT(toep->tx_credits >= credits, + ("%s: not enough credits: credits %u " + "toep->tx_credits %u tx_credits %u nsegs %u " + "max_nsegs %u iso %d", __func__, credits, + toep->tx_credits, tx_credits, nsegs, max_nsegs, iso)); + tp->snd_nxt += adjusted_plen; tp->snd_max += adjusted_plen; - counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1); + counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, npdu); counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen); + if (iso) + counter_u64_add(toep->ofld_txq->tx_iscsi_iso_wrs, 1); return (wr); } diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 21cfb1df6e16..89c38f8c988a 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -363,6 +363,58 @@ mbuf_ulp_submode(struct mbuf *m) return (m->m_pkthdr.PH_per.eight[0]); } +static inline void +set_mbuf_iscsi_iso(struct mbuf *m, bool iso) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.eight[1] = iso; +} + +static inline bool +mbuf_iscsi_iso(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.eight[1]); +} + +/* Flags for iSCSI segmentation offload. */ +#define CXGBE_ISO_TYPE(flags) ((flags) & 0x3) +#define CXGBE_ISO_F 0x4 + +static inline void +set_mbuf_iscsi_iso_flags(struct mbuf *m, uint8_t flags) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.eight[2] = flags; +} + +static inline uint8_t +mbuf_iscsi_iso_flags(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.eight[2]); +} + +static inline void +set_mbuf_iscsi_iso_mss(struct mbuf *m, uint16_t mss) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.sixteen[2] = mss; +} + +static inline uint16_t +mbuf_iscsi_iso_mss(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.sixteen[2]); +} + /* t4_tom.c */ struct toepcb *alloc_toepcb(struct vi_info *, int); int init_toepcb(struct vi_info *, struct toepcb *); From nobody Fri Oct 29 23:58:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D565D181DB15; Fri, 29 Oct 2021 23:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsR4ZzRz4VXw; Fri, 29 Oct 2021 23:58:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7779C20070; Fri, 29 Oct 2021 23:58:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwWK1003900; Fri, 29 Oct 2021 23:58:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwW3a003899; Fri, 29 Oct 2021 23:58:32 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:32 GMT Message-Id: <202110292358.19TNwW3a003899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 37c5daa85596 - stable/13 - cxgbei: Wait for the final CPL to be received in icl_cxgbei_conn_close. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37c5daa855966118e99bca7f5c79f7c20c61529c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=37c5daa855966118e99bca7f5c79f7c20c61529c commit 37c5daa855966118e99bca7f5c79f7c20c61529c Author: John Baldwin AuthorDate: 2021-08-12 15:48:14 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:27:31 +0000 cxgbei: Wait for the final CPL to be received in icl_cxgbei_conn_close. A socket in the FIN_WAIT_1 state is marked disconnected by do_close_con_rpl() even though there might still receive data pending. This is because the socket at that point has set SBS_CANTRCVMORE which causes the protocol layer to discard any data received before the FIN. However, icl_cxgbei_conn_close needs to wait until all the data has been discarded. Replace the wait for SS_ISDISCONNECTED with instead waiting for final_cpl_received() to be called. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit 2eb0e53a6b5ec1a72be70e966d4e562e1a8d4e88) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 28 +++++++++++++++++++++------- sys/dev/cxgbe/tom/t4_tom.c | 12 +++++++++++- sys/dev/cxgbe/tom/t4_tom.h | 1 + 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index a57d26ae21b8..5526388915f7 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -947,6 +947,18 @@ icl_cxgbei_conn_close(struct icl_conn *ic) icl_cxgbei_pdu_done(ip, ENOTCONN); } SOCKBUF_UNLOCK(sb); + + /* + * Grab a reference to use when waiting for the final + * CPL to be received. If toep->inp is NULL, then + * final_cpl_received() has already been called (e.g. + * due to the peer sending a RST). + */ + if (toep->inp != NULL) { + toep = hold_toepcb(toep); + toep->flags |= TPF_WAITING_FOR_FINAL; + } else + toep = NULL; } INP_WUNLOCK(inp); @@ -959,7 +971,6 @@ icl_cxgbei_conn_close(struct icl_conn *ic) * queues were purged instead of delivered reliably but soabort isn't * really general purpose and wouldn't do the right thing here. */ - soref(so); soclose(so); /* @@ -969,12 +980,15 @@ icl_cxgbei_conn_close(struct icl_conn *ic) * Callers assume that it is safe to free buffers for tasks * and transfers after this function returns. */ - SOCK_LOCK(so); - while ((so->so_state & SS_ISDISCONNECTED) == 0) - mtx_sleep(&so->so_timeo, SOCK_MTX(so), PSOCK, "conclo2", 0); - CURVNET_SET(so->so_vnet); - sorele(so); - CURVNET_RESTORE(); + if (toep != NULL) { + struct mtx *lock = mtx_pool_find(mtxpool_sleep, toep); + + mtx_lock(lock); + while ((toep->flags & TPF_WAITING_FOR_FINAL) != 0) + mtx_sleep(toep, lock, PSOCK, "conclo2", 0); + mtx_unlock(lock); + free_toepcb(toep); + } } static void diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index f3cd8270d24d..fdd0ab870f43 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -848,6 +848,7 @@ void final_cpl_received(struct toepcb *toep) { struct inpcb *inp = toep->inp; + bool need_wakeup; KASSERT(inp != NULL, ("%s: inp is NULL", __func__)); INP_WLOCK_ASSERT(inp); @@ -862,7 +863,8 @@ final_cpl_received(struct toepcb *toep) else if (ulp_mode(toep) == ULP_MODE_TLS) tls_detach(toep); toep->inp = NULL; - toep->flags &= ~TPF_CPL_PENDING; + need_wakeup = (toep->flags & TPF_WAITING_FOR_FINAL) != 0; + toep->flags &= ~(TPF_CPL_PENDING | TPF_WAITING_FOR_FINAL); mbufq_drain(&toep->ulp_pduq); mbufq_drain(&toep->ulp_pdu_reclaimq); @@ -871,6 +873,14 @@ final_cpl_received(struct toepcb *toep) if (!in_pcbrele_wlocked(inp)) INP_WUNLOCK(inp); + + if (need_wakeup) { + struct mtx *lock = mtx_pool_find(mtxpool_sleep, toep); + + mtx_lock(lock); + wakeup(toep); + mtx_unlock(lock); + } } void diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 89c38f8c988a..2224ece20c38 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -76,6 +76,7 @@ enum { TPF_INITIALIZED = (1 << 12), /* init_toepcb has been called */ TPF_TLS_RECEIVE = (1 << 13), /* should receive TLS records */ TPF_TLS_ESTABLISHED = (1 << 14), /* TLS handshake timer initialized */ + TPF_WAITING_FOR_FINAL = (1<< 15), /* waiting for wakeup on final CPL */ }; enum { From nobody Fri Oct 29 23:58:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1A4FD181DC83; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsS3Nb1z4VVw; Fri, 29 Oct 2021 23:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9D49820243; Fri, 29 Oct 2021 23:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwXvW003930; Fri, 29 Oct 2021 23:58:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwX5L003929; Fri, 29 Oct 2021 23:58:33 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:33 GMT Message-Id: <202110292358.19TNwX5L003929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5dfe6f23d388 - stable/13 - cxgbei: Restructure how PDU limits are managed. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5dfe6f23d388c93d868257b76c2c3eff4dc1d12d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5dfe6f23d388c93d868257b76c2c3eff4dc1d12d commit 5dfe6f23d388c93d868257b76c2c3eff4dc1d12d Author: John Baldwin AuthorDate: 2021-08-17 18:14:11 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:29:08 +0000 cxgbei: Restructure how PDU limits are managed. - Compute data segment limits in read_pdu_limits() rather than PDU length limits. - Add back connection-specific PDU overhead lengths to compute PDU length limits in icl_cxgbei_conn_handoff(). Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31574 (cherry picked from commit cbc186360c658eda884ed97f37cdc2d1b6512b91) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 19 ++++++++++++++----- sys/dev/cxgbe/cxgbei/cxgbei.h | 4 ++-- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 30 ++++++++++++++++++------------ 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 5cce7d3fce05..24187c862fe6 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -97,8 +97,8 @@ static struct cxgbei_worker_thread_softc *cwt_softc; static struct proc *cxgbei_proc; static void -read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, - uint32_t *max_rx_pdu_len) +read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, + uint32_t *max_rx_data_len) { uint32_t tx_len, rx_len, r, v; @@ -114,8 +114,17 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, rx_len = min(rx_len, v); tx_len = min(tx_len, v); - *max_tx_pdu_len = rounddown2(tx_len, 512); - *max_rx_pdu_len = rounddown2(rx_len, 512); + /* + * AHS is not supported by the kernel so we'll not account for + * it either in our PDU len -> data segment len conversions. + */ + rx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + + ISCSI_DATA_DIGEST_SIZE; + tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + + ISCSI_DATA_DIGEST_SIZE; + + *max_tx_data_len = rounddown2(tx_len, 512); + *max_rx_data_len = rounddown2(rx_len, 512); } /* @@ -135,7 +144,7 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) MPASS(sc->vres.iscsi.size > 0); MPASS(ci != NULL); - read_pdu_limits(sc, &ci->max_tx_pdu_len, &ci->max_rx_pdu_len); + read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len); pr = &ci->pr; r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 433f15b743fe..20754fa893a8 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -125,8 +125,8 @@ ip_to_icp(struct icl_pdu *ip) } struct cxgbei_data { - u_int max_tx_pdu_len; - u_int max_rx_pdu_len; + u_int max_tx_data_len; + u_int max_rx_data_len; u_int ddp_threshold; struct ppod_region pr; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 5526388915f7..a6e7f8b95815 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -783,6 +783,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) struct tcpcb *tp; struct toepcb *toep; cap_rights_t rights; + u_int max_rx_pdu_len, max_tx_pdu_len; int error, max_iso_pdus; MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); @@ -828,6 +829,17 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) icc->sc = fa.sc; ci = icc->sc->iscsi_ulp_softc; + max_rx_pdu_len = ISCSI_BHS_SIZE + ic->ic_max_recv_data_segment_length; + max_tx_pdu_len = ISCSI_BHS_SIZE + ic->ic_max_send_data_segment_length; + if (ic->ic_header_crc32c) { + max_rx_pdu_len += ISCSI_HEADER_DIGEST_SIZE; + max_tx_pdu_len += ISCSI_HEADER_DIGEST_SIZE; + } + if (ic->ic_data_crc32c) { + max_rx_pdu_len += ISCSI_DATA_DIGEST_SIZE; + max_tx_pdu_len += ISCSI_DATA_DIGEST_SIZE; + } + inp = sotoinpcb(so); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -853,7 +865,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) { max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / - ci->max_tx_pdu_len; + max_tx_pdu_len; ic->ic_hw_isomax = max_iso_pdus * ic->ic_max_send_data_segment_length; } else @@ -864,15 +876,15 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) toep->ulpcb = icc; send_iscsi_flowc_wr(icc->sc, toep, - roundup(max_iso_pdus * ci->max_tx_pdu_len, tp->t_maxseg)); + roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); error = 0; } INP_WUNLOCK(inp); if (error == 0) { - error = icl_cxgbei_setsockopt(ic, so, ci->max_tx_pdu_len, - ci->max_rx_pdu_len); + error = icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, + max_rx_pdu_len); } return (error); @@ -1378,18 +1390,12 @@ cxgbei_limits(struct adapter *sc, void *arg) ci = sc->iscsi_ulp_softc; MPASS(ci != NULL); - /* - * AHS is not supported by the kernel so we'll not account for - * it either in our PDU len -> data segment len conversions. - */ - max_dsl = ci->max_rx_pdu_len - ISCSI_BHS_SIZE - - ISCSI_HEADER_DIGEST_SIZE - ISCSI_DATA_DIGEST_SIZE; + max_dsl = ci->max_rx_data_len; if (idl->idl_max_recv_data_segment_length > max_dsl) idl->idl_max_recv_data_segment_length = max_dsl; - max_dsl = ci->max_tx_pdu_len - ISCSI_BHS_SIZE - - ISCSI_HEADER_DIGEST_SIZE - ISCSI_DATA_DIGEST_SIZE; + max_dsl = ci->max_tx_data_len; if (idl->idl_max_send_data_segment_length > max_dsl) idl->idl_max_send_data_segment_length = max_dsl; } From nobody Fri Oct 29 23:58:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AF0B181DD2A; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsW33gfz4Vkh; Fri, 29 Oct 2021 23:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CD0D720244; Fri, 29 Oct 2021 23:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwYi2003954; Fri, 29 Oct 2021 23:58:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwYJY003953; Fri, 29 Oct 2021 23:58:34 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:34 GMT Message-Id: <202110292358.19TNwYJY003953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: da92c273d534 - stable/13 - cxgbei: Only round PDU data segment lengths down by 512 on T5. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: da92c273d534ab8991e43fee88d8ef68d0862295 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=da92c273d534ab8991e43fee88d8ef68d0862295 commit da92c273d534ab8991e43fee88d8ef68d0862295 Author: John Baldwin AuthorDate: 2021-08-17 18:14:29 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:29:49 +0000 cxgbei: Only round PDU data segment lengths down by 512 on T5. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31575 (cherry picked from commit f28715fdc1f7e801b260369787e7bcd633a481bb) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 24187c862fe6..acf6ee74c94f 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -123,8 +123,13 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE; - *max_tx_data_len = rounddown2(tx_len, 512); - *max_rx_data_len = rounddown2(rx_len, 512); + if (chip_id(sc) == CHELSIO_T5) { + rx_len = rounddown2(rx_len, 512); + tx_len = rounddown2(tx_len, 512); + } + + *max_tx_data_len = tx_len; + *max_rx_data_len = rx_len; } /* From nobody Fri Oct 29 23:58:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 40E9C181DBF8; Fri, 29 Oct 2021 23:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsY74B8z4VhZ; Fri, 29 Oct 2021 23:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EBBE5201F4; Fri, 29 Oct 2021 23:58:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwZ7U003978; Fri, 29 Oct 2021 23:58:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwZBR003977; Fri, 29 Oct 2021 23:58:35 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:35 GMT Message-Id: <202110292358.19TNwZBR003977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 0967aa717d50 - stable/13 - cxgbei: Restrict received PDUs to 4 DDP pages in length. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0967aa717d50e767c756a2ab4969424bccb29b01 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0967aa717d50e767c756a2ab4969424bccb29b01 commit 0967aa717d50e767c756a2ab4969424bccb29b01 Author: John Baldwin AuthorDate: 2021-08-17 18:14:37 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:30:43 +0000 cxgbei: Restrict received PDUs to 4 DDP pages in length. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31576 (cherry picked from commit d75b0870e542613e63d9f4ac8ec9fb22817e34fa) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index acf6ee74c94f..8dc580d65770 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -98,7 +98,7 @@ static struct proc *cxgbei_proc; static void read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, - uint32_t *max_rx_data_len) + uint32_t *max_rx_data_len, struct ppod_region *pr) { uint32_t tx_len, rx_len, r, v; @@ -123,6 +123,14 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE; + /* + * DDP can place only 4 pages for a single PDU. A single + * request might use larger pages than the smallest page size, + * but that cannot be guaranteed. Assume the smallest DDP + * page size for this limit. + */ + rx_len = min(rx_len, 4 * (1U << pr->pr_page_shift[0])); + if (chip_id(sc) == CHELSIO_T5) { rx_len = rounddown2(rx_len, 512); tx_len = rounddown2(tx_len, 512); @@ -149,8 +157,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) MPASS(sc->vres.iscsi.size > 0); MPASS(ci != NULL); - read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len); - pr = &ci->pr; r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ); rc = t4_init_ppod_region(pr, &sc->vres.iscsi, r, "iSCSI page pods"); @@ -176,6 +182,8 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) V_ISCSITAGMASK(M_ISCSITAGMASK), pr->pr_tag_mask); } + read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len, pr); + sysctl_ctx_init(&ci->ctx); oid = device_get_sysctl_tree(sc->dev); /* dev.t5nex.X */ children = SYSCTL_CHILDREN(oid); From nobody Fri Oct 29 23:58:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F1DB7181DCD9; Fri, 29 Oct 2021 23:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsb3MsHz4Vhn; Fri, 29 Oct 2021 23:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 279FF20071; Fri, 29 Oct 2021 23:58:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwaB3004002; Fri, 29 Oct 2021 23:58:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwaeW004001; Fri, 29 Oct 2021 23:58:36 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:36 GMT Message-Id: <202110292358.19TNwaeW004001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 51983604daa4 - stable/13 - iscsi: Teach the iSCSI stack about "large" received PDUs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 51983604daa4c263b8e2824f13aedc2c8d75f8cd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=51983604daa4c263b8e2824f13aedc2c8d75f8cd commit 51983604daa4c263b8e2824f13aedc2c8d75f8cd Author: John Baldwin AuthorDate: 2021-08-18 17:56:28 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:30:51 +0000 iscsi: Teach the iSCSI stack about "large" received PDUs. When using iSCSI PDU offload (cxgbei) on T6 adapters, a burst of received PDUs can be reported via a single message to the driver. Previously the driver passed these multi-PDU bursts up to the iSCSI stack up as a single "large" PDU by rewriting the buffer offset, data segment length, and DataSN fields in the iSCSI header. The DataSN field in particular was rewritten so that each of the "large" PDUs used consecutively increasing values. While this worked, the forged DataSN values did not match the ExpDataSN value in the subsequent SCSI Response PDU. The initiator does not currently verify this value, but the forged DataSN values prevent adding a check. To avoid this, allow a logical iSCSI PDU (struct icl_pdu) to describe a burst of PDUs via a new 'ip_additional_pdus' field. Normally this field is set to zero when 'struct icl_pdu' represents a single PDU. If logical PDU represents a burst of on-the-wire PDUs, then 'ip_npdus' contains the count of additional on-the-wire PDUs. The header of this "large" PDU is still modified, but the DataSN field now contains the DataSN value of the first on-the-wire PDU in the burst. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31577 (cherry picked from commit c261b6ea4e2ef1fc6a446443ee594ad76f392350) --- sys/cam/ctl/ctl_frontend_iscsi.c | 2 +- sys/dev/cxgbe/cxgbei/cxgbei.c | 18 +++++++++++------- sys/dev/cxgbe/cxgbei/cxgbei.h | 1 - sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 1 - sys/dev/iscsi/icl.h | 8 ++++++++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index b8fafcea69ed..0cbe3bcefc73 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -917,7 +917,7 @@ cfiscsi_pdu_handle_data_out(struct icl_pdu *request) cfiscsi_session_terminate(cs); return; } - cdw->cdw_datasn++; + cdw->cdw_datasn += request->ip_additional_pdus + 1; io = cdw->cdw_ctl_io; KASSERT((io->io_hdr.flags & CTL_FLAG_DATA_MASK) != CTL_FLAG_DATA_IN, diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 8dc580d65770..6af7043460fb 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -583,10 +583,12 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) cmp->next_buffer_offset; if (prev_seg_len != 0) { + uint32_t orig_datasn; + /* - * Since cfiscsi doesn't know about previous - * headers, pretend that the entire r2t data - * length was received in this single segment. + * Return a "large" PDU representing the burst + * of PDUs. Adjust the offset and length of + * this PDU to represent the entire burst. */ ip->ip_data_len += prev_seg_len; bhsdo->bhsdo_data_segment_len[2] = ip->ip_data_len; @@ -595,17 +597,19 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) bhsdo->bhsdo_buffer_offset = htobe32(cmp->next_buffer_offset); - npdus = htobe32(bhsdo->bhsdo_datasn) - cmp->last_datasn; + orig_datasn = htobe32(bhsdo->bhsdo_datasn); + npdus = orig_datasn - cmp->last_datasn; + bhsdo->bhsdo_datasn = htobe32(cmp->last_datasn + 1); + cmp->last_datasn = orig_datasn; + ip->ip_additional_pdus = npdus - 1; } else { MPASS(htobe32(bhsdo->bhsdo_datasn) == cmp->last_datasn + 1); npdus = 1; + cmp->last_datasn = htobe32(bhsdo->bhsdo_datasn); } cmp->next_buffer_offset += ip->ip_data_len; - cmp->last_datasn = htobe32(bhsdo->bhsdo_datasn); - bhsdo->bhsdo_datasn = htobe32(cmp->next_datasn); - cmp->next_datasn++; toep->ofld_rxq->rx_iscsi_ddp_pdus += npdus; toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len; } else { diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 20754fa893a8..09d556988091 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -58,7 +58,6 @@ struct cxgbei_cmp { uint32_t tt; /* Transfer tag. */ - uint32_t next_datasn; uint32_t next_buffer_offset; uint32_t last_datasn; }; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index a6e7f8b95815..687fc545cebd 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1346,7 +1346,6 @@ no_ddp: prsv->prsv_tag &= ~pr->pr_alias_mask; prsv->prsv_tag |= alias << pr->pr_alias_shift & pr->pr_alias_mask; - ddp->cmp.next_datasn = 0; ddp->cmp.last_datasn = -1; cxgbei_insert_cmp(icc, &ddp->cmp, prsv->prsv_tag); *tttp = htobe32(prsv->prsv_tag); diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index bd12569a8957..07dcbbf2a0b5 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -75,6 +75,14 @@ struct icl_pdu { size_t ip_data_len; struct mbuf *ip_data_mbuf; + /* + * When a "large" received PDU represents multiple on-the-wire + * PDUs, this is the count of additional on-the-wire PDUs. + * For PDUs that match on-the-wire PDUs, this should be set to + * zero. + */ + u_int ip_additional_pdus; + /* * User (initiator or provider) private fields. */ From nobody Fri Oct 29 23:58:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 27AA8181DCF3; Fri, 29 Oct 2021 23:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsc3gBhz4Vc8; Fri, 29 Oct 2021 23:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 60D611FF7E; Fri, 29 Oct 2021 23:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwdj1004056; Fri, 29 Oct 2021 23:58:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwd9g004055; Fri, 29 Oct 2021 23:58:39 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:39 GMT Message-Id: <202110292358.19TNwd9g004055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a75428c375f0 - stable/13 - cxgbei: Add sysctls to report the maximum data segment lengths. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a75428c375f0350a8a28ccfd30493cdb86c3b161 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a75428c375f0350a8a28ccfd30493cdb86c3b161 commit a75428c375f0350a8a28ccfd30493cdb86c3b161 Author: John Baldwin AuthorDate: 2021-08-30 22:55:40 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:33:14 +0000 cxgbei: Add sysctls to report the maximum data segment lengths. These sysctls report the maximum data segment lengths supported by an adapter. These are the values advertised to the remote end during the login phase. Sponsored by: Chelsio Communications (cherry picked from commit d39e65b5bdc04cac4521ad8e071015cd751c2302) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index e6ed2671711a..2fa38f941b91 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -198,6 +198,13 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "ddp_threshold", CTLFLAG_RW, &ci->ddp_threshold, 0, "Rx zero copy threshold"); + SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "max_rx_data_len", + CTLFLAG_RD, &ci->max_rx_data_len, 0, + "Maximum receive data segment length"); + SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "max_tx_data_len", + CTLFLAG_RD, &ci->max_tx_data_len, 0, + "Maximum transmit data segment length"); + return (0); } From nobody Fri Oct 29 23:58:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 146AC181DCF2; Fri, 29 Oct 2021 23:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsc2kmTz4Vc5; Fri, 29 Oct 2021 23:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3EA71203B0; Fri, 29 Oct 2021 23:58:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwc20004026; Fri, 29 Oct 2021 23:58:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwcTV004025; Fri, 29 Oct 2021 23:58:38 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:38 GMT Message-Id: <202110292358.19TNwcTV004025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d724218a7492 - stable/13 - cxgbei: Limit T5 transmit data segments to 15k. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d724218a7492126c14fc853424e756b6bc836030 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d724218a7492126c14fc853424e756b6bc836030 commit d724218a7492126c14fc853424e756b6bc836030 Author: John Baldwin AuthorDate: 2021-08-30 22:27:08 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:32:24 +0000 cxgbei: Limit T5 transmit data segments to 15k. This avoids exceeding a limit in the firmware when using ISO with jumbo frames. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit 64f09f2346650f02b6deccbe05bb02b88fce4a5e) --- sys/dev/cxgbe/cxgbei/cxgbei.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 6af7043460fb..e6ed2671711a 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -132,6 +132,8 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len, rx_len = min(rx_len, 4 * (1U << pr->pr_page_shift[0])); if (chip_id(sc) == CHELSIO_T5) { + tx_len = min(tx_len, 15360); + rx_len = rounddown2(rx_len, 512); tx_len = rounddown2(tx_len, 512); } From nobody Fri Oct 29 23:58:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4C696181DC69; Fri, 29 Oct 2021 23:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsf0tcgz4VTd; Fri, 29 Oct 2021 23:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 74302203B1; Fri, 29 Oct 2021 23:58:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwedx004080; Fri, 29 Oct 2021 23:58:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNweqm004079; Fri, 29 Oct 2021 23:58:40 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:40 GMT Message-Id: <202110292358.19TNweqm004079@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 075c8d9db328 - stable/13 - cxgbei: Handle errors in PDUs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 075c8d9db3281fa6de48eae2e097d00b4c7349d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=075c8d9db3281fa6de48eae2e097d00b4c7349d7 commit 075c8d9db3281fa6de48eae2e097d00b4c7349d7 Author: John Baldwin AuthorDate: 2021-09-10 22:10:00 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:34:01 +0000 cxgbei: Handle errors in PDUs. When a PDU with an error (bad padding, header digest, or data digest) is received, log the error via ICL_WARN() and then reset the connection via the ic_error callback. While here, add per-rxq counters for errors. Sponsored by: Chelsio Communications (cherry picked from commit 4d4cf62e29b06a763dfa8b218de38c8d2cf051bb) --- sys/dev/cxgbe/adapter.h | 3 ++ sys/dev/cxgbe/cxgbei/cxgbei.c | 67 ++++++++++++++++++++++++++++++++++--------- sys/dev/cxgbe/cxgbei/cxgbei.h | 3 -- sys/dev/cxgbe/t4_sge.c | 9 ++++++ 4 files changed, 65 insertions(+), 17 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index c5a10c563e87..5c87a1ac5e31 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -674,6 +674,9 @@ struct sge_ofld_rxq { uint64_t rx_iscsi_ddp_octets; uint64_t rx_iscsi_fl_pdus; uint64_t rx_iscsi_fl_octets; + uint64_t rx_iscsi_padding_errors; + uint64_t rx_iscsi_header_digest_errors; + uint64_t rx_iscsi_data_digest_errors; u_long rx_toe_tls_records; u_long rx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 2fa38f941b91..bd34e6a2a149 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -335,12 +335,21 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) icp->icp_flags |= ICPF_RX_STATUS; ip = &icp->ip; - if (val & F_DDP_PADDING_ERR) - icp->icp_flags |= ICPF_PAD_ERR; - if (val & F_DDP_HDRCRC_ERR) - icp->icp_flags |= ICPF_HCRC_ERR; - if (val & F_DDP_DATACRC_ERR) - icp->icp_flags |= ICPF_DCRC_ERR; + if (val & F_DDP_PADDING_ERR) { + ICL_WARN("received PDU 0x%02x with invalid padding", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_padding_errors++; + } + if (val & F_DDP_HDRCRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid header digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_header_digest_errors++; + } + if (val & F_DDP_DATACRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid data digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_data_digest_errors++; + } if (val & F_DDP_PDU && ip->ip_data_mbuf == NULL) { MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); MPASS(ip->ip_data_len > 0); @@ -400,6 +409,16 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) } MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); ic = &icc->ic; + if ((val & (F_DDP_PADDING_ERR | F_DDP_HDRCRC_ERR | + F_DDP_DATACRC_ERR)) != 0) { + SOCKBUF_UNLOCK(sb); + INP_WUNLOCK(inp); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + ic->ic_error(ic); + return (0); + } icl_cxgbei_new_pdu_set_conn(ip, ic); MPASS(m == NULL); /* was unused, we'll use it now. */ @@ -514,12 +533,21 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) icp->icp_flags |= ICPF_RX_HDR; icp->icp_flags |= ICPF_RX_STATUS; - if (val & F_DDP_PADDING_ERR) - icp->icp_flags |= ICPF_PAD_ERR; - if (val & F_DDP_HDRCRC_ERR) - icp->icp_flags |= ICPF_HCRC_ERR; - if (val & F_DDP_DATACRC_ERR) - icp->icp_flags |= ICPF_DCRC_ERR; + if (val & F_DDP_PADDING_ERR) { + ICL_WARN("received PDU 0x%02x with invalid padding", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_padding_errors++; + } + if (val & F_DDP_HDRCRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid header digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_header_digest_errors++; + } + if (val & F_DDP_DATACRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid data digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_data_digest_errors++; + } INP_WLOCK(inp); if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { @@ -557,6 +585,19 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) return (0); } + MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); + ic = &icc->ic; + if ((val & (F_DDP_PADDING_ERR | F_DDP_HDRCRC_ERR | + F_DDP_DATACRC_ERR)) != 0) { + INP_WUNLOCK(inp); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + ic->ic_error(ic); + return (0); + } + data_digest_len = (icc->ulp_submode & ULP_CRC_DATA) ? ISCSI_DATA_DIGEST_SIZE : 0; hdr_digest_len = (icc->ulp_submode & ULP_CRC_HEADER) ? @@ -658,8 +699,6 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) m_freem(m); return (0); } - MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); - ic = &icc->ic; icl_cxgbei_new_pdu_set_conn(ip, ic); /* Enqueue the PDU to the received pdus queue. */ diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 09d556988091..58a5dac6d63b 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -96,9 +96,6 @@ enum { ICPF_RX_FLBUF = 1 << 1, /* PDU payload received in a freelist. */ ICPF_RX_DDP = 1 << 2, /* PDU payload DDP'd. */ ICPF_RX_STATUS = 1 << 3, /* Rx status received. */ - ICPF_HCRC_ERR = 1 << 4, /* Header digest error. */ - ICPF_DCRC_ERR = 1 << 5, /* Data digest error. */ - ICPF_PAD_ERR = 1 << 6, /* Padding error. */ CXGBEI_PDU_SIGNATURE = 0x12344321 }; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 6b40a23516d7..bddacb448ff5 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4162,6 +4162,15 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_pdus", CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_pdus, 0, "# of PDUs with data delivered in freelist"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "padding_errors", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_padding_errors, 0, + "# of PDUs with invalid padding"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "header_digest_errors", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_header_digest_errors, 0, + "# of PDUs with invalid header digests"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "data_digest_errors", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_data_digest_errors, 0, + "# of PDUs with invalid data digests"); } #endif From nobody Fri Oct 29 23:58:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C73F5181DC6F; Fri, 29 Oct 2021 23:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsh0BT0z4VcX; Fri, 29 Oct 2021 23:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9D9C91FFDA; Fri, 29 Oct 2021 23:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwfV1004104; Fri, 29 Oct 2021 23:58:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwfNY004103; Fri, 29 Oct 2021 23:58:41 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:41 GMT Message-Id: <202110292358.19TNwfNY004103@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 56bc3b1a95bb - stable/13 - cxgbei: Disable ISO for -SO cards without external memory. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 56bc3b1a95bb54ea1653c483d77871f5334637b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=56bc3b1a95bb54ea1653c483d77871f5334637b0 commit 56bc3b1a95bb54ea1653c483d77871f5334637b0 Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:35:15 +0000 cxgbei: Disable ISO for -SO cards without external memory. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit 9b1bb0aee697352b39b3efa1843f581ca29068ba) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 687fc545cebd..4b1eb0718e86 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$"); #include #include "common/common.h" +#include "common/t4_regs.h" #include "common/t4_tcb.h" #include "tom/t4_tom.h" #include "cxgbei.h" @@ -707,6 +708,19 @@ find_offload_adapter(struct adapter *sc, void *arg) INP_WUNLOCK(inp); } +static bool +is_memfree(struct adapter *sc) +{ + uint32_t em; + + em = t4_read_reg(sc, A_MA_TARGET_MEM_ENABLE); + if ((em & F_EXT_MEM_ENABLE) != 0) + return (false); + if (is_t5(sc) && (em & F_EXT_MEM1_ENABLE) != 0) + return (false); + return (true); +} + /* XXXNP: move this to t4_tom. */ static void send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen) @@ -863,7 +877,8 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) if (ic->ic_data_crc32c) icc->ulp_submode |= ULP_CRC_DATA; - if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) { + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && + !is_memfree(icc->sc)) { max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / max_tx_pdu_len; ic->ic_hw_isomax = max_iso_pdus * From nobody Fri Oct 29 23:58:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8FD84181E037; Fri, 29 Oct 2021 23:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsj0X0Hz4VYx; Fri, 29 Oct 2021 23:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D31911FFDB; Fri, 29 Oct 2021 23:58:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwgtn004128; Fri, 29 Oct 2021 23:58:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwgmB004127; Fri, 29 Oct 2021 23:58:42 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:42 GMT Message-Id: <202110292358.19TNwgmB004127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: ed2a5ae6aa49 - stable/13 - cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed2a5ae6aa49bef2e2265731502a2f91c66e46a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ed2a5ae6aa49bef2e2265731502a2f91c66e46a9 commit ed2a5ae6aa49bef2e2265731502a2f91c66e46a9 Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:36:10 +0000 cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff. This permits unindenting almost half of the function. Sponsored by: Chelsio Communications (cherry picked from commit b7caa8157602f4eb9acd2729b48ba3a0c0cdc045) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 80 ++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4b1eb0718e86..6bec1f812cc0 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -857,52 +857,46 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) inp = sotoinpcb(so); INP_WLOCK(inp); tp = intotcpcb(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) - error = EBUSY; - else { - /* - * socket could not have been "unoffloaded" if here. - */ - MPASS(tp->t_flags & TF_TOE); - MPASS(tp->tod != NULL); - MPASS(tp->t_toe != NULL); - toep = tp->t_toe; - MPASS(toep->vi->adapter == icc->sc); - icc->toep = toep; - icc->cwt = cxgbei_select_worker_thread(icc); - - icc->ulp_submode = 0; - if (ic->ic_header_crc32c) - icc->ulp_submode |= ULP_CRC_HEADER; - if (ic->ic_data_crc32c) - icc->ulp_submode |= ULP_CRC_DATA; - - if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && - !is_memfree(icc->sc)) { - max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / - max_tx_pdu_len; - ic->ic_hw_isomax = max_iso_pdus * - ic->ic_max_send_data_segment_length; - } else - max_iso_pdus = 1; - - so->so_options |= SO_NO_DDP; - toep->params.ulp_mode = ULP_MODE_ISCSI; - toep->ulpcb = icc; - - send_iscsi_flowc_wr(icc->sc, toep, - roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); - set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); - error = 0; + if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + INP_WUNLOCK(inp); + return (EBUSY); } - INP_WUNLOCK(inp); - if (error == 0) { - error = icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, - max_rx_pdu_len); - } + /* + * socket could not have been "unoffloaded" if here. + */ + MPASS(tp->t_flags & TF_TOE); + MPASS(tp->tod != NULL); + MPASS(tp->t_toe != NULL); + toep = tp->t_toe; + MPASS(toep->vi->adapter == icc->sc); + icc->toep = toep; + icc->cwt = cxgbei_select_worker_thread(icc); + + icc->ulp_submode = 0; + if (ic->ic_header_crc32c) + icc->ulp_submode |= ULP_CRC_HEADER; + if (ic->ic_data_crc32c) + icc->ulp_submode |= ULP_CRC_DATA; + + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && + !is_memfree(icc->sc)) { + max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / max_tx_pdu_len; + ic->ic_hw_isomax = max_iso_pdus * + ic->ic_max_send_data_segment_length; + } else + max_iso_pdus = 1; + + so->so_options |= SO_NO_DDP; + toep->params.ulp_mode = ULP_MODE_ISCSI; + toep->ulpcb = icc; + + send_iscsi_flowc_wr(icc->sc, toep, + roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); + set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); + INP_WUNLOCK(inp); - return (error); + return (icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, max_rx_pdu_len)); } void From nobody Fri Oct 29 23:58:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D5E64181E203; Fri, 29 Oct 2021 23:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsk3g8Tz4VTt; Fri, 29 Oct 2021 23:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 052101FFDD; Fri, 29 Oct 2021 23:58:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwi9N004182; Fri, 29 Oct 2021 23:58:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwiQI004181; Fri, 29 Oct 2021 23:58:44 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:44 GMT Message-Id: <202110292358.19TNwiQI004181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 90f0f8dab2d5 - stable/13 - iscsid: Disable TCP DDP for connection sockets. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 90f0f8dab2d534f17a8f71635e09a8d14fed8ccf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=90f0f8dab2d534f17a8f71635e09a8d14fed8ccf commit 90f0f8dab2d534f17a8f71635e09a8d14fed8ccf Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:38:06 +0000 iscsid: Disable TCP DDP for connection sockets. cxgbei is not able to offload PDU processing for a socket using TCP DDP offload. Sponsored by: Chelsio Communications (cherry picked from commit 91c62d626d0e9995da9dc424120a4f1b0b987eea) --- usr.sbin/iscsid/iscsid.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 797a7561f79c..db8b5d4f5e4c 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -164,7 +164,7 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) #ifdef ICL_KERNEL_PROXY struct iscsi_daemon_connect idc; #endif - int error, sockbuf; + int error, optval; conn = calloc(1, sizeof(*conn)); if (conn == NULL) @@ -275,14 +275,18 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) fail(conn, strerror(errno)); log_err(1, "failed to create socket for %s", from_addr); } - sockbuf = SOCKBUF_SIZE; + optval = SOCKBUF_SIZE; if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_RCVBUF, - &sockbuf, sizeof(sockbuf)) == -1) + &optval, sizeof(optval)) == -1) log_warn("setsockopt(SO_RCVBUF) failed"); - sockbuf = SOCKBUF_SIZE; + optval = SOCKBUF_SIZE; if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_SNDBUF, - &sockbuf, sizeof(sockbuf)) == -1) + &optval, sizeof(optval)) == -1) log_warn("setsockopt(SO_SNDBUF) failed"); + optval = 1; + if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_NO_DDP, + &optval, sizeof(optval)) == -1) + log_warn("setsockopt(SO_NO_DDP) failed"); if (conn->conn_conf.isc_dscp != -1) { int tos = conn->conn_conf.isc_dscp << 2; if (to_ai->ai_family == AF_INET) { From nobody Fri Oct 29 23:58:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 580CD181E0D2; Fri, 29 Oct 2021 23:58:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsk05gXz4Vcg; Fri, 29 Oct 2021 23:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E21D01FFDC; Fri, 29 Oct 2021 23:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwhwB004152; Fri, 29 Oct 2021 23:58:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwhJR004151; Fri, 29 Oct 2021 23:58:43 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:43 GMT Message-Id: <202110292358.19TNwhJR004151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5767c8ca4c58 - stable/13 - cxgbei: Only convert "plain" TCP connections to ISCSI. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5767c8ca4c581626d597f649b177cb01587674dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5767c8ca4c581626d597f649b177cb01587674dd commit 5767c8ca4c581626d597f649b177cb01587674dd Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:37:11 +0000 cxgbei: Only convert "plain" TCP connections to ISCSI. Reject attempts to convert a connection using a different ULP mode: (e.g. DDP or TLS) to ISCSI. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit f63ddf465fe09d3547deaf80fbdb91bc7b816dfb) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 6bec1f812cc0..cf1032f2a3a2 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -870,6 +870,12 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) MPASS(tp->t_toe != NULL); toep = tp->t_toe; MPASS(toep->vi->adapter == icc->sc); + + if (ulp_mode(toep) != ULP_MODE_NONE) { + INP_WUNLOCK(inp); + return (EINVAL); + } + icc->toep = toep; icc->cwt = cxgbei_select_worker_thread(icc); @@ -887,7 +893,6 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) } else max_iso_pdus = 1; - so->so_options |= SO_NO_DDP; toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; From nobody Fri Oct 29 23:58:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9AF46181E68D; Fri, 29 Oct 2021 23:58:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsq3JjRz4Vt8; Fri, 29 Oct 2021 23:58:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7D27B1FFDE; Fri, 29 Oct 2021 23:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwmgh004254; Fri, 29 Oct 2021 23:58:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwmwZ004253; Fri, 29 Oct 2021 23:58:48 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:48 GMT Message-Id: <202110292358.19TNwmwZ004253@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: b2f1beeeff10 - stable/13 - iscsi: Abort data-out tasks queued on a terminating session. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b2f1beeeff10e24b4da21f6d97a88f70163c7bf0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b2f1beeeff10e24b4da21f6d97a88f70163c7bf0 commit b2f1beeeff10e24b4da21f6d97a88f70163c7bf0 Author: John Baldwin AuthorDate: 2021-09-15 20:25:30 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:43:48 +0000 iscsi: Abort data-out tasks queued on a terminating session. cfiscsi_datamove_out() can race with cfiscsi_session_terminate_tasks() and enqueue a new task after the latter function has aborted existing tasks. This could result in a deadlock as cfiscsi_session_terminate_tasks() waited forever for this task to complete. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31892 (cherry picked from commit 0cd6e85e242bb07a33df9a6314e90bcb0ba99576) --- sys/cam/ctl/ctl_frontend_iscsi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index ac94a786a701..b8ab25e89eb9 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2783,6 +2783,11 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len; CFISCSI_SESSION_LOCK(cs); + if (cs->cs_terminating) { + CFISCSI_SESSION_UNLOCK(cs); + cfiscsi_data_wait_abort(cs, cdw, 44); + return; + } TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); From nobody Fri Oct 29 23:58:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8B48D181E785; Fri, 29 Oct 2021 23:58:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsq2q3sz4Vlq; Fri, 29 Oct 2021 23:58:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9714520246; Fri, 29 Oct 2021 23:58:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwlfZ004230; Fri, 29 Oct 2021 23:58:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwlx4004229; Fri, 29 Oct 2021 23:58:47 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:47 GMT Message-Id: <202110292358.19TNwlx4004229@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: c1d6b0cdca19 - stable/13 - iscsi: Add a helper routine to abort a data-out task. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c1d6b0cdca19a3045b24c0437b447092c3b45118 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c1d6b0cdca19a3045b24c0437b447092c3b45118 commit c1d6b0cdca19a3045b24c0437b447092c3b45118 Author: John Baldwin AuthorDate: 2021-09-15 20:25:04 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:38:42 +0000 iscsi: Add a helper routine to abort a data-out task. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31891 (cherry picked from commit 529364b032d774bff4dc818ff23d20be482f9d99) --- sys/cam/ctl/ctl_frontend_iscsi.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 0cbe3bcefc73..ac94a786a701 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1108,11 +1108,30 @@ cfiscsi_data_wait_free(struct cfiscsi_session *cs, uma_zfree(cfiscsi_data_wait_zone, cdw); } +static void +cfiscsi_data_wait_abort(struct cfiscsi_session *cs, + struct cfiscsi_data_wait *cdw, int status) +{ + union ctl_io *cdw_io; + + /* + * Set nonzero port status; this prevents backends from + * assuming that the data transfer actually succeeded + * and writing uninitialized data to disk. + */ + MPASS(status != 0); + cdw_io = cdw->cdw_ctl_io; + cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; + cdw_io->scsiio.io_hdr.port_status = status; + cfiscsi_data_wait_free(cs, cdw); + ctl_datamove_done(cdw_io, false); +} + static void cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) { struct cfiscsi_data_wait *cdw; - union ctl_io *io, *cdw_io; + union ctl_io *io; int error, last, wait; if (cs->cs_target == NULL) @@ -1139,16 +1158,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) while ((cdw = TAILQ_FIRST(&cs->cs_waiting_for_data_out)) != NULL) { TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); - /* - * Set nonzero port status; this prevents backends from - * assuming that the data transfer actually succeeded - * and writing uninitialized data to disk. - */ - cdw_io = cdw->cdw_ctl_io; - cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw_io->scsiio.io_hdr.port_status = 42; - cfiscsi_data_wait_free(cs, cdw); - ctl_datamove_done(cdw_io, false); + cfiscsi_data_wait_abort(cs, cdw, 42); CFISCSI_SESSION_LOCK(cs); } CFISCSI_SESSION_UNLOCK(cs); @@ -2931,7 +2941,6 @@ cfiscsi_task_management_done(union ctl_io *io) struct cfiscsi_data_wait *cdw, *tmpcdw; struct cfiscsi_session *cs, *tcs; struct cfiscsi_softc *softc; - union ctl_io *cdw_io; int cold_reset = 0; request = PRIV_REQUEST(io); @@ -2965,11 +2974,7 @@ cfiscsi_task_management_done(union ctl_io *io) #endif TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); - cdw_io = cdw->cdw_ctl_io; - cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw_io->scsiio.io_hdr.port_status = 43; - cfiscsi_data_wait_free(cs, cdw); - ctl_datamove_done(cdw_io, false); + cfiscsi_data_wait_abort(cs, cdw, 43); } CFISCSI_SESSION_UNLOCK(cs); } From nobody Fri Oct 29 23:58:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE49A18270F6; Sat, 30 Oct 2021 00:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzzy5NZ4z4bsg; Sat, 30 Oct 2021 00:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4551A20245; Fri, 29 Oct 2021 23:58:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwke1004206; Fri, 29 Oct 2021 23:58:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwk56004205; Fri, 29 Oct 2021 23:58:46 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:46 GMT Message-Id: <202110292358.19TNwk56004205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 34d6b4c3523c - stable/13 - ctld: Disable TCP DDP for connection sockets. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 34d6b4c3523ce5b81d1c4613cef1c307eebc14f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=34d6b4c3523ce5b81d1c4613cef1c307eebc14f5 commit 34d6b4c3523ce5b81d1c4613cef1c307eebc14f5 Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:38:21 +0000 ctld: Disable TCP DDP for connection sockets. cxgbei is not able to offload PDU processing for a socket using TCP DDP offload. Sponsored by: Chelsio Communications (cherry picked from commit 3b5f95d7bd20e366d720a47a79c451ae037a3ae1) --- usr.sbin/ctld/ctld.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 7af1d88da44a..c37181ff00d0 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -2178,6 +2178,10 @@ conf_apply(struct conf *oldconf, struct conf *newconf) &sockbuf, sizeof(sockbuf)) == -1) log_warn("setsockopt(SO_SNDBUF) failed " "for %s", newp->p_listen); + if (setsockopt(newp->p_socket, SOL_SOCKET, SO_NO_DDP, + &one, sizeof(one)) == -1) + log_warn("setsockopt(SO_NO_DDP) failed " + "for %s", newp->p_listen); error = setsockopt(newp->p_socket, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); if (error != 0) { From nobody Sat Oct 30 00:25:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7969D18323D1; Sat, 30 Oct 2021 00:25:24 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hh0SM4mLTz3CVS; Sat, 30 Oct 2021 00:25:23 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pj1-x102d.google.com with SMTP id ls14-20020a17090b350e00b001a00e2251c8so8425356pjb.4; Fri, 29 Oct 2021 17:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=L9p63o0ivQwCQ2C4acrBRBMiTFQl4oYFhCvE0qTGaKw=; b=ZC+VUU1wRSSOHmB/L7sDlWzEd0v7/an5RZOj1/U1WAmRE/BrgQ0myvYeJoxC4gIa7N MCkQqP73qDtNsYR+otpot5iCguho1TNf2dmdBqoYWT87khBlifx1X/x8aJamSzWKaHc6 Z/xHI03NdaFq71dfpUGRBKdxqfHP/Obr8fIDuQ3uVaye70kjxzHXHhc4XKJ+D8Y/TCNx e43iIAC8iXKQjdbgYQvR9TYjpdJLSxNny2TF1WY7TtrR2enq/GWXTV301Xazrs3DmQUc uYTQSKTqIfg6em1Oc/cyKZ7wXfbM6R9JYMtKzkMRjoioQJSDFh/bUBka3+J41xIsRVFs Orlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=L9p63o0ivQwCQ2C4acrBRBMiTFQl4oYFhCvE0qTGaKw=; b=KJaFh1QySN9EoRbYh+yw5FxqutXpk5Y/fIIhRrTHfseBuV58MVK7hONAVp7ntfsJK7 NF41WWabcyFqczOERY9R4jnMjPGUQ/q3eGKWQbtluZ9FTgoZBQS8f7z9OoKabLxj+Fat F72+MHYnIvuJ7F61B2/Txe6VvYZqrtF/UhGo9BUPqpZnd7jruqxh0v+C76Wn8GyQCZaS Laly0Q846g0tU/ulH06f9zmULB86d3XIqsKqkYZ55qZNA2DHkfvMOD8H5JQ+eWDFpypE 1cfVHnDSW57NFtburq7059lDWnLdMzoJoNDwZWkLrZ/0dYI0mqwL46WMvhyGcc4uZ1Op EQkw== X-Gm-Message-State: AOAM530ssT/FQ/acyv0rA/BAToelSW18AckqUYdfgT0L/Sv0z6gkQ/SU kIMt1VAo/TTNoUTnkh+QujHfGBVhUPM= X-Google-Smtp-Source: ABdhPJzAUWy/j9iwkpnMy/sRVa1jvRj619E36uLypFg+bJiltBmK7+bAD/h9WBMgqGuHD/Y0d4CqrQ== X-Received: by 2002:a17:902:db02:b0:141:b1dd:111 with SMTP id m2-20020a170902db0200b00141b1dd0111mr5382261plx.44.1635553517053; Fri, 29 Oct 2021 17:25:17 -0700 (PDT) Received: from ?IPV6:2403:5807:1b:1:29fd:8863:3b42:c493? (2403-5807-1b-1-29fd-8863-3b42-c493.ip6.aussiebb.net. [2403:5807:1b:1:29fd:8863:3b42:c493]) by smtp.gmail.com with ESMTPSA id c1sm4926775pfv.54.2021.10.29.17.25.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Oct 2021 17:25:16 -0700 (PDT) Sender: Kubilay Kocak Message-ID: Date: Sat, 30 Oct 2021 11:25:12 +1100 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Thunderbird/95.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: 92b3e07229ba - main - Enable net.inet.tcp.nolocaltimewait. Content-Language: en-US To: Gleb Smirnoff , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110282235.19SMZoAL076017@gitrepo.freebsd.org> From: Kubilay Kocak In-Reply-To: <202110282235.19SMZoAL076017@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Hh0SM4mLTz3CVS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZC+VUU1w; dmarc=none; spf=pass (mx1.freebsd.org: domain of koobsfreebsd@gmail.com designates 2607:f8b0:4864:20::102d as permitted sender) smtp.mailfrom=koobsfreebsd@gmail.com X-Spamd-Result: default: False [-3.20 / 15.00]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::102d:from]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 29/10/2021 9:35 am, Gleb Smirnoff wrote: > The branch main has been updated by glebius: > > URL: https://cgit.FreeBSD.org/src/commit/?id=92b3e07229baab17cbe258ff1081e66bb7913b31 > > commit 92b3e07229baab17cbe258ff1081e66bb7913b31 > Author: Gleb Smirnoff > AuthorDate: 2021-10-28 22:34:00 +0000 > Commit: Gleb Smirnoff > CommitDate: 2021-10-28 22:34:00 +0000 > > Enable net.inet.tcp.nolocaltimewait. > > This feature has been used for many years at large sites and > didn't show any pitfalls. > --- > sys/netinet/tcp_timewait.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c > index 5d4de222b802..9d397d62424f 100644 > --- a/sys/netinet/tcp_timewait.c > +++ b/sys/netinet/tcp_timewait.c > @@ -176,10 +176,10 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, > &maxtcptw, 0, sysctl_maxtcptw, "IU", > "Maximum number of compressed TCP TIME_WAIT entries"); > > -VNET_DEFINE_STATIC(int, nolocaltimewait) = 0; > +VNET_DEFINE_STATIC(bool, nolocaltimewait) = true; > #define V_nolocaltimewait VNET(nolocaltimewait) > -SYSCTL_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET | CTLFLAG_RW, > - &VNET_NAME(nolocaltimewait), 0, > +SYSCTL_BOOL(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET | CTLFLAG_RW, > + &VNET_NAME(nolocaltimewait), true, > "Do not create compressed TCP TIME_WAIT entries for local connections"); > > void > RELNOTES: ? From nobody Sat Oct 30 03:38:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2E63E1836B6A; Sat, 30 Oct 2021 03:38: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hh4ky0qbdz4mBS; Sat, 30 Oct 2021 03:38:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F034A23078; Sat, 30 Oct 2021 03:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U3cHHK098091; Sat, 30 Oct 2021 03:38:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U3cHmi098090; Sat, 30 Oct 2021 03:38:17 GMT (envelope-from git) Date: Sat, 30 Oct 2021 03:38:17 GMT Message-Id: <202110300338.19U3cHmi098090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: dc6dd769de63 - main - nfscl: Use NFSMNTP_DELEGISSUED in two more functions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc6dd769de63c4eceb8899205a5d780d9f278fd2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=dc6dd769de63c4eceb8899205a5d780d9f278fd2 commit dc6dd769de63c4eceb8899205a5d780d9f278fd2 Author: Rick Macklem AuthorDate: 2021-10-30 03:35:02 +0000 Commit: Rick Macklem CommitDate: 2021-10-30 03:35:02 +0000 nfscl: Use NFSMNTP_DELEGISSUED in two more functions Commit 5e5ca4c8fc53 added a NFSMNTP_DELEGISSUED flag to indicate when a delegation has been issued to the mount. For the common case where an NFSv4 server is not issuing delegations, this flag can be checked to avoid acquisition of the NFSCLSTATEMUTEX. This patch adds checks for NFSMNTP_DELEGISSUED being set to two more functions. This change appears to be performance neutral for a small number of opens, but should reduce lock contention for a large number of opens for the common case where server is not issuing delegations. MFC after: 2 week --- sys/fs/nfsclient/nfs_clstate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 36f8bbd6b51f..549d2f8ff538 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4565,6 +4565,12 @@ nfscl_mustflush(vnode_t vp) nmp = VFSTONFS(vp->v_mount); if (!NFSHASNFSV4(nmp)) return (1); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (1); + } + NFSUNLOCKMNT(nmp); NFSLOCKCLSTATE(); clp = nfscl_findcl(nmp); if (clp == NULL) { @@ -4748,6 +4754,12 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, *gottdp = 0; if (NFSHASPNFS(nmp)) return (retcnt); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (retcnt); + } + NFSUNLOCKMNT(nmp); NFSLOCKCLSTATE(); /* * Loop around waiting for: From nobody Sat Oct 30 03:45:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 45959183991A; Sat, 30 Oct 2021 03:45: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hh4vH1R0fz4p3r; Sat, 30 Oct 2021 03:45:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 115912388F; Sat, 30 Oct 2021 03:45:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U3jViN011616; Sat, 30 Oct 2021 03:45:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U3jUW5011615; Sat, 30 Oct 2021 03:45:30 GMT (envelope-from git) Date: Sat, 30 Oct 2021 03:45:30 GMT Message-Id: <202110300345.19U3jUW5011615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 627b15e81406 - stable/13 - nfscl: Move release of the clientID lock into nfscl_doclose() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 627b15e8140675f136e9f4e72a2204cac0316eeb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=627b15e8140675f136e9f4e72a2204cac0316eeb commit 627b15e8140675f136e9f4e72a2204cac0316eeb Author: Rick Macklem AuthorDate: 2021-10-16 22:49:38 +0000 Commit: Rick Macklem CommitDate: 2021-10-30 03:42:08 +0000 nfscl: Move release of the clientID lock into nfscl_doclose() This patch moves release of the shared clientID lock from nfsrpc_close() just after the nfscl_doclose() call to the end of nfscl_doclose() call. This does make the code cleaner, since the shared lock is acquired at the beginning of nfscl_doclose(). The only semantics change is that the code no longer drops and reaquires the NFSCLSTATELOCK() mutex, which I do not believe will have a negative effect on the NFSv4 client. This is being done to prepare the code for a future patch that fixes the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation. (cherry picked from commit e2aab5e2d73486aa76bb861d583bbce021661601) --- sys/fs/nfsclient/nfs_clrpcops.c | 11 +++++------ sys/fs/nfsclient/nfs_clstate.c | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 795eafabb6de..fc7d8687be77 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -747,13 +747,12 @@ nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p) return (0); if (doclose) error = nfscl_doclose(vp, &clp, p); - else + else { error = nfscl_getclose(vp, &clp); - if (error) - return (error); - - nfscl_clientrelease(clp); - return (0); + if (error == 0) + nfscl_clientrelease(clp); + } + return (error); } /* diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 4c74963da747..984d8382ee45 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3383,6 +3383,7 @@ lookformore: goto lookformore; } } + nfscl_clrelease(clp); NFSUNLOCKCLSTATE(); /* * recallp has been set NULL by nfscl_retoncloselayout() if it was From nobody Sat Oct 30 07:09:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DA41E18186B7; Sat, 30 Oct 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hh9R05qqqz4flv; Sat, 30 Oct 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A951E262E0; Sat, 30 Oct 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U79mll078040; Sat, 30 Oct 2021 07:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U79mDS078039; Sat, 30 Oct 2021 07:09:48 GMT (envelope-from git) Date: Sat, 30 Oct 2021 07:09:48 GMT Message-Id: <202110300709.19U79mDS078039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 20f8331aca89 - main - usr.bin/stat: honour locale for "-t %+" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20f8331aca892ff812510609b3bc4e747b201197 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=20f8331aca892ff812510609b3bc4e747b201197 commit 20f8331aca892ff812510609b3bc4e747b201197 Author: Stefan Eßer AuthorDate: 2021-10-30 07:00:34 +0000 Commit: Stefan Eßer CommitDate: 2021-10-30 07:00:34 +0000 usr.bin/stat: honour locale for "-t %+" The man page states that "-t %+" prints time information in the same format as date with no format specifier. This was not the case, the format used was always that of date for the POSIX locale. The fix suggested by the reporter leads to output that matches the documentation. Reported by: Jamie Landeg-Jones MFC after: 3 days --- usr.bin/stat/stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index e504333c3329..9d94399a6333 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -763,6 +764,7 @@ format1(const struct stat *st, ts.tv_sec = 0; tm = localtime(&ts.tv_sec); } + (void)setlocale(LC_TIME, ""); (void)strftime(path, sizeof(path), timefmt, tm); sdata = path; formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX | From nobody Sat Oct 30 07:49:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B04861828860; Sat, 30 Oct 2021 07:49: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhBJF4YNQz4rB6; Sat, 30 Oct 2021 07:49:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 78EB126BC7; Sat, 30 Oct 2021 07:49:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U7n1BE030512; Sat, 30 Oct 2021 07:49:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U7n1f4030511; Sat, 30 Oct 2021 07:49:01 GMT (envelope-from git) Date: Sat, 30 Oct 2021 07:49:01 GMT Message-Id: <202110300749.19U7n1f4030511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 6ad1c6a82635 - stable/13 - jail(8): Fix a few common typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ad1c6a8263591b6a4c48daa59d001e5cd0a13f9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=6ad1c6a8263591b6a4c48daa59d001e5cd0a13f9 commit 6ad1c6a8263591b6a4c48daa59d001e5cd0a13f9 Author: Gordon Bergling AuthorDate: 2021-10-27 04:16:06 +0000 Commit: Gordon Bergling CommitDate: 2021-10-30 07:48:43 +0000 jail(8): Fix a few common typos in source code comments - s/phyiscal/physical/ (cherry picked from commit 70de1003da6f6e78e32f92bd98c9f18f965e6663) --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index c13aa73538a5..e9019eda4d6c 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -3618,7 +3618,7 @@ prison_priv_check(struct ucred *cred, int priv) /* * As in the non-jail case, non-root users are expected to be - * able to read kernel/phyiscal memory (provided /dev/[k]mem + * able to read kernel/physical memory (provided /dev/[k]mem * exists in the jail and they have permission to access it). */ case PRIV_KMEM_READ: From nobody Sat Oct 30 07:49:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4C90C1828D5F; Sat, 30 Oct 2021 07:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhBJj1bGsz4rRv; Sat, 30 Oct 2021 07:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 142B826BC8; Sat, 30 Oct 2021 07:49:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U7nPSo030651; Sat, 30 Oct 2021 07:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U7nOAm030650; Sat, 30 Oct 2021 07:49:24 GMT (envelope-from git) Date: Sat, 30 Oct 2021 07:49:24 GMT Message-Id: <202110300749.19U7nOAm030650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 499506ac09b4 - stable/13 - bxe(4): Fix a few common typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 499506ac09b489cac1a19d8842b968bcdbc24e38 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=499506ac09b489cac1a19d8842b968bcdbc24e38 commit 499506ac09b489cac1a19d8842b968bcdbc24e38 Author: Gordon Bergling AuthorDate: 2021-10-27 04:15:06 +0000 Commit: Gordon Bergling CommitDate: 2021-10-30 07:49:09 +0000 bxe(4): Fix a few common typos in source code comments - s/controled/controlled/ - s/allignment/alignment/ (cherry picked from commit 80abcfbdfe1af72318c2c0b1690013f43e875267) --- sys/dev/bxe/bxe_elink.c | 4 ++-- sys/dev/bxe/ecore_hsi.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/bxe/bxe_elink.c b/sys/dev/bxe/bxe_elink.c index bdd8affdb437..dd77e9301ab0 100644 --- a/sys/dev/bxe/bxe_elink.c +++ b/sys/dev/bxe/bxe_elink.c @@ -4418,7 +4418,7 @@ static uint8_t elink_ext_phy_resolve_fc(struct elink_phy *phy, uint8_t ret = 0; vars->flow_ctrl = ELINK_FLOW_CTRL_NONE; if (phy->req_flow_ctrl != ELINK_FLOW_CTRL_AUTO) { - /* Update the advertised flow-controled of LD/LP in AN */ + /* Update the advertised flow-controlled of LD/LP in AN */ if (phy->req_line_speed == ELINK_SPEED_AUTO_NEG) elink_ext_phy_update_adv_fc(phy, params, vars); /* But set the flow-control result as the requested one */ @@ -6262,7 +6262,7 @@ static void elink_flow_ctrl_resolve(struct elink_phy *phy, /* Resolve from gp_status in case of AN complete and not sgmii */ if (phy->req_flow_ctrl != ELINK_FLOW_CTRL_AUTO) { - /* Update the advertised flow-controled of LD/LP in AN */ + /* Update the advertised flow-controlled of LD/LP in AN */ if (phy->req_line_speed == ELINK_SPEED_AUTO_NEG) elink_update_adv_fc(phy, params, vars, gp_status); /* But set the flow-control result as the requested one */ diff --git a/sys/dev/bxe/ecore_hsi.h b/sys/dev/bxe/ecore_hsi.h index 5048ff5dfc78..22f0767e6b0f 100644 --- a/sys/dev/bxe/ecore_hsi.h +++ b/sys/dev/bxe/ecore_hsi.h @@ -9448,7 +9448,7 @@ struct iscsi_cq_db struct iscsi_cq_db_prod_pnd_cmpltn_cnt_arr cq_u_prod_pend_comp_ctr_arr /* Ustorm CQ producer and pending completion counter array, updated by Ustorm */; struct iscsi_cq_db_pnd_comp_itt_arr cq_c_pend_comp_itt_arr /* Cstorm CQ pending completion ITT array, updated by Cstorm */; struct iscsi_cq_db_sqn_2_notify_arr cq_drv_sqn_2_notify_arr /* Cstorm CQ sequence to notify array, updated by driver */; - uint32_t reserved[4] /* 16 byte allignment */; + uint32_t reserved[4] /* 16 byte alignment */; }; From nobody Sat Oct 30 07:50:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06391182A3AC; Sat, 30 Oct 2021 07:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhBKq6pvCz4sH1; Sat, 30 Oct 2021 07:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB668264FA; Sat, 30 Oct 2021 07:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U7oND6039049; Sat, 30 Oct 2021 07:50:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U7oNbc039048; Sat, 30 Oct 2021 07:50:23 GMT (envelope-from git) Date: Sat, 30 Oct 2021 07:50:23 GMT Message-Id: <202110300750.19U7oNbc039048@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: d1b3747ba300 - stable/12 - bxe(4): Fix a few common typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d1b3747ba3005dcade82439fd3876555319736a1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d1b3747ba3005dcade82439fd3876555319736a1 commit d1b3747ba3005dcade82439fd3876555319736a1 Author: Gordon Bergling AuthorDate: 2021-10-27 04:15:06 +0000 Commit: Gordon Bergling CommitDate: 2021-10-30 07:49:53 +0000 bxe(4): Fix a few common typos in source code comments - s/controled/controlled/ - s/allignment/alignment/ (cherry picked from commit 80abcfbdfe1af72318c2c0b1690013f43e875267) --- sys/dev/bxe/bxe_elink.c | 4 ++-- sys/dev/bxe/ecore_hsi.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/bxe/bxe_elink.c b/sys/dev/bxe/bxe_elink.c index bdd8affdb437..dd77e9301ab0 100644 --- a/sys/dev/bxe/bxe_elink.c +++ b/sys/dev/bxe/bxe_elink.c @@ -4418,7 +4418,7 @@ static uint8_t elink_ext_phy_resolve_fc(struct elink_phy *phy, uint8_t ret = 0; vars->flow_ctrl = ELINK_FLOW_CTRL_NONE; if (phy->req_flow_ctrl != ELINK_FLOW_CTRL_AUTO) { - /* Update the advertised flow-controled of LD/LP in AN */ + /* Update the advertised flow-controlled of LD/LP in AN */ if (phy->req_line_speed == ELINK_SPEED_AUTO_NEG) elink_ext_phy_update_adv_fc(phy, params, vars); /* But set the flow-control result as the requested one */ @@ -6262,7 +6262,7 @@ static void elink_flow_ctrl_resolve(struct elink_phy *phy, /* Resolve from gp_status in case of AN complete and not sgmii */ if (phy->req_flow_ctrl != ELINK_FLOW_CTRL_AUTO) { - /* Update the advertised flow-controled of LD/LP in AN */ + /* Update the advertised flow-controlled of LD/LP in AN */ if (phy->req_line_speed == ELINK_SPEED_AUTO_NEG) elink_update_adv_fc(phy, params, vars, gp_status); /* But set the flow-control result as the requested one */ diff --git a/sys/dev/bxe/ecore_hsi.h b/sys/dev/bxe/ecore_hsi.h index 5048ff5dfc78..22f0767e6b0f 100644 --- a/sys/dev/bxe/ecore_hsi.h +++ b/sys/dev/bxe/ecore_hsi.h @@ -9448,7 +9448,7 @@ struct iscsi_cq_db struct iscsi_cq_db_prod_pnd_cmpltn_cnt_arr cq_u_prod_pend_comp_ctr_arr /* Ustorm CQ producer and pending completion counter array, updated by Ustorm */; struct iscsi_cq_db_pnd_comp_itt_arr cq_c_pend_comp_itt_arr /* Cstorm CQ pending completion ITT array, updated by Cstorm */; struct iscsi_cq_db_sqn_2_notify_arr cq_drv_sqn_2_notify_arr /* Cstorm CQ sequence to notify array, updated by driver */; - uint32_t reserved[4] /* 16 byte allignment */; + uint32_t reserved[4] /* 16 byte alignment */; }; From nobody Sat Oct 30 07:50:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 77622182A601; Sat, 30 Oct 2021 07:50: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhBKs1VFyz4sPb; Sat, 30 Oct 2021 07:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F2EAA26C94; Sat, 30 Oct 2021 07:50:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U7oOmS039073; Sat, 30 Oct 2021 07:50:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U7oOKG039072; Sat, 30 Oct 2021 07:50:24 GMT (envelope-from git) Date: Sat, 30 Oct 2021 07:50:24 GMT Message-Id: <202110300750.19U7oOKG039072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: c8e557c99938 - stable/12 - jail(8): Fix a few common typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c8e557c999384bbb0f4d45915e191d7aff185475 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c8e557c999384bbb0f4d45915e191d7aff185475 commit c8e557c999384bbb0f4d45915e191d7aff185475 Author: Gordon Bergling AuthorDate: 2021-10-27 04:16:06 +0000 Commit: Gordon Bergling CommitDate: 2021-10-30 07:50:09 +0000 jail(8): Fix a few common typos in source code comments - s/phyiscal/physical/ (cherry picked from commit 70de1003da6f6e78e32f92bd98c9f18f965e6663) --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 69762b683f4c..bd31a5826d55 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -3333,7 +3333,7 @@ prison_priv_check(struct ucred *cred, int priv) /* * As in the non-jail case, non-root users are expected to be - * able to read kernel/phyiscal memory (provided /dev/[k]mem + * able to read kernel/physical memory (provided /dev/[k]mem * exists in the jail and they have permission to access it). */ case PRIV_KMEM_READ: From nobody Sat Oct 30 09:12:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 10C7F182B926; Sat, 30 Oct 2021 09:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhD9800Qyz3mD0; Sat, 30 Oct 2021 09:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D489A27A6E; Sat, 30 Oct 2021 09:12:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U9CxWF050815; Sat, 30 Oct 2021 09:12:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U9Cx5H050814; Sat, 30 Oct 2021 09:12:59 GMT (envelope-from git) Date: Sat, 30 Oct 2021 09:12:59 GMT Message-Id: <202110300912.19U9Cx5H050814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 8bbc0600cc21 - main - linux: Add additional ptracestop only if the debugger is Linux List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8bbc0600cc21bbfdc3b8e67199eec4220952b7e3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=8bbc0600cc21bbfdc3b8e67199eec4220952b7e3 commit 8bbc0600cc21bbfdc3b8e67199eec4220952b7e3 Author: Edward Tomasz Napierala AuthorDate: 2021-10-30 08:53:55 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-30 08:54:17 +0000 linux: Add additional ptracestop only if the debugger is Linux In 6e66030c4c0, additional ptracestop was added in order to implement PTRACE_EVENT_EXEC. Make it only apply to cases where the debugger is a Linux processes; native FreeBSD debuggers can trace Linux processes too, but they don't expect that additonal ptracestop. Fixes: 6e66030c4c0 Reported By: kib Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32726 --- sys/kern/subr_syscall.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index fab67a68b0a3..dacd82f4c466 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -260,9 +260,15 @@ syscallret(struct thread *td) * the exec event now and then clear TDB_EXEC so that * the next stop is reported as a syscall exit by * linux_ptrace_status(). + * + * We are accessing p->p_pptr without any additional + * locks here: it cannot change while p is kept locked; + * while the debugger could in theory change its ABI + * while tracing another process, the outcome of such + * a race wouln't be deterministic anyway. */ - if ((td->td_dbgflags & TDB_EXEC) != 0 && - SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) { + if (traced && (td->td_dbgflags & TDB_EXEC) != 0 && + SV_PROC_ABI(p->p_pptr) == SV_ABI_LINUX) { ptracestop(td, SIGTRAP, NULL); td->td_dbgflags &= ~TDB_EXEC; } From nobody Sat Oct 30 10:14:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E4800181C402; Sat, 30 Oct 2021 10:14: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhFX45k6lz4X3q; Sat, 30 Oct 2021 10:14:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9FAEAB44; Sat, 30 Oct 2021 10:14:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19UAESA5030601; Sat, 30 Oct 2021 10:14:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19UAESZK030600; Sat, 30 Oct 2021 10:14:28 GMT (envelope-from git) Date: Sat, 30 Oct 2021 10:14:28 GMT Message-Id: <202110301014.19UAESZK030600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: f0d9a6a781f3 - main - linux: make PTRACE_SETREGS use a correct struct List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0d9a6a781f331440baf9a846e773e44a297d59c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d9a6a781f331440baf9a846e773e44a297d59c commit f0d9a6a781f331440baf9a846e773e44a297d59c Author: Edward Tomasz Napierala AuthorDate: 2021-10-30 09:13:32 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-10-30 09:13:37 +0000 linux: make PTRACE_SETREGS use a correct struct Note that this is largely untested at this point, as was the previous version; I'm committing this mostly to get rid of `struct linux_pt_reg`. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32735 --- sys/amd64/linux/linux.h | 3 ++ sys/amd64/linux/linux_machdep.c | 31 +++++++++++++++++++ sys/amd64/linux/linux_ptrace.c | 66 ++--------------------------------------- 3 files changed, 37 insertions(+), 63 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 519b6bd200ac..16fe3793eae7 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -461,5 +461,8 @@ struct reg; void bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset); +void linux_to_bsd_regset(struct reg *b_reg, + const struct linux_pt_regset *l_regset); + #endif /* !_AMD64_LINUX_H_ */ diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index c34d98e86d0b..e2346f68da3a 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -330,3 +330,34 @@ bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset) l_regset->fs = b_reg->r_fs; l_regset->gs = b_reg->r_gs; } + +void +linux_to_bsd_regset(struct reg *b_reg, const struct linux_pt_regset *l_regset) +{ + + b_reg->r_r15 = l_regset->r15; + b_reg->r_r14 = l_regset->r14; + b_reg->r_r13 = l_regset->r13; + b_reg->r_r12 = l_regset->r12; + b_reg->r_rbp = l_regset->rbp; + b_reg->r_rbx = l_regset->rbx; + b_reg->r_r11 = l_regset->r11; + b_reg->r_r10 = l_regset->r10; + b_reg->r_r9 = l_regset->r9; + b_reg->r_r8 = l_regset->r8; + b_reg->r_rax = l_regset->rax; + b_reg->r_rcx = l_regset->rcx; + b_reg->r_rdx = l_regset->rdx; + b_reg->r_rsi = l_regset->rsi; + b_reg->r_rdi = l_regset->rdi; + b_reg->r_rax = l_regset->orig_rax; + b_reg->r_rip = l_regset->rip; + b_reg->r_cs = l_regset->cs; + b_reg->r_rflags = l_regset->eflags; + b_reg->r_rsp = l_regset->rsp; + b_reg->r_ss = l_regset->ss; + b_reg->r_ds = l_regset->ds; + b_reg->r_es = l_regset->es; + b_reg->r_fs = l_regset->fs; + b_reg->r_gs = l_regset->gs; +} diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 0f06f2aa9c5c..191e6265b39c 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -168,30 +168,6 @@ linux_ptrace_status(struct thread *td, pid_t pid, int status) return (status); } -struct linux_pt_reg { - l_ulong r15; - l_ulong r14; - l_ulong r13; - l_ulong r12; - l_ulong rbp; - l_ulong rbx; - l_ulong r11; - l_ulong r10; - l_ulong r9; - l_ulong r8; - l_ulong rax; - l_ulong rcx; - l_ulong rdx; - l_ulong rsi; - l_ulong rdi; - l_ulong orig_rax; - l_ulong rip; - l_ulong cs; - l_ulong eflags; - l_ulong rsp; - l_ulong ss; -}; - struct syscall_info { uint8_t op; uint32_t arch; @@ -214,42 +190,6 @@ struct syscall_info { }; }; -static void -map_regs_from_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) -{ - b_reg->r_r15 = l_reg->r15; - b_reg->r_r14 = l_reg->r14; - b_reg->r_r13 = l_reg->r13; - b_reg->r_r12 = l_reg->r12; - b_reg->r_r11 = l_reg->r11; - b_reg->r_r10 = l_reg->r10; - b_reg->r_r9 = l_reg->r9; - b_reg->r_r8 = l_reg->r8; - b_reg->r_rdi = l_reg->rdi; - b_reg->r_rsi = l_reg->rsi; - b_reg->r_rbp = l_reg->rbp; - b_reg->r_rbx = l_reg->rbx; - b_reg->r_rdx = l_reg->rdx; - b_reg->r_rcx = l_reg->rcx; - b_reg->r_rax = l_reg->rax; - - /* - * XXX: Are zeroes the right thing to put here? - */ - b_reg->r_trapno = 0; - b_reg->r_fs = 0; - b_reg->r_gs = 0; - b_reg->r_err = 0; - b_reg->r_es = 0; - b_reg->r_ds = 0; - - b_reg->r_rip = l_reg->rip; - b_reg->r_cs = l_reg->cs; - b_reg->r_rflags = l_reg->eflags; - b_reg->r_rsp = l_reg->rsp; - b_reg->r_ss = l_reg->ss; -} - static int linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data) { @@ -446,13 +386,13 @@ static int linux_ptrace_setregs(struct thread *td, pid_t pid, void *data) { struct reg b_reg; - struct linux_pt_reg l_reg; + struct linux_pt_regset l_regset; int error; - error = copyin(data, &l_reg, sizeof(l_reg)); + error = copyin(data, &l_regset, sizeof(l_regset)); if (error != 0) return (error); - map_regs_from_linux(&b_reg, &l_reg); + linux_to_bsd_regset(&b_reg, &l_regset); error = kern_ptrace(td, PT_SETREGS, pid, &b_reg, 0); return (error); } From nobody Sat Oct 30 14:15:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B9BD91832789; Sat, 30 Oct 2021 14:15: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhLsn4sMzz4X3G; Sat, 30 Oct 2021 14:15:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 86CDE3FDA; Sat, 30 Oct 2021 14:15:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19UEF9t6050134; Sat, 30 Oct 2021 14:15:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19UEF9ZF050133; Sat, 30 Oct 2021 14:15:09 GMT (envelope-from git) Date: Sat, 30 Oct 2021 14:15:09 GMT Message-Id: <202110301415.19UEF9ZF050133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 382eec24c028 - stable/13 - bhyve: Map the MSI-X table unconditionally for passthrough List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 382eec24c0284bd7dc5997b85abc9ee70ea704a1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=382eec24c0284bd7dc5997b85abc9ee70ea704a1 commit 382eec24c0284bd7dc5997b85abc9ee70ea704a1 Author: Mark Johnston AuthorDate: 2021-10-09 15:36:19 +0000 Commit: Mark Johnston CommitDate: 2021-10-30 14:14:21 +0000 bhyve: Map the MSI-X table unconditionally for passthrough It is possible for the PBA to reside in the same page as the MSI-X table. And, while devices are not supposed to do this, at least some Intel wifi devices place registers in a page shared with the MSI-X table. To handle the first case we currently map the PBA page using /dev/mem, and the second case is not handled. Kill two birds with one stone: map the MSI-X table BAR using the PCIOCBARMMAP ioctl instead of /dev/mem, and map the entire table so that accesses beyond the bounds of the table can be emulated. Regions of the BAR not containing the table are left unmapped. Reviewed by: bz, grehan, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 7fa2335347362378322a4d27cb40f6e6cd5dd0fb) --- usr.sbin/bhyve/pci_emul.h | 4 +- usr.sbin/bhyve/pci_passthru.c | 186 +++++++++++++++++------------------------- 2 files changed, 76 insertions(+), 114 deletions(-) diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 031a6113fac4..5b6a17119960 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -157,8 +157,8 @@ struct pci_devinst { int pba_size; int function_mask; struct msix_table_entry *table; /* allocated at runtime */ - void *pba_page; - int pba_page_offset; + uint8_t *mapped_addr; + size_t mapped_size; } pi_msix; void *pi_arg; /* devemu-private data */ diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index 2c6a2ebd8dd9..bf99c646c480 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -43,7 +43,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include +#include #ifndef WITHOUT_CAPSICUM #include @@ -69,17 +72,12 @@ __FBSDID("$FreeBSD$"); #define _PATH_DEVPCI "/dev/pci" #endif -#ifndef _PATH_MEM -#define _PATH_MEM "/dev/mem" -#endif - #define LEGACY_SUPPORT 1 #define MSIX_TABLE_COUNT(ctrl) (((ctrl) & PCIM_MSIXCTRL_TABLE_SIZE) + 1) #define MSIX_CAPLEN 12 static int pcifd = -1; -static int memfd = -1; struct passthru_softc { struct pci_devinst *psc_pi; @@ -290,30 +288,30 @@ msix_table_read(struct passthru_softc *sc, uint64_t offset, int size) uint64_t *src64; uint64_t data; size_t entry_offset; - int index; + uint32_t table_offset; + int index, table_count; pi = sc->psc_pi; - if (pi->pi_msix.pba_page != NULL && offset >= pi->pi_msix.pba_offset && - offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { - switch(size) { + + table_offset = pi->pi_msix.table_offset; + table_count = pi->pi_msix.table_count; + if (offset < table_offset || + offset >= table_offset + table_count * MSIX_TABLE_ENTRY_SIZE) { + switch (size) { case 1: - src8 = (uint8_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + src8 = (uint8_t *)(pi->pi_msix.mapped_addr + offset); data = *src8; break; case 2: - src16 = (uint16_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + src16 = (uint16_t *)(pi->pi_msix.mapped_addr + offset); data = *src16; break; case 4: - src32 = (uint32_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + src32 = (uint32_t *)(pi->pi_msix.mapped_addr + offset); data = *src32; break; case 8: - src64 = (uint64_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + src64 = (uint64_t *)(pi->pi_msix.mapped_addr + offset); data = *src64; break; default: @@ -322,32 +320,28 @@ msix_table_read(struct passthru_softc *sc, uint64_t offset, int size) return (data); } - if (offset < pi->pi_msix.table_offset) - return (-1); - - offset -= pi->pi_msix.table_offset; + offset -= table_offset; index = offset / MSIX_TABLE_ENTRY_SIZE; - if (index >= pi->pi_msix.table_count) - return (-1); + assert(index < table_count); entry = &pi->pi_msix.table[index]; entry_offset = offset % MSIX_TABLE_ENTRY_SIZE; - switch(size) { + switch (size) { case 1: - src8 = (uint8_t *)((void *)entry + entry_offset); + src8 = (uint8_t *)((uint8_t *)entry + entry_offset); data = *src8; break; case 2: - src16 = (uint16_t *)((void *)entry + entry_offset); + src16 = (uint16_t *)((uint8_t *)entry + entry_offset); data = *src16; break; case 4: - src32 = (uint32_t *)((void *)entry + entry_offset); + src32 = (uint32_t *)((uint8_t *)entry + entry_offset); data = *src32; break; case 8: - src64 = (uint64_t *)((void *)entry + entry_offset); + src64 = (uint64_t *)((uint8_t *)entry + entry_offset); data = *src64; break; default: @@ -368,46 +362,39 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc, uint32_t *dest32; uint64_t *dest64; size_t entry_offset; - uint32_t vector_control; - int index; + uint32_t table_offset, vector_control; + int index, table_count; pi = sc->psc_pi; - if (pi->pi_msix.pba_page != NULL && offset >= pi->pi_msix.pba_offset && - offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { - switch(size) { + + table_offset = pi->pi_msix.table_offset; + table_count = pi->pi_msix.table_count; + if (offset < table_offset || + offset >= table_offset + table_count * MSIX_TABLE_ENTRY_SIZE) { + switch (size) { case 1: - dest8 = (uint8_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + dest8 = (uint8_t *)(pi->pi_msix.mapped_addr + offset); *dest8 = data; break; case 2: - dest16 = (uint16_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + dest16 = (uint16_t *)(pi->pi_msix.mapped_addr + offset); *dest16 = data; break; case 4: - dest32 = (uint32_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + dest32 = (uint32_t *)(pi->pi_msix.mapped_addr + offset); *dest32 = data; break; case 8: - dest64 = (uint64_t *)(pi->pi_msix.pba_page + offset - - pi->pi_msix.pba_page_offset); + dest64 = (uint64_t *)(pi->pi_msix.mapped_addr + offset); *dest64 = data; break; - default: - break; } return; } - if (offset < pi->pi_msix.table_offset) - return; - - offset -= pi->pi_msix.table_offset; + offset -= table_offset; index = offset / MSIX_TABLE_ENTRY_SIZE; - if (index >= pi->pi_msix.table_count) - return; + assert(index < table_count); entry = &pi->pi_msix.table[index]; entry_offset = offset % MSIX_TABLE_ENTRY_SIZE; @@ -435,13 +422,10 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc, static int init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) { + struct pci_devinst *pi = sc->psc_pi; + struct pci_bar_mmap pbm; int b, s, f; - int idx; - size_t remaining; uint32_t table_size, table_offset; - uint32_t pba_size, pba_offset; - vm_paddr_t start; - struct pci_devinst *pi = sc->psc_pi; assert(pci_msix_table_bar(pi) >= 0 && pci_msix_pba_bar(pi) >= 0); @@ -449,55 +433,48 @@ init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) s = sc->psc_sel.pc_dev; f = sc->psc_sel.pc_func; - /* - * If the MSI-X table BAR maps memory intended for - * other uses, it is at least assured that the table - * either resides in its own page within the region, - * or it resides in a page shared with only the PBA. + /* + * Map the region of the BAR containing the MSI-X table. This is + * necessary for two reasons: + * 1. The PBA may reside in the first or last page containing the MSI-X + * table. + * 2. While PCI devices are not supposed to use the page(s) containing + * the MSI-X table for other purposes, some do in practice. */ + memset(&pbm, 0, sizeof(pbm)); + pbm.pbm_sel = sc->psc_sel; + pbm.pbm_flags = PCIIO_BAR_MMAP_RW; + pbm.pbm_reg = PCIR_BAR(pi->pi_msix.pba_bar); + pbm.pbm_memattr = VM_MEMATTR_DEVICE; + + if (ioctl(pcifd, PCIOCBARMMAP, &pbm) != 0) { + warn("Failed to map MSI-X table BAR on %d/%d/%d", b, s, f); + return (-1); + } + assert(pbm.pbm_bar_off == 0); + pi->pi_msix.mapped_addr = (uint8_t *)(uintptr_t)pbm.pbm_map_base; + pi->pi_msix.mapped_size = pbm.pbm_map_length; + table_offset = rounddown2(pi->pi_msix.table_offset, 4096); table_size = pi->pi_msix.table_offset - table_offset; table_size += pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; table_size = roundup2(table_size, 4096); - idx = pi->pi_msix.table_bar; - start = pi->pi_bar[idx].addr; - remaining = pi->pi_bar[idx].size; - - if (pi->pi_msix.pba_bar == pi->pi_msix.table_bar) { - pba_offset = pi->pi_msix.pba_offset; - pba_size = pi->pi_msix.pba_size; - if (pba_offset >= table_offset + table_size || - table_offset >= pba_offset + pba_size) { - /* - * If the PBA does not share a page with the MSI-x - * tables, no PBA emulation is required. - */ - pi->pi_msix.pba_page = NULL; - pi->pi_msix.pba_page_offset = 0; - } else { - /* - * The PBA overlaps with either the first or last - * page of the MSI-X table region. Map the - * appropriate page. - */ - if (pba_offset <= table_offset) - pi->pi_msix.pba_page_offset = table_offset; - else - pi->pi_msix.pba_page_offset = table_offset + - table_size - 4096; - pi->pi_msix.pba_page = mmap(NULL, 4096, PROT_READ | - PROT_WRITE, MAP_SHARED, memfd, start + - pi->pi_msix.pba_page_offset); - if (pi->pi_msix.pba_page == MAP_FAILED) { - warn( - "Failed to map PBA page for MSI-X on %d/%d/%d", - b, s, f); - return (-1); - } - } - } + /* + * Unmap any pages not covered by the table, we do not need to emulate + * accesses to them. Avoid releasing address space to help ensure that + * a buggy out-of-bounds access causes a crash. + */ + if (table_offset != 0) + if (mprotect(pi->pi_msix.mapped_addr, table_offset, + PROT_NONE) != 0) + warn("Failed to unmap MSI-X table BAR region"); + if (table_offset + table_size != pi->pi_msix.mapped_size) + if (mprotect(pi->pi_msix.mapped_addr, + pi->pi_msix.mapped_size - (table_offset + table_size), + PROT_NONE) != 0) + warn("Failed to unmap MSI-X table BAR region"); return (0); } @@ -645,7 +622,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) #ifndef WITHOUT_CAPSICUM cap_rights_t rights; cap_ioctl_t pci_ioctls[] = - { PCIOCREAD, PCIOCWRITE, PCIOCGETBAR, PCIOCBARIO }; + { PCIOCREAD, PCIOCWRITE, PCIOCGETBAR, PCIOCBARIO, PCIOCBARMMAP }; #endif sc = NULL; @@ -676,21 +653,6 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif - if (memfd < 0) { - memfd = open(_PATH_MEM, O_RDWR, 0); - if (memfd < 0) { - warn("failed to open %s", _PATH_MEM); - return (error); - } - } - -#ifndef WITHOUT_CAPSICUM - cap_rights_clear(&rights, CAP_IOCTL); - cap_rights_set(&rights, CAP_MMAP_RW); - if (caph_rights_limit(memfd, &rights) == -1) - errx(EX_OSERR, "Unable to apply rights for sandbox"); -#endif - #define GET_INT_CONFIG(var, name) do { \ value = get_config_value_node(nvl, name); \ if (value == NULL) { \ From nobody Sat Oct 30 14:15:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 30310183263F; Sat, 30 Oct 2021 14:15: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhLsq06mmz4X3L; Sat, 30 Oct 2021 14:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C37C03E37; Sat, 30 Oct 2021 14:15:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19UEFAqr050158; Sat, 30 Oct 2021 14:15:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19UEFALv050157; Sat, 30 Oct 2021 14:15:10 GMT (envelope-from git) Date: Sat, 30 Oct 2021 14:15:10 GMT Message-Id: <202110301415.19UEFALv050157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 000b70f038f4 - stable/13 - bhyve: Fix the WITH_BHYVE_SNAPSHOT build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 000b70f038f4fd6893d69bd3dce75a416cd13dfe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=000b70f038f4fd6893d69bd3dce75a416cd13dfe commit 000b70f038f4fd6893d69bd3dce75a416cd13dfe Author: Mark Johnston AuthorDate: 2021-10-16 17:13:26 +0000 Commit: Mark Johnston CommitDate: 2021-10-30 14:14:41 +0000 bhyve: Fix the WITH_BHYVE_SNAPSHOT build Note, this breaks compatibility with snapshots generated by older builds of bhyve(8). Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough") Reported by: Greg V Reviewed by: grehan, bz Sponsored by: The FreeBSD Foundation (cherry picked from commit 77bc75c7abd29de69d3ef35b66c23c7baba95094) --- usr.sbin/bhyve/pci_emul.c | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 113ac5121238..d155029d269f 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -2079,7 +2079,6 @@ pci_snapshot_pci_dev(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_offset, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_size, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.function_mask, meta, ret, done); - SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_page_offset, meta, ret, done); SNAPSHOT_BUF_OR_LEAVE(pi->pi_cfgdata, sizeof(pi->pi_cfgdata), meta, ret, done); From nobody Sat Oct 30 23:40:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7F0DE181DE97; Sat, 30 Oct 2021 23:40: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhbPc3851z4d6l; Sat, 30 Oct 2021 23:40:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4C55E1354B; Sat, 30 Oct 2021 23:40:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19UNe4AN096133; Sat, 30 Oct 2021 23:40:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19UNe4wL096128; Sat, 30 Oct 2021 23:40:04 GMT (envelope-from git) Date: Sat, 30 Oct 2021 23:40:04 GMT Message-Id: <202110302340.19UNe4wL096128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 2be417843a04 - main - PR#259071 provides a test program that fails for the NFS client. Testing with it, there appears to be a race between Lookup and VOPs like Setattr-of-size, where Lookup ends up loading stale attributes (including what might be the wrong file size) into the NFS vnode's attribute cache. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2be417843a04f25e631e99d5188eb2652b13d80d Auto-Submitted: auto-generated X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2be417843a04f25e631e99d5188eb2652b13d80d commit 2be417843a04f25e631e99d5188eb2652b13d80d Author: Rick Macklem AuthorDate: 2021-10-30 23:35:02 +0000 Commit: Rick Macklem CommitDate: 2021-10-30 23:35:02 +0000 PR#259071 provides a test program that fails for the NFS client. Testing with it, there appears to be a race between Lookup and VOPs like Setattr-of-size, where Lookup ends up loading stale attributes (including what might be the wrong file size) into the NFS vnode's attribute cache. The race occurs when the modifying VOP (which holds a lock on the vnode), blocks the acquisition of the vnode in Lookup, after the RPC (with now potentially stale attributes). Here's what seems to happen: Child Parent does stat(), which does VOP_LOOKUP(), doing the Lookup RPC with the directory vnode locked, acquiring file attributes valid at this point in time blocks waiting for locked file does ftruncate(), which vnode does VOP_SETATTR() of Size, changing the file's size while holding an exclusive lock on the file's vnode releases the vnode lock acquires file vnode and fills in now stale attributes including the old wrong Size does a read() which returns wrong data size This patch fixes the problem by saving a timestamp in the NFS vnode in the VOPs that modify the file (Setattr-of-size, Allocate). Then lookup/readdirplus compares that timestamp with the time just before starting the RPC after it has acquired the file's vnode. If the modifying RPC occurred during the Lookup, the attributes in the RPC reply are discarded, since they might be stale. With this patch the test program works as expected. Note that the test program does not fail on a July stable/12, although this race is in the NFS client code. I suspect a fairly recent change to the name caching code exposed this bug. PR: 259071 Reviewed by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D32635 --- sys/fs/nfsclient/nfs_clrpcops.c | 29 +++++++++++++-- sys/fs/nfsclient/nfs_clvnops.c | 78 +++++++++++++++++++++++++++++++++++++---- sys/fs/nfsclient/nfsnode.h | 1 + 3 files changed, 99 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index dec70dc2ac06..f74493debd7c 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3630,7 +3630,8 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, nfsattrbit_t attrbits, dattrbits; size_t tresid; u_int32_t *tl2 = NULL, rderr; - struct timespec dctime; + struct timespec dctime, ts; + bool attr_ok; KASSERT(uiop->uio_iovcnt == 1 && (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0, @@ -3815,6 +3816,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &dattrbits); } + nanouptime(&ts); error = nfscl_request(nd, vp, p, cred, stuff); if (error) return (error); @@ -3972,6 +3974,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ncookie.lval[1]; if (nfhp != NULL) { + attr_ok = true; if (NFSRV_CMPFH(nfhp->nfh_fh, nfhp->nfh_len, dnp->n_fhp->nfh_fh, dnp->n_fhp->nfh_len)) { VREF(vp); @@ -4001,12 +4004,32 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, if (!error) { newvp = NFSTOV(np); unlocknewvp = 1; + /* + * If n_localmodtime >= time before RPC, + * then a file modification operation, + * such as VOP_SETATTR() of size, has + * occurred while the Lookup RPC and + * acquisition of the vnode happened. As + * such, the attributes might be stale, + * with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset( + &np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, + &ts, >=)) { + NFSCL_DEBUG(4, "nfsrpc_readdirplus:" + " localmod stale attributes\n"); + attr_ok = false; + } + NFSUNLOCKNODE(np); } } nfhp = NULL; if (newvp != NULLVP) { - error = nfscl_loadattrcache(&newvp, - &nfsva, NULL, NULL, 0, 0); + if (attr_ok) + error = nfscl_loadattrcache(&newvp, + &nfsva, NULL, NULL, 0, 0); if (error) { if (unlocknewvp) vput(newvp); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 4a1ab9552a15..e8c713086717 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1014,6 +1014,7 @@ nfs_setattr(struct vop_setattr_args *ap) struct vattr *vap = ap->a_vap; int error = 0; u_quad_t tsize; + struct timespec ts; #ifndef nolint tsize = (u_quad_t)0; @@ -1108,11 +1109,18 @@ nfs_setattr(struct vop_setattr_args *ap) NFSUNLOCKNODE(np); } error = nfs_setattrrpc(vp, vap, ap->a_cred, td); - if (error && vap->va_size != VNOVAL) { - NFSLOCKNODE(np); - np->n_size = np->n_vattr.na_size = tsize; - vnode_pager_setsize(vp, tsize); - NFSUNLOCKNODE(np); + if (vap->va_size != VNOVAL) { + if (error == 0) { + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); + } else { + NFSLOCKNODE(np); + np->n_size = np->n_vattr.na_size = tsize; + vnode_pager_setsize(vp, tsize); + NFSUNLOCKNODE(np); + } } return (error); } @@ -1169,7 +1177,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - struct timespec nctime; + struct timespec nctime, ts; uint32_t openmode; *vpp = NULLVP; @@ -1293,6 +1301,7 @@ nfs_lookup(struct vop_lookup_args *ap) newvp = NULLVP; NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses); + nanouptime(&ts); error = nfsrpc_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag, NULL, openmode); @@ -1359,6 +1368,22 @@ nfs_lookup(struct vop_lookup_args *ap) if (error) return (error); newvp = NFSTOV(np); + /* + * If n_localmodtime >= time before RPC, then + * a file modification operation, such as + * VOP_SETATTR() of size, has occurred while + * the Lookup RPC and acquisition of the vnode + * happened. As such, the attributes might + * be stale, with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset(&np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, &ts, >=)) { + NFSCL_DEBUG(4, "nfs_lookup: rename localmod " + "stale attributes\n"); + attrflag = 0; + } + NFSUNLOCKNODE(np); if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); @@ -1418,6 +1443,22 @@ nfs_lookup(struct vop_lookup_args *ap) if (error) return (error); newvp = NFSTOV(np); + /* + * If n_localmodtime >= time before RPC, then + * a file modification operation, such as + * VOP_SETATTR() of size, has occurred while + * the Lookup RPC and acquisition of the vnode + * happened. As such, the attributes might + * be stale, with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset(&np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, &ts, >=)) { + NFSCL_DEBUG(4, "nfs_lookup: localmod " + "stale attributes\n"); + attrflag = 0; + } + NFSUNLOCKNODE(np); if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); @@ -2635,7 +2676,9 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred, struct componentname cn; int error = 0, attrflag, dattrflag; u_int hash; + struct timespec ts; + nanouptime(&ts); error = nfsrpc_lookup(dvp, name, len, cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag, NULL, 0); if (dattrflag) @@ -2696,6 +2739,22 @@ printf("replace=%s\n",nnn); if (error) return (error); newvp = NFSTOV(np); + /* + * If n_localmodtime >= time before RPC, then + * a file modification operation, such as + * VOP_SETATTR() of size, has occurred while + * the Lookup RPC and acquisition of the vnode + * happened. As such, the attributes might + * be stale, with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset(&np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, &ts, >=)) { + NFSCL_DEBUG(4, "nfs_lookitup: localmod " + "stale attributes\n"); + attrflag = 0; + } + NFSUNLOCKNODE(np); } if (!attrflag && *npp == NULL) { if (newvp == dvp) @@ -3643,11 +3702,14 @@ nfs_allocate(struct vop_allocate_args *ap) struct thread *td = curthread; struct nfsvattr nfsva; struct nfsmount *nmp; + struct nfsnode *np; off_t alen; int attrflag, error, ret; + struct timespec ts; attrflag = 0; nmp = VFSTONFS(vp->v_mount); + np = VTONFS(vp); mtx_lock(&nmp->nm_mtx); if (NFSHASNFSV4(nmp) && nmp->nm_minorvers >= NFSV42_MINORVERSION && (nmp->nm_privflag & NFSMNTP_NOALLOCATE) == 0) { @@ -3667,6 +3729,10 @@ nfs_allocate(struct vop_allocate_args *ap) if (error == 0) { *ap->a_offset += alen; *ap->a_len -= alen; + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); } else if (error == NFSERR_NOTSUPP) { mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_NOALLOCATE; diff --git a/sys/fs/nfsclient/nfsnode.h b/sys/fs/nfsclient/nfsnode.h index b34e362a8522..833737654f6b 100644 --- a/sys/fs/nfsclient/nfsnode.h +++ b/sys/fs/nfsclient/nfsnode.h @@ -129,6 +129,7 @@ struct nfsnode { struct nfsv4node *n_v4; /* extra V4 stuff */ struct ucred *n_writecred; /* Cred. for putpages */ struct nfsclopen *n_openstateid; /* Cached open stateid */ + struct timespec n_localmodtime; /* Last local modify */ }; #define n_atim n_un1.nf_atim From nobody Sat Oct 30 23:49:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5ED991822389; Sat, 30 Oct 2021 23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhbcR2C6Lz4h00; Sat, 30 Oct 2021 23:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2C0AF1382B; Sat, 30 Oct 2021 23:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19UNnRUq007668; Sat, 30 Oct 2021 23:49:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19UNnRWS007667; Sat, 30 Oct 2021 23:49:27 GMT (envelope-from git) Date: Sat, 30 Oct 2021 23:49:27 GMT Message-Id: <202110302349.19UNnRWS007667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: ab87c39c257e - main - nfscl: Set n_localmodtime in Deallocate List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab87c39c257e7130677867f8e5c11a3ec53fa1bc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ab87c39c257e7130677867f8e5c11a3ec53fa1bc commit ab87c39c257e7130677867f8e5c11a3ec53fa1bc Author: Rick Macklem AuthorDate: 2021-10-30 23:46:14 +0000 Commit: Rick Macklem CommitDate: 2021-10-30 23:46:14 +0000 nfscl: Set n_localmodtime in Deallocate Commit 2be417843a04 added n_localmodtime, which is used by Lookup and ReaddirPlus to check to see if the file attributes in an RPC reply might be stale. This patch sets n_localmodtime in Deallocate. Done as a separate commit, since Deallocate is not in stable/13. PR: 259071 Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D32635 --- sys/fs/nfsclient/nfs_clvnops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index e8c713086717..f63eadf26a91 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3767,6 +3767,7 @@ nfs_deallocate(struct vop_deallocate_args *ap) off_t tlen, mlen; int attrflag, error, ret; bool clipped; + struct timespec ts; error = 0; attrflag = 0; @@ -3809,6 +3810,10 @@ nfs_deallocate(struct vop_deallocate_args *ap) if (error == 0) { NFSCL_DEBUG(4, "dealloc: attrflag=%d na_size=%ju\n", attrflag, (uintmax_t)nfsva.na_size); + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); if (attrflag != 0) { if ((uint64_t)*ap->a_offset < nfsva.na_size) *ap->a_offset += omin((off_t) From nobody Sun Oct 31 00:12:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CBF55182BDA7; Sun, 31 Oct 2021 00:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hhc6l5RqPz4pq7; Sun, 31 Oct 2021 00:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9B8F1141B0; Sun, 31 Oct 2021 00:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19V0CF2E046963; Sun, 31 Oct 2021 00:12:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19V0CFrF046962; Sun, 31 Oct 2021 00:12:15 GMT (envelope-from git) Date: Sun, 31 Oct 2021 00:12:15 GMT Message-Id: <202110310012.19V0CFrF046962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 50dcff0816e5 - main - nfscl: Add setting n_localmodtime to the Write RPC code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50dcff0816e5e4aa94f51ce27da5121e49902996 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=50dcff0816e5e4aa94f51ce27da5121e49902996 commit 50dcff0816e5e4aa94f51ce27da5121e49902996 Author: Rick Macklem AuthorDate: 2021-10-31 00:08:28 +0000 Commit: Rick Macklem CommitDate: 2021-10-31 00:08:28 +0000 nfscl: Add setting n_localmodtime to the Write RPC code Similar to commit 2be417843a, I believe there could be a race between the NFS client VOP_LOOKUP() and file Writing that could result in stale file attributes being loaded into the NFS vnode by VOP_LOOKUP(). I have not been able to reproduce a failure due to this race, but I believe that there are two possibilities: The Lookup RPC happens while VOP_WRITE() is being executed and loads stale file attributes after VOP_WRITE() returns when it has already completed the Write/Commit RPC(s). --> For this case, setting the local modify timestamp at the end of VOP_WRITE() should ensure that stale file attributes are not loaded. The Lookup RPC occurs after VOP_WRITE() has returned, while asynchronous Write/Commit RPCs are in progress and then is blocked by the vnode held by VOP_OPEN/VOP_CLOSE/VOP_FSYNC which will flush writes via ncl_flush() or ncl_vinvalbuf(), clearing the NMODIFIED flag (which indicates Writes-in-progress). The VOP_LOOKUP() then acquires the NFS vnode lock and fills in stale file attributes. --> Setting the local modify timestamp in ncl_flsuh() and ncl_vinvalbuf() when they clear NMODIFIED should ensure that stale file attributes are not loaded. This patch does the above. PR: 259071 Reviewed by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D32677 --- sys/fs/nfsclient/nfs_clbio.c | 18 +++++++++++++++--- sys/fs/nfsclient/nfs_clvnops.c | 7 +++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 10a76f0a4b83..250d01d88948 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -907,6 +907,7 @@ ncl_write(struct vop_write_args *ap) int bp_cached, n, on, error = 0, error1, save2, wouldcommit; size_t orig_resid, local_resid; off_t orig_size, tmp_off; + struct timespec ts; KASSERT(uio->uio_rw == UIO_WRITE, ("ncl_write mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, @@ -1284,7 +1285,12 @@ again: break; } while (uio->uio_resid > 0 && n > 0); - if (error != 0) { + if (error == 0) { + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); + } else { if (ioflag & IO_UNIT) { VATTR_NULL(&vattr); vattr.va_size = orig_size; @@ -1356,6 +1362,7 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg) struct nfsmount *nmp = VFSTONFS(vp->v_mount); int error = 0, slpflag, slptimeo; bool old_lock; + struct timespec ts; ASSERT_VOP_LOCKED(vp, "ncl_vinvalbuf"); @@ -1400,16 +1407,21 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg) } if (NFSHASPNFS(nmp)) { nfscl_layoutcommit(vp, td); + nanouptime(&ts); /* * Invalidate the attribute cache, since writes to a DS * won't update the size attribute. */ NFSLOCKNODE(np); np->n_attrstamp = 0; - } else + } else { + nanouptime(&ts); NFSLOCKNODE(np); - if (np->n_directio_asyncwr == 0) + } + if (np->n_directio_asyncwr == 0 && (np->n_flag & NMODIFIED) != 0) { + np->n_localmodtime = ts; np->n_flag &= ~NMODIFIED; + } NFSUNLOCKNODE(np); out: ncl_excl_finish(vp, old_lock); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index f63eadf26a91..1685edf5b2de 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2914,6 +2914,7 @@ ncl_flush(struct vnode *vp, int waitfor, struct thread *td, #endif struct buf *bvec_on_stack[NFS_COMMITBVECSIZ]; u_int bvecsize = 0, bveccount; + struct timespec ts; if (called_from_renewthread != 0) slptimeo = hz; @@ -3234,6 +3235,12 @@ done: vn_printf(vp, "ncl_flush failed"); error = called_from_renewthread != 0 ? EIO : EBUSY; } + if (error == 0) { + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); + } return (error); } From nobody Sun Oct 31 01:03:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 75703181A376; Sun, 31 Oct 2021 01:03:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhdG72thrz3Mf8; Sun, 31 Oct 2021 01:03:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4349514C24; Sun, 31 Oct 2021 01:03:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19V13hdl015241; Sun, 31 Oct 2021 01:03:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19V13hio015240; Sun, 31 Oct 2021 01:03:43 GMT (envelope-from git) Date: Sun, 31 Oct 2021 01:03:43 GMT Message-Id: <202110310103.19V13hio015240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 446da52f9e6e - stable/13 - sh: Set PATH envvar after setting HOME in dotfile List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 446da52f9e6eef72041d6ae338ada23761d41f70 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=446da52f9e6eef72041d6ae338ada23761d41f70 commit 446da52f9e6eef72041d6ae338ada23761d41f70 Author: Ka Ho Ng AuthorDate: 2021-10-26 14:48:57 +0000 Commit: Ka Ho Ng CommitDate: 2021-10-31 00:46:41 +0000 sh: Set PATH envvar after setting HOME in dotfile In single-user mode, all env vars are absent, so exptilde() would not be able to expand ~ correctly. Place the lines setting PATH below HOME, so exptilde() would work as expected. Sponsored by: The FreeBSD Foundation Reviewed by: jilles, emaste Differential Revision: https://reviews.freebsd.org/D27003 (cherry picked from commit fcfa64801a4fe836ff481465ea068e791aa4ce6a) --- bin/sh/dot.profile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile index fd0c43fdb927..e296a360bcc7 100644 --- a/bin/sh/dot.profile +++ b/bin/sh/dot.profile @@ -1,9 +1,9 @@ # $FreeBSD$ # -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin -export PATH HOME=/root export HOME +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin +export PATH TERM=${TERM:-xterm} export TERM PAGER=less From nobody Sun Oct 31 01:05:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E7C5C181AB56; Sun, 31 Oct 2021 01:05:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhdJ06DcSz3N6G; Sun, 31 Oct 2021 01:05:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B5EE514E8E; Sun, 31 Oct 2021 01:05:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19V15KFC015480; Sun, 31 Oct 2021 01:05:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19V15K6k015479; Sun, 31 Oct 2021 01:05:20 GMT (envelope-from git) Date: Sun, 31 Oct 2021 01:05:20 GMT Message-Id: <202110310105.19V15K6k015479@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: b4c7d45c8490 - main - sys/proc.h: put proc_add_orphan() into proper place List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4c7d45c849071b31936fec6ec43f3d4df3ef3d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b4c7d45c849071b31936fec6ec43f3d4df3ef3d8 commit b4c7d45c849071b31936fec6ec43f3d4df3ef3d8 Author: Konstantin Belousov AuthorDate: 2021-10-29 22:02:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-31 01:05:14 +0000 sys/proc.h: put proc_add_orphan() into proper place Noted by: markj Reviewed by: emaste, markjd Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32738 --- sys/sys/proc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 177efd5257af..6bc9c82bb698 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1127,6 +1127,7 @@ int p_canwait(struct thread *td, struct proc *p); struct pargs *pargs_alloc(int len); void pargs_drop(struct pargs *pa); void pargs_hold(struct pargs *pa); +void proc_add_orphan(struct proc *child, struct proc *parent); int proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb); @@ -1137,7 +1138,6 @@ void proc_linkup(struct proc *p, struct thread *td); struct proc *proc_realparent(struct proc *child); void proc_reap(struct thread *td, struct proc *p, int *status, int options); void proc_reparent(struct proc *child, struct proc *newparent, bool set_oppid); -void proc_add_orphan(struct proc *child, struct proc *parent); void proc_set_traced(struct proc *p, bool stop); void proc_wkilled(struct proc *p); struct pstats *pstats_alloc(void); From nobody Sun Oct 31 01:05:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 62C02181AE98; Sun, 31 Oct 2021 01:05:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhdJ21TJlz3NB1; Sun, 31 Oct 2021 01:05:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F35FB14CBD; Sun, 31 Oct 2021 01:05:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19V15Lhc015506; Sun, 31 Oct 2021 01:05:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19V15Lnw015505; Sun, 31 Oct 2021 01:05:21 GMT (envelope-from git) Date: Sun, 31 Oct 2021 01:05:21 GMT Message-Id: <202110310105.19V15Lnw015505@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: f34fc6ba06a1 - main - Extract proc_get_binpath() from sysctl_kern_proc_pathname() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f34fc6ba06a10e0f2a505ec0dd2f2fab2a79e53d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f34fc6ba06a10e0f2a505ec0dd2f2fab2a79e53d commit f34fc6ba06a10e0f2a505ec0dd2f2fab2a79e53d Author: Konstantin Belousov AuthorDate: 2021-10-29 01:42:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-31 01:05:14 +0000 Extract proc_get_binpath() from sysctl_kern_proc_pathname() Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32738 --- sys/kern/kern_proc.c | 89 +++++++++++++++++++++++++++++++++------------------- sys/sys/proc.h | 2 ++ 2 files changed, 58 insertions(+), 33 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index c4c01da1faea..2156c5c465ba 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2226,41 +2226,34 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARGS) } /* - * This sysctl allows a process to retrieve the path of the executable for - * itself or another process. + * Look up the canonical executable path running in the specified process. + * It tries to return the same hardlink name as was used for execve(2). + * This allows the programs that modify their behavior based on their progname, + * to operate correctly. + * + * Result is returned in retbuf, it must not be freed, similar to vn_fullpath() + * calling conventions. + * binname is a pointer to temporary string buffer of length MAXPATHLEN, + * allocated and freed by caller. + * freebuf should be freed by caller, from the M_TEMP malloc type. */ -static int -sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) +int +proc_get_binpath(struct proc *p, char *binname, char **retbuf, + char **freebuf) { - pid_t *pidp = (pid_t *)arg1; - unsigned int arglen = arg2; - struct proc *p; - struct vnode *vp, *dvp; - char *retbuf, *freebuf, *binname; struct nameidata nd; + struct vnode *vp, *dvp; size_t freepath_size; int error; bool do_fullpath; - if (arglen != 1) - return (EINVAL); - binname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - binname[0] = '\0'; - if (*pidp == -1) { /* -1 means this process */ - p = req->td->td_proc; - } else { - error = pget(*pidp, PGET_CANSEE, &p); - if (error != 0) { - free(binname, M_TEMP); - return (error); - } - } + PROC_LOCK_ASSERT(p, MA_OWNED); vp = p->p_textvp; if (vp == NULL) { - if (*pidp != -1) - PROC_UNLOCK(p); - free(binname, M_TEMP); + PROC_UNLOCK(p); + *retbuf = NULL; + *freebuf = NULL; return (0); } vref(vp); @@ -2269,20 +2262,20 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) vref(dvp); if (p->p_binname != NULL) strlcpy(binname, p->p_binname, MAXPATHLEN); - if (*pidp != -1) - PROC_UNLOCK(p); + PROC_UNLOCK(p); + do_fullpath = true; - freebuf = NULL; + *freebuf = NULL; if (dvp != NULL && binname[0] != '\0') { freepath_size = MAXPATHLEN; if (vn_fullpath_hardlink(vp, dvp, binname, strlen(binname), - &retbuf, &freebuf, &freepath_size) == 0) { + retbuf, freebuf, &freepath_size) == 0) { /* * Recheck the looked up path. The binary * might have been renamed or replaced, in * which case we should not report old name. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, retbuf, + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf, req->td); error = namei(&nd); if (error == 0) { @@ -2294,13 +2287,43 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) } } if (do_fullpath) { - free(freebuf, M_TEMP); - freebuf = NULL; - error = vn_fullpath(vp, &retbuf, &freebuf); + free(*freebuf, M_TEMP); + *freebuf = NULL; + error = vn_fullpath(vp, retbuf, freebuf); } vrele(vp); if (dvp != NULL) vrele(dvp); + return (error); +} + +/* + * This sysctl allows a process to retrieve the path of the executable for + * itself or another process. + */ +static int +sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) +{ + pid_t *pidp = (pid_t *)arg1; + unsigned int arglen = arg2; + struct proc *p; + char *retbuf, *freebuf, *binname; + int error; + + if (arglen != 1) + return (EINVAL); + binname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + binname[0] = '\0'; + if (*pidp == -1) { /* -1 means this process */ + error = 0; + p = req->td->td_proc; + PROC_LOCK(p); + } else { + error = pget(*pidp, PGET_CANSEE, &p); + } + + if (error == 0) + error = proc_get_binpath(p, binname, &retbuf, &freebuf); free(binname, M_TEMP); if (error != 0) return (error); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 6bc9c82bb698..de19bfc9cc3b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1128,6 +1128,8 @@ struct pargs *pargs_alloc(int len); void pargs_drop(struct pargs *pa); void pargs_hold(struct pargs *pa); void proc_add_orphan(struct proc *child, struct proc *parent); +int proc_get_binpath(struct proc *p, char *binname, char **fullpath, + char **freepath); int proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb); From nobody Sun Oct 31 01:05:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 774E8181AEA5; Sun, 31 Oct 2021 01:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhdJ31b7Pz3NB4; Sun, 31 Oct 2021 01:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0C9F714E4B; Sun, 31 Oct 2021 01:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19V15MQt015531; Sun, 31 Oct 2021 01:05:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19V15Mlv015530; Sun, 31 Oct 2021 01:05:22 GMT (envelope-from git) Date: Sun, 31 Oct 2021 01:05:22 GMT Message-Id: <202110310105.19V15Mlv015530@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: e5248548f95f - main - procfs: return right hardlink from /proc/curproc/file List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5248548f95ff1c89667847e0d945dea38adeca7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e5248548f95ff1c89667847e0d945dea38adeca7 commit e5248548f95ff1c89667847e0d945dea38adeca7 Author: Konstantin Belousov AuthorDate: 2021-10-29 01:43:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-31 01:05:14 +0000 procfs: return right hardlink from /proc/curproc/file Use proc_get_binpath() to get the hardlink right. PR: 248184 Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32738 --- sys/fs/procfs/procfs.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index c492533c52bb..697bbfc9877a 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -69,22 +69,17 @@ int procfs_doprocfile(PFS_FILL_ARGS) { - char *fullpath; - char *freepath; - struct vnode *textvp; + char *fullpath, *freepath, *binpath; int error; freepath = NULL; + binpath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); PROC_LOCK(p); - textvp = p->p_textvp; - vhold(textvp); - PROC_UNLOCK(p); - error = vn_fullpath(textvp, &fullpath, &freepath); - vdrop(textvp); + error = proc_get_binpath(p, binpath, &fullpath, &freepath); if (error == 0) - sbuf_printf(sb, "%s", fullpath); - if (freepath != NULL) - free(freepath, M_TEMP); + sbuf_printf(sb, "%s", fullpath == NULL ? "" : fullpath); + free(binpath, M_TEMP); + free(freepath, M_TEMP); return (error); } From nobody Sun Oct 31 01:45:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E057A182D294; Sun, 31 Oct 2021 01:45:46 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.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 (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhfBf3TdTz3q0M; Sun, 31 Oct 2021 01:45:46 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 19V1jcVL035253 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 30 Oct 2021 18:45:38 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 19V1jcdl035252; Sat, 30 Oct 2021 18:45:38 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Sat, 30 Oct 2021 18:45:38 -0700 From: Gleb Smirnoff To: Kubilay Kocak Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 92b3e07229ba - main - Enable net.inet.tcp.nolocaltimewait. Message-ID: References: <202110282235.19SMZoAL076017@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HhfBf3TdTz3q0M X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-ThisMailContainsUnwantedMimeParts: N On Sat, Oct 30, 2021 at 11:25:12AM +1100, Kubilay Kocak wrote: K> On 29/10/2021 9:35 am, Gleb Smirnoff wrote: K> > The branch main has been updated by glebius: K> > K> > URL: https://cgit.FreeBSD.org/src/commit/?id=92b3e07229baab17cbe258ff1081e66bb7913b31 K> > K> > commit 92b3e07229baab17cbe258ff1081e66bb7913b31 K> > Author: Gleb Smirnoff K> > AuthorDate: 2021-10-28 22:34:00 +0000 K> > Commit: Gleb Smirnoff K> > CommitDate: 2021-10-28 22:34:00 +0000 K> > K> > Enable net.inet.tcp.nolocaltimewait. K> > K> > This feature has been used for many years at large sites and K> > didn't show any pitfalls. K> K> RELNOTES: ? Probably would be useful. Thanks! -- Gleb Smirnoff From nobody Sun Oct 31 06:10:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AE9C5182B2AE; Sun, 31 Oct 2021 06:10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hhm3f70nPz3t4Z; Sun, 31 Oct 2021 06:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BF35C18C25; Sun, 31 Oct 2021 06:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19V6A6dA016719; Sun, 31 Oct 2021 06:10:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19V6A6M9016716; Sun, 31 Oct 2021 06:10:06 GMT (envelope-from git) Date: Sun, 31 Oct 2021 06:10:06 GMT Message-Id: <202110310610.19V6A6M9016716@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: f38bef2ce417 - main - Bump __FreeBSD_version following the libdialog shared library version number bump. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f38bef2ce417d6270f32b4ed17cec84bfd95d548 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=f38bef2ce417d6270f32b4ed17cec84bfd95d548 commit f38bef2ce417d6270f32b4ed17cec84bfd95d548 Author: Xin LI AuthorDate: 2021-10-31 06:09:29 +0000 Commit: Xin LI CommitDate: 2021-10-31 06:09:29 +0000 Bump __FreeBSD_version following the libdialog shared library version number bump. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 42e200de2eae..f4beaf0ec408 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400039 +#define __FreeBSD_version 1400040 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Sun Oct 31 14:02:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 57F8D1826931; Sun, 31 Oct 2021 14:02:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhyXQ24vjz4cpJ; Sun, 31 Oct 2021 14:02:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 27CAA1F12F; Sun, 31 Oct 2021 14:02:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VE2Emq053731; Sun, 31 Oct 2021 14:02:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VE2Ex4053730; Sun, 31 Oct 2021 14:02:14 GMT (envelope-from git) Date: Sun, 31 Oct 2021 14:02:14 GMT Message-Id: <202110311402.19VE2Ex4053730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 712f028b2f59 - stable/13 - Revert "bhyve: Fix the WITH_BHYVE_SNAPSHOT build" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 712f028b2f59ce8f86294de317ec2e2bbf0f6271 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=712f028b2f59ce8f86294de317ec2e2bbf0f6271 commit 712f028b2f59ce8f86294de317ec2e2bbf0f6271 Author: Mark Johnston AuthorDate: 2021-10-31 13:59:50 +0000 Commit: Mark Johnston CommitDate: 2021-10-31 13:59:50 +0000 Revert "bhyve: Fix the WITH_BHYVE_SNAPSHOT build" This reverts commit 000b70f038f4fd6893d69bd3dce75a416cd13dfe. --- usr.sbin/bhyve/pci_emul.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index d155029d269f..113ac5121238 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -2079,6 +2079,7 @@ pci_snapshot_pci_dev(struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_offset, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_size, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.function_mask, meta, ret, done); + SNAPSHOT_VAR_OR_LEAVE(pi->pi_msix.pba_page_offset, meta, ret, done); SNAPSHOT_BUF_OR_LEAVE(pi->pi_cfgdata, sizeof(pi->pi_cfgdata), meta, ret, done); From nobody Sun Oct 31 14:02:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BAADE182677D; Sun, 31 Oct 2021 14:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HhyXR3mh2z4cjn; Sun, 31 Oct 2021 14:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 509B11F2AA; Sun, 31 Oct 2021 14:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VE2FCk053755; Sun, 31 Oct 2021 14:02:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VE2FXs053754; Sun, 31 Oct 2021 14:02:15 GMT (envelope-from git) Date: Sun, 31 Oct 2021 14:02:15 GMT Message-Id: <202110311402.19VE2FXs053754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 925211125cec - stable/13 - Revert "bhyve: Map the MSI-X table unconditionally for passthrough" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 925211125cec3481cb0fc14444868ab51d904222 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=925211125cec3481cb0fc14444868ab51d904222 commit 925211125cec3481cb0fc14444868ab51d904222 Author: Mark Johnston AuthorDate: 2021-10-31 13:59:59 +0000 Commit: Mark Johnston CommitDate: 2021-10-31 13:59:59 +0000 Revert "bhyve: Map the MSI-X table unconditionally for passthrough" This reverts commit 382eec24c0284bd7dc5997b85abc9ee70ea704a1. This change causes a regression where a VM using passthrough no longer starts. Until this is resolved, revert the commit. Reported by: Raúl Muñoz --- usr.sbin/bhyve/pci_emul.h | 4 +- usr.sbin/bhyve/pci_passthru.c | 186 +++++++++++++++++++++++++----------------- 2 files changed, 114 insertions(+), 76 deletions(-) diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 5b6a17119960..031a6113fac4 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -157,8 +157,8 @@ struct pci_devinst { int pba_size; int function_mask; struct msix_table_entry *table; /* allocated at runtime */ - uint8_t *mapped_addr; - size_t mapped_size; + void *pba_page; + int pba_page_offset; } pi_msix; void *pi_arg; /* devemu-private data */ diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index bf99c646c480..2c6a2ebd8dd9 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -43,10 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include -#include #ifndef WITHOUT_CAPSICUM #include @@ -72,12 +69,17 @@ __FBSDID("$FreeBSD$"); #define _PATH_DEVPCI "/dev/pci" #endif +#ifndef _PATH_MEM +#define _PATH_MEM "/dev/mem" +#endif + #define LEGACY_SUPPORT 1 #define MSIX_TABLE_COUNT(ctrl) (((ctrl) & PCIM_MSIXCTRL_TABLE_SIZE) + 1) #define MSIX_CAPLEN 12 static int pcifd = -1; +static int memfd = -1; struct passthru_softc { struct pci_devinst *psc_pi; @@ -288,30 +290,30 @@ msix_table_read(struct passthru_softc *sc, uint64_t offset, int size) uint64_t *src64; uint64_t data; size_t entry_offset; - uint32_t table_offset; - int index, table_count; + int index; pi = sc->psc_pi; - - table_offset = pi->pi_msix.table_offset; - table_count = pi->pi_msix.table_count; - if (offset < table_offset || - offset >= table_offset + table_count * MSIX_TABLE_ENTRY_SIZE) { - switch (size) { + if (pi->pi_msix.pba_page != NULL && offset >= pi->pi_msix.pba_offset && + offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { + switch(size) { case 1: - src8 = (uint8_t *)(pi->pi_msix.mapped_addr + offset); + src8 = (uint8_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); data = *src8; break; case 2: - src16 = (uint16_t *)(pi->pi_msix.mapped_addr + offset); + src16 = (uint16_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); data = *src16; break; case 4: - src32 = (uint32_t *)(pi->pi_msix.mapped_addr + offset); + src32 = (uint32_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); data = *src32; break; case 8: - src64 = (uint64_t *)(pi->pi_msix.mapped_addr + offset); + src64 = (uint64_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); data = *src64; break; default: @@ -320,28 +322,32 @@ msix_table_read(struct passthru_softc *sc, uint64_t offset, int size) return (data); } - offset -= table_offset; + if (offset < pi->pi_msix.table_offset) + return (-1); + + offset -= pi->pi_msix.table_offset; index = offset / MSIX_TABLE_ENTRY_SIZE; - assert(index < table_count); + if (index >= pi->pi_msix.table_count) + return (-1); entry = &pi->pi_msix.table[index]; entry_offset = offset % MSIX_TABLE_ENTRY_SIZE; - switch (size) { + switch(size) { case 1: - src8 = (uint8_t *)((uint8_t *)entry + entry_offset); + src8 = (uint8_t *)((void *)entry + entry_offset); data = *src8; break; case 2: - src16 = (uint16_t *)((uint8_t *)entry + entry_offset); + src16 = (uint16_t *)((void *)entry + entry_offset); data = *src16; break; case 4: - src32 = (uint32_t *)((uint8_t *)entry + entry_offset); + src32 = (uint32_t *)((void *)entry + entry_offset); data = *src32; break; case 8: - src64 = (uint64_t *)((uint8_t *)entry + entry_offset); + src64 = (uint64_t *)((void *)entry + entry_offset); data = *src64; break; default: @@ -362,39 +368,46 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc, uint32_t *dest32; uint64_t *dest64; size_t entry_offset; - uint32_t table_offset, vector_control; - int index, table_count; + uint32_t vector_control; + int index; pi = sc->psc_pi; - - table_offset = pi->pi_msix.table_offset; - table_count = pi->pi_msix.table_count; - if (offset < table_offset || - offset >= table_offset + table_count * MSIX_TABLE_ENTRY_SIZE) { - switch (size) { + if (pi->pi_msix.pba_page != NULL && offset >= pi->pi_msix.pba_offset && + offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { + switch(size) { case 1: - dest8 = (uint8_t *)(pi->pi_msix.mapped_addr + offset); + dest8 = (uint8_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); *dest8 = data; break; case 2: - dest16 = (uint16_t *)(pi->pi_msix.mapped_addr + offset); + dest16 = (uint16_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); *dest16 = data; break; case 4: - dest32 = (uint32_t *)(pi->pi_msix.mapped_addr + offset); + dest32 = (uint32_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); *dest32 = data; break; case 8: - dest64 = (uint64_t *)(pi->pi_msix.mapped_addr + offset); + dest64 = (uint64_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); *dest64 = data; break; + default: + break; } return; } - offset -= table_offset; + if (offset < pi->pi_msix.table_offset) + return; + + offset -= pi->pi_msix.table_offset; index = offset / MSIX_TABLE_ENTRY_SIZE; - assert(index < table_count); + if (index >= pi->pi_msix.table_count) + return; entry = &pi->pi_msix.table[index]; entry_offset = offset % MSIX_TABLE_ENTRY_SIZE; @@ -422,10 +435,13 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc, static int init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) { - struct pci_devinst *pi = sc->psc_pi; - struct pci_bar_mmap pbm; int b, s, f; + int idx; + size_t remaining; uint32_t table_size, table_offset; + uint32_t pba_size, pba_offset; + vm_paddr_t start; + struct pci_devinst *pi = sc->psc_pi; assert(pci_msix_table_bar(pi) >= 0 && pci_msix_pba_bar(pi) >= 0); @@ -433,48 +449,55 @@ init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) s = sc->psc_sel.pc_dev; f = sc->psc_sel.pc_func; - /* - * Map the region of the BAR containing the MSI-X table. This is - * necessary for two reasons: - * 1. The PBA may reside in the first or last page containing the MSI-X - * table. - * 2. While PCI devices are not supposed to use the page(s) containing - * the MSI-X table for other purposes, some do in practice. + /* + * If the MSI-X table BAR maps memory intended for + * other uses, it is at least assured that the table + * either resides in its own page within the region, + * or it resides in a page shared with only the PBA. */ - memset(&pbm, 0, sizeof(pbm)); - pbm.pbm_sel = sc->psc_sel; - pbm.pbm_flags = PCIIO_BAR_MMAP_RW; - pbm.pbm_reg = PCIR_BAR(pi->pi_msix.pba_bar); - pbm.pbm_memattr = VM_MEMATTR_DEVICE; - - if (ioctl(pcifd, PCIOCBARMMAP, &pbm) != 0) { - warn("Failed to map MSI-X table BAR on %d/%d/%d", b, s, f); - return (-1); - } - assert(pbm.pbm_bar_off == 0); - pi->pi_msix.mapped_addr = (uint8_t *)(uintptr_t)pbm.pbm_map_base; - pi->pi_msix.mapped_size = pbm.pbm_map_length; - table_offset = rounddown2(pi->pi_msix.table_offset, 4096); table_size = pi->pi_msix.table_offset - table_offset; table_size += pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; table_size = roundup2(table_size, 4096); - /* - * Unmap any pages not covered by the table, we do not need to emulate - * accesses to them. Avoid releasing address space to help ensure that - * a buggy out-of-bounds access causes a crash. - */ - if (table_offset != 0) - if (mprotect(pi->pi_msix.mapped_addr, table_offset, - PROT_NONE) != 0) - warn("Failed to unmap MSI-X table BAR region"); - if (table_offset + table_size != pi->pi_msix.mapped_size) - if (mprotect(pi->pi_msix.mapped_addr, - pi->pi_msix.mapped_size - (table_offset + table_size), - PROT_NONE) != 0) - warn("Failed to unmap MSI-X table BAR region"); + idx = pi->pi_msix.table_bar; + start = pi->pi_bar[idx].addr; + remaining = pi->pi_bar[idx].size; + + if (pi->pi_msix.pba_bar == pi->pi_msix.table_bar) { + pba_offset = pi->pi_msix.pba_offset; + pba_size = pi->pi_msix.pba_size; + if (pba_offset >= table_offset + table_size || + table_offset >= pba_offset + pba_size) { + /* + * If the PBA does not share a page with the MSI-x + * tables, no PBA emulation is required. + */ + pi->pi_msix.pba_page = NULL; + pi->pi_msix.pba_page_offset = 0; + } else { + /* + * The PBA overlaps with either the first or last + * page of the MSI-X table region. Map the + * appropriate page. + */ + if (pba_offset <= table_offset) + pi->pi_msix.pba_page_offset = table_offset; + else + pi->pi_msix.pba_page_offset = table_offset + + table_size - 4096; + pi->pi_msix.pba_page = mmap(NULL, 4096, PROT_READ | + PROT_WRITE, MAP_SHARED, memfd, start + + pi->pi_msix.pba_page_offset); + if (pi->pi_msix.pba_page == MAP_FAILED) { + warn( + "Failed to map PBA page for MSI-X on %d/%d/%d", + b, s, f); + return (-1); + } + } + } return (0); } @@ -622,7 +645,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) #ifndef WITHOUT_CAPSICUM cap_rights_t rights; cap_ioctl_t pci_ioctls[] = - { PCIOCREAD, PCIOCWRITE, PCIOCGETBAR, PCIOCBARIO, PCIOCBARMMAP }; + { PCIOCREAD, PCIOCWRITE, PCIOCGETBAR, PCIOCBARIO }; #endif sc = NULL; @@ -653,6 +676,21 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif + if (memfd < 0) { + memfd = open(_PATH_MEM, O_RDWR, 0); + if (memfd < 0) { + warn("failed to open %s", _PATH_MEM); + return (error); + } + } + +#ifndef WITHOUT_CAPSICUM + cap_rights_clear(&rights, CAP_IOCTL); + cap_rights_set(&rights, CAP_MMAP_RW); + if (caph_rights_limit(memfd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + #define GET_INT_CONFIG(var, name) do { \ value = get_config_value_node(nvl, name); \ if (value == NULL) { \ From nobody Sun Oct 31 19:12:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 318F018220B1; Sun, 31 Oct 2021 19:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hj5Q70WD8z3QsF; Sun, 31 Oct 2021 19:12:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E611B2350C; Sun, 31 Oct 2021 19:12:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VJCE62065424; Sun, 31 Oct 2021 19:12:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VJCEvt065423; Sun, 31 Oct 2021 19:12:14 GMT (envelope-from git) Date: Sun, 31 Oct 2021 19:12:14 GMT Message-Id: <202110311912.19VJCEvt065423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 917181dddf66 - main - net80211: add a driver-private pointer to struct ieee80211_node List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 917181dddf66a02958cf0a28e0c7c69e13e21af0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=917181dddf66a02958cf0a28e0c7c69e13e21af0 commit 917181dddf66a02958cf0a28e0c7c69e13e21af0 Author: Bjoern A. Zeeb AuthorDate: 2021-10-31 19:08:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-10-31 19:08:28 +0000 net80211: add a driver-private pointer to struct ieee80211_node Add a void *ni_drv_data field to struct ieee80211_node that drivers can use to backtrack to their internal state from a net80211 node. Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential Revision: https://reviews.freebsd.org/D30654 (abandoned) --- sys/net80211/ieee80211_node.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 07144fa0adb3..0e885440687c 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -260,6 +260,8 @@ struct ieee80211_node { /* U-APSD */ uint8_t ni_uapsd; /* U-APSD per-node flags matching WMM STA QoS Info field */ + void *ni_drv_data; /* driver specific */ + uint64_t ni_spare[3]; }; MALLOC_DECLARE(M_80211_NODE); From nobody Sun Oct 31 19:28:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 65B08182969F; Sun, 31 Oct 2021 19:28:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hj5n72VrHz3lLM; Sun, 31 Oct 2021 19:28:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 359E0234E3; Sun, 31 Oct 2021 19:28:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VJShEu080308; Sun, 31 Oct 2021 19:28:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VJShaJ080307; Sun, 31 Oct 2021 19:28:43 GMT (envelope-from git) Date: Sun, 31 Oct 2021 19:28:43 GMT Message-Id: <202110311928.19VJShaJ080307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: cbd82a22eb0c - stable/13 - config(5): Update upper limit for maxusers on 64-bit systems List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cbd82a22eb0cfd32889e7ddd74fa8b0edf1adf19 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=cbd82a22eb0cfd32889e7ddd74fa8b0edf1adf19 commit cbd82a22eb0cfd32889e7ddd74fa8b0edf1adf19 Author: Felix Johnson AuthorDate: 2021-10-28 18:15:08 +0000 Commit: Guangyuan Yang CommitDate: 2021-10-31 19:27:20 +0000 config(5): Update upper limit for maxusers on 64-bit systems The limit of 384 maxusers for auto configuration was only imposed on 32-bit systems. Document that maxusers scales above 384 based on memory for 64-bit systems. PR: 204938 Reported by: David Höppner <0xffea@gmail.com> (cherry picked from commit 191c624d9519a2767801de390b192ee7a96b41cd) --- usr.sbin/config/config.5 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index 9b26326ea862..15f92ea735ef 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 9, 2020 +.Dd October 28, 2021 .Dt CONFIG 5 .Os .Sh NAME @@ -329,7 +329,9 @@ A value of 0 indicates that the kernel should configure its data structures according to the size of available physical memory. If auto configuration is requested, the kernel will set -this tunable to a value between 32 and 384. +this tunable to a value between 32 and 384 for 32-bit systems, +or scale the value higher based on available memory for 64-bit +systems. .Pp As explained in .Xr tuning 7 , From nobody Sun Oct 31 19:29:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 159C618299E8; Sun, 31 Oct 2021 19:29: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hj5pZ4f99z3lkM; Sun, 31 Oct 2021 19:29:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 810DD23473; Sun, 31 Oct 2021 19:29:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VJTw0X080508; Sun, 31 Oct 2021 19:29:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VJTwLe080507; Sun, 31 Oct 2021 19:29:58 GMT (envelope-from git) Date: Sun, 31 Oct 2021 19:29:58 GMT Message-Id: <202110311929.19VJTwLe080507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 49f3ad056e34 - stable/13 - Makefile.inc1: Remove mentions of removed target "update" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 49f3ad056e34c73e969ddb072c650da0f4d4e6da Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=49f3ad056e34c73e969ddb072c650da0f4d4e6da commit 49f3ad056e34c73e969ddb072c650da0f4d4e6da Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-10-24 19:03:22 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-10-31 19:29:51 +0000 Makefile.inc1: Remove mentions of removed target "update" This is follow-up to commits e290182bcf38 and 1f7d11e636ab. (cherry picked from commit eab5358b90804669681b639f76ff7e5707e27138) --- Makefile.inc1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 66a4c4bf316b..4fa955779c1f 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -43,7 +43,6 @@ # installworld- install everything built by "buildworld" # checkworld - run test suite on installed world # doxygen - build API documentation of the kernel -# update - convenient way to update your source tree (eg: svn/svnup) # # Standard targets (not defined here) are documented in the makefiles in # /usr/share/mk. These include: From nobody Sun Oct 31 20:41:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F5781823569; Sun, 31 Oct 2021 20:41:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hj7PX6w15z4bnF; Sun, 31 Oct 2021 20:41:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CEB1724843; Sun, 31 Oct 2021 20:41:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VKfq9I085623; Sun, 31 Oct 2021 20:41:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VKfqP5085622; Sun, 31 Oct 2021 20:41:52 GMT (envelope-from git) Date: Sun, 31 Oct 2021 20:41:52 GMT Message-Id: <202110312041.19VKfqP5085622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 627d5d19664f - main - geli: eli data -> eli_data for consistency with other geom classes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 627d5d19664f8a7fc4c9c952ac4b15f8c9f29e95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=627d5d19664f8a7fc4c9c952ac4b15f8c9f29e95 commit 627d5d19664f8a7fc4c9c952ac4b15f8c9f29e95 Author: Mateusz Guzik AuthorDate: 2021-10-31 20:36:51 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-31 20:36:51 +0000 geli: eli data -> eli_data for consistency with other geom classes PR: 259392 Reported by: dewayne@heuristicsystems.com.au MFC after: 1 week --- sys/geom/eli/g_eli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index c2fdb70980c0..095d5cd2c274 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); FEATURE(geom_eli, "GEOM crypto module"); -MALLOC_DEFINE(M_ELI, "eli data", "GEOM_ELI Data"); +MALLOC_DEFINE(M_ELI, "eli_data", "GEOM_ELI Data"); SYSCTL_DECL(_kern_geom); SYSCTL_NODE(_kern_geom, OID_AUTO, eli, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, From nobody Sun Oct 31 23:35:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 988B21830E58; Sun, 31 Oct 2021 23:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjCFm3rj5z3pHL; Sun, 31 Oct 2021 23:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5C41B26C23; Sun, 31 Oct 2021 23:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19VNZOE5012012; Sun, 31 Oct 2021 23:35:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19VNZO2M012011; Sun, 31 Oct 2021 23:35:24 GMT (envelope-from git) Date: Sun, 31 Oct 2021 23:35:24 GMT Message-Id: <202110312335.19VNZO2M012011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d5d2ce1c8550 - main - nfscl: Do pNFS layout return_on_close synchronously List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5d2ce1c8550a41e7374893ccd864c172461221f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d5d2ce1c8550a41e7374893ccd864c172461221f commit d5d2ce1c8550a41e7374893ccd864c172461221f Author: Rick Macklem AuthorDate: 2021-10-31 23:31:31 +0000 Commit: Rick Macklem CommitDate: 2021-10-31 23:31:31 +0000 nfscl: Do pNFS layout return_on_close synchronously For pNFS servers that specify that Layouts are to be returned upon close, they may expect that LayoutReturn to happen before the associated Close. This patch modifies the NFSv4.1/4.2 pNFS client so that this is done. This only affects a pNFS mount against a non-FreeBSD NFSv4.1/4.2 server that specifies return_on_close in LayoutGet replies. Found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfs/nfsclstate.h | 1 + sys/fs/nfsclient/nfs_clstate.c | 63 ++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/sys/fs/nfs/nfsclstate.h b/sys/fs/nfs/nfsclstate.h index 898a7de391dc..03400a2cdea5 100644 --- a/sys/fs/nfs/nfsclstate.h +++ b/sys/fs/nfs/nfsclstate.h @@ -273,6 +273,7 @@ struct nfscllayout { #define NFSLY_RETONCLOSE 0x0080 #define NFSLY_WRITTEN 0x0100 /* Has been used to write to a DS. */ #define NFSLY_FLEXFILE 0x0200 +#define NFSLY_RETURNED 0x0400 /* * Flex file layout mirror specific stuff for nfsclflayout. diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 549d2f8ff538..523cc59039af 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -127,7 +127,7 @@ static struct nfsclclient *nfscl_getclntsess(uint8_t *); static struct nfscldeleg *nfscl_finddeleg(struct nfsclclient *, u_int8_t *, int); static void nfscl_retoncloselayout(vnode_t, struct nfsclclient *, uint8_t *, - int, struct nfsclrecalllayout **); + int, struct nfsclrecalllayout **, struct nfscllayout **); static void nfscl_reldevinfo_locked(struct nfscldevinfo *); static struct nfscllayout *nfscl_findlayout(struct nfsclclient *, u_int8_t *, int); @@ -2934,7 +2934,8 @@ tryagain2: while (lyp != NULL) { nlyp = TAILQ_PREV(lyp, nfscllayouthead, nfsly_list); if (lyp->nfsly_timestamp < NFSD_MONOSEC && - (lyp->nfsly_flags & NFSLY_RECALL) == 0 && + (lyp->nfsly_flags & (NFSLY_RECALL | + NFSLY_RETONCLOSE)) == 0 && lyp->nfsly_lock.nfslock_usecnt == 0 && lyp->nfsly_lock.nfslock_lock == 0) { NFSCL_DEBUG(4, "ret stale lay=%d\n", @@ -2969,7 +2970,13 @@ tryagain2: TAILQ_REMOVE(&rlh, lyp, nfsly_list); NFSCL_DEBUG(4, "ret layout\n"); nfscl_layoutreturn(clp->nfsc_nmp, lyp, cred, p); - nfscl_freelayout(lyp); + if ((lyp->nfsly_flags & NFSLY_RETONCLOSE) != 0) { + NFSLOCKCLSTATE(); + lyp->nfsly_flags |= NFSLY_RETURNED; + wakeup(lyp); + NFSUNLOCKCLSTATE(); + } else + nfscl_freelayout(lyp); } /* @@ -3334,6 +3341,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) struct nfscldeleg *dp; struct nfsfh *nfhp; struct nfsclrecalllayout *recallp; + struct nfscllayout *lyp; int error; error = nfscl_getcl(vp->v_mount, NULL, NULL, false, true, &clp); @@ -3363,7 +3371,8 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) } /* Return any layouts marked return on close. */ - nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp); + nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp, + &lyp); /* Now process the opens against the server. */ LIST_INIT(&delayed); @@ -3394,6 +3403,20 @@ lookformore: } } nfscl_clrelease(clp); + + /* Now, wait for any layout that is returned upon close. */ + if (lyp != NULL) { + while ((lyp->nfsly_flags & NFSLY_RETURNED) == 0) { + if (NFSCL_FORCEDISM(nmp->nm_mountp)) { + lyp = NULL; + break; + } + msleep(lyp, NFSCLSTATEMUTEXPTR, PZERO, "nfslroc", hz); + } + if (lyp != NULL) + nfscl_freelayout(lyp); + } + NFSUNLOCKCLSTATE(); /* * recallp has been set NULL by nfscl_retoncloselayout() if it was @@ -5233,28 +5256,34 @@ nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, int fhlen, */ static void nfscl_retoncloselayout(vnode_t vp, struct nfsclclient *clp, uint8_t *fhp, - int fhlen, struct nfsclrecalllayout **recallpp) + int fhlen, struct nfsclrecalllayout **recallpp, struct nfscllayout **lypp) { struct nfscllayout *lyp; uint32_t iomode; + *lypp = NULL; if (vp->v_type != VREG || !NFSHASPNFS(VFSTONFS(vp->v_mount)) || nfscl_enablecallb == 0 || nfs_numnfscbd == 0 || (VTONFS(vp)->n_flag & NNOLAYOUT) != 0) return; lyp = nfscl_findlayout(clp, fhp, fhlen); - if (lyp != NULL && (lyp->nfsly_flags & (NFSLY_RETONCLOSE | - NFSLY_RECALL)) == NFSLY_RETONCLOSE) { - iomode = 0; - if (!LIST_EMPTY(&lyp->nfsly_flayread)) - iomode |= NFSLAYOUTIOMODE_READ; - if (!LIST_EMPTY(&lyp->nfsly_flayrw)) - iomode |= NFSLAYOUTIOMODE_RW; - (void)nfscl_layoutrecall(NFSLAYOUTRETURN_FILE, lyp, iomode, - 0, UINT64_MAX, lyp->nfsly_stateid.seqid, 0, 0, NULL, - *recallpp); - NFSCL_DEBUG(4, "retoncls recall iomode=%d\n", iomode); - *recallpp = NULL; + if (lyp != NULL && (lyp->nfsly_flags & NFSLY_RETONCLOSE) != 0) { + if ((lyp->nfsly_flags & NFSLY_RECALL) == 0) { + iomode = 0; + if (!LIST_EMPTY(&lyp->nfsly_flayread)) + iomode |= NFSLAYOUTIOMODE_READ; + if (!LIST_EMPTY(&lyp->nfsly_flayrw)) + iomode |= NFSLAYOUTIOMODE_RW; + nfscl_layoutrecall(NFSLAYOUTRETURN_FILE, lyp, iomode, + 0, UINT64_MAX, lyp->nfsly_stateid.seqid, 0, 0, NULL, + *recallpp); + NFSCL_DEBUG(4, "retoncls recall iomode=%d\n", iomode); + *recallpp = NULL; + } + + /* Now, wake up renew thread to do LayoutReturn. */ + wakeup(clp); + *lypp = lyp; } }