From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIs6Z-00075y-Br for qemu-devel@nongnu.org; Sun, 08 Sep 2013 23:25:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VIs6U-0001qb-AL for qemu-devel@nongnu.org; Sun, 08 Sep 2013 23:25:35 -0400 Received: from mga14.intel.com ([143.182.124.37]:1883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIs6U-0001qK-2x for qemu-devel@nongnu.org; Sun, 08 Sep 2013 23:25:30 -0400 From: "Liu, Jinsong" Date: Mon, 9 Sep 2013 03:24:59 +0000 Message-ID: References: <5228E235.9090109@redhat.com> In-Reply-To: <5228E235.9090109@redhat.com> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH V2] qemu-xen: HVM domain S3 bugfix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Ian Campbell , Stefano Stabellini , George Dunlap , "qemu-devel@nongnu.org" , "xen-devel@lists.xen.org" , Anthony PERARD Paolo Bonzini wrote: > Il 29/08/2013 10:25, Liu, Jinsong ha scritto: >> 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. >>=20 >> 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. >>=20 >> We have 2 patches to fix the HVM S3 bug: qemu-xen patch and xl patch. >> This patch is the qemu-xen patch. It registers a wakeup later notify, >> so that when 'xl trigger' command invokes QMP system_wakeup and after >> qemu system reset, it hypercalls to hypervisor to unpause domain, >> then=20 >> hvm S3 resumes successfully. >>=20 >> Signed-off-by: Liu Jinsong >> --- >> vl.c | 13 +++++++++++++ >> xen-all.c | 9 +++++++++ >> 2 files changed, 22 insertions(+), 0 deletions(-) >>=20 >> diff --git a/vl.c b/vl.c >> index 5314f55..aeebd83 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -1478,6 +1478,8 @@ static NotifierList suspend_notifiers =3D >> NOTIFIER_LIST_INITIALIZER(suspend_notifiers); >> static NotifierList wakeup_notifiers =3D >> NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); >> +static NotifierList wakeup_later_notifiers =3D >> + NOTIFIER_LIST_INITIALIZER(wakeup_later_notifiers); >> static uint32_t wakeup_reason_mask =3D ~0; >> static RunState vmstop_requested =3D RUN_STATE_MAX; >>=20 >> @@ -1625,6 +1627,11 @@ static void qemu_system_suspend(void) >> monitor_protocol_event(QEVENT_SUSPEND, NULL); >> } >>=20 >> +static void qemu_system_wakeup(void) >> +{ >> + notifier_list_notify(&wakeup_later_notifiers, NULL); +} >> + >> void qemu_system_suspend_request(void) >> { >> if (runstate_check(RUN_STATE_SUSPENDED)) { >> @@ -1668,6 +1675,11 @@ void qemu_register_wakeup_notifier(Notifier >> *notifier) notifier_list_add(&wakeup_notifiers, notifier); } >>=20 >> +void qemu_register_wakeup_later_notifier(Notifier *notifier) +{ >> + notifier_list_add(&wakeup_later_notifiers, notifier); +} >> + >> void qemu_system_killed(int signal, pid_t pid) >> { >> shutdown_signal =3D signal; >> @@ -1744,6 +1756,7 @@ static bool main_loop_should_exit(void) >> cpu_synchronize_all_states(); >> qemu_system_reset(VMRESET_SILENT); >> resume_all_vcpus(); >> + qemu_system_wakeup(); >=20 > Does Xen work if the hypercall is placed before resume_all_vcpus? In > this case, you can just move the wakeup_notifiers invocation from > qemu_system_wakeup_request to here, and avoid introducing a separate > list.=20 >=20 > Paolo >=20 No problem. Have updated and sent out. Thanks, Jinsong=