[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: |
Tue, 22 Nov 2016 18:21:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 22/11/2016 17:31, Stefan Hajnoczi wrote:
> +static bool try_poll_mode(AioContext *ctx, bool enable)
> +{
> + if (enable && aio_poll_max_ns && ctx->poll_disable_cnt == 0) {
> + /* See qemu_soonest_timeout() uint64_t hack */
> + int64_t max_ns = MIN((uint64_t)aio_compute_timeout(ctx),
> + (uint64_t)aio_poll_max_ns);
> +
> + if (max_ns) {
> + poll_set_started(ctx, true);
> +
> + if (run_poll_handlers(ctx, max_ns)) {
> + return true;
> + }
> + }
> + }
> +
> + poll_set_started(ctx, false);
You could do a single iteration even if enable == false (which I'd
rename to blocking, BTW, because poll_start can be false on exit even if
enable == true).
In fact, since (like virtio_queue_host_notifier_aio_poll_end) all
.io_poll_end() callbacks are going to poll once more, what about adding
here:
return run_poll_handlers(ctx, 0);
or just an instance of the loop, without qemu_clock_get_ns and the
tracepoints:
return run_poll_handlers_once(ctx);
and removing from patch 10 the
/* Handle any buffers that snuck in after we finished polling */
virtio_queue_host_notifier_aio_poll(n);
?
Thanks,
Paolo
- [Qemu-devel] [PATCH v3 00/10] aio: experimental virtio-blk polling mode, Stefan Hajnoczi, 2016/11/22
- [Qemu-devel] [PATCH v3 02/10] virtio-blk: suppress virtqueue kick during processing, Stefan Hajnoczi, 2016/11/22
- [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
- Re: [Qemu-devel] [PATCH v3 09/10] aio: add .io_poll_begin/end() callbacks,
Paolo Bonzini <=
- [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