From owner-svn-src-all@freebsd.org Mon Feb 3 23:25:12 2020 Return-Path: Delivered-To: svn-src-all@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 DA660232D1A; Mon, 3 Feb 2020 23:25:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) 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 48BP7X5VTJz4JD9; Mon, 3 Feb 2020 23:25:12 +0000 (UTC) (envelope-from np@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 B7E4E8713; Mon, 3 Feb 2020 23:25:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 013NPCqE017212; Mon, 3 Feb 2020 23:25:12 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 013NPCfO017211; Mon, 3 Feb 2020 23:25:12 GMT (envelope-from np@FreeBSD.org) Message-Id: <202002032325.013NPCfO017211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 3 Feb 2020 23:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357475 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 357475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2020 23:25:12 -0000 Author: np Date: Mon Feb 3 23:25:12 2020 New Revision: 357475 URL: https://svnweb.freebsd.org/changeset/base/357475 Log: cxgbe(4): Initialize the rx buffer's metadata on first-use and not on allocation. refill_fl doesn't touch any part of a freshly allocated cluster after this change. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Mon Feb 3 23:06:42 2020 (r357474) +++ head/sys/dev/cxgbe/adapter.h Mon Feb 3 23:25:12 2020 (r357475) @@ -327,7 +327,6 @@ struct cluster_layout { struct cluster_metadata { u_int refcount; - struct fl_sdesc *sd; /* For debug only. Could easily be stale */ }; struct fl_sdesc { Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:06:42 2020 (r357474) +++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:25:12 2020 (r357475) @@ -1872,11 +1872,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl fr_offset == 0 ? M_PKTHDR | M_NOFREE : M_NOFREE)) return (NULL); fl->mbuf_inlined++; + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + counter_u64_add(extfree_refs, 1); + } m_extaddref(m, payload, blen, &clm->refcount, rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); - } else { /* @@ -1890,10 +1891,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl return (NULL); fl->mbuf_allocated++; if (clm != NULL) { + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + counter_u64_add(extfree_refs, 1); + } m_extaddref(m, payload, blen, &clm->refcount, rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */ @@ -4401,7 +4404,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n if (clm != NULL) MPASS(clm->refcount == 1); #endif - goto recycled_fast; + goto recycled; } /* @@ -4440,16 +4443,8 @@ alloc: sd->cl = cl; sd->cll = *cll; *d = htobe64(pa | cll->hwidx); - clm = cl_metadata(sc, fl, cll, cl); - if (clm != NULL) { recycled: -#ifdef INVARIANTS - clm->sd = sd; -#endif - clm->refcount = 1; - } sd->nmbuf = 0; -recycled_fast: d++; sd++; if (__predict_false(++fl->pidx % 8 == 0)) {