qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Raymond <cerbere@gmail.com>
To: qemu-devel@nongnu.org
Cc: Alexandre Raymond <cerbere@gmail.com>,
	pbonzini@redhat.com, andreas.faerber@web.de, agraf@suse.de,
	jan.kiszka@siemens.com
Subject: [Qemu-devel] [RFC PATCH 1/2] Signals: fix race condition with aio-compat
Date: Wed, 20 Jul 2011 01:01:29 -0400	[thread overview]
Message-ID: <1311138090-2909-2-git-send-email-cerbere@gmail.com> (raw)
In-Reply-To: <1311138090-2909-1-git-send-email-cerbere@gmail.com>

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 <cerbere@gmail.com>
---
 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	other threads:[~2011-07-20  5:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20  5:01 [Qemu-devel] [RFC PATCH 0/2] Signal fixes for OSX Alexandre Raymond
2011-07-20  5:01 ` Alexandre Raymond [this message]
2011-07-20  5:01 ` [Qemu-devel] [RFC PATCH 2/2] Signals: rework initial signal setup Alexandre Raymond
2011-07-25 15:54 ` [Qemu-devel] [RFC PATCH 0/2] Signal fixes for OSX Alexandre Raymond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311138090-2909-2-git-send-email-cerbere@gmail.com \
    --to=cerbere@gmail.com \
    --cc=agraf@suse.de \
    --cc=andreas.faerber@web.de \
    --cc=jan.kiszka@siemens.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).