From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjOvL-0007OK-F2 for qemu-devel@nongnu.org; Wed, 20 Jul 2011 01:02:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjOvJ-0005CM-NE for qemu-devel@nongnu.org; Wed, 20 Jul 2011 01:02:18 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:49605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjOvJ-0005Bj-JV for qemu-devel@nongnu.org; Wed, 20 Jul 2011 01:02:17 -0400 Received: by mail-vx0-f173.google.com with SMTP id 29so3304581vxi.4 for ; Tue, 19 Jul 2011 22:02:17 -0700 (PDT) From: Alexandre Raymond Date: Wed, 20 Jul 2011 01:01:29 -0400 Message-Id: <1311138090-2909-2-git-send-email-cerbere@gmail.com> In-Reply-To: <1311138090-2909-1-git-send-email-cerbere@gmail.com> References: <1311138090-2909-1-git-send-email-cerbere@gmail.com> Subject: [Qemu-devel] [RFC PATCH 1/2] Signals: fix race condition with aio-compat List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexandre Raymond , pbonzini@redhat.com, andreas.faerber@web.de, agraf@suse.de, jan.kiszka@siemens.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 --- 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