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/
Home Products Support Community News


[Xen-changelog] [xen-unstable] hvm: Fix ioemu Qcow support.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: Fix ioemu Qcow support.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Jun 2007 11:21:32 -0700
Delivery-date: Wed, 20 Jun 2007 11:19:54 -0700
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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182346571 -3600
# Node ID ea52a66e43a8b11084563a418995294d3dbff018
# Parent  fe3df33e27615a9732f0ae73d65dae0f23afbb4d
hvm: Fix ioemu Qcow support.

Normally by default, SIGUSR2 is not blocked, so the signal masks of
SIGUSR2 in all threads is unblocked.

When creating HVM guest, if we use the Qcow format image file, in the
main thread, Qcow uses SIGUSR2 to be notified of the completion of the
request after it issues an AIO request; in tools/ioemu/block.c:
bdrv_read_em(), in some point between bdrv_aio_read() and
qemu_aio_wait(), Dom0 may send a SIGUSR2 to Qemu immediately to
indicate the completion of an AIO request -- since at the moment
SIGUSR2 in main thread is blocked by qemu_aio_wait_start(), the signal
may be delivered to one non-main thread, causing the signal handler of
SIGUSR2 is invoked, then the main thread hangs in

This patch blocks SIGUSR2 at the beginning of Qemu's main(), so it
ensures SIGUSR2 is blocked by default when a new thread is created,
then only the threads that use the signal unblock it.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
 tools/ioemu/block-raw.c |    2 +-
 tools/ioemu/vl.c        |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff -r fe3df33e2761 -r ea52a66e43a8 tools/ioemu/block-raw.c
--- a/tools/ioemu/block-raw.c   Wed Jun 20 13:39:54 2007 +0100
+++ b/tools/ioemu/block-raw.c   Wed Jun 20 14:36:11 2007 +0100
@@ -166,7 +166,7 @@ typedef struct RawAIOCB {
     struct RawAIOCB *next;
 } RawAIOCB;
-static int aio_sig_num = SIGUSR2;
+const int aio_sig_num = SIGUSR2;
 static RawAIOCB *first_aio; /* AIO issued */
 static int aio_initialized = 0;
diff -r fe3df33e2761 -r ea52a66e43a8 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Wed Jun 20 13:39:54 2007 +0100
+++ b/tools/ioemu/vl.c  Wed Jun 20 14:36:11 2007 +0100
@@ -7059,6 +7059,18 @@ int main(int argc, char **argv)
     char qemu_dm_logfilename[128];
+    /* Ensure that SIGUSR2 is blocked by default when a new thread is created,
+       then only the threads that use the signal unblock it -- this fixes a
+       race condition in Qcow support where the AIO signal is misdelivered.  */
+    {
+        extern const int aio_sig_num;
+        sigset_t set;
+        sigemptyset(&set);
+        sigaddset(&set, aio_sig_num);
+        sigprocmask(SIG_BLOCK, &set, NULL);
+    }
     LIST_INIT (&vm_change_state_head);
 #ifndef _WIN32

Xen-changelog mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: Fix ioemu Qcow support., Xen patchbot-unstable <=