qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] virtio-serial-pci very expensive during live migration


From: Chris Friesen
Subject: Re: [Qemu-devel] virtio-serial-pci very expensive during live migration
Date: Wed, 7 May 2014 16:25:50 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 05/07/2014 12:39 AM, Paolo Bonzini wrote:
Il 06/05/2014 22:01, Chris Friesen ha scritto:

It seems like the main problem is that we loop over all the queues,
calling virtio_pci_set_host_notifier_internal() on each of them.  That
in turn calls memory_region_add_eventfd(), which calls
memory_region_transaction_commit(), which scans over all the address
spaces, which seems to take the vast majority of the time.

Yes, you can wrap the entire loop with memory_region_transaction_begin
and memory_region_transaction_commit.  Can you try that?

I tried the patch below.  Unfortunately it seems to cause qemu to crash.

That said, I'm on a patched version so it might be good if someone else tried it. If it works for other people it might mean bugs in our other patches.

Chris





Index: qemu-1.4.2/hw/virtio-pci.c
===================================================================
--- qemu-1.4.2.orig/hw/virtio-pci.c
+++ qemu-1.4.2/hw/virtio-pci.c
@@ -32,6 +32,7 @@
 #include "virtio-pci.h"
 #include "qemu/range.h"
 #include "virtio-bus.h"
+#include "exec/memory.h"

 /* from Linux's linux/virtio_pci.h */

@@ -209,6 +210,7 @@ static void virtio_pci_start_ioeventfd(V
         return;
     }

+    memory_region_transaction_begin();
     for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) {
         if (!virtio_queue_get_num(proxy->vdev, n)) {
             continue;
@@ -219,10 +221,12 @@ static void virtio_pci_start_ioeventfd(V
             goto assign_error;
         }
     }
+    memory_region_transaction_commit();
     proxy->ioeventfd_started = true;
     return;

 assign_error:
+    memory_region_transaction_commit();
     while (--n >= 0) {
         if (!virtio_queue_get_num(proxy->vdev, n)) {
             continue;
@@ -244,6 +248,7 @@ static void virtio_pci_stop_ioeventfd(Vi
         return;
     }

+    memory_region_transaction_begin();
     for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) {
         if (!virtio_queue_get_num(proxy->vdev, n)) {
             continue;
@@ -252,6 +257,7 @@ static void virtio_pci_stop_ioeventfd(Vi
         r = virtio_pci_set_host_notifier_internal(proxy, n, false, false);
         assert(r >= 0);
     }
+    memory_region_transaction_commit();
     proxy->ioeventfd_started = false;
 }







reply via email to

[Prev in Thread] Current Thread [Next in Thread]