Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- vl.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/vl.c b/vl.c index a305fed..705c7f1 100644 --- a/vl.c +++ b/vl.c @@ -1700,7 +1700,6 @@ static int reset_requested; static int shutdown_requested, shutdown_signal = -1; static pid_t shutdown_pid; static int powerdown_requested; -static int suspend_requested; static int wakeup_requested; static NotifierList powerdown_notifiers = NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); @@ -1751,13 +1750,6 @@ static int qemu_reset_requested(void) return r; } -static int qemu_suspend_requested(void) -{ - int r = suspend_requested; - suspend_requested = 0; - return r; -} - static int qemu_wakeup_requested(void) { int r = wakeup_requested; @@ -1840,12 +1832,13 @@ void qemu_system_reset_request(void) qemu_notify_event(); } -static void qemu_system_suspend(void) +static gboolean qemu_system_suspend(gpointer unused) { pause_all_vcpus(); notifier_list_notify(&suspend_notifiers, NULL); runstate_set(RUN_STATE_SUSPENDED); monitor_protocol_event(QEVENT_SUSPEND, NULL); + return FALSE; } void qemu_system_suspend_request(void) @@ -1853,9 +1846,8 @@ void qemu_system_suspend_request(void) if (runstate_check(RUN_STATE_SUSPENDED)) { return; } - suspend_requested = 1; cpu_stop_current(); - qemu_notify_event(); + g_idle_add(qemu_system_suspend, NULL); } void qemu_register_suspend_notifier(Notifier *notifier) @@ -1942,9 +1934,6 @@ void qemu_system_vmstop_request(RunState state) static void main_loop_junk(void) { RunState r; - if (qemu_suspend_requested()) { - qemu_system_suspend(); - } if (qemu_shutdown_requested()) { qemu_kill_report(); monitor_protocol_event(QEVENT_SHUTDOWN, NULL); -- 1.8.0