From nobody Mon Oct 25 00:37:30 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 21:32:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:36:36 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Tue Oct 26 02:37:04 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:10 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:11 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:12 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 10:05:47 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 20:24:01 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/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 21:00:36 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Wed Oct 27 00:45:15 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:20 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:22 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 13:56:16 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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 Thu Oct 28 00:01:09 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:36:26 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/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 15:45:30 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 17:52:41 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Fri Oct 29 03:20:56 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 23:58:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:13 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:14 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:09 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:11 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:07 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:17 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:16 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:15 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:12 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:18 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:20 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:23 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:22 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:24 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 03:45:30 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:49:01 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 14:15:09 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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 Sun Oct 31 01:03:43 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 14:02:14 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/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:28:43 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 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: