]> git.proxmox.com Git - mirror_qemu.git/commitdiff
virtio-blk: suppress virtqueue kick during processing
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 1 Dec 2016 19:26:46 +0000 (19:26 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 3 Jan 2017 16:38:49 +0000 (16:38 +0000)
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>
hw/block/virtio-blk.c

index 0c5fd275939fe884ac356660f3b70551c32ff6ea..50bb0cbb9329e9639d10b9cd1669c5c30b41bec2 100644 (file)
@@ -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);