From owner-freebsd-virtualization@freebsd.org Tue Apr 23 04:14:00 2019 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55416158D891 for ; Tue, 23 Apr 2019 04:14:00 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from admin.sibptus.ru (admin.sibptus.ru [IPv6:2001:19f0:5001:21dc::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 937368E097 for ; Tue, 23 Apr 2019 04:13:59 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=+yMfVAiTJC1x872xsS+TlH+MDIW3BU8nc4FZThfT5As=; b=aWxLma/yE2U1mh7cD3/kEpY7yk bi9fT9DsWGNDt3bkMrezkAmKxGEodKIytei3vO4EyzsjrXs2PTsLYa5Q+HV6+UwoNWdWxpOOphRRn xIab7wSAmGk9MDs9NLY8340z5o1Mz6+Bp8FuO36utQu7i8viQj+884K/DhW3qkVu2SPI=; Received: from vas by admin.sibptus.ru with local (Exim 4.92 (FreeBSD)) (envelope-from ) id 1hImog-0000tl-Av for freebsd-virtualization@freebsd.org; Tue, 23 Apr 2019 11:13:58 +0700 Date: Tue, 23 Apr 2019 11:13:58 +0700 From: Victor Sudakov To: freebsd-virtualization@freebsd.org Subject: Re: [vm-bhyve] Windows 2012 and 2016 servers guests would not stop Message-ID: <20190423041358.GA2992@admin.sibptus.ru> References: <20190421154616.GA59283@admin.sibptus.ru> <201904211708.x3LH8DiK028282@gndrsh.dnsmgr.net> <20190423024301.GA940@admin.sibptus.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xHFwDpU9dbj6ez1V" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://www.dreamwidth.org/pubkey?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.11.4 (2019-03-13) Sender: Victor Sudakov X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2019 04:14:00 -0000 --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Paul Vixie wrote: >=20 > 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=3D$(pgrep -f 'bhyve:') > >> > >> echo "Shutting down all bhyve virtual machines" > >> killall bhyve > >> sleep 1 > >> killall bhyve > >> wait_for_pids ${_pids} > >> } >=20 > 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. >=20 > >> > >> I wonder what the effect of the second kill is, > >> that seems odd. > >=20 > > Indeed. >=20 > the first killall will cause each client OS to see a soft shutdown=20 > signal. the sleep 1 gives them some time to flush their buffers. the=20 > second killall says, time's up, just stop. >=20 > i think this is worse than brutal, it's wrong. consider freebsd's own=20 > work flow when trying to comply with the first soft shutdown it got: >=20 > https://github.com/freebsd/freebsd/blob/master/sbin/reboot/reboot.c#L220 >=20 > this has bitten me more than once, because using "pageins" as a proxy=20 > for "my server processes are busy trying to synchronize their user mode= =20 > state" is inaccurate. i think _any_ continuing I/O should be reason to=20 > wait the full 60 seconds. Would it be beneficial to just hack /usr/local/lib/vm-bhyve/vm-* ? >=20 > and so i think the "sleep 1" above should be a "sleep 65". >=20 > > 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. >=20 > i agree with this. Will you please support the bug report: https://bugs.freebsd.org/bugzilla/s= how_bug.cgi?id=3D237479 --=20 Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/ --xHFwDpU9dbj6ez1V Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJcvpEGAAoJEA2k8lmbXsY0rBIH/iHyk57c2eQNmoEsVYnPN6Mw afifUtGt0DVzLpp2G67gnES6+OhvQXNmVyUdOf+pJW8WlwMetSG8XCQImXoCN/Mk asQ+jJiNmu3QxdJAs7acAsf5epUE+5Qe5SsGV/MKwuVevbvfpn3TFzKQ2dJf8dAg xQv9O/UD2csr5tkNSaRlICP1Bv5CKycSW0p3Qs9m3gGzdCs/k7F5/F7KLkmWzYgI BHXJCrGdFEGx53fBCRsU/IGUug1EAcLrwALCglzf1PaqinLeicVXK0Lb3Fgvbbmp FiT5elQe1gKs/T8RmaPp7IZXy0hALx97RLOkNulxPApjAEtOQr+frErdwzlUMYw= =UG4B -----END PGP SIGNATURE----- --xHFwDpU9dbj6ez1V--