From patchwork Wed Feb 20 15:32:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 222118 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 18E632C007E for ; Thu, 21 Feb 2013 03:47:14 +1100 (EST) Received: from localhost ([::1]:45546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Bge-0001Er-96 for incoming@patchwork.ozlabs.org; Wed, 20 Feb 2013 10:34:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8BfZ-0007EG-Hi for qemu-devel@nongnu.org; Wed, 20 Feb 2013 10:33:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8BfT-0001hO-1J for qemu-devel@nongnu.org; Wed, 20 Feb 2013 10:33:16 -0500 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:56443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8BfS-0001h9-Fh for qemu-devel@nongnu.org; Wed, 20 Feb 2013 10:33:10 -0500 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Feb 2013 21:01:07 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp05.in.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Feb 2013 21:01:06 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id B66673940059 for ; Wed, 20 Feb 2013 21:03:05 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1KFX1m528704900 for ; Wed, 20 Feb 2013 21:03:01 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1KFX4EI023699 for ; Thu, 21 Feb 2013 02:33:05 +1100 Received: from titi.austin.rr.com (sig-9-76-138-226.mts.ibm.com [9.76.138.226]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r1KFWpJM022744; Thu, 21 Feb 2013 02:33:00 +1100 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 20 Feb 2013 09:32:43 -0600 Message-Id: <1361374369-19024-4-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1361374369-19024-1-git-send-email-aliguori@us.ibm.com> References: <1361374369-19024-1-git-send-email-aliguori@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13022015-8256-0000-0000-0000064AD5E6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.5 Cc: Paolo Bonzini , Anthony Liguori , Jan Kiszka , Stefano Stabellini Subject: [Qemu-devel] [PATCH 3/9] main-loop: refactor qemu_system_suspend_request() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori --- 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);