From nobody Thu Feb 23 06:28:53 2023 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 4PMjlq3hfnz3t3sJ; Thu, 23 Feb 2023 06:28:55 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from glebi.us (glebi.us [162.251.186.162]) by mx1.freebsd.org (Postfix) with ESMTP id 4PMjlp3FFsz3GMD; Thu, 23 Feb 2023 06:28:54 +0000 (UTC) (envelope-from glebius@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=softfail (mx1.freebsd.org: 162.251.186.162 is neither permitted nor denied by domain of glebius@freebsd.org) smtp.mailfrom=glebius@freebsd.org; dmarc=none Received: by glebi.us (Postfix, from userid 1000) id 3FD5D3B026; Wed, 22 Feb 2023 22:28:53 -0800 (PST) Date: Wed, 22 Feb 2023 22:28:53 -0800 From: Gleb Smirnoff To: Rick Macklem Cc: Rick Macklem , bz@freebsd.org, jamie@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ef6fcc5e2b07 - main - nfsd: Add VNET_SYSUNINIT() macros for vnet cleanup Message-ID: References: <202302202112.31KLCfQB080359@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: X-Spamd-Result: default: False [0.50 / 15.00]; VIOLATED_DIRECT_SPF(3.50)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_TO(0.00)[gmail.com]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[glebius]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TAGGED_RCPT(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4PMjlp3FFsz3GMD X-Spamd-Bar: / X-ThisMailContainsUnwantedMimeParts: N Rick, On Tue, Feb 21, 2023 at 07:29:30PM -0800, Rick Macklem wrote: R> I did that for one of the ones related to nfsd (sys/fs/nfsserver/nfs_fha_new.c). This one actually doesn't look correct to me. What happens here is that the sysctls will affect only the default VNET. I think the VNET-itezation of this file went a bit wrong. You don't need to convert static structures to malloced when you VNET-ize a module. The infrastructure should take care of memory management. The dynamic sysctl context seems to be unneeded from the very beginning. It was always attached to the static softc. Suggested patch: https://reviews.freebsd.org/D38742 It gets rid of one case of IS_DEFAULT_VNET. Tested very little: run two jails and observed difference in sysctl. R> It so happens it doesn't work for this case. If you look at the patch, you'll R> see that the variable is vnet'd. It happens that it is only malloc'd for prisons R> other than prison0. (For prison0, it points to a global structure that is not R> malloc'd and is shared with the NFS client, which is not vnet'd. I think all of this instances can be fixed. For example nfsstatsv1, which is now malloced for non-default vnets and static for the default. Lots of modules still incorrectly update the global one. This patch makes it right: https://reviews.freebsd.org/D38743 Tested very little: run two jails, use some NFS, observe difference in nfsstat. Removes another IS_DEFAULT_VNET. Note that D38743 is still far from perfect. NFS would benefit a lot if used macros for per-VNET per-CPU (raceless!) stats, that are used in TCP/IP. Sorry, they aren't documented :( You can find them in vnet.h starting from VNET_PCPUSTAT_DECLARE() and look for example usage in TCP/IP. Please fill free to commandeer those reviews from me and finalize them if you agree with general idea. -- Gleb Smirnoff