Date: Tue, 28 Apr 2009 10:10:52 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 161232 for review Message-ID: <200904281010.n3SAAqNw017633@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=161232 Change 161232 by zec@zec_amdx2 on 2009/04/28 10:10:19 Set curvnet to the default vnet during system autoconfiguration, and clear it before turning on SMP. Merge from vimage branch a DDB command for listing vnets. Affected files ... .. //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#20 edit Differences ... ==== //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#20 (text+ko) ==== @@ -181,7 +181,8 @@ free(vml, M_VIMAGE); } -static int vnet_mod_constructor(struct vnet_modlink *vml) +static int +vnet_mod_constructor(struct vnet_modlink *vml) { const struct vnet_modinfo *vmi = vml->vml_modinfo; @@ -300,7 +301,9 @@ if (vnet == NULL) panic("vi_alloc: malloc failed"); LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le); + vnet->vnet_magic_n = VNET_MAGIC_N; + /* We MUST clear curvnet in vi_init_done before going SMP. */ curvnet = LIST_FIRST(&vnet_head); #endif } @@ -310,6 +313,10 @@ { struct vnet_modlink *vml_iter; +#ifdef VIMAGE + curvnet = NULL; +#endif + if (TAILQ_EMPTY(&vnet_modpending_head)) return; @@ -324,5 +331,36 @@ SYSINIT(vimage, SI_SUB_VIMAGE, SI_ORDER_FIRST, vi_init, NULL); SYSINIT(vimage_done, SI_SUB_VIMAGE_DONE, SI_ORDER_FIRST, vi_init_done, NULL); +#endif /* !VIMAGE_GLOBALS */ + +#ifdef VIMAGE +#ifdef DDB +static void +db_vnet_ptr(void *arg) +{ + + if (arg) + db_printf(" %p", arg); + else + db_printf(" 0"); +} + +DB_SHOW_COMMAND(vnets, db_show_vnets) +{ + VNET_ITERATOR_DECL(vnet_iter); -#endif /* !VIMAGE_GLOBALS */ + db_printf(" vnet ifs socks"); + db_printf(" net inet inet6 ipsec netgraph\n"); + VNET_FOREACH(vnet_iter) { + db_printf("%p %3d %5d", + vnet_iter, vnet_iter->ifccnt, vnet_iter->sockcnt); + db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_NET]); + db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_INET]); + db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_INET6]); + db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_IPSEC]); + db_vnet_ptr(vnet_iter->mod_data[VNET_MOD_NETGRAPH]); + db_printf("\n"); + } +} +#endif +#endif /* VIMAGE */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904281010.n3SAAqNw017633>