qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 1/2] Signals: fix race condition with aio-compat


From: Alexandre Raymond
Subject: [Qemu-devel] [RFC PATCH 1/2] Signals: fix race condition with aio-compat
Date: Wed, 20 Jul 2011 01:01:29 -0400

There appears to be a race condition when SIGUSR2 is not handled synchronously
by the signalfd thread. This caused random freezes/segfaults under OS X.

This fix also appears to fix most of the I/O errors that occur when the 
io-thread
is enabled on OS X.

Signed-off-by: Alexandre Raymond <address@hidden>
---
 cpus.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/cpus.c b/cpus.c
index 3035314..f466d95 100644
--- a/cpus.c
+++ b/cpus.c
@@ -391,10 +391,6 @@ static int qemu_signal_init(void)
     sigset_t set;
 
 #ifdef CONFIG_IOTHREAD
-    /* SIGUSR2 used by posix-aio-compat.c */
-    sigemptyset(&set);
-    sigaddset(&set, SIGUSR2);
-    pthread_sigmask(SIG_UNBLOCK, &set, NULL);
 
     /*
      * SIG_IPI must be blocked in the main thread and must not be caught
@@ -406,11 +402,13 @@ static int qemu_signal_init(void)
     pthread_sigmask(SIG_BLOCK, &set, NULL);
 
     sigemptyset(&set);
+    sigaddset(&set, SIGUSR2);
     sigaddset(&set, SIGIO);
     sigaddset(&set, SIGALRM);
     sigaddset(&set, SIGBUS);
 #else
     sigemptyset(&set);
+    sigaddset(&set, SIGUSR2);
     sigaddset(&set, SIGBUS);
     if (kvm_enabled()) {
         /*
-- 
1.7.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]