From nobody Mon Jul 18 21:07:57 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lmvgf1ZMwz4X9r4; Mon, 18 Jul 2022 21:07:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lmvgf1353z3t97; Mon, 18 Jul 2022 21:07:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658178478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yGE8VELt6EycZI/mlP4Z2Bb0TXsHrGlYu+tqy5vm2ts=; b=sx1Y/E7xSl9UfDw1DjXHBaVkZaZLMrehZOf7S90nLb2trwBKQI0mb2vhIHKZPOVj/PeR0f 9eh3pg5yo54Ajyvw94mCO6Q0qUNJvu9HzSKx/rkGErwfP3+sc1noqpQdKAmIPLybXtrCPe liwJJZmlPwf29eK3Sgytf3s6+1jBIS+E/qD4fjhahC91e8707tDWoskKxs7K/pdOZYNZvi Qc12+78fcn4NDJTKctDTO8drKf93cTnUwM8H92W6gUyGVX66eJudoMzonvGXsSHJrw0L0m zCw46D/M5OShNGnukZpCstLAD/4gkUn/gU5XHO/BuKNU03nDKrPxcIBkF6Mirw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lmvgd6zNpztW8; Mon, 18 Jul 2022 21:07:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26IL7v7G066706; Mon, 18 Jul 2022 21:07:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26IL7vOM066705; Mon, 18 Jul 2022 21:07:57 GMT (envelope-from git) Date: Mon, 18 Jul 2022 21:07:57 GMT Message-Id: <202207182107.26IL7vOM066705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 3ca4a3390356 - main - bge: tell debugnet there are 2 rx rings, not 1,024 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ca4a3390356d72ae4f3be9400b23c52279694e6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658178478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yGE8VELt6EycZI/mlP4Z2Bb0TXsHrGlYu+tqy5vm2ts=; b=D/oR/ko6PSe1XSeSAhxgUfowAuvyJTAHDKRSJB5MYddRmnXYHjLRmyQgtlH1aZnVbtQh+V pFFI0aqitwnbqU/RfB9RXu+zQMI3EDsPKnvkXE0l9IctWH4SKZ7JAsodaEVL3GoqeAlPHV bcnFZAx16roUv3w7KU9/hTe3V7erF+cIm5jUbf1U9JU9PFiv+jJdYOOakekcFIPX01hiwh GQINoK3y/HBXAM82pqFTfd8P14Ng0Awi8FVL0GrqKQhAMECbGKslxpvGs5NRuMq8UcCki5 mUPNqLBoCW5Zl5fe2QvlXF6L0rfP4SgRur7ieblcZxyUI3mI0gXbtFkgmfOPqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658178478; a=rsa-sha256; cv=none; b=o/H4gIER/GAiz1wj4wuINXO/tOYAeVGng9VLx2coN2uqgYD/NLFDyALZ35qhIdFP2BpJsG +I/XHF6kTZcKWtCmKs9AqPYB4hphRyuZvihLl4STm/izjYthOngLE14JdfDhS6VNn8/XJk Ow7XBIT4/Oqz1bweR/+V6TMyNH2r93jyMVyL3B3c0Ban6X4Hhi0Jd9zktBElF1E8QWNyrs H/0sFLmM1G/12BH/FWtfKzQXacv8xjPgjf0YF7/dnaVwO/PohDpR+eD+nRXk/wKADmkmli HkP56Nk2t1jyqP3Y6XXeNTatYnV9TkmxgbCHIv2MiOZWNwMjc02ARXvYTuh4Qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=3ca4a3390356d72ae4f3be9400b23c52279694e6 commit 3ca4a3390356d72ae4f3be9400b23c52279694e6 Author: Eric van Gyzen AuthorDate: 2022-07-18 18:07:20 +0000 Commit: Eric van Gyzen CommitDate: 2022-07-18 21:05:18 +0000 bge: tell debugnet there are 2 rx rings, not 1,024 debugnet provides the network stack for netgdb and netdump. Since it must operate under panic/debugger conditions and can't rely on dynamic memory allocation, it preallocates mbufs during boot or network configuration. At that time, it does not yet know which interface will be used for debugging, so it does not know the required size and quantity of mbufs to allocate. It takes the worst-case approach by calculating its requirements from the largest MTU and largest number of receive queues across all interfaces that support debugnet. Unfortunately, the bge NIC driver told debugnet that it supports 1,024 receive queues. It actually supports only 2 queues (with 1,024 slots, thus the error). This greatly exaggerated debugnet's preallocation, so with an MTU of 9000 on any interface, it allocated 600 MB of memory. A tiny fraction of this memory would be used if netgdb or netdump were invoked; the rest is completely wasted. Reviewed by: markj, rlibby MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D35845 --- sys/dev/bge/if_bge.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index ef1674783441..7133e1b7d002 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -6781,7 +6781,14 @@ bge_debugnet_init(if_t ifp, int *nrxr, int *ncl, int *clsize) sc = if_getsoftc(ifp); BGE_LOCK(sc); - *nrxr = sc->bge_return_ring_cnt; + /* + * There is only one logical receive ring, but it is backed + * by two actual rings, for cluster- and jumbo-sized mbufs. + * Debugnet expects only one size, so if jumbo is in use, + * this says we have two rings of jumbo mbufs, but that's + * only a little wasteful. + */ + *nrxr = 2; *ncl = DEBUGNET_MAX_IN_FLIGHT; if ((sc->bge_flags & BGE_FLAG_JUMBO_STD) != 0 && (if_getmtu(sc->bge_ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN +