All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Friesen <chris.friesen@windriver.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, armbru@redhat.com, amit.shah@redhat.com
Subject: Re: [Qemu-devel] virtio-serial-pci very expensive during live migration
Date: Wed, 7 May 2014 16:25:50 -0600	[thread overview]
Message-ID: <536AB2EE.6010504@windriver.com> (raw)
In-Reply-To: <5369D504.2070101@redhat.com>

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	other threads:[~2014-05-07 22:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 20:01 [Qemu-devel] virtio-serial-pci very expensive during live migration Chris Friesen
2014-05-07  5:58 ` Markus Armbruster
2014-05-07  6:39 ` Paolo Bonzini
2014-05-07 22:25   ` Chris Friesen [this message]
2014-05-08 13:02     ` Amit Shah
2014-05-08 13:14       ` Paolo Bonzini
2014-05-08 13:30         ` Amit Shah
2014-05-08 13:36           ` Paolo Bonzini
2014-05-08 13:47             ` Amit Shah
2014-05-08 15:40               ` Chris Friesen
2014-05-09  0:53                 ` Chris Friesen
2014-05-09  8:19                   ` Paolo Bonzini
2014-06-19 15:19                     ` Chris Friesen
2014-06-19 15:31                       ` Paolo Bonzini
2014-05-08 14:31           ` Chris Friesen
2014-05-08 14:34             ` Paolo Bonzini
2014-05-08 15:57               ` Chris Friesen
2014-05-08 16:02                 ` Paolo Bonzini
2014-05-08 20:57                   ` Chris Friesen
2014-05-09  1:44               ` ChenLiang
2014-05-09  3:31                 ` Chris Friesen
2014-05-08  2:54   ` Gonglei (Arei)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=536AB2EE.6010504@windriver.com \
    --to=chris.friesen@windriver.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.