Date: Sat, 11 Apr 2009 05:58:58 +0000 (UTC) From: Marko Zec <zec@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/sys/kern kern_vimage.c uipc_domain.c src/sys/net if.c if_gif.c if_loop.c route.c src/sys/netinet if_ether.c ip_input.c src/sys/netinet6 ip6_input.c src/sys/netipsec ipsec.c xform_ah.c xform_esp.c xform_ipcomp.c xform_ipip.c src/sys/sys ... Message-ID: <200904110601.n3B61S7M071776@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
zec 2009-04-11 05:58:58 UTC FreeBSD src repository Modified files: sys/kern kern_vimage.c uipc_domain.c sys/net if.c if_gif.c if_loop.c route.c sys/netinet if_ether.c ip_input.c sys/netinet6 ip6_input.c sys/netipsec ipsec.c xform_ah.c xform_esp.c xform_ipcomp.c xform_ipip.c sys/sys kernel.h vimage.h Log: SVN rev 190909 on 2009-04-11 05:58:58Z by zec Introduce vnet module registration / initialization framework with dependency tracking and ordering enforcement. With this change, per-vnet initialization functions introduced with r190787 are no longer directly called from traditional initialization functions (which cc in most cases inlined to pre-r190787 code), but are instead registered via the vnet framework first, and are invoked only after all prerequisite modules have been initialized. In the long run, this framework should allow us to both initialize and dismantle multiple vnet instances in a correct order. The problem this change aims to solve is how to replay the initialization sequence of various network stack components, which have been traditionally triggered via different mechanisms (SYSINIT, protosw). Note that this initialization sequence was and still can be subtly different depending on whether certain pieces of code have been statically compiled into the kernel, loaded as modules by boot loader, or kldloaded at run time. The approach is simple - we record the initialization sequence established by the traditional mechanisms whenever vnet_mod_register() is called for a particular vnet module. The vnet_mod_register_multi() variant allows a single initializer function to be registered multiple times but with different arguments - currently this is only used in kern/uipc_domain.c by net_add_domain() with different struct domain * as arguments, which allows for protosw-registered initialization routines to be invoked in a correct order by the new vnet initialization framework. For the purpose of identifying vnet modules, each vnet module has to have a unique ID, which is statically assigned in sys/vimage.h. Dynamic assignment of vnet module IDs is not supported yet. A vnet module may specify a single prerequisite module at registration time by filling in the vmi_dependson field of its vnet_modinfo struct with the ID of the module it depends on. Unless specified otherwise, all vnet modules depend on VNET_MOD_NET (container for ifnet list head, rt_tables etc.), which thus has to and will always be initialized first. The framework will panic if it detects any unresolved dependencies before completing system initialization. Detection of unresolved dependencies for vnet modules registered after boot (kldloaded modules) is not provided. Note that the fact that each module can specify only a single prerequisite may become problematic in the long run. In particular, INET6 depends on INET being already instantiated, due to TCP / UDP structures residing in INET container. IPSEC also depends on INET, which will in turn additionally complicate making INET6-only kernel configs a reality. The entire registration framework can be compiled out by turning on the VIMAGE_GLOBALS kernel config option. Reviewed by: bz Approved by: julian (mentor) Revision Changes Path 1.2 +140 -4 src/sys/kern/kern_vimage.c 1.57 +19 -2 src/sys/kern/uipc_domain.c 1.316 +7 -3 src/sys/net/if.c 1.76 +13 -0 src/sys/net/if_gif.c 1.130 +12 -0 src/sys/net/if_loop.c 1.152 +12 -0 src/sys/net/route.c 1.194 +13 -0 src/sys/netinet/if_ether.c 1.353 +17 -0 src/sys/netinet/ip_input.c 1.117 +19 -0 src/sys/netinet6/ip6_input.c 1.48 +14 -0 src/sys/netipsec/ipsec.c 1.22 +13 -0 src/sys/netipsec/xform_ah.c 1.26 +13 -0 src/sys/netipsec/xform_esp.c 1.17 +13 -0 src/sys/netipsec/xform_ipcomp.c 1.27 +14 -0 src/sys/netipsec/xform_ipip.c 1.146 +1 -0 src/sys/sys/kernel.h 1.14 +70 -19 src/sys/sys/vimage.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904110601.n3B61S7M071776>