svn commit: r300155 - head/sys/net

Bjoern A. Zeeb bz at FreeBSD.org
Wed May 18 15:50:54 UTC 2016


Author: bz
Date: Wed May 18 15:50:52 2016
New Revision: 300155
URL: https://svnweb.freebsd.org/changeset/base/300155

Log:
  Add a "vnet_state" field to struct vnet.
  This is set to the SI_SUB_* value before executing any VNET_SYSINIT
  or VNET_SYSUNINT.  While good for debugging especially VNET teardown
  problems having a chance to know at which level during teardown we are,
  it will also be used to identify to detcted a "stable state"
  (as in fully up and running) later on.
  
  Obtained from:	projects/vnet
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/net/vnet.c
  head/sys/net/vnet.h

Modified: head/sys/net/vnet.c
==============================================================================
--- head/sys/net/vnet.c	Wed May 18 15:45:12 2016	(r300154)
+++ head/sys/net/vnet.c	Wed May 18 15:50:52 2016	(r300155)
@@ -233,6 +233,7 @@ vnet_alloc(void)
 	SDT_PROBE1(vnet, functions, vnet_alloc, entry, __LINE__);
 	vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO);
 	vnet->vnet_magic_n = VNET_MAGIC_N;
+	vnet->vnet_state = 0;
 	SDT_PROBE2(vnet, functions, vnet_alloc, alloc, __LINE__, vnet);
 
 	/*
@@ -581,6 +582,7 @@ vnet_sysinit(void)
 
 	VNET_SYSINIT_RLOCK();
 	TAILQ_FOREACH(vs, &vnet_constructors, link) {
+		curvnet->vnet_state = vs->subsystem;
 		vs->func(vs->arg);
 	}
 	VNET_SYSINIT_RUNLOCK();
@@ -599,6 +601,7 @@ vnet_sysuninit(void)
 	VNET_SYSINIT_RLOCK();
 	TAILQ_FOREACH_REVERSE(vs, &vnet_destructors, vnet_sysuninit_head,
 	    link) {
+		curvnet->vnet_state = vs->subsystem;
 		vs->func(vs->arg);
 	}
 	VNET_SYSINIT_RUNLOCK();
@@ -714,6 +717,7 @@ db_vnet_print(struct vnet *vnet)
 	db_printf(" vnet_data_mem  = %p\n", vnet->vnet_data_mem);
 	db_printf(" vnet_data_base = %#jx\n",
 	    (uintmax_t)vnet->vnet_data_base);
+	db_printf(" vnet_state     = %#08x\n", vnet->vnet_state);
 	db_printf("\n");
 }
 

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Wed May 18 15:45:12 2016	(r300154)
+++ head/sys/net/vnet.h	Wed May 18 15:50:52 2016	(r300155)
@@ -70,6 +70,7 @@ struct vnet {
 	u_int			 vnet_magic_n;
 	u_int			 vnet_ifcnt;
 	u_int			 vnet_sockcnt;
+	u_int			 vnet_state;	/* SI_SUB_* */
 	void			*vnet_data_mem;
 	uintptr_t		 vnet_data_base;
 };


More information about the svn-src-all mailing list