Define and use functions to test specific VNET states during shutdown.
This makes the code more readable and easier to maintain.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Differential D20051
Define and use functions to test specific VNET states during shutdown • hselasky on Apr 25 2019, 10:59 AM. Authored by Tags None Referenced Files
Details
Define and use functions to test specific VNET states during shutdown. MFC after: 1 week
Diff Detail
Event TimelineComment Actions I kept thinking which states we can really observe and when:
States (1) and (5) should not really observable. So Maybe the original states were too precise as we really only are interested "are we in an up/running/stable" state? What if we'd simply call the function "running" or "up" or "stable"? Not sure which one.. ready always makes me think of "READY? " asking for input. bool vnet_is_up_running_and_stable(struct vnet *vnet) { return (vnet->vnet_state == SI_SUB_VNET_DONE); } I cannot remember why I ended up with the more precise checks initially. Sadly history was in p4 which is gone.
Comment Actions Make sure vnet0 gets its vnet_state set aswell and add a KASSERT() for valid vnet_state. Comment Actions In general this seems good.
Comment Actions Replace vnet_state with simpler vnet_is_running variable.
Comment Actions @bz: Just add a printf() in the done function to print the state of the vnet and you'll see! Comment Actions Okay. I see why the vnet0 state is not updated. I'll take that as a different problem as it requires a bit of trickyness as it goes through the code module loading also uses. For your, this, current problem, what about simply doing something like this: https://people.freebsd.org/~bz/20191004-01.diff ? Comment Actions I'm fine with your change. If you want you can commander this revision. Comment Actions I am sorry, was I not clear enough in email that we actually need none of this changed (neither the previous commits nor any of this) in order to solve your original problem? Can we please try not to further touch what was a working system (or complicate it more). Yes I am sorry I had not fully understood the initial complications of the D19622 panic and that the VNET specific solution could be something local (as done elsewhere as well in the past). It is understood now, and I would greatly love the original state to be restored again. Comment Actions @bz: The old checks don't respect if we are bringing up or destroying a VNET. For example this one in if_detach: - shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && - ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; If during attach we are creating an ifnet and then for some reason need to destroy it, the code will do nothing for that ifnet. The answer to your question: No. These additional checks are not needed for the good case, but there might be bad cases which need them. |