diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2016-12-01 19:26:46 +0000 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-01-03 16:38:49 +0000 |
commit | 9ef9d40261cc05c01545f46b49dddfe39602e1c8 (patch) | |
tree | 751648e1ce32ef238a790f62a41c72727e8d255f /hw | |
parent | 0d9d86fb4df4882ba4ad9968efe81eca1c7b7c90 (diff) | |
download | qemu-9ef9d40261cc05c01545f46b49dddfe39602e1c8.zip qemu-9ef9d40261cc05c01545f46b49dddfe39602e1c8.tar.gz qemu-9ef9d40261cc05c01545f46b49dddfe39602e1c8.tar.bz2 |
virtio-blk: suppress virtqueue kick during processing
The guest does not need to kick the virtqueue while we are processing
it. This reduces the number of vmexits during periods of heavy I/O.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20161201192652.9509-8-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/block/virtio-blk.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 0c5fd27..50bb0cb 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -588,13 +588,19 @@ void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq) blk_io_plug(s->blk); - while ((req = virtio_blk_get_request(s, vq))) { - if (virtio_blk_handle_request(req, &mrb)) { - virtqueue_detach_element(req->vq, &req->elem, 0); - virtio_blk_free_request(req); - break; + do { + virtio_queue_set_notification(vq, 0); + + while ((req = virtio_blk_get_request(s, vq))) { + if (virtio_blk_handle_request(req, &mrb)) { + virtqueue_detach_element(req->vq, &req->elem, 0); + virtio_blk_free_request(req); + break; + } } - } + + virtio_queue_set_notification(vq, 1); + } while (!virtio_queue_empty(vq)); if (mrb.num_reqs) { virtio_blk_submit_multireq(s->blk, &mrb); |