From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxaH-0001Na-QO for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:51:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZxaB-00084b-Ma for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:51:57 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:36055) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxaB-00084W-F9 for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:51:51 -0400 Received: by wicgb1 with SMTP id gb1so15506710wic.1 for ; Thu, 10 Sep 2015 01:51:50 -0700 (PDT) Date: Thu, 10 Sep 2015 09:51:49 +0100 From: Stefan Hajnoczi Message-ID: <20150910085149.GB13094@stefanha-thinkpad.redhat.com> References: <1441699228-25767-1-git-send-email-den@openvz.org> <1441699228-25767-3-git-send-email-den@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441699228-25767-3-git-send-email-den@openvz.org> Subject: Re: [Qemu-devel] [PATCH 2/5] disk_deadlines: add request to resume Virtual Machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , Paolo Bonzini , Stefan Hajnoczi , qemu-devel@nongnu.org, Raushaniya Maksudova On Tue, Sep 08, 2015 at 11:00:25AM +0300, Denis V. Lunev wrote: > From: Raushaniya Maksudova > > In some cases one needs to pause and resume a Virtual Machine from inside > of Qemu. Currently there are request functions to pause VM (vmstop), but > there are no respective ones to resume VM. > > Signed-off-by: Raushaniya Maksudova > Signed-off-by: Denis V. Lunev > CC: Stefan Hajnoczi > CC: Kevin Wolf > CC: Paolo Bonzini > --- > include/sysemu/sysemu.h | 1 + > stubs/vm-stop.c | 5 +++++ > vl.c | 18 ++++++++++++++++++ > 3 files changed, 24 insertions(+) Why can't vm_start() be used? > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 44570d1..a382ae1 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -62,6 +62,7 @@ void qemu_system_shutdown_request(void); > void qemu_system_powerdown_request(void); > void qemu_register_powerdown_notifier(Notifier *notifier); > void qemu_system_debug_request(void); > +void qemu_system_vmstart_request(void); > void qemu_system_vmstop_request(RunState reason); > void qemu_system_vmstop_request_prepare(void); > int qemu_shutdown_requested_get(void); > diff --git a/stubs/vm-stop.c b/stubs/vm-stop.c > index 69fd86b..c8e2cdd 100644 > --- a/stubs/vm-stop.c > +++ b/stubs/vm-stop.c > @@ -10,3 +10,8 @@ void qemu_system_vmstop_request(RunState state) > { > abort(); > } > + > +void qemu_system_vmstart_request(void) > +{ > + abort(); > +} > diff --git a/vl.c b/vl.c > index 584ca88..63f10d3 100644 > --- a/vl.c > +++ b/vl.c > @@ -563,6 +563,7 @@ static RunState current_run_state = RUN_STATE_PRELAUNCH; > /* We use RUN_STATE_MAX but any invalid value will do */ > static RunState vmstop_requested = RUN_STATE_MAX; > static QemuMutex vmstop_lock; > +static bool vmstart_requested; > > typedef struct { > RunState from; > @@ -723,6 +724,19 @@ void qemu_system_vmstop_request(RunState state) > qemu_notify_event(); > } > > +static bool qemu_vmstart_requested(void) > +{ > + bool r = vmstart_requested; > + vmstart_requested = false; > + return r; > +} > + > +void qemu_system_vmstart_request(void) > +{ > + vmstart_requested = true; > + qemu_notify_event(); > +} > + > void vm_start(void) > { > RunState requested; > @@ -1884,6 +1898,10 @@ static bool main_loop_should_exit(void) > if (qemu_vmstop_requested(&r)) { > vm_stop(r); > } > + if (qemu_vmstart_requested()) { > + vm_start(); > + } > + > return false; > } > > -- > 2.1.4 > >