freebsd-dev/sys/kern
Marko Zec 21ca7b57bd Change the curvnet variable from a global const struct vnet *,
previously always pointing to the default vnet context, to a
dynamically changing thread-local one.  The currvnet context
should be set on entry to networking code via CURVNET_SET() macros,
and reverted to previous state via CURVNET_RESTORE().  Recursions
on curvnet are permitted, though strongly discuouraged.

This change should have no functional impact on nooptions VIMAGE
kernel builds, where CURVNET_* macros expand to whitespace.

The curthread->td_vnet (aka curvnet) variable's purpose is to be an
indicator of the vnet context in which the current network-related
operation takes place, in case we cannot deduce the current vnet
context from any other source, such as by looking at mbuf's
m->m_pkthdr.rcvif->if_vnet, sockets's so->so_vnet etc.  Moreover, so
far curvnet has turned out to be an invaluable consistency checking
aid: it helps to catch cases when sockets, ifnets or any other
vnet-aware structures may have leaked from one vnet to another.

The exact placement of the CURVNET_SET() / CURVNET_RESTORE() macros
was a result of an empirical iterative process, whith an aim to
reduce recursions on CURVNET_SET() to a minimum, while still reducing
the scope of CURVNET_SET() to networking only operations - the
alternative would be calling CURVNET_SET() on each system call entry.
In general, curvnet has to be set in three typicall cases: when
processing socket-related requests from userspace or from within the
kernel; when processing inbound traffic flowing from device drivers
to upper layers of the networking stack, and when executing
timer-driven networking functions.

This change also introduces a DDB subcommand to show the list of all
vnet instances.

Approved by:	julian (mentor)
2009-05-05 10:56:12 +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 Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
init_sysent.c Regen for new jail system calls in r191673. 2009-04-29 21:50:13 +00:00
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
kern_condvar.c Remove unused variables p' and unneeded assignments of rval'. 2009-02-26 13:00:13 +00:00
kern_conf.c Remove dead code from devtoname(). 2009-04-15 20:43:12 +00:00
kern_cons.c Remove unneeded variable `ocn_mute'. 2009-02-26 13:01:45 +00:00
kern_context.c
kern_cpu.c
kern_cpuset.c Prevent a superuser inside a jail from modifying the dedicated 2009-04-28 21:00:50 +00:00
kern_ctf.c
kern_descrip.c Update comment above _fget() for earlier change to FWRITE failures return 2009-04-15 19:10:37 +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 Fix typo. 2009-04-20 15:10:03 +00:00
kern_fork.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
kern_idle.c
kern_intr.c
kern_jail.c Introduce the extensible jail framework, using the same "name=value" 2009-04-29 21:14:15 +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 Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +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 struct malloc_type has had a 'magic' field statically initialized to 2009-04-19 12:41:37 +00:00
kern_mbuf.c
kern_mib.c Permit buiding kernels with options VIMAGE, restricted to only a single 2009-04-30 13:36:26 +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 a constant PR_MAXMETHOD to better define the jail/OSD interface. 2009-05-05 05:49:08 +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 Improve approximation of style(9). 2009-04-26 21:16:03 +00:00
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 Permit buiding kernels with options VIMAGE, restricted to only a single 2009-04-30 13:36:26 +00:00
kern_tc.c Remove conditionally compiled time counter statistics; tools like 2009-04-11 22:01:40 +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
kern_umtx.c Make UMTX_OP_WAIT_UINT actually wait for an unsigned integer on 64-bits 2009-04-13 05:21:17 +00:00
kern_uuid.c Lock the interface address list while iterating a network interface's 2009-04-19 21:36:18 +00:00
kern_vimage.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
kern_xxx.c
ksched.c
link_elf_obj.c
link_elf.c
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh
md4c.c
md5c.c
p1003_1b.c
posix4_mib.c
sched_4bsd.c
sched_ule.c - Fix non-SMP build by encapsulating idle spin logic in a macro. 2009-04-29 23:04:31 +00:00
serdev_if.m
stack_protector.c
subr_acl_posix1e.c
subr_autoconf.c
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
subr_clock.c
subr_devstat.c
subr_disk.c
subr_eventhandler.c
subr_fattime.c
subr_firmware.c
subr_hints.c
subr_kdb.c
subr_kobj.c
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 Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +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
subr_rman.c
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 - Remove the bogus idle thread state code. This may have a race in it 2009-04-29 03:15:43 +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
subr_turnstile.c
subr_unit.c
subr_witness.c Bite the bullet, and make the IPv6 SSM and MLDv2 mega-commit: 2009-04-29 19:19:13 +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 Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
syscalls.c Regen for new jail system calls in r191673. 2009-04-29 21:50:13 +00:00
syscalls.master Introduce the extensible jail framework, using the same "name=value" 2009-04-29 21:14:15 +00:00
systrace_args.c Regen for new jail system calls in r191673. 2009-04-29 21:50:13 +00:00
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 Turn MAXPTSDEVS into a sysctl tunable. 2009-04-25 10:05:55 +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 Remove unneeded check for SESS_LEADER(). 2009-05-04 11:11:10 +00:00
uipc_accf.c
uipc_cow.c
uipc_debug.c
uipc_domain.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
uipc_mbuf2.c
uipc_mbuf.c
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 Fix sbappendrecord_locked(). 2009-04-21 19:14:13 +00:00
uipc_socket.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
uipc_syscalls.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
uipc_usrreq.c Change the curvnet variable from a global const struct vnet *, 2009-05-05 10:56:12 +00:00
vfs_acl.c When allocating 'struct acl' instances, use malloc(9) instead of uma(9). 2009-04-19 09:56:30 +00:00
vfs_aio.c
vfs_bio.c Undo private changes that should never have been committed. 2009-04-17 18:34:11 +00:00
vfs_cache.c More fallout from negative dotdot caching. Negative entries should 2009-04-17 18:11:11 +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
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
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 - use a shared lock for reads 2009-04-13 23:09:44 +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