freebsd-skq/sys/kern
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
..
bus_if.m
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh
imgact_aout.c
imgact_elf32.c
imgact_elf64.c
imgact_elf.c Fix KBI breakage by r190520 which affects older linux.ko binaries: 2009-04-05 09:27:19 +00:00
imgact_gzip.c
imgact_shell.c
inflate.c
init_main.c
init_sysent.c
kern_acct.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
kern_alq.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
kern_clock.c - Implement generic macros for producing KTR records that are compatible 2009-01-17 07:17:57 +00:00
kern_condvar.c Remove unused variables p' and unneeded assignments of rval'. 2009-02-26 13:00:13 +00:00
kern_conf.c Extract the no_poll() and vop_nopoll() code into the common routine 2009-03-06 15:35:37 +00:00
kern_cons.c Remove unneeded variable `ocn_mute'. 2009-02-26 13:01:45 +00:00
kern_context.c
kern_cpu.c If possible, try to obtain max_mhz on cpufreq attach instead of first request. 2008-12-16 01:24:05 +00:00
kern_cpuset.c
kern_ctf.c
kern_descrip.c Remove the printf's when the vnode to be exported for procstat is not a VDIR. 2009-02-14 21:55:09 +00:00
kern_dtrace.c
kern_environment.c Correctly sanity-check timer IDs. [SA-09:06] 2009-03-23 00:00:50 +00:00
kern_event.c
kern_exec.c Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and 2009-03-17 12:53:28 +00:00
kern_exit.c Remove even more unneeded variable assignments. 2009-02-26 15:51:54 +00:00
kern_fork.c
kern_idle.c
kern_intr.c
kern_jail.c Whitespace/spelling fixes in advance of upcoming functional changes. 2009-03-27 13:13:59 +00:00
kern_kthread.c
kern_ktr.c
kern_ktrace.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
kern_linker.c Scanning all the formats for binary translation of modules loading can 2009-02-10 15:50:19 +00:00
kern_lock.c - Wrap lock profiling state variables in #ifdef LOCK_PROFILING blocks. 2009-03-15 08:03:54 +00:00
kern_lockf.c
kern_malloc.c Remove even more unneeded variable assignments. 2009-02-26 15:51:54 +00:00
kern_mbuf.c Temporary workaround for the limitations of the mbuf flowid field: zero 2009-01-01 20:03:01 +00:00
kern_mib.c Mark most often used sysctl's as MPSAFE. 2009-01-28 19:58:05 +00:00
kern_module.c
kern_mtxpool.c
kern_mutex.c - Wrap lock profiling state variables in #ifdef LOCK_PROFILING blocks. 2009-03-15 08:03:54 +00:00
kern_ntptime.c
kern_osd.c Add support for methods to the OSD subsystem. Each object type has a 2009-02-21 11:15:38 +00:00
kern_physio.c
kern_pmc.c
kern_poll.c Remove IFF_NEEDSGIANT, a compatibility infrastructure introduced 2009-03-15 14:21:05 +00:00
kern_priv.c Reduce the verbosity of SDT trace points for DTrace by defining several 2009-03-03 17:15:05 +00:00
kern_proc.c - Add a function (fill_kinfo_aggregate()) which aggregates relevant 2009-02-18 21:52:13 +00:00
kern_prot.c Improve the consistency of MAC Framework and MAC policy entry point 2009-03-08 10:58:37 +00:00
kern_resource.c
kern_rmlock.c
kern_rwlock.c - Wrap lock profiling state variables in #ifdef LOCK_PROFILING blocks. 2009-03-15 08:03:54 +00:00
kern_sdt.c
kern_sema.c
kern_shutdown.c PowerPC, meet kernel core dumps. The support is based 2009-04-04 02:12:37 +00:00
kern_sig.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
kern_subr.c
kern_switch.c
kern_sx.c - Wrap lock profiling state variables in #ifdef LOCK_PROFILING blocks. 2009-03-15 08:03:54 +00:00
kern_synch.c Remove even more unneeded variable assignments. 2009-02-26 15:51:54 +00:00
kern_syscalls.c
kern_sysctl.c Add a new type of KTRACE record for sysctl(3) invocations. It uses the 2009-03-11 21:48:36 +00:00
kern_tc.c By default, don't compile in counters of calls to various time 2009-03-08 22:19:28 +00:00
kern_thr.c Remove even more unneeded variable assignments. 2009-02-26 15:51:54 +00:00
kern_thread.c - Implement a new mechanism for resetting lock profiling. We now 2009-03-15 06:41:47 +00:00
kern_time.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
kern_timeout.c Add explicit static DTrace tracing to the callout mechanism, capturing 2009-01-24 10:22:49 +00:00
kern_umtx.c 1) Check NULL pointer before calling umtx_pi_adjust_locked(), this avoids 2009-03-13 06:06:20 +00:00
kern_uuid.c For all files including net/vnet.h directly include opt_route.h and 2009-02-27 14:12:05 +00:00
kern_vimage.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
kern_xxx.c Fix compilation. Also move ogetkerninfo() to kern_xxx.c. 2008-12-29 19:24:00 +00:00
ksched.c
link_elf_obj.c Scanning all the formats for binary translation of modules loading can 2009-02-10 15:50:19 +00:00
link_elf.c Scanning all the formats for binary translation of modules loading can 2009-02-10 15:50:19 +00:00
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh
md4c.c
md5c.c
p1003_1b.c
posix4_mib.c
sched_4bsd.c - Use __XSTRING where I want the define to be expanded. This resulted in 2009-01-25 07:35:10 +00:00
sched_ule.c - Fix an error that occurs when mp_ncpu is an odd number. steal_thresh 2009-03-14 11:41:36 +00:00
serdev_if.m
stack_protector.c
subr_acl_posix1e.c
subr_autoconf.c Prefer ANSI function definitions to K&R ones. 2009-02-03 07:52:07 +00:00
subr_blist.c
subr_bufring.c
subr_bus.c When looking up the parent devclass of a new devclass, create the parent 2009-03-25 17:02:05 +00:00
subr_clist.c Remove a stale comment from the clists code. 2009-02-09 11:27:56 +00:00
subr_clock.c
subr_devstat.c Use NULL in preference to 0 in pointer contexts. 2009-02-03 07:54:42 +00:00
subr_disk.c Clarify and reimplement the bioq API so that bioq_disksort() has 2009-02-13 11:36:32 +00:00
subr_eventhandler.c
subr_fattime.c
subr_firmware.c Use NULL in preference to 0 for pointers. 2009-02-03 07:51:11 +00:00
subr_hints.c
subr_kdb.c
subr_kobj.c Use NULL in preference to 0 in pointer contexts. 2009-02-03 07:54:42 +00:00
subr_lock.c - Implement a new mechanism for resetting lock profiling. We now 2009-03-15 06:41:47 +00:00
subr_log.c
subr_mbpool.c
subr_mchain.c
subr_module.c
subr_msgbuf.c
subr_param.c Improve the description of a few sysctls. 2009-03-23 20:18:06 +00:00
subr_pcpu.c - Implement generic macros for producing KTR records that are compatible 2009-01-17 07:17:57 +00:00
subr_power.c
subr_prf.c Remove redundant code in printf() and vprintf(). 2009-02-27 13:28:54 +00:00
subr_prof.c Use ANSI function definition for profil. 2009-02-03 07:52:36 +00:00
subr_rman.c rman_debug should be static, so make it static. 2009-02-03 07:53:08 +00:00
subr_rtc.c Clean up MI inittodr(9) and kill noop code. 2009-03-23 21:16:21 +00:00
subr_sbuf.c
subr_scanf.c
subr_sleepqueue.c
subr_smp.c Initial suspend/resume support for amd64. 2009-03-17 00:48:11 +00:00
subr_stack.c
subr_taskqueue.c Remove semicolon left in the last commit 2009-02-13 18:51:39 +00:00
subr_trap.c - Bug fix: prevent a thread from migrating between CPUs between the 2008-12-13 13:07:12 +00:00
subr_turnstile.c
subr_unit.c
subr_witness.c Decompose the global UNIX domain sockets rwlock into two different 2009-03-08 21:48:29 +00:00
sys_generic.c When writing out updated pollfd records when returning from 2009-03-11 22:00:03 +00:00
sys_pipe.c - Make maxpipekva a signed long rather than an unsigned long as overflow 2009-03-10 21:28:43 +00:00
sys_process.c Use the p_sysent->sv_flags flag SV_ILP32 to detect 32bit process 2009-03-02 18:43:50 +00:00
sys_socket.c
syscalls.c
syscalls.master
systrace_args.c
sysv_ipc.c
sysv_msg.c
sysv_sem.c Fix memory leak in semunload(). 2009-03-30 15:01:29 +00:00
sysv_shm.c Systematically use vm_size_t to specify the size of the segment for VM KPI. 2009-03-05 11:45:42 +00:00
tty_compat.c
tty_info.c Replace bcopy() calls inside the TTY layer with memcpy()/strlcpy(). 2009-02-28 14:20:26 +00:00
tty_inq.c Use unsigned longs for the TTY's sysctl stats. 2009-02-26 10:28:32 +00:00
tty_outq.c Use unsigned longs for the TTY's sysctl stats. 2009-02-26 10:28:32 +00:00
tty_pts.c Improve my previous changes to the TTY code: also remove memcpy(). 2009-03-01 09:50:13 +00:00
tty_pty.c Don't use PTY name as format string, even though it isn't insecure here. 2009-02-26 10:14:10 +00:00
tty_tty.c
tty_ttydisc.c Use unsigned longs for the TTY's sysctl stats. 2009-02-26 10:28:32 +00:00
tty.c Fix tty_wait_background() to comply with standards. 2009-04-08 15:56:50 +00:00
uipc_accf.c
uipc_cow.c Extend the struct vm_page wire_count to u_int to avoid the overflow 2009-01-03 13:24:08 +00:00
uipc_debug.c Remove extra 'comma = 0' in socket state printing code, which otherwise 2009-02-09 18:19:58 +00:00
uipc_domain.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
uipc_mbuf2.c
uipc_mbuf.c Teach m_copyback() to use trailing space of the last mbuf in chain. 2009-01-18 20:19:55 +00:00
uipc_mqueue.c
uipc_sem.c Ensure that the semaphore value is re-checked after sem_lock 2009-03-12 10:36:39 +00:00
uipc_shm.c
uipc_sockbuf.c
uipc_socket.c Don't allow creating a socket with a protocol family that the current 2009-02-05 14:15:18 +00:00
uipc_syscalls.c
uipc_usrreq.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vfs_acl.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vfs_aio.c Use the correct type for the timeout parameter to the 32-bit 2009-01-23 13:23:17 +00:00
vfs_bio.c Improve the description of a few sysctls. 2009-03-23 20:18:06 +00:00
vfs_cache.c Cache_lookup() for DOTDOT drops dvp vnode lock, allowing dvp to be reclaimed. 2009-04-10 10:22:44 +00:00
vfs_cluster.c
vfs_default.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vfs_export.c drop rnh lock before destroying it 2008-12-28 14:32:27 +00:00
vfs_extattr.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vfs_hash.c
vfs_init.c Expand the scope of the sysctllock sx lock to protect the sysctl tree itself. 2009-02-06 14:51:32 +00:00
vfs_lookup.c Add SDT DTrace probes for namei(): 2009-04-06 10:32:40 +00:00
vfs_mount.c Revert r190676,190677 2009-04-10 04:08:34 +00:00
vfs_subr.c Replace v_dd vnode pointer with v_cache_dd pointer to struct namecache 2009-03-29 21:25:40 +00:00
vfs_syscalls.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vfs_vnops.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
vnode_if.src Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00