From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXBNF-000796-C4 for qemu-devel@nongnu.org; Thu, 25 Sep 2014 11:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXBN9-0003Ys-2p for qemu-devel@nongnu.org; Thu, 25 Sep 2014 11:54:29 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:33983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXBN8-0003Xf-TY for qemu-devel@nongnu.org; Thu, 25 Sep 2014 11:54:23 -0400 Received: by mail-we0-f179.google.com with SMTP id u56so293263wes.24 for ; Thu, 25 Sep 2014 08:54:17 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54243AA3.7030007@redhat.com> Date: Thu, 25 Sep 2014 17:54:11 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411660269-11081-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1411660269-11081-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and SIGTERM synchronously List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: =?windows-1252?Q?Alex_Benn=E9e?= , Stefan Hajnoczi , patches@linaro.org Il 25/09/2014 17:51, Peter Maydell ha scritto: > Add the termination signals SIGINT, SIGHUP and SIGTERM to the > list of signals which we handle synchronously via a signalfd. > This avoids a race condition where if we took the SIGTERM > in the middle of qemu_shutdown_requested: > int r = shutdown_requested; > [SIGTERM here...] > shutdown_requested = 0; > > then the setting of the shutdown_requested flag by > termsig_handler() would be lost and QEMU would fail to > shut down. This was causing 'make check' to hang occasionally. > > Signed-off-by: Peter Maydell > Cc: qemu-stable@nongnu.org > --- > main-loop.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/main-loop.c b/main-loop.c > index 3cc79f8..8746abc 100644 > --- a/main-loop.c > +++ b/main-loop.c > @@ -84,6 +84,9 @@ static int qemu_signal_init(void) > sigaddset(&set, SIGIO); > sigaddset(&set, SIGALRM); > sigaddset(&set, SIGBUS); > + sigaddset(&set, SIGINT); > + sigaddset(&set, SIGHUP); > + sigaddset(&set, SIGTERM); > pthread_sigmask(SIG_BLOCK, &set, NULL); > > sigdelset(&set, SIG_IPI); > Reviewed-by: Paolo Bonzini Paolo