From nobody Mon Feb 9 11:06:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15059206495807.790190095891262; Wed, 20 Sep 2017 08:17:29 -0700 (PDT) Received: from localhost ([::1]:48780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dugkg-0005Ak-Mv for importer@patchew.org; Wed, 20 Sep 2017 11:17:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dufmG-0003O6-NA for qemu-devel@nongnu.org; Wed, 20 Sep 2017 10:15:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dufmE-00058R-6u for qemu-devel@nongnu.org; Wed, 20 Sep 2017 10:15:00 -0400 Received: from ozlabs.ru ([107.173.13.209]:59756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dufmD-00057l-T7 for qemu-devel@nongnu.org; Wed, 20 Sep 2017 10:14:58 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 0D8173A60060; Wed, 20 Sep 2017 07:48:16 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Wed, 20 Sep 2017 21:46:36 +1000 Message-Id: <20170920114637.42004-18-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170920114637.42004-1-aik@ozlabs.ru> References: <20170920114637.42004-1-aik@ozlabs.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu v4 17/18] memory: Create FlatView directly 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: Alexey Kardashevskiy , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This avoids usual memory_region_transaction_commit() which rebuilds all FVs. On POWER8 with 255 CPUs, 255 virtio-net, 40 PCI bridges guest this brings down the boot time from 25s to 20s and reduces the amount of temporary FVs allocated during machine constructon (~800000 -> ~640000) and amount of temporary dispatch trees (~370000 -> ~300000), the total memory footprint goes down (18G -> 17G). Signed-off-by: Alexey Kardashevskiy --- memory.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/memory.c b/memory.c index 25000d1035..d3b3581990 100644 --- a/memory.c +++ b/memory.c @@ -1020,6 +1020,20 @@ static void flatview_set_to_address_space(AddressSpa= ce *as) } } =20 +static void flatview_update_topology_single(AddressSpace *as) +{ + MemoryRegion *physmr =3D memory_region_get_flatview_root(as->root); + FlatView *new_view; + + flatviews_init(); + new_view =3D g_hash_table_lookup(flat_views, physmr); + if (!new_view) { + new_view =3D generate_memory_topology(physmr); + g_hash_table_insert(flat_views, physmr, new_view); + } + flatview_set_to_address_space(as); +} + void memory_region_transaction_begin(void) { qemu_flush_coalesced_mmio_buffer(); @@ -2731,7 +2745,6 @@ void memory_region_invalidate_mmio_ptr(MemoryRegion *= mr, hwaddr offset, void address_space_init(AddressSpace *as, MemoryRegion *root, const char *= name) { memory_region_ref(root); - memory_region_transaction_begin(); as->root =3D root; as->current_map =3D NULL; as->ioeventfd_nb =3D 0; @@ -2739,8 +2752,7 @@ void address_space_init(AddressSpace *as, MemoryRegio= n *root, const char *name) QTAILQ_INIT(&as->listeners); QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link); as->name =3D g_strdup(name ? name : "anonymous"); - memory_region_update_pending |=3D root->enabled; - memory_region_transaction_commit(); + flatview_update_topology_single(as); } =20 static void do_address_space_destroy(AddressSpace *as) --=20 2.11.0