From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VobHW-0007qM-8N for qemu-devel@nongnu.org; Thu, 05 Dec 2013 10:56:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VobHQ-0000bS-To for qemu-devel@nongnu.org; Thu, 05 Dec 2013 10:56:02 -0500 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]:50319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VobHQ-0000aq-F2 for qemu-devel@nongnu.org; Thu, 05 Dec 2013 10:55:56 -0500 Received: by mail-ea0-f178.google.com with SMTP id d10so11438630eaj.37 for ; Thu, 05 Dec 2013 07:55:55 -0800 (PST) Date: Thu, 5 Dec 2013 16:55:52 +0100 From: Stefan Hajnoczi Message-ID: <20131205155552.GA14226@stefanha-thinkpad.redhat.com> References: <1385479081-17887-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1385479081-17887-1-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 0/2] block: make aio_poll(ctx, true) block with no fds List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , pingfank@linux.vnet.ibm.com, jan.kiszka@siemens.com, qemu-devel@nongnu.org, alex@alex.org.uk, pbonzini@redhat.com On Tue, Nov 26, 2013 at 04:17:59PM +0100, Stefan Hajnoczi wrote: > v2: > * Oops, this patch got lost. Rebased onto qemu.git/master for 1.8 > > Jan and Alex have expressed that aio_poll(ctx, blocking=true) should block even > when there are no file descriptors registered. This can be handy since other > threads may still kick the AioContext using aio_notify(ctx). > > A concrete example is a thread that has only a timer in its AioContext. > aio_poll(ctx, true) should block until the timer expires or another thread > invokes aio_notify(ctx). > > Alex and Paolo were concerned about bdrv_drain_all() which has the following > comment: > > while (busy) { > /* FIXME: We do not have timer support here, so this is effectively > * a busy wait. > */ > QTAILQ_FOREACH(bs, &bdrv_states, list) { > if (bdrv_start_throttled_reqs(bs)) { > busy = true; > } > } > > busy = bdrv_requests_pending_all(); > busy |= aio_poll(qemu_get_aio_context(), busy); > } > > Patch 1 drops this outdated comment. The new I/O throttling code already > eliminated the busy wait. > > Patch 2 drops the special case which returns immediately from aio_poll(ctx, > true) when no file descriptors are registered. > > Note that aio_notify(ctx) still causes aio_poll(ctx, true) to return false. I > don't see a need to change it so aio_poll(ctx, true) always returns true. > > Stefan Hajnoczi (2): > block: clean up bdrv_drain_all() throttling comments > aio: make aio_poll(ctx, true) block with no fds > > aio-posix.c | 5 ----- > aio-win32.c | 5 ----- > block.c | 7 +------ > tests/test-aio.c | 1 - > 4 files changed, 1 insertion(+), 17 deletions(-) Applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan