From owner-p4-projects@FreeBSD.ORG Thu Aug 13 00:57:37 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BCD701065678; Thu, 13 Aug 2009 00:57:36 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C3BB1065675 for ; Thu, 13 Aug 2009 00:57:36 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outX.internet-mail-service.net (outx.internet-mail-service.net [216.240.47.247]) by mx1.freebsd.org (Postfix) with ESMTP id 6010D8FC4F for ; Thu, 13 Aug 2009 00:57:36 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 26278A1EA7; Wed, 12 Aug 2009 17:57:36 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id A0FB02D6011; Wed, 12 Aug 2009 17:57:35 -0700 (PDT) Message-ID: <4A8364FF.2010605@elischer.org> Date: Wed, 12 Aug 2009 17:57:35 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Marko Zec References: <200908122108.n7CL8uhJ058398@repoman.freebsd.org> <200908130034.57133.zec@freebsd.org> <4A8345E1.1070301@elischer.org> <200908130052.11423.zec@freebsd.org> <4A835CBE.4060903@elischer.org> In-Reply-To: <4A835CBE.4060903@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Perforce Change Reviews , Robert Watson Subject: Re: PERFORCE change 167260 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2009 00:57:38 -0000 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.