WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] hvm: Fix 'xm save' bug in qhich qemu-dm i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: Fix 'xm save' bug in qhich qemu-dm ignores SIGTERM.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 01 Feb 2008 08:00:30 -0800
Delivery-date: Fri, 01 Feb 2008 08:01:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201867294 0
# Node ID d29d74d4eeac4e6ca46065dcca1e1bfee2c77a52
# Parent  3787e70b2ab219de50dff7417917fd9f9ccfcc35
hvm: Fix 'xm save' bug in qhich qemu-dm ignores SIGTERM.

When saving a guest in early ChangeSet (Before 16750), Xend will
send "SIGKILL" signal to kill qemu process. But in ChangeSet 16750,
the signal is modified to "SIGTERM". However, "SIGTERM" handler has
been registered by SDL in qemu. So when qemu process receives a
"SIGTERM", SDL will catch it and it will push out a "SDL_QUIT" even to
qemu. If qemu can receive that event, it will be successfully
terminated. While we do "xm save", qemu can't go out from the dead
loop "while (suspend_requested) {...}" in main_loop() to handle the
SQL_QUIT event. So it is unable to poll that "SDL_QUIT" event. This
makes xm save command hang. This fix enables qemu to poll the
"SDL_QUIT" event while doing save.

Signed-off-by: Xu Dongxiao <dongxiao.xu@xxxxxxxxx>
---
 tools/ioemu/target-i386-dm/helper2.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff -r 3787e70b2ab2 -r d29d74d4eeac tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Fri Feb 01 11:21:27 2008 +0000
+++ b/tools/ioemu/target-i386-dm/helper2.c      Fri Feb 01 12:01:34 2008 +0000
@@ -672,11 +672,28 @@ int main_loop(void)
         xenstore_record_dm_state("paused");
 
         /* Wait to be allowed to continue */
-        while (suspend_requested) {
+        while (suspend_requested && !shutdown_requested) {
+            /*
+             * Poll for shutdown via SDL every 10ms.
+             * This is needed because SDL steals SIGTERM and only lets us
+             * know about it after gui_update().
+             */
+            struct timeval tv;
+            tv.tv_sec  = 0;
+            tv.tv_usec = 10000;
+
             FD_ZERO(&fds);
             FD_SET(xenstore_fd(), &fds);
-            if (select(xenstore_fd() + 1, &fds, NULL, NULL, NULL) > 0)
+            if (select(xenstore_fd() + 1, &fds, NULL, NULL, &tv) > 0)
                 xenstore_process_event(NULL);
+
+            /* Refresh SDL state and pick up any pending shutdown request. */
+            gui_update();
+        }
+
+        if (shutdown_requested) {
+            ret = EXCP_INTERRUPT;
+            break;
         }
 
         xenstore_record_dm_state("running");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: Fix 'xm save' bug in qhich qemu-dm ignores SIGTERM., Xen patchbot-unstable <=