From patchwork Sun Sep 1 09:51:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Jinsong" X-Patchwork-Id: 271587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 892EB2C0082 for ; Sun, 1 Sep 2013 19:52:00 +1000 (EST) Received: from localhost ([::1]:33213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG4K6-0008EQ-Ao for incoming@patchwork.ozlabs.org; Sun, 01 Sep 2013 05:51:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG4Jl-0008Dn-RY for qemu-devel@nongnu.org; Sun, 01 Sep 2013 05:51:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VG4Je-0004F8-DR for qemu-devel@nongnu.org; Sun, 01 Sep 2013 05:51:37 -0400 Received: from mga02.intel.com ([134.134.136.20]:58992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG4Je-0004Du-1T for qemu-devel@nongnu.org; Sun, 01 Sep 2013 05:51:30 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 01 Sep 2013 02:51:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,1001,1367996400"; d="scan'208,223";a="396618907" Received: from fmsmsx103.amr.corp.intel.com ([10.19.9.34]) by orsmga002.jf.intel.com with ESMTP; 01 Sep 2013 02:51:27 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX103.amr.corp.intel.com (10.19.9.34) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sun, 1 Sep 2013 02:51:27 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.99]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.139]) with mapi id 14.03.0123.003; Sun, 1 Sep 2013 17:51:25 +0800 From: "Liu, Jinsong" To: Anthony PERARD , Stefano Stabellini Thread-Topic: [PATCH 1/2] qem-xen: add later wakeup logic when qemu wakeup Thread-Index: AQHOpZG3n22gM+PNSE2jwdSv1v3CmZmwpJqg Date: Sun, 1 Sep 2013 09:51:24 +0000 Message-ID: References: <5220B3A3.4000100@citrix.com> In-Reply-To: <5220B3A3.4000100@citrix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.20 Cc: George Dunlap , "qemu-devel@nongnu.org" , Ian Campbell , "xen-devel@lists.xen.org" Subject: [Qemu-devel] [PATCH 1/2] qem-xen: add later wakeup logic when qemu wakeup 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 From 86ad3bb83a984ad7bbc00b81d6a0bfc1abc543ca Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Sun, 1 Sep 2013 23:39:14 +0800 Subject: [PATCH 1/2] qemu-xen: add later wakeup logic when qemu wakeup Currently HVM S3 has a bug coming from the difference between qemu-traditioanl and qemu-xen. For qemu-traditional, the way to resume from hvm s3 is via 'xl trigger' command. However, for qemu-xen, the way to resume from hvm s3 inherited from standard qemu, i.e. via QMP, and it doesn't work under Xen. The root cause is, for qemu-xen, 'xl trigger' command didn't reset devices, while QMP didn't unpause hvm domain though they did qemu system reset. We have two qemu-xen patches and one xl patch to fix the HVM S3 bug. This patch is the qemu-xen patch 1. It provides a later wakeup notifier and a register function, and notifies the later wakeup list when qemu wakup by 'xl trigger' command. Signed-off-by: Liu Jinsong Acked-by: Anthony PERARD --- sysemu.h | 1 + vl.c | 8 ++++++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/sysemu.h b/sysemu.h index b71f244..4dbcab7 100644 --- a/sysemu.h +++ b/sysemu.h @@ -49,6 +49,7 @@ void qemu_register_suspend_notifier(Notifier *notifier); void qemu_system_wakeup_request(WakeupReason reason); void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); void qemu_register_wakeup_notifier(Notifier *notifier); +void qemu_register_later_wakeup_notifier(Notifier *notifier); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); void qemu_register_powerdown_notifier(Notifier *notifier); diff --git a/vl.c b/vl.c index 5314f55..1c4842d 100644 --- a/vl.c +++ b/vl.c @@ -1478,6 +1478,8 @@ static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); +static NotifierList later_wakeup_notifiers = + NOTIFIER_LIST_INITIALIZER(later_wakeup_notifiers); static uint32_t wakeup_reason_mask = ~0; static RunState vmstop_requested = RUN_STATE_MAX; @@ -1668,6 +1670,11 @@ void qemu_register_wakeup_notifier(Notifier *notifier) notifier_list_add(&wakeup_notifiers, notifier); } +void qemu_register_later_wakeup_notifier(Notifier *notifier) +{ + notifier_list_add(&later_wakeup_notifiers, notifier); +} + void qemu_system_killed(int signal, pid_t pid) { shutdown_signal = signal; @@ -1744,6 +1751,7 @@ static bool main_loop_should_exit(void) cpu_synchronize_all_states(); qemu_system_reset(VMRESET_SILENT); resume_all_vcpus(); + notifier_list_notify(&later_wakeup_notifiers, NULL); monitor_protocol_event(QEVENT_WAKEUP, NULL); } if (qemu_powerdown_requested()) {