From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiPLt-0004EJ-Gy for qemu-devel@nongnu.org; Thu, 08 May 2014 10:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiPLl-0001Cb-8Y for qemu-devel@nongnu.org; Thu, 08 May 2014 10:31:13 -0400 Received: from mail.windriver.com ([147.11.1.11]:57083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiPLl-0001CH-13 for qemu-devel@nongnu.org; Thu, 08 May 2014 10:31:05 -0400 Message-ID: <536B9524.8070307@windriver.com> Date: Thu, 8 May 2014 08:31:00 -0600 From: Chris Friesen MIME-Version: 1.0 References: <53693FA4.3000306@windriver.com> <5369D504.2070101@redhat.com> <536AB2EE.6010504@windriver.com> <20140508130231.GA24978@grmbl.mre> <536B8332.9070705@redhat.com> <20140508133052.GA25602@grmbl.mre> In-Reply-To: <20140508133052.GA25602@grmbl.mre> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] virtio-serial-pci very expensive during live migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah , Paolo Bonzini Cc: qemu-devel@nongnu.org, armbru@redhat.com On 05/08/2014 07:30 AM, Amit Shah wrote: > On (Thu) 08 May 2014 [15:14:26], Paolo Bonzini wrote: >> Il 08/05/2014 15:02, Amit Shah ha scritto: >>>>> I tried the patch below. Unfortunately it seems to cause qemu to crash. >>> This doesn't remove the memory_region_transaction_begin() and >>> _commit() from memory_region_add_eventfd(), which will still be >>> called. >> >> That's correct, transactions can be nested. > > But each _commit() will add to the delay? No, the _commit() call checks "memory_region_transaction_depth" and only does the address space scan when it hits zero. So with nested transactions only the outer commit will actually do the address space scan. The fact remains that qemu crashes when I apply the patch. I also tried patching it as below in virtio_pci_vmstate_change(). That would allow the VM to boot, but it would crash when I tried to do a live migration. Chris --- 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 */ @@ -854,7 +855,7 @@ static int virtio_pci_set_host_notifier( static void virtio_pci_vmstate_change(DeviceState *d, bool running) { VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); - + memory_region_transaction_begin(); if (running) { /* Try to find out if the guest has bus master disabled, but is in ready state. Then we have a buggy guest OS. */ @@ -866,6 +867,7 @@ static void virtio_pci_vmstate_change(De } else { virtio_pci_stop_ioeventfd(proxy); } + memory_region_transaction_commit(); } static const VirtIOBindings virtio_pci_bindings = {