From patchwork Wed Jun 15 05:20:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Raymond X-Patchwork-Id: 100477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B416DB6F89 for ; Wed, 15 Jun 2011 15:23:53 +1000 (EST) Received: from localhost ([::1]:39663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWiZx-0005vD-5j for incoming@patchwork.ozlabs.org; Wed, 15 Jun 2011 01:23:49 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=j1BJftfHUPGMtyo1nd0y3mBwMIpJ32Gf8HUElrqB6HA=; b=wxVJzVCNDK8NpfgcTE2XEOrtMaH7KqvwntoUFMi4BYBXAcP5ImTGIFD9eEOhxv+eS9 /ivoeFm3vvCA3f+ljuoTDQOJRm+p1Pdqj44Qu6kPPXCagtm3f85y2mVvmwgGly36vo9K TJpcPZvVpBw1hwY/HrYLIasjFQ1KaRhMzmxCQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=Ykw2sSoeVlZNfNzqAMu+HyVmSExKFLby8/AuyHnbEXbk8VilvT3KeigPitNOlK+QuU RtTejtAe97+tXpPMs4iVdneV6aEzD+59iksZ0s3Z3be16MKk/XhXA0NYIKdeUBgMtXGB 8Jn9A5NunE2loo4sqYgnd6sg0GY9HxF81XbMg= Received: by 10.52.97.99 with SMTP id dz3mr107096vdb.161.1308115272140; Tue, 14 Jun 2011 22:21:12 -0700 (PDT) Received: from localhost.localdomain (modemcable055.201-23-96.mc.videotron.ca [96.23.201.55]) by mx.google.com with ESMTPS id e14sm58793vby.6.2011.06.14.22.21.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2011 22:21:11 -0700 (PDT) From: Alexandre Raymond To: qemu-devel@nongnu.org Date: Wed, 15 Jun 2011 01:20:31 -0400 Message-Id: <1308115231-33690-1-git-send-email-cerbere@gmail.com> X-Mailer: git-send-email 1.7.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.45 Cc: Alexandre Raymond , 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Acked-by: Jan Kiszka --- 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);