From patchwork Thu Aug 9 17:28:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 176199 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 21A412C00F1 for ; Fri, 10 Aug 2012 03:28:44 +1000 (EST) Received: from localhost ([::1]:53549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzWXK-0008Q8-6l for incoming@patchwork.ozlabs.org; Thu, 09 Aug 2012 13:28:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzWWb-0006JB-WD for qemu-devel@nongnu.org; Thu, 09 Aug 2012 13:28:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzWWX-0005cO-5k for qemu-devel@nongnu.org; Thu, 09 Aug 2012 13:27:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzWWW-0005cK-Sg for qemu-devel@nongnu.org; Thu, 09 Aug 2012 13:27:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q79HRqaG007255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 Aug 2012 13:27:52 -0400 Received: from localhost (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q79HRpWR021684; Thu, 9 Aug 2012 13:27:51 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2012 14:28:17 -0300 Message-Id: <1344533300-6422-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1344533300-6422-1-git-send-email-lcapitulino@redhat.com> References: <1344533300-6422-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [PATCH 1/4] qmp: don't emit the RESET event on wakeup from S3 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 QEMU is basically using reset logic when waking up from S3. This causes the QMP RESET event to be emitted, which is wrong. Also, the runstate checks done in reset are not necessary for S3 wakeup. Fix this by untangling wakeup from reset logic and passing VMRESET_SILENT to qemu_system_reset() to avoid emitting the RESET event. Signed-off-by: Luiz Capitulino --- vl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index e71cb30..b642637 100644 --- a/vl.c +++ b/vl.c @@ -1293,6 +1293,7 @@ static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; static int suspend_requested; +static int wakeup_requested; static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = @@ -1347,6 +1348,13 @@ static int qemu_suspend_requested(void) return r; } +static int qemu_wakeup_requested(void) +{ + int r = wakeup_requested; + wakeup_requested = 0; + return r; +} + int qemu_powerdown_requested(void) { int r = powerdown_requested; @@ -1454,7 +1462,7 @@ void qemu_system_wakeup_request(WakeupReason reason) runstate_set(RUN_STATE_RUNNING); monitor_protocol_event(QEVENT_WAKEUP, NULL); notifier_list_notify(&wakeup_notifiers, &reason); - reset_requested = 1; + wakeup_requested = 1; qemu_notify_event(); } @@ -1534,6 +1542,12 @@ static bool main_loop_should_exit(void) runstate_set(RUN_STATE_PAUSED); } } + if (qemu_wakeup_requested()) { + pause_all_vcpus(); + cpu_synchronize_all_states(); + qemu_system_reset(VMRESET_SILENT); + resume_all_vcpus(); + } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown);