From owner-dev-commits-src-main@freebsd.org Sat Apr 24 10:27:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A8FD5FA125; Sat, 24 Apr 2021 10:27: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 4FS6m62zMrz4mGC; Sat, 24 Apr 2021 10:27: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 594BA1EFF1; Sat, 24 Apr 2021 10:27: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 13OARICt061645; Sat, 24 Apr 2021 10:27:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13OARIVn061644; Sat, 24 Apr 2021 10:27:18 GMT (envelope-from git) Date: Sat, 24 Apr 2021 10:27:18 GMT Message-Id: <202104241027.13OARIVn061644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: a9b66dbd9169 - main - Allow the tcp_lro_flush_all() function to be called when the control structure is zeroed, by setting the VNET after checking the mbuf count for zero. It appears there are some cases with early interrupts on some network devices which still trigger page-faults on accessing a NULL "ifp" pointer before the TCP LRO control structure has been initialized. This basically preserves the old behaviour, prior to 9ca874cf740ee68c5742df8b5f9e20910085c011 . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9b66dbd9169f102dea92ad369a09c0d20cdb41f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2021 10:27:18 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a9b66dbd9169f102dea92ad369a09c0d20cdb41f commit a9b66dbd9169f102dea92ad369a09c0d20cdb41f Author: Hans Petter Selasky AuthorDate: 2021-04-24 10:20:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-24 10:23:42 +0000 Allow the tcp_lro_flush_all() function to be called when the control structure is zeroed, by setting the VNET after checking the mbuf count for zero. It appears there are some cases with early interrupts on some network devices which still trigger page-faults on accessing a NULL "ifp" pointer before the TCP LRO control structure has been initialized. This basically preserves the old behaviour, prior to 9ca874cf740ee68c5742df8b5f9e20910085c011 . No functional change. Reported by: rscheff@ Differential Revision: https://reviews.freebsd.org/D29564 MFC after: 2 weeks Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/netinet/tcp_lro.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 61c6f218e513..09fc024c3d73 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1439,12 +1439,12 @@ tcp_lro_flush_all(struct lro_ctrl *lc) uint64_t nseq; unsigned x; - CURVNET_SET(lc->ifp->if_vnet); - /* check if no mbufs to flush */ if (lc->lro_mbuf_count == 0) goto done; + CURVNET_SET(lc->ifp->if_vnet); + /* get current time */ lc->lro_last_queue_time = getsbinuptime(); @@ -1478,13 +1478,12 @@ tcp_lro_flush_all(struct lro_ctrl *lc) lc->lro_flushed++; } } + CURVNET_RESTORE(); done: /* flush active streams */ tcp_lro_rx_done(lc); lc->lro_mbuf_count = 0; - - CURVNET_RESTORE(); } #ifdef TCPHPTS