From nobody Thu Feb 23 14:17:51 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 4PMw9F0JFnz3tmWh; Thu, 23 Feb 2023 14:18:09 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMw9D3lypz4LNJ; Thu, 23 Feb 2023 14:18:08 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1035.google.com with SMTP id qa18-20020a17090b4fd200b0023750b675f5so4953530pjb.3; Thu, 23 Feb 2023 06:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uqlZ69Y0aB7cu9Hp1fEOjBnwihG0MSZjIjZn3ZvOFZM=; b=Cssvqs4rIgKm65J+0XD+OTLmEVhXpUzYEUdAnsUo4hVqGD8Kez2l/BW8yTPI7uy4jm 74KKRqxw3w0i6hPBTziWIsBVrhoWgE3aUx1ghxj8itB0jnsq0Kj6yNfcHn5Muoo3ceDr zeXTL78rexiCWZMwuZXcuIV6jsCGBDRWeDj7BovZtLoARn1iUQwljSP8hX8q3/tHHsAC a5RwApV1kgiNk6XPUg0NYVHCuwls2pNxut1Gw/jGoxetT8pL3636WPOh2tjFBCK4JSpe H1WKaEBhRrORzJDRH+J4Tt9mGQNVWfF0Frikgv+G5hGRkMNp1tbWrBL7bzAhGpFCPESw kJXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uqlZ69Y0aB7cu9Hp1fEOjBnwihG0MSZjIjZn3ZvOFZM=; b=eTmPZCkrxNmikycvwfBU7b53m1cvCdxke5tieivJ5DFGckDfGUMKVSCSvhQgGlTbHB UH4tmL50JBp5C8RdzeXtfu6dZE0KBb+mb20jZQUE+rvVNgqC7MlxNTjT51EnWiyXVA2j umRgX6AUD+6c3ievXpP6Fob8p+K1EngpyblbklU3jIw6m/NZZQ6XN1xq+eQYgyoWITJK dFfyOdBrvrvK+xCyZca3OZnWcVRXgnkWMJvly+wO5XT6BNwANqoZbZeoGx6U9R40mo8p Ovrb6OgH6QqbDpL98SsJ7/QuGj4/4lX1S+fCVhniY9Q3qwXp5xHAWmVrKqI84cROejAY d7aA== X-Gm-Message-State: AO0yUKVqCtBKYzuUBd/Fia62Dj3iRsnzYzblgc7WtdJFB7V3mW3/Vj9U ofCUnJRHGo7rWxGHDu16yTcIWZUSHFX2ZmzL8g8TpQhfBwm9 X-Google-Smtp-Source: AK7set/V1ehriUvEFrHnmHmFotVu2jqv0MuOZJ3XmcBBtdftu+182kgqLYhf3zU4O8ZYx2EHVi0jgT+e6kcPJrjDQSY= X-Received: by 2002:a17:90b:4a90:b0:237:2eed:6610 with SMTP id lp16-20020a17090b4a9000b002372eed6610mr2090392pjb.4.1677161887118; Thu, 23 Feb 2023 06:18:07 -0800 (PST) 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 References: <202302202112.31KLCfQB080359@gitrepo.freebsd.org> In-Reply-To: From: Rick Macklem Date: Thu, 23 Feb 2023 06:17:51 -0800 Message-ID: Subject: Re: git: ef6fcc5e2b07 - main - nfsd: Add VNET_SYSUNINIT() macros for vnet cleanup To: Gleb Smirnoff 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4PMw9D3lypz4LNJ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Wed, Feb 22, 2023 at 10:28 PM Gleb Smirnoff wrote: > > 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 can pull the sysctls out of softc and vnet them. I will look at that to-day and should be easy to do. I'll admit I didn't bother, since they are basically of little use, only affect NFSv3 and, yes, I was being lazy. The sysctls in the krpc pool are another story. Not easy to move out of the pool, so I think they are going to be prison0 only for a long time. They probably are rarely used (I didn't code the krpc), so I think having them only on prison0 is ok. The ones people might set (that control how many nfsd threads are generated) can be set in the prisons using the command line options on nfsd(8), so the sysctls are not needed in this case. rick > 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