[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 2/6] virtio: Introduce virtio_add_queue_aio
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH v4 2/6] virtio: Introduce virtio_add_queue_aio |
Date: |
Wed, 13 Jul 2016 11:07:00 +0200 |
On Wed, 13 Jul 2016 13:09:44 +0800
Fam Zheng <address@hidden> wrote:
> Using this function instead of virtio_add_queue marks the vq as aio
> based. This differentiation will be useful in later patches.
>
> Distinguish between virtqueue processing in the iohandler context and main
> loop
> AioContext. iohandler context is isolated from AioContexts and therefore does
> not run during aio_poll().
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> hw/virtio/virtio.c | 38 ++++++++++++++++++++++++++++++++++----
> include/hw/virtio/virtio.h | 3 +++
> 2 files changed, 37 insertions(+), 4 deletions(-)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 2cc68d24..2fbed0c 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -97,6 +97,7 @@ struct VirtQueue
> uint16_t vector;
> VirtIOHandleOutput handle_output;
> VirtIOHandleOutput handle_aio_output;
> + bool use_aio;
After some thought: We don't need to migrate that, so your patch is
fine.
> VirtIODevice *vdev;
> EventNotifier guest_notifier;
> EventNotifier host_notifier;
(...)
> +/* Add a virt queue and mark AIO.
> + * An AIO queue will use the AioContext based event interface instead of the
> + * default IOHandler and EventNotifier interface.
> + */
> +VirtQueue *virtio_add_queue_aio(VirtIODevice *vdev, int queue_size,
> + VirtIOHandleOutput handle_output)
> +{
> + return virtio_add_queue_internal(vdev, queue_size, handle_output, true);
> +}
> +
> +/* Add a normal virt queue (on the contrary to the AIO version above. */
/* Add a normal (non-AIO) virtqueue. */
?
> +VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
> + VirtIOHandleOutput handle_output)
> +{
> + return virtio_add_queue_internal(vdev, queue_size, handle_output, false);
> +}
> +
> void virtio_del_queue(VirtIODevice *vdev, int n)
> {
> if (n < 0 || n >= VIRTIO_QUEUE_MAX) {
> @@ -1830,11 +1850,21 @@ static void
> virtio_queue_host_notifier_read(EventNotifier *n)
> void virtio_queue_set_host_notifier_fd_handler(VirtQueue *vq, bool assign,
> bool set_handler)
> {
> + AioContext *ctx = qemu_get_aio_context();
Add a blank line.
> if (assign && set_handler) {
(...)
Other than the nits above:
Reviewed-by: Cornelia Huck <address@hidden>
- [Qemu-devel] [PATCH v4 0/6] virtio: Merge virtio-{blk, scsi} host notifier handling paths, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 2/6] virtio: Introduce virtio_add_queue_aio, Fam Zheng, 2016/07/13
- Re: [Qemu-devel] [PATCH v4 2/6] virtio: Introduce virtio_add_queue_aio,
Cornelia Huck <=
- [Qemu-devel] [PATCH v4 4/6] virtio-scsi: Call virtio_add_queue_aio, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 1/6] virtio: Add typedef for handle_output, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 3/6] virtio-blk: Call virtio_add_queue_aio, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 5/6] Revert "mirror: Workaround for unexpected iohandler events during completion", Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 6/6] virtio-scsi: Replace HandleOutput typedef, Fam Zheng, 2016/07/13