[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] disk_deadlines: add request to resume Virtu
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] disk_deadlines: add request to resume Virtual Machine |
Date: |
Thu, 10 Sep 2015 09:51:49 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Sep 08, 2015 at 11:00:25AM +0300, Denis V. Lunev wrote:
> From: Raushaniya Maksudova <address@hidden>
>
> 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 <address@hidden>
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Stefan Hajnoczi <address@hidden>
> CC: Kevin Wolf <address@hidden>
> CC: Paolo Bonzini <address@hidden>
> ---
> 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
>
>