From owner-freebsd-virtualization@freebsd.org Tue Apr 23 03:07: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 EB0D5158BD5C for ; Tue, 23 Apr 2019 03:06:59 +0000 (UTC) (envelope-from paul@redbarn.org) Received: from family.redbarn.org (family.redbarn.org [IPv6:2001:559:8000:cd::5]) (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 F1A908BE0E for ; Tue, 23 Apr 2019 03:06:58 +0000 (UTC) (envelope-from paul@redbarn.org) Received: from [IPv6:2601:151:c302:493d:7455:4dfb:93b3:783b] (unknown [IPv6:2601:151:c302:493d:7455:4dfb:93b3:783b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by family.redbarn.org (Postfix) with ESMTPSA id 7197B892C6; Tue, 23 Apr 2019 03:06:56 +0000 (UTC) Subject: Re: [vm-bhyve] Windows 2012 and 2016 servers guests would not stop To: Victor Sudakov Cc: freebsd-virtualization@freebsd.org References: <20190421154616.GA59283@admin.sibptus.ru> <201904211708.x3LH8DiK028282@gndrsh.dnsmgr.net> <20190423024301.GA940@admin.sibptus.ru> From: Paul Vixie Message-ID: Date: Mon, 22 Apr 2019 20:06:54 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/6.1.14 MIME-Version: 1.0 In-Reply-To: <20190423024301.GA940@admin.sibptus.ru> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 03:07:00 -0000 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. >> >> 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. 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. -- P Vixie