From nobody Tue Oct 19 21:27:16 2021 X-Original-To: dev-commits-src-main@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 B67B117EE25F; Tue, 19 Oct 2021 21:27:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4HYmzq301lz3N5q; Tue, 19 Oct 2021 21:27:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 19JLRGfB041640 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 20 Oct 2021 00:27:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 19JLRGfB041640 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 19JLRGQC041639; Wed, 20 Oct 2021 00:27:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 20 Oct 2021 00:27:16 +0300 From: Konstantin Belousov To: John Baldwin Cc: Cy Schubert , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 7ae879b14a20 - main - kern_procctl(): convert the function to be table-driven Message-ID: References: <202110192004.19JK4jN3069844@gitrepo.freebsd.org> <202110192035.19JKZDqM026085@slippy.cwsent.com> <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org> <202110192051.19JKpV66059807@slippy.cwsent.com> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HYmzq301lz3N5q X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, Oct 19, 2021 at 02:04:15PM -0700, John Baldwin wrote: > On 10/19/21 1:51 PM, Cy Schubert wrote: > > In message <91ebf9d8-5547-8570-18cb-26a58baf89ba@FreeBSD.org>, John Baldwin > > wri > > tes: > > > On 10/19/21 1:35 PM, Cy Schubert wrote: > > > > In message <202110192004.19JK4jN3069844@gitrepo.freebsd.org>, Konstantin > > > > Belous > > > > ov writes: > > > > > The branch main has been updated by kib: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d > > > 3a0 > > > > > 72e08bc6 > > > > > > > > > > commit 7ae879b14a2086df521c59c4a379d3a072e08bc6 > > > > > Author: Konstantin Belousov > > > > > AuthorDate: 2021-10-15 18:57:17 +0000 > > > > > Commit: Konstantin Belousov > > > > > CommitDate: 2021-10-19 20:04:34 +0000 > > > > > > > > > > kern_procctl(): convert the function to be table-driven > > > > > Reviewed by: emaste, markj > > > > > Sponsored by: The FreeBSD Foundation > > > > > MFC after: 1 week > > > > > Differential revision: https://reviews.freebsd.org/D32513 > > > > > --- > > > > > sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++--------------- > > > ---- > > > > > -- > > > > > 1 file changed, 69 insertions(+), 54 deletions(-) > > > > > > > > > > diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c > > > > > index eb36f0822938..90c5e63c7219 100644 > > > > > --- a/sys/kern/kern_procctl.c > > > > > +++ b/sys/kern/kern_procctl.c > > > > > @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t > > > id > > > > > , int com, void *data) > > > > > error = EINVAL; > > > > > break; > > > > > } > > > > > - if (tree_locked) > > > > > - sx_unlock(&proctree_lock); > > > > > + > > > > > + switch (cmd_info->lock_tree) { > > > > > + case SA_XLOCKED: > > > > > + sx_xunlock(&proctree_lock); > > > > > + break; > > > > > + case SA_SLOCKED: > > > > > + sx_sunlock(&proctree_lock); > > > > > + break; > > > > > + } > > > > > return (error); > > > > > } > > > > > > > > > > > > > Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas > > > > LA_* in sys/lock.h has no such requirement. > > > > > > Both are for "assertions". The LA_* constants aren't really public but are > > > the values used for witness_assert() that various foo_assert() routines in > > > locking APIs (mtx_assert/sx_assert, etc.) can use. For locking APIs, the > > > type-specific macros are the ones you use, e.g. SA_* with sx_assert(). > > > > > > Given that, SA_* is the closest match here. > > > > We'll need some #ifdefs for non-INVARIANTS built kernels, as it stands > > buildkernel is broken. > > So it is helpeful if your e-mail starts with "the build is broken". :) > > That said, I think the issue is that SA_* (and LA_*) have to date only been > used for assertions and are thus only relevant when INVARIANTS is defined. > It's probably simplest to just expose SA_* always if that is what is > needed. Should be fixed by c7f38a2df1f0.