Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2009 11:12:30 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 161235 for review
Message-ID:  <200904281112.n3SBCUYY077850@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=161235

Change 161235 by zec@zec_amdx2 on 2009/04/28 11:12:12

	Make VIMAGE kernels boot into single-user stage.  Hehehe.
	
	Deviation from vimage branch: process's vnet affinity is
	hanging off directly of struct ucred, instead of having
	another level of indirection via struct vimage.

Affected files ...

.. //depot/projects/vimage-commit2/src/sys/kern/init_main.c#6 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/in6_rmx.c#30 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#31 edit
.. //depot/projects/vimage-commit2/src/sys/sys/ucred.h#2 edit
.. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#45 edit

Differences ...

==== //depot/projects/vimage-commit2/src/sys/kern/init_main.c#6 (text+ko) ====

@@ -74,6 +74,7 @@
 #include <sys/malloc.h>
 #include <sys/conf.h>
 #include <sys/cpuset.h>
+#include <sys/vimage.h>
 
 #include <machine/cpu.h>
 
@@ -452,6 +453,9 @@
 	p->p_ucred->cr_uidinfo = uifind(0);
 	p->p_ucred->cr_ruidinfo = uifind(0);
 	p->p_ucred->cr_prison = NULL;	/* Don't jail it. */
+#ifdef VIMAGE
+	p->p_ucred->cr_vnet = LIST_FIRST(&vnet_head);
+#endif
 #ifdef AUDIT
 	audit_cred_kproc0(p->p_ucred);
 #endif

==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_rmx.c#30 (text+ko) ====

@@ -289,8 +289,9 @@
 in6_rtqtimo(void *rock)
 {
 	CURVNET_SET_QUIET((struct vnet *) rock);
+	INIT_VNET_NET(curvnet);
 	INIT_VNET_INET6(curvnet);
-	struct radix_node_head *rnh = rock;
+	struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
 	struct rtqk_arg arg;
 	struct timeval atv;
 	static time_t last_adjusted_timeout = 0;
@@ -376,8 +377,9 @@
 in6_mtutimo(void *rock)
 {
 	CURVNET_SET_QUIET((struct vnet *) rock);
+	INIT_VNET_NET(curvnet);
 	INIT_VNET_INET6(curvnet);
-	struct radix_node_head *rnh = rock;
+	struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
 	struct mtuex_arg arg;
 	struct timeval atv;
 
@@ -403,7 +405,7 @@
 in6_rtqdrain(void)
 {
 	INIT_VNET_NET(curvnet);
-	struct radix_node_head *rnh = V_rt_tables[AF_INET6];
+	struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
 	struct rtqk_arg arg;
 
 	arg.found = arg.killed = 0;
@@ -427,6 +429,9 @@
 int
 in6_inithead(void **head, int off)
 {
+#ifdef INVARIANTS
+	INIT_VNET_NET(curvnet);
+#endif
 	INIT_VNET_INET6(curvnet);
 	struct radix_node_head *rnh;
 
@@ -442,11 +447,12 @@
 	V_rtq_timeout6 = RTQ_TIMEOUT;
 
 	rnh = *head;
+	KASSERT(rnh == V_rt_tables[0][AF_INET6], ("rnh?"));
 	rnh->rnh_addaddr = in6_addroute;
 	rnh->rnh_matchaddr = in6_matroute;
 	callout_init(&V_rtq_timer6, CALLOUT_MPSAFE);
-	in6_rtqtimo(rnh);	/* kick off timeout first time */
 	callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE);
-	in6_mtutimo(rnh);	/* kick off timeout first time */
+	in6_rtqtimo(curvnet);	/* kick off timeout first time */
+	in6_mtutimo(curvnet);	/* kick off timeout first time */
 	return 1;
 }

==== //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#31 (text+ko) ====

@@ -600,8 +600,8 @@
 void
 nd6_timer(void *arg)
 {
-	CURVNET_SET_QUIET((struct vnet *) arg); /* XXX revisit! */
-	INIT_VNET_INET6(curvnet); /* XXX revisit! */
+	CURVNET_SET((struct vnet *) arg);
+	INIT_VNET_INET6(curvnet);
 	int s;
 	struct nd_defrouter *dr;
 	struct nd_prefix *pr;
@@ -609,7 +609,7 @@
 	struct in6_addrlifetime *lt6;
 
 	callout_reset(&V_nd6_timer_ch, V_nd6_prune * hz,
-	    nd6_timer, NULL);
+	    nd6_timer, arg);
 
 	/* expire default router list */
 	s = splnet();

==== //depot/projects/vimage-commit2/src/sys/sys/ucred.h#2 (text+ko) ====

@@ -55,7 +55,8 @@
 	struct uidinfo	*cr_uidinfo;	/* per euid resource consumption */
 	struct uidinfo	*cr_ruidinfo;	/* per ruid resource consumption */
 	struct prison	*cr_prison;	/* jail(2) */
-	void 		*cr_pspare[3];	/* vimage 2; general use 1 */
+	struct vnet	*cr_vnet;	/* vimage / vnet */
+	void 		*cr_pspare[2];	/* vimage 1; general use 1 */
 #define	cr_endcopy	cr_label
 	struct label	*cr_label;	/* MAC label */
 	struct auditinfo_addr	cr_audit;	/* Audit properties. */

==== //depot/projects/vimage-commit2/src/sys/sys/vimage.h#45 (text+ko) ====

@@ -246,7 +246,7 @@
 #define	VNET_FOREACH(arg)
 #endif
 
-#define	TD_TO_VNET(td)	curvnet
+#define	TD_TO_VNET(td)	(td)->td_ucred->cr_vnet
 
 /* Non-VIMAGE null-macros */
 #define	IS_DEFAULT_VNET(arg) 1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904281112.n3SBCUYY077850>