From patchwork Mon Sep 19 11:54:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 115325 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 192E3B6F9D for ; Mon, 19 Sep 2011 21:54:22 +1000 (EST) Received: from localhost ([::1]:40166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5cQV-0006iO-Ej for incoming@patchwork.ozlabs.org; Mon, 19 Sep 2011 07:54:19 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5cQN-0006aR-KV for qemu-devel@nongnu.org; Mon, 19 Sep 2011 07:54:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5cQM-0007Ie-Oe for qemu-devel@nongnu.org; Mon, 19 Sep 2011 07:54:11 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:37326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5cQM-0007Fh-Hx for qemu-devel@nongnu.org; Mon, 19 Sep 2011 07:54:10 -0400 Received: by mail-iy0-f173.google.com with SMTP id f6so6566572iag.4 for ; Mon, 19 Sep 2011 04:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=1g6VogiPKZmHvbFZz66tGsAe/EpyoxXbGUYxGm7i2s4=; b=yAE00SMxbnWAf9ljD1xB2WYTDbvGZOJj3oQO12V9QeRgpG5yz62eIK92siwVsRBoQA k8yY+q1FwSNWh5TWVqQXHQJMCUdZvok8qrIIZn1dssOXm4WRfE/cGT4QtrXvmSsOOPLj mnumLIA13Jfb50LbnnZVv2dazyju0TYUdczfw= Received: by 10.42.144.72 with SMTP id a8mr4422927icv.131.1316433250224; Mon, 19 Sep 2011 04:54:10 -0700 (PDT) Received: from obol602.omnitel.it (tor-exit-readme-1wh1.kromyon.net. [209.236.66.108]) by mx.google.com with ESMTPS id v16sm25467426ibe.0.2011.09.19.04.54.02 (version=SSLv3 cipher=OTHER); Mon, 19 Sep 2011 04:54:09 -0700 (PDT) From: Frediano Ziglio To: aliguori@us.ibm.com, kwolf@redhat.com Date: Mon, 19 Sep 2011 13:54:17 +0200 Message-Id: <1316433257-4863-3-git-send-email-freddy77@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1316433257-4863-1-git-send-email-freddy77@gmail.com> References: <1316433257-4863-1-git-send-email-freddy77@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.173 Cc: qemu-devel@nongnu.org, Frediano Ziglio Subject: [Qemu-devel] [PATCH 2/2] block: avoid SIGUSR2 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 Signed-off-by: Frediano Ziglio --- cpus.c | 5 ----- posix-aio-compat.c | 14 ++++---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/cpus.c b/cpus.c index 54c188c..d0cfe91 100644 --- a/cpus.c +++ b/cpus.c @@ -380,11 +380,6 @@ static int qemu_signal_init(void) int sigfd; sigset_t set; - /* SIGUSR2 used by posix-aio-compat.c */ - sigemptyset(&set); - 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 diff --git a/posix-aio-compat.c b/posix-aio-compat.c index 7ea63a1..72c6dbb 100644 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@ -308,6 +308,8 @@ static ssize_t handle_aiocb_rw(struct qemu_paiocb *aiocb) return nbytes; } +static void posix_aio_notify_event(void); + static void *aio_thread(void *unused) { pid_t pid; @@ -380,7 +382,7 @@ static void *aio_thread(void *unused) aiocb->ret = ret; mutex_unlock(&lock); - if (kill(pid, SIGUSR2)) die("kill failed"); + posix_aio_notify_event(); } cur_threads--; @@ -547,7 +549,7 @@ static int posix_aio_flush(void *opaque) static PosixAioState *posix_aio_state; -static void aio_signal_handler(int signum) +static void posix_aio_notify_event(void) { if (posix_aio_state) { char byte = 0; @@ -557,8 +559,6 @@ static void aio_signal_handler(int signum) if (ret < 0 && errno != EAGAIN) die("write()"); } - - qemu_service_io(); } static void paio_remove(struct qemu_paiocb *acb) @@ -662,7 +662,6 @@ BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, int paio_init(void) { - struct sigaction act; PosixAioState *s; int fds[2]; int ret; @@ -672,11 +671,6 @@ int paio_init(void) s = g_malloc(sizeof(PosixAioState)); - sigfillset(&act.sa_mask); - act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ - act.sa_handler = aio_signal_handler; - sigaction(SIGUSR2, &act, NULL); - s->first_aio = NULL; if (qemu_pipe(fds) == -1) { fprintf(stderr, "failed to create pipe\n");