From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePBSD-0000w3-Pv for qemu-devel@nongnu.org; Wed, 13 Dec 2017 13:08:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePBSC-0004Dx-S1 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 13:08:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32784) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ePBSC-0004DR-LZ for qemu-devel@nongnu.org; Wed, 13 Dec 2017 13:08:24 -0500 From: "Dr. David Alan Gilbert (git)" Date: Wed, 13 Dec 2017 18:08:04 +0000 Message-Id: <20171213180807.7066-4-dgilbert@redhat.com> In-Reply-To: <20171213180807.7066-1-dgilbert@redhat.com> References: <20171213180807.7066-1-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH v4 3/6] vhost: Add temporary memory structure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Cc: maxime.coquelin@redhat.com, mst@redhat.com, groug@kaod.org From: "Dr. David Alan Gilbert" Add a 2nd 'vhost_memory' structure that will be used to build the new version as the listener iterates over the address space. Signed-off-by: Dr. David Alan Gilbert --- hw/virtio/vhost.c | 3 +++ include/hw/virtio/vhost.h | 1 + 2 files changed, 4 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index c7ce7baf9b..4523f45587 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -632,6 +632,8 @@ static void vhost_begin(MemoryListener *listener) memory_listener); dev->mem_changed_end_addr = 0; dev->mem_changed_start_addr = -1; + + dev->tmp_mem = g_malloc0(offsetof(struct vhost_memory, regions)); } static void vhost_commit(MemoryListener *listener) @@ -641,6 +643,7 @@ static void vhost_commit(MemoryListener *listener) uint64_t log_size; int r; + g_free(dev->tmp_mem); if (!dev->memory_changed) { return; } diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 467dc7794b..41f9e569be 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -70,6 +70,7 @@ struct vhost_dev { bool memory_changed; hwaddr mem_changed_start_addr; hwaddr mem_changed_end_addr; + struct vhost_memory *tmp_mem; const VhostOps *vhost_ops; void *opaque; struct vhost_log *log; -- 2.14.3