[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 09/10] aio: add .io_poll_begin/end() callback
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v3 09/10] aio: add .io_poll_begin/end() callbacks |
Date: |
Wed, 23 Nov 2016 11:59:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 23/11/2016 10:44, Stefan Hajnoczi wrote:
> I thought about the final poll but decided it was nicer for virtio.c to
> do it internally. Not all .io_poll_end() implementations may require an
> additional poll so it seemed more optimal to leave it up to each
> callback.
>
> If you prefer the run_poll_handlers_once(ctx) approach I'll switch to
> that.
I think the question is more whether it makes sense to poll once even
for non-blocking aio_poll. I think it does; after all, why even call
ppoll() if all sources support polling and you don't need to sleep? :)
Doing the run_poll_handlers_once automatically after .io_poll_end()
would be a side effect of how to write that code, but it's the less
interesting part.
BTW, iothread.c doesn't use non-blocking aio_poll, but there are
interesting opportunities for (micro)optimization of the event loop
involving non-blocking mode. For example we could add a
if (atomic_read(&ctx->notified)) {
blocking = false;
}
at the beginning of aio_poll. When a bottom half is scheduled, this
would avoid further notifications (notify_me stays zero) and skip
aio_compute_timeout. I think it's worthwhile for aio=threads, but it
would be a pity to lose polling in this case. The null backend also
uses bottom halves heavily, either directly for null-aio:// or through
bdrv_co_maybe_schedule_bh for null-co://.
Paolo
- [Qemu-devel] [PATCH v3 01/10] virtio: add missing vdev->broken check, (continued)
- [Qemu-devel] [PATCH v3 01/10] virtio: add missing vdev->broken check, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 03/10] virtio-scsi: suppress virtqueue kick during processing, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 06/10] virtio: poll virtqueues for new buffers, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 04/10] aio: add AioPollFn and io_poll() interface, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 08/10] virtio: turn vq->notification into a nested counter, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 07/10] linux-aio: poll ring for completions, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 05/10] aio: add polling mode to AioContext, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 09/10] aio: add .io_poll_begin/end() callbacks, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 10/10] virtio: disable virtqueue notifications during polling, Stefan Hajnoczi, 2016/11/22
- Re: [Qemu-devel] [PATCH v3 00/10] aio: experimental virtio-blk polling mode, no-reply, 2016/11/22
- Re: [Qemu-devel] [PATCH v3 00/10] aio: experimental virtio-blk polling mode, Paolo Bonzini, 2016/11/22
- Re: [Qemu-devel] [PATCH v3 00/10] aio: experimental virtio-blk polling mode, Christian Borntraeger, 2016/11/22