Skip to content

block: make aio_poll(ctx, true) block with no fds

Stefan Hajnoczi qemu-devel 2 versions – Applied

Status from this message: Applied to my block tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

* Oops, this patch got lost. Rebased onto qemu.git/master for 1.8

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2block: clean up bdrv_drain_all() throttling commentsblock.c+1 -60 replies
2/2aio: make aio_poll(ctx, true) block with no fdsaio-posix.c aio-win32.c tests/test-aio.c+0 -110 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAlex Bligh
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/2] block: make aio_poll(ctx, true) block with no fds

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(-)
Signature · 1 line
1.8.4.2