Date: Sun, 14 Aug 2022 16:20:24 +0100 From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: Kyle Evans <kevans@FreeBSD.org> Cc: "Alexander V. Chernikov" <melifaro@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9b967bd65de6 - main - domains: allow domains to be unloaded Message-ID: <C47B4A85-2A43-45EB-85E5-1FC48CC3EF08@ipfw.ru> In-Reply-To: <CACNAnaGUc-c8ohwT4mNVvHmBeCG14NTLQW4AP7bJXfsSMdaBvA@mail.gmail.com> References: <202208140922.27E9Mewk097766@gitrepo.freebsd.org> <CACNAnaGUc-c8ohwT4mNVvHmBeCG14NTLQW4AP7bJXfsSMdaBvA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 14 Aug 2022, at 15:51, Kyle Evans <kevans@FreeBSD.org> wrote: >=20 > On Sun, Aug 14, 2022 at 2:22 AM Alexander V. Chernikov > <melifaro@freebsd.org> wrote: >>=20 >> The branch main has been updated by melifaro: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D9b967bd65de6647aed68a141dc34f9b2= 23a2593c >>=20 >> commit 9b967bd65de6647aed68a141dc34f9b223a2593c >> Author: Alexander V. Chernikov <melifaro@FreeBSD.org> >> AuthorDate: 2022-08-12 13:36:53 +0000 >> Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> >> CommitDate: 2022-08-14 09:22:33 +0000 >>=20 >> domains: allow domains to be unloaded >>=20 >> Add domain_remove() SYSUNINT callback that removes the domain >> from the domain list if it has DOMF_UNLOADABLE flag set. >> This change is required to support netlink ( D36002 ). >>=20 >> Reviewed by: glebius >> Differential Revision: https://reviews.freebsd.org/D36173 >> --- >> sys/kern/uipc_domain.c | 23 +++++++++++++++++++++++ >> sys/sys/domain.h | 4 ++++ >> 2 files changed, 27 insertions(+) >>=20 >> diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c >> index c70b3150cbf0..2cae08be089a 100644 >> --- a/sys/kern/uipc_domain.c >> +++ b/sys/kern/uipc_domain.c >> @@ -239,6 +239,29 @@ domain_add(void *data) >> mtx_unlock(&dom_mtx); >> } >>=20 >> +void >> +domain_remove(void *data) >> +{ >> + struct domain *dp =3D (struct domain *)data; >> + >> + if ((dp->dom_flags & DOMF_UNLOADABLE) =3D=3D 0) >> + return; >> + >> + mtx_lock(&dom_mtx); >> + if (domains =3D=3D dp) { >> + domains =3D dp->dom_next; >> + } else { >> + struct domain *curr; >> + for (curr =3D domains; curr !=3D NULL; curr =3D = curr->dom_next) { >> + if (curr->dom_next =3D=3D dp) { >> + curr->dom_next =3D dp->dom_next; >> + break; >> + } >> + } >> + } >> + mtx_unlock(&dom_mtx); >> +} >> + >> /* ARGSUSED*/ >> static void >> domaininit(void *dummy) >=20 > While it's not important for the one domain you care about, this > should likely also check if any contained protocols have > pr_fasttimo/pr_slowtimo and purge them from the appropriate list, just > to be technically correct. (Or at least assert under INVARIANTS that > they do not) That=E2=80=99s a good point! I should have provided more context in the commit message. There is some ongoing work glebius@ is doing in the domain space. Specifically, there are plans to remove this callbacks in the near = future - https://reviews.freebsd.org/D36163 stack provides more = reasoning and implementation details. Additionally, the KPI may be a bit fluid and may change in the = near/mid-term future - that=E2=80=99s why the minimal working version = was committed.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C47B4A85-2A43-45EB-85E5-1FC48CC3EF08>