From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWkgP-0005Ma-J3 for qemu-devel@nongnu.org; Wed, 15 Jun 2011 03:38:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWkgM-0005Cz-Lb for qemu-devel@nongnu.org; Wed, 15 Jun 2011 03:38:37 -0400 Received: from thoth.sbs.de ([192.35.17.2]:28428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWkgM-0005C7-1O for qemu-devel@nongnu.org; Wed, 15 Jun 2011 03:38:34 -0400 Message-ID: <4DF86174.7090406@siemens.com> Date: Wed, 15 Jun 2011 09:38:28 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1308115231-33690-1-git-send-email-cerbere@gmail.com> In-Reply-To: <1308115231-33690-1-git-send-email-cerbere@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [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: Alexandre Raymond Cc: "pbonzini@redhat.com" , "andreas.faerber@web.de" , "qemu-devel@nongnu.org" , "agraf@suse.de" On 2011-06-15 07:20, Alexandre Raymond wrote: > Both the signal thread (via sigwait()) and the cpu thread (via > a normal signal handler) were attempting to catch SIG_IPI. Why? Ahh, because of qemu_cpu_kick_self: raise(SIG_IPI)! That should generate a per-process SIG_IPI. And that may not only affect Darwin. Looks good. Acked-by: Jan Kiszka > > 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); -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux