FreeBSD src
Go to file
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
bin Don't let trailing empty lines overwrite the result of the last command with 0. 2009-04-04 19:06:52 +00:00
cddl Switch over to gnu99 compilation on default for userland. 2009-03-14 17:55:16 +00:00
contrib - Use gdb-* glob instead of gdb-6.1.1, to simplify future imports. 2009-04-07 20:15:51 +00:00
crypto Prevent cross-site forgery attacks on lukemftpd(8) due to splitting 2009-01-07 20:17:55 +00:00
etc - Add ipfw_nat to the list of required modules if "firewall_nat_enable" 2009-03-30 21:31:52 +00:00
games Too good to pass. 2009-03-06 13:24:54 +00:00
gnu Fix build breakage due to the interplay between r189801 and r189824. 2009-03-14 22:50:03 +00:00
include Implement support for RTLD_NODELETE flag for dlopen() and -z nodelete 2009-03-30 08:47:28 +00:00
kerberos5 Add strndup(3) prototype to string.h. 2008-12-08 21:04:24 +00:00
lib Include a space between "send" and "broadcast". 2009-04-09 20:57:35 +00:00
libexec Currently, when mapping an object, rtld reserves the whole address space 2009-04-10 10:14:04 +00:00
release Autogenerate hardware notes for the uath(4) driver. 2009-04-07 20:12:15 +00:00
rescue Remove if_ppp(4) and if_sl(4). 2009-04-05 22:08:18 +00:00
sbin - Better wording in comment. 2009-04-10 11:15:34 +00:00
secure Enable getaudit_addr(2) for sshd again. This will un-break the subject 2008-11-30 15:35:24 +00:00
share Updates based on my testing of the cards. 2009-04-10 15:01:48 +00:00
sys Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
tools Return -1 instead of 0 upon reaching EOF. This is somewhat ill-advised 2009-04-06 13:50:04 +00:00
usr.bin Avoid infinite loops when remaking makefiles not only 2009-04-07 19:49:38 +00:00
usr.sbin Removed more vestiges of if_sl(4). 2009-04-09 12:20:37 +00:00
COPYRIGHT Bump the odometer of the years. A little early this year for 7.1R. 2008-12-30 04:46:25 +00:00
LOCKS Update LOCKS syntax. 2008-06-05 19:47:58 +00:00
MAINTAINERS Replace anholt with myself as drm maintainer. 2009-03-20 18:51:13 +00:00
Makefile Add a new world named 'mips' to our universe. 2009-04-01 17:11:50 +00:00
Makefile.inc1 Revert c190007 at the request of Ruslan. It was not correct because 2009-04-05 00:24:49 +00:00
ObsoleteFiles.inc - fix my previous commit (added missing .gz) 2009-04-10 22:15:01 +00:00
README Simply running ``make world'' will bomb unless you dig up the 2006-06-07 03:33:48 +00:00
UPDATING A belated note on layout change of certain V_ containers. 2009-04-08 18:30:42 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The ``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html