[vm-bhyve] Windows 2012 and 2016 servers guests would not stop

Rodney W. Grimes freebsd-rwg at gndrsh.dnsmgr.net
Tue Apr 23 05:27:12 UTC 2019


-- Start of PGP signed section.
> Paul Vixie wrote:
> > 
> > Victor Sudakov wrote on 2019-04-22 19:43:
> > ...
> > >> And the implementation is pretty brutal:
> > >> # 'vm stopall'
> > >> # stop all bhyve instances
> > >> # note this will also stop instances not started by vm-bhyve
> > >> #
> > >> core::stopall(){
> > >>      local _pids=$(pgrep -f 'bhyve:')
> > >>
> > >>      echo "Shutting down all bhyve virtual machines"
> > >>      killall bhyve
> > >>      sleep 1
> > >>      killall bhyve
> > >>      wait_for_pids ${_pids}
> > >> }
> > 
> > yow.
> 
> To be sure, I was unable to find the above code (as is) in
> /usr/local/lib/vm-bhyve/vm-* (the vm-bhyve port 1.3.0). It may be that
> something more intelligent is happening in a more recent version, like a
> sequential shutdown. However, "kill $pid; sleep 1; kill $pid" seems to
> be still present.

I probably pulled that from old code, pulled from:
vm-bhyve-1.2.3                 Management system for bhyve virtual machines

> 
> > 
> > >>
> > >> I wonder what the effect of the second kill is,
> > >> that seems odd.
> > > 
> > > Indeed.
> > 
> > the first killall will cause each client OS to see a soft shutdown 
> > signal. the sleep 1 gives them some time to flush their buffers. the 
> > second killall says, time's up, just stop.
> > 
> > i think this is worse than brutal, it's wrong. consider freebsd's own 
> > work flow when trying to comply with the first soft shutdown it got:
> > 
> > https://github.com/freebsd/freebsd/blob/master/sbin/reboot/reboot.c#L220
> > 
> > this has bitten me more than once, because using "pageins" as a proxy 
> > for "my server processes are busy trying to synchronize their user mode 
> > state" is inaccurate. i think _any_ continuing I/O should be reason to 
> > wait the full 60 seconds.
> 
> Would it be beneficial to just hack /usr/local/lib/vm-bhyve/vm-* ?

One can always hack experiments, my vm-bhyve is fairly diverged
from the release bits as I have done stuff to it so that it
better meets my needs.  Most of that is not submittable as upstream
changes, some I should really sort out and try to push up.

Some is due to local changes to bhyve that are not mainstream
and thus are not (yet) applicable.

> > and so i think the "sleep 1" above should be a "sleep 65".
> > 
> > > What is needed in vm-bhyve is the feature that if ACPI does not stop the
> > > guest for a predefined period of time, the guest is powered off.
> > 
> > i agree with this.
> 
> Will you please support the bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237479

More powerfull would be if we could come up with some
patches against 1.3.0 that effected some of the changes
we desire.  And some more investigation as to just how
the guests are handling this ACPI shutdown event.  What
might be wrong for FreeBSD might be right for windows?
 
Does the ACPI spec saying anything about hitting the
power down button twice within 1 second for example?

> Victor Sudakov,  VAS4-RIPE, VAS47-RIPN

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-virtualization mailing list