Date: Tue, 5 May 2009 10:56:12 +0000 (UTC) From: Marko Zec <zec@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/sys/conf files src/sys/dev/cxgb/ulp/tom cxgb_cpl_io.c src/sys/kern init_main.c kern_fork.c kern_linker.c kern_vimage.c subr_pcpu.c sys_socket.c uipc_socket.c uipc_syscalls.c uipc_usrreq.c src/sys/net bpf.c if.c if_clone.c ... Message-ID: <200905051057.n45AvcaA032738@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
zec 2009-05-05 10:56:12 UTC
FreeBSD src repository
Modified files:
sys/conf files
sys/dev/cxgb/ulp/tom cxgb_cpl_io.c
sys/kern init_main.c kern_fork.c kern_linker.c
kern_vimage.c subr_pcpu.c sys_socket.c
uipc_socket.c uipc_syscalls.c
uipc_usrreq.c
sys/net bpf.c if.c if_clone.c if_ethersubr.c
if_var.h netisr.c rtsock.c
sys/net80211 ieee80211_freebsd.c
sys/netgraph netgraph.h
sys/netinet if_ether.c igmp.c in_rmx.c ip_input.c
tcp_hostcache.c
sys/netinet6 in6_rmx.c ip6_mroute.c mld6.c nd6.c
nd6_nbr.c
sys/netipsec xform_tcp.c
sys/nfsclient nfs_vnops.c
sys/sys proc.h ucred.h vimage.h
Log:
SVN rev 191816 on 2009-05-05 10:56:12Z by zec
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)
Revision Changes Path
1.1398 +1 -1 src/sys/conf/files
1.31 +2 -2 src/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
1.298 +4 -0 src/sys/kern/init_main.c
1.299 +6 -0 src/sys/kern/kern_fork.c
1.167 +9 -0 src/sys/kern/kern_linker.c
1.5 +54 -4 src/sys/kern/kern_vimage.c
1.13 +4 -0 src/sys/kern/subr_pcpu.c
1.78 +8 -2 src/sys/kern/sys_socket.c
1.329 +35 -9 src/sys/kern/uipc_socket.c
1.275 +17 -0 src/sys/kern/uipc_syscalls.c
1.228 +5 -0 src/sys/kern/uipc_usrreq.c
1.208 +2 -2 src/sys/net/bpf.c
1.328 +28 -14 src/sys/net/if.c
1.13 +6 -6 src/sys/net/if_clone.c
1.260 +10 -2 src/sys/net/if_ethersubr.c
1.139 +3 -0 src/sys/net/if_var.h
1.23 +4 -0 src/sys/net/netisr.c
1.171 +9 -0 src/sys/net/rtsock.c
1.28 +13 -0 src/sys/net80211/ieee80211_freebsd.c
1.82 +1 -0 src/sys/netgraph/netgraph.h
1.197 +2 -0 src/sys/netinet/if_ether.c
1.74 +4 -3 src/sys/netinet/igmp.c
1.71 +3 -3 src/sys/netinet/in_rmx.c
1.358 +1 -1 src/sys/netinet/ip_input.c
1.29 +4 -2 src/sys/netinet/tcp_hostcache.c
1.38 +11 -5 src/sys/netinet6/in6_rmx.c
1.56 +5 -1 src/sys/netinet6/ip6_mroute.c
1.45 +3 -5 src/sys/netinet6/mld6.c
1.113 +9 -1 src/sys/netinet6/nd6.c
1.63 +9 -11 src/sys/netinet6/nd6_nbr.c
1.7 +1 -0 src/sys/netipsec/xform_tcp.c
1.308 +0 -2 src/sys/nfsclient/nfs_vnops.c
1.530 +2 -0 src/sys/sys/proc.h
1.57 +2 -1 src/sys/sys/ucred.h
1.18 +57 -6 src/sys/sys/vimage.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905051057.n45AvcaA032738>
