freebsd-dev/sys
Marko Zec bfe1aba468 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)
2009-04-11 05:58:58 +00:00
..
amd64 Add ixgbe to the GENERIC amd64 kernel in place of the 2009-04-10 00:40:48 +00:00
arm Minor description fix. 2009-04-08 13:01:18 +00:00
boot Rewrite SMBIOS for loader: 2009-04-07 17:58:15 +00:00
bsm Merge OpenBSM 1.1 beta 1 from OpenBSM vendor branch to head, both 2009-03-02 13:29:18 +00:00
cam Revert r190676,190677 2009-04-10 04:08:34 +00:00
cddl Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
compat MFp4 //depot/projects/usb@159909 2009-04-05 18:20:38 +00:00
conf Add additional file to ixgbe files list, and uncomment NOTES entry 2009-04-10 00:34:55 +00:00
contrib Add uath(4) wireless USB driver for Atheros AR5005UG and AR5005UX 2009-04-04 11:23:00 +00:00
crypto identify routine takes driver_t *, not device_t *. 2009-02-05 19:30:28 +00:00
ddb Prefer prototypes to k&r definitions. 2009-03-09 13:32:19 +00:00
dev Two refinements to the 3c1 support: 2009-04-11 04:30:38 +00:00
fs Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
gdb
geom - Move out allocation part of different gvinum objects into its own routine and 2009-04-10 08:50:14 +00:00
gnu Fix two issues with bufdaemon, often causing the processes to hang in 2009-03-16 15:39:46 +00:00
i386 Also remove the unused __word_swap_int*() macros. 2009-04-08 19:10:20 +00:00
ia64 Fix KBI breakage by r190520 which affects older linux.ko binaries: 2009-04-05 09:27:19 +00:00
isa Allow syscons to work on amd64 and i386 without any hints: 2009-03-05 19:10:17 +00:00
kern Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
kgssapi Call svc_freereq() before returning from the service proc. 2008-11-12 15:31:05 +00:00
legacy/dev remove now-redunant cardbus attachment lines. 2009-03-09 13:25:34 +00:00
libkern Add memmove() to the kernel, making the kernel compile with Clang. 2009-02-28 16:21:25 +00:00
mips Fix KBI breakage by r190520 which affects older linux.ko binaries: 2009-04-05 09:27:19 +00:00
modules Add support file for 82599 in Makefile 2009-04-10 00:31:54 +00:00
net Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
net80211 o add a capability for drivers that require 802.3 encapsulation of 2009-04-08 16:19:50 +00:00
netatalk Remove local variable 'ddp' from DDP's attach and detach routines; they 2009-02-04 20:04:32 +00:00
netgraph Make Netgraph compile with Clang. 2009-03-03 18:47:33 +00:00
netinet Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
netinet6 Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
netipsec Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
netipx Add missing "goto set_head" for SO_IPX_CHECKSUM; otherwise we fall through 2008-12-11 10:29:35 +00:00
netnatm Remove IFF_NEEDSGIANT, a compatibility infrastructure introduced 2009-03-15 14:21:05 +00:00
netncp Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netsmb Implement device cloning for /dev/nsmb, the netsmb control pseudo-device. 2008-11-03 14:23:15 +00:00
nfs Adding sys/nfs/nfssvc.h and sys/nfs/nfs_nfssvc.c in preparation for 2009-04-07 19:06:51 +00:00
nfs4client Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
nfsclient Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
nfsserver Fix an mbuf leak in the error path. 2009-03-19 14:13:18 +00:00
nlm Don't call svc_freereq() before svc_freeargs(). 2008-11-12 15:30:30 +00:00
opencrypto Fix return type for detach routine (should be int) 2009-02-05 17:43:12 +00:00
pc98 MFi386: revision 190617 2009-04-08 11:35:47 +00:00
pci intpm: minor enhancements 2009-03-16 16:15:14 +00:00
powerpc Fix the build when KDB is disabled. The second instance of rfi in 2009-04-05 21:52:13 +00:00
rpc Use the correct creds when reconnecting so that we have enough privilege to 2009-02-05 11:48:10 +00:00
security Get rid of VSTAT and replace it with VSTAT_PERMS, which is somewhat 2009-03-29 17:45:48 +00:00
sparc64 Fix KBI breakage by r190520 which affects older linux.ko binaries: 2009-04-05 09:27:19 +00:00
sun4v - There's no need to wrap kdb_active and kdb_trap() in #ifdef KDB as 2009-03-19 20:46:51 +00:00
sys Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
tools Add SDT DTrace probes for VFS vnode operations in the vfs:vop 2009-03-29 03:30:15 +00:00
ufs Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vm When vm_map_wire(9) is allowed to skip holes in the wired region, skip 2009-04-10 10:16:03 +00:00
xdr Add memmove() to the kernel, making the kernel compile with Clang. 2009-02-28 16:21:25 +00:00
xen Fix the Xen build for i386 PV mode. 2009-04-01 17:06:28 +00:00
Makefile Removal pccard directory requires removing it from the list of things 2009-02-15 18:19:24 +00:00