Date: Wed, 12 Aug 2009 17:57:35 -0700 From: Julian Elischer <julian@elischer.org> To: Marko Zec <zec@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org>, Robert Watson <rwatson@freebsd.org> Subject: Re: PERFORCE change 167260 for review Message-ID: <4A8364FF.2010605@elischer.org> In-Reply-To: <4A835CBE.4060903@elischer.org> References: <200908122108.n7CL8uhJ058398@repoman.freebsd.org> <200908130034.57133.zec@freebsd.org> <4A8345E1.1070301@elischer.org> <200908130052.11423.zec@freebsd.org> <4A835CBE.4060903@elischer.org>
index | next in thread | previous in thread | raw e-mail
Julian Elischer wrote:
ok I think I have worked it out.
>
> AND for example:
> in ./netinet/in_proto.c
> VNET_DOMAIN_SET(inet);
> includes
> VNET_SYSINIT ##### --> called for every vnet as created #### (dubious)
##### --> and existing vnets.....on load
> calls
> vnet_domain_init()
> calls
> domain_init()
> calls
> protosw_init()
> which includes
> if (pr->pr_init)
> (*pr->pr_init)();
>
> so, robert is calling the init routine from each protocol
> not the modevent.
but you now do:
pf_proto_register(int family, struct protosw *npr)
{
+ VNET_ITERATOR_DECL(vnet_iter);
struct domain *dp;
struct protosw *pr, *fpr;
@@ -391,7 +392,13 @@
mtx_unlock(&dom_mtx);
/* Initialize and activate the protocol. */
- protosw_init(fpr);
+ VNET_LIST_RLOCK();
+ VNET_FOREACH(vnet_iter) {
+ CURVNET_SET_QUIET(vnet_iter);
+ protosw_init(fpr);
+ CURVNET_RESTORE();
+ }
+ VNET_LIST_RUNLOCK();
but that only dets called for existing domains at load time.
so, who calls protosw_init on new domains? Robert does, and you don't.
so there is no duplication. by design or luck...
if we load a new domain (like netgraph sockets) then we need to just
call the domain stuff which will get called every time a new
vnet is made via VNET_SYSINIT and the module code does nothing.
however I'm not totally convinced about running the
domain code N times...
the following code has references to dom_init calls
./kern/uipc_usrreq.c: .dom_init = unp_init,
./netipsec/keysock.c: .dom_init = key_init0,
./netnatm/natm_proto.c: .dom_init = natm_init,
Of these only natm looks like it will go wierd if called multiple times..
I'd like to add a protocol flag that we set on protocols that it was
ok to call the inti routine for on non-default vnets.
3rd party domains wouldn't ever have it set.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A8364FF.2010605>
