From owner-svn-src-head@freebsd.org Tue Sep 29 20:46:25 2020 Return-Path: Delivered-To: svn-src-head@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 CF9A942FEB4; Tue, 29 Sep 2020 20:46:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1BJ156V3z4Fcb; Tue, 29 Sep 2020 20:46:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93800149D6; Tue, 29 Sep 2020 20:46:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08TKkPaX090234; Tue, 29 Sep 2020 20:46:25 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08TKkPMm090233; Tue, 29 Sep 2020 20:46:25 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202009292046.08TKkPMm090233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 29 Sep 2020 20:46:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366268 - head/sys/dev/rtwn/usb X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/dev/rtwn/usb X-SVN-Commit-Revision: 366268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2020 20:46:25 -0000 Author: bz Date: Tue Sep 29 20:46:25 2020 New Revision: 366268 URL: https://svnweb.freebsd.org/changeset/base/366268 Log: rtwn: narrow the epoch area Rather than placing the epoch around the entire receive loop which might call into rtwn_rx_frame() and USB and sleep, split the loop into two[1] and leave us with one unlock/lock cycle as well. PR: 249925 Reported by: thj, (rkoberman gmail.com) Tested by: thj Suggested by: adrian [1] Reviewed by: adrian MFC after: 3 days Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host) Differential Revision: https://reviews.freebsd.org/D26554 Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:29:07 2020 (r366267) +++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:46:25 2020 (r366268) @@ -368,7 +368,7 @@ rtwn_bulk_rx_callback(struct usb_xfer *xfer, usb_error struct rtwn_softc *sc = &uc->uc_sc; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_node *ni; - struct mbuf *m = NULL, *next; + struct mbuf *m0, *m = NULL, *next; struct rtwn_data *data; RTWN_ASSERT_LOCKED(sc); @@ -400,24 +400,30 @@ tr_setup: * ieee80211_input() because here is at the end of a USB * callback and safe to unlock. */ + m0 = m; + while (m != NULL) { + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_loc.ptr = rtwn_rx_frame(sc, m); + m = m->m_nextpkt; + } NET_EPOCH_ENTER(et); + RTWN_UNLOCK(sc); + m = m0; while (m != NULL) { next = m->m_nextpkt; m->m_nextpkt = NULL; - ni = rtwn_rx_frame(sc, m); - - RTWN_UNLOCK(sc); - + ni = m->m_pkthdr.PH_loc.ptr; + m->m_pkthdr.PH_loc.ptr = NULL; if (ni != NULL) { (void)ieee80211_input_mimo(ni, m); ieee80211_free_node(ni); } else { (void)ieee80211_input_mimo_all(ic, m); } - RTWN_LOCK(sc); m = next; } + RTWN_LOCK(sc); NET_EPOCH_EXIT(et); break; default: