From patchwork Mon Feb 4 12:12:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 217912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5AE002C02AD for ; Tue, 5 Feb 2013 00:20:19 +1100 (EST) Received: from localhost ([::1]:38686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2Kvz-0001aq-61 for incoming@patchwork.ozlabs.org; Mon, 04 Feb 2013 07:14:03 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2KvO-0000kq-TU for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:13:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2KvL-000117-Vr for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:13:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2KvL-00010v-OD for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:13:23 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r14CDLfv012808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Feb 2013 07:13:21 -0500 Received: from localhost (ovpn-112-30.ams2.redhat.com [10.36.112.30]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r14CDKVe022426; Mon, 4 Feb 2013 07:13:21 -0500 From: Stefan Hajnoczi To: Date: Mon, 4 Feb 2013 13:12:53 +0100 Message-Id: <1359979973-31338-11-git-send-email-stefanha@redhat.com> In-Reply-To: <1359979973-31338-1-git-send-email-stefanha@redhat.com> References: <1359979973-31338-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Jan Kiszka , Fabien Chouteau , Blue Swirl , Stefan Hajnoczi , Paolo Bonzini , Amos Kong , Laszlo Ersek Subject: [Qemu-devel] [PATCH v3 10/10] aio: support G_IO_HUP and G_IO_ERR 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 aio-posix.c could not take advantage of G_IO_HUP and G_IO_ERR because select(2) does not have equivalent events. Now that g_poll(3) is used we can support G_IO_HUP and G_IO_ERR. Signed-off-by: Stefan Hajnoczi Reviewed-by: Laszlo Ersek --- aio-posix.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index 7769927..1c5e601 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -88,8 +88,8 @@ void aio_set_fd_handler(AioContext *ctx, node->opaque = opaque; node->pollfds_idx = -1; - node->pfd.events = (io_read ? G_IO_IN | G_IO_HUP : 0); - node->pfd.events |= (io_write ? G_IO_OUT : 0); + node->pfd.events = (io_read ? G_IO_IN | G_IO_HUP | G_IO_ERR : 0); + node->pfd.events |= (io_write ? G_IO_OUT | G_IO_ERR : 0); } aio_notify(ctx); @@ -112,13 +112,6 @@ bool aio_pending(AioContext *ctx) QLIST_FOREACH(node, &ctx->aio_handlers, node) { int revents; - /* - * FIXME: right now we cannot get G_IO_HUP and G_IO_ERR because - * main-loop.c is still select based (due to the slirp legacy). - * If main-loop.c ever switches to poll, G_IO_ERR should be - * tested too. Dispatching G_IO_ERR to both handlers should be - * okay, since handlers need to be ready for spurious wakeups. - */ revents = node->pfd.revents & node->pfd.events; if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR) && node->io_read) { return true; @@ -150,7 +143,6 @@ static bool aio_dispatch(AioContext *ctx) revents = node->pfd.revents & node->pfd.events; node->pfd.revents = 0; - /* See comment in aio_pending. */ if (!node->deleted && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) && node->io_read) {