From patchwork Wed Dec 13 18:08:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 848090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yxlDz5Wyxz9s7m for ; Thu, 14 Dec 2017 05:13:39 +1100 (AEDT) Received: from localhost ([::1]:36792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePBXF-0004fT-E6 for incoming@patchwork.ozlabs.org; Wed, 13 Dec 2017 13:13:37 -0500 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 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9D99C119CAA; Wed, 13 Dec 2017 18:08:23 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-87.ams2.redhat.com [10.36.117.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19BF9614F2; Wed, 13 Dec 2017 18:08:21 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com 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> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Dec 2017 18:08:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 3/6] vhost: Add temporary memory structure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maxime.coquelin@redhat.com, groug@kaod.org, mst@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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;