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
This commit is contained in:
Bjoern A. Zeeb 2016-05-18 15:50:52 +00:00
parent fc614c29c1
commit 94081f88e8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300155
2 changed files with 5 additions and 0 deletions

View File

@ -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");
}

View File

@ -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;
};