From patchwork Mon Aug 13 19:48:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 177116 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 4696E2C0085 for ; Tue, 14 Aug 2012 07:04:37 +1000 (EST) Received: from localhost ([::1]:34366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T10eU-0002ff-8K for incoming@patchwork.ozlabs.org; Mon, 13 Aug 2012 15:50:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T10dp-0001lY-V6 for qemu-devel@nongnu.org; Mon, 13 Aug 2012 15:49:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T10dn-0003wK-Ps for qemu-devel@nongnu.org; Mon, 13 Aug 2012 15:49:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61552) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T10dn-0003wC-Hl for qemu-devel@nongnu.org; Mon, 13 Aug 2012 15:49:31 -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 q7DJnU2v008414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 13 Aug 2012 15:49:30 -0400 Received: from localhost (ovpn-113-98.phx2.redhat.com [10.3.113.98]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q7DJnT3k005218; Mon, 13 Aug 2012 15:49:30 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Mon, 13 Aug 2012 16:48:58 -0300 Message-Id: <1344887349-13041-38-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1344887349-13041-1-git-send-email-lcapitulino@redhat.com> References: <1344887349-13041-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: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 37/48] 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 Acked-by: Gerd Hoffmann --- vl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 91076f0..68fa0a0 100644 --- a/vl.c +++ b/vl.c @@ -1298,6 +1298,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 = @@ -1352,6 +1353,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; @@ -1459,7 +1467,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(); } @@ -1539,6 +1547,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);