From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtmFv-0007G2-Ru for qemu-devel@nongnu.org; Tue, 03 Nov 2015 19:48:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtmFs-0005sY-Kd for qemu-devel@nongnu.org; Tue, 03 Nov 2015 19:48:51 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:8602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtmFr-0005jA-BJ for qemu-devel@nongnu.org; Tue, 03 Nov 2015 19:48:48 -0500 Message-ID: <563955D4.7080000@huawei.com> Date: Wed, 4 Nov 2015 08:48:20 +0800 From: Gonglei MIME-Version: 1.0 References: <8E78D212B8C25246BE4CE7EA0E645FE5291A08@SZXEMI504-MBS.china.huawei.com> In-Reply-To: <8E78D212B8C25246BE4CE7EA0E645FE5291A08@SZXEMI504-MBS.china.huawei.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Xulei (Stone, Euler)" , qemu-devel Cc: "wangxin (U)" , seabios@seabios.org, "Huangweidong (C)" Ccing Seabios community. On 2015/11/3 14:58, Xulei (Stone, Euler) wrote: > On qemu-kvm platform, when I reset a VM through "virsh reset", and coincidently > the VM is in process of internal rebooting at the same time. Then the VM will > not be successfully reseted any more due to the reset reentrancy. I found: > (1)SeaBios try to shutdown the VM after reseting it failed by apm_shutdown(). > However, apm_shutdown() does not work on qemu-kvm platform; > (2)I add 1s sleep in qemu_prep_reset(), then continuously reset the VM twice, > aforementioned case must happen. > This patch fixes this issue by letting the VM always execute the reboot > routing while a reenrancy happenes instead of attempting apm_shutdown on > qemu-kvm platform. > > Signed-off-by: Lei Xu > --- > roms/seabios/src/resume.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/roms/seabios/src/resume.c b/roms/seabios/src/resume.c > index 1903174..96ff79e 100644 > --- a/roms/seabios/src/resume.c > +++ b/roms/seabios/src/resume.c > @@ -16,6 +16,7 @@ > #include "std/bda.h" // struct bios_data_area_s > #include "string.h" // memset > #include "util.h" // dma_setup > +#include "fw/paravirt.h" //runningOnKVM > > // Handler for post calls that look like a resume. > void VISIBLE16 > @@ -122,7 +123,11 @@ tryReboot(void) > dprintf(1, "Unable to hard-reboot machine - attempting shutdown.\n"); > apm_shutdown(); > } > - HaveAttemptedReboot = 1; > + if (!runningOnKVM()) { > + // Hard reboot has failed - try to shutdown machine. > + HaveAttemptedReboot = 1; > + } > + > > dprintf(1, "Attempting a hard reboot\n"); > > -- > 1.7.12.4 >