From nobody Fri Jul 23 05:49:45 2021 X-Original-To: freebsd-hackers@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 6F22712ACF61 for ; Fri, 23 Jul 2021 05:50:21 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (midget.dons.net.au [IPv6:2403:5800:5101:0:225:90ff:fe47:39b4]) (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 ECDSA (P-384) client-digest SHA384) (Client CN "dons.net.au", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GWJLw2sk8z4Y59 for ; Fri, 23 Jul 2021 05:50:15 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (localhost [127.0.0.1]) by midget.dons.net.au (8.16.1/8.16.1) with ESMTPS id 16N5nwmZ047851 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Fri, 23 Jul 2021 15:20:03 +0930 (ACST) (envelope-from darius@dons.net.au) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dons.net.au; s=default; t=1627019406; bh=A5vAISuLpVeo1flPT5+BPSFSog7Zr3WYO9yCJhgeCfU=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=HtZrao8JRX3O2H0uRkUQI5Pvbd+oHHJXwjiu/XpefwRtYUP0YasDE1D7SfAlcmDSP qEflxEBRF4oJmaqqxLjstl3L66NHkDcRXwV7nnrpHkQGs8n0zEdbBTNMOXSfJSqII5 epf78qL++1YcaW6GKsCkAUmUPCn4YnqGmMepKO4k= Received: (from mailnull@localhost) by midget.dons.net.au (8.16.1/8.16.1/Submit) id 16N5njDW047842 for ; Fri, 23 Jul 2021 15:19:45 +0930 (ACST) (envelope-from darius@dons.net.au) X-MIMEDefang-Relay-f0f0b4ff001831caa5b8ac39868c4c7e9b4d12fc: 2403:5800:5101:0:1514:a92f:cf1e:2561 Received: from smtpclient.apple ([IPv6:2403:5800:5101:0:1514:a92f:cf1e:2561] [2403:5800:5101:0:1514:a92f:cf1e:2561]) by midget.dons.net.au (envelope-sender ) (MIMEDefang) with ESMTP id 16N5njgo047836; Fri, 23 Jul 2021 15:19:45 +0930 Content-Type: text/plain; charset=us-ascii List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: a730d82378d3 - main - tcp: fix RACK and BBR when using VIMAGE enabled kernel In-Reply-To: <20210720105238.1341472c@x23> Date: Fri, 23 Jul 2021 15:19:45 +0930 Cc: "Daniel O'Connor via freebsd-hackers" , Michael Tuexen Content-Transfer-Encoding: quoted-printable Message-Id: <4ED18100-AE72-409E-B5AA-C839B920804F@dons.net.au> References: <202107192233.16JMX0k4044018@gitrepo.freebsd.org> <20210720105238.1341472c@x23> To: Marko Zec X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Spam-Score: -1 () No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.4 X-Scanned-By: MIMEDefang 2.83 on 10.0.2.1 X-Rspamd-Queue-Id: 4GWJLw2sk8z4Y59 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=dons.net.au header.s=default header.b=HtZrao8J; dmarc=pass (policy=quarantine) header.from=dons.net.au; spf=pass (mx1.freebsd.org: domain of darius@dons.net.au designates 2403:5800:5101:0:225:90ff:fe47:39b4 as permitted sender) smtp.mailfrom=darius@dons.net.au X-Spamd-Result: default: False [-1.43 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2403:5800:5101:0:225:90ff:fe47:39b4:from]; R_DKIM_ALLOW(-0.20)[dons.net.au:s=default]; NEURAL_HAM_MEDIUM(-0.93)[-0.925]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_SPAM_SHORT(1.00)[0.997]; SPAMHAUS_ZRD(0.00)[2403:5800:5101:0:225:90ff:fe47:39b4:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[dons.net.au:+]; DMARC_POLICY_ALLOW(-0.50)[dons.net.au,quarantine]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:4764, ipnet:2403:5800:5000::/36, country:AU]; MID_RHS_MATCH_FROM(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] Reply-To: darius@dons.net.au From: Daniel O'Connor via freebsd-hackers X-Original-From: Daniel O'Connor X-ThisMailContainsUnwantedMimeParts: N > On 20 Jul 2021, at 18:22, Marko Zec wrote: >=20 > On Tue, 20 Jul 2021 10:29:30 +0930 > Daniel O'Connor via freebsd-hackers = wrote: >>=20 >> Not to pick on this particular commit, but does anyone know why >> CURVNET_RESTORE os not defined such that it doesn't require wrapping >> with {}? >=20 > True, the body of CURVNET_RESTORE() macro could be redefined so that = it > gets enclosed in a do {...} while (0) block, most probably without any > ill side-effects. >=20 > One reason it was never defined in such manner is that CURVNET_ macros > were never intended to be invoked conditionally, which is also clearly > documented in VNET(9) . The other reason is my clumsiness... OK understood. I didn't even think to look for a man page, sorry! One nit pick about the man page is that 'man 9 VNET' doesn't work, you = need 'man 9 vnet'. >> Looking through vnet.h I see that VNET_ASSERT, >> VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG, and >> VNET_GLOBAL_EVENTHANDLER_REGISTER have a do { } while(0) wrapper but >> CURVNET_SET_QUIET, CURVNET_SET_VERBOSE, CURVNET_RESTORE, >> VNET_SYSINIT, and VNET_SYSUNINIT don't. >=20 > CURVNET_SET macros cannot be wrapped in a separate block because they > declare a local variable which must be visible / available to the > corresponding CURVNET_RESTORE(s). Ahh right, obviously I didn't read the code very deeply :) > In this particular case, i.e. inside ctf_process_inbound_raw(), the > rule that CURVNET_SET() must not be conditionally called seems to be > circumvented by a local hack, in an attempt to handle a case when > VNET cannot be inferred from m->m_pkthdr->rcvif->if_vnet, when m =3D=3D > NULL. >=20 > Given that a non-NULL struct socket *so seem to be available as an > argument to ctf_process_inbound_raw(), perhaps it could be possible to > remove the if (no_vn =3D=3D 0) hack, and instead to unconditionally = invoke > CURVNET_SET(so->so_vnet) on entry to ctf_process_inbound_raw()? Thanks for the detailed explanation, much appreciated. -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum