All of lore.kernel.org
 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] [PATCH] Fix signal handling of SIG_IPI when io-thread is enabled
Date: Wed, 15 Jun 2011 01:20:31 -0400	[thread overview]
Message-ID: <1308115231-33690-1-git-send-email-cerbere@gmail.com> (raw)

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 <cerbere@gmail.com>
---
 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

             reply	other threads:[~2011-06-15  5:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  5:20 Alexandre Raymond [this message]
2011-06-15  7:38 ` [Qemu-devel] [PATCH] Fix signal handling of SIG_IPI when io-thread is enabled Jan Kiszka
2011-06-15 14:11   ` Alexandre Raymond
2011-07-09  2:33     ` Alexandre Raymond
2011-07-16 19:44       ` Blue Swirl

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=1308115231-33690-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.