From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWiXT-0005uk-QC for qemu-devel@nongnu.org; Wed, 15 Jun 2011 01:21:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWiXS-0004u6-5T for qemu-devel@nongnu.org; Wed, 15 Jun 2011 01:21:15 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:32858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWiXR-0004sZ-QS for qemu-devel@nongnu.org; Wed, 15 Jun 2011 01:21:14 -0400 Received: by vws17 with SMTP id 17so51583vws.4 for ; Tue, 14 Jun 2011 22:21:12 -0700 (PDT) From: Alexandre Raymond Date: Wed, 15 Jun 2011 01:20:31 -0400 Message-Id: <1308115231-33690-1-git-send-email-cerbere@gmail.com> Subject: [Qemu-devel] [PATCH] Fix signal handling of SIG_IPI when io-thread is enabled 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 Both the signal thread (via sigwait()) and the cpu thread (via a normal signal handler) were attempting to catch SIG_IPI. This resulted in random freezes under Darwin. This patch separates SIG_IPI from the rest of the signals handled by the signal thread, because it is independently caught by the cpu thread. Signed-off-by: Alexandre Raymond --- cpus.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/cpus.c b/cpus.c index 18a1522..84ffd1c 100644 --- a/cpus.c +++ b/cpus.c @@ -394,10 +394,18 @@ static int qemu_signal_init(void) sigaddset(&set, SIGUSR2); pthread_sigmask(SIG_UNBLOCK, &set, NULL); + /* + * SIG_IPI must be blocked in the main thread and must not be caught + * by sigwait() in the signal thread. Otherwise, the cpu thread will + * not catch it reliably. + */ + sigemptyset(&set); + sigaddset(&set, SIG_IPI); + pthread_sigmask(SIG_BLOCK, &set, NULL); + sigemptyset(&set); sigaddset(&set, SIGIO); sigaddset(&set, SIGALRM); - sigaddset(&set, SIG_IPI); sigaddset(&set, SIGBUS); #else sigemptyset(&set); -- 1.7.5