On Mon, Jan 11, 2010 at 11:19:21AM +0200, Dor Laor wrote: > >Attached results with rhel5.4 (qemu0.11) for win2k8 32bit guest. Note > >the drastic reduction in cpu consumption. > > Attachment did not survive the email server, so you'll have to trust me > saying that cpu consumption was done from 65% -> 40% for reads and from > 80% --> 30% for writes
For what kind of workload, and using what qemu parameters, and cpu consumtion in the host or guest? Either way this is an awfull lot, did you use kernel AIO on the host? Any chance you could publish the benchmark, guest and host configs so we have meaningfull numbers? FYI below is the manually applied patch without all the wrapping: Index: qemu/hw/virtio-blk.c =================================================================== --- qemu.orig/hw/virtio-blk.c 2010-01-11 14:05:09.619254004 +0100 +++ qemu/hw/virtio-blk.c 2010-01-11 14:06:54.385013004 +0100 @@ -28,6 +28,7 @@ typedef struct VirtIOBlock char serial_str[BLOCK_SERIAL_STRLEN + 1]; QEMUBH *bh; size_t config_size; + unsigned int pending; } VirtIOBlock; static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) @@ -87,6 +88,8 @@ typedef struct VirtIOBlockReq struct VirtIOBlockReq *next; } VirtIOBlockReq; +static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq); + static void virtio_blk_req_complete(VirtIOBlockReq *req, int status) { VirtIOBlock *s = req->dev; @@ -95,6 +98,12 @@ static void virtio_blk_req_complete(Virt virtqueue_push(s->vq, &req->elem, req->qiov.size + sizeof(*req->in)); virtio_notify(&s->vdev, s->vq); + if (--s->pending == 0) { + virtio_queue_set_notification(s->vq, 1); + virtio_blk_handle_output(&s->vdev, s->vq); + } + + qemu_free(req); } @@ -340,6 +349,9 @@ static void virtio_blk_handle_output(Vir exit(1); } + if (++s->pending == 1) + virtio_queue_set_notification(s->vq, 0); + req->out = (void *)req->elem.out_sg[0].iov_base; req->in = (void *)req->elem.in_sg[req->elem.in_num - 1].iov_base;