Blame SOURCES/kvm-memory-Create-FlatView-directly.patch

4a2fec
From 61fad0cef2ed50a900717d11aab2e5e0ef121894 Mon Sep 17 00:00:00 2001
4a2fec
From: David Gibson <dgibson@redhat.com>
4a2fec
Date: Thu, 16 Nov 2017 03:07:29 +0100
4a2fec
Subject: [PATCH 25/30] memory: Create FlatView directly
4a2fec
4a2fec
RH-Author: David Gibson <dgibson@redhat.com>
4a2fec
Message-id: <20171116030732.8560-20-dgibson@redhat.com>
4a2fec
Patchwork-id: 77703
4a2fec
O-Subject: [PATCH 19/22] memory: Create FlatView directly
4a2fec
Bugzilla: 1481593
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
4a2fec
From: Alexey Kardashevskiy <aik@ozlabs.ru>
4a2fec
4a2fec
This avoids usual memory_region_transaction_commit() which rebuilds
4a2fec
all FVs.
4a2fec
4a2fec
On POWER8 with 255 CPUs, 255 virtio-net, 40 PCI bridges guest this brings
4a2fec
down the boot time from 25s to 20s and reduces the amount of temporary FVs
4a2fec
allocated during machine constructon (~800000 -> ~640000) and amount of
4a2fec
temporary dispatch trees (~370000 -> ~300000), the total memory footprint
4a2fec
goes down (18G -> 17G).
4a2fec
4a2fec
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
4a2fec
Message-Id: <20170921085110.25598-18-aik@ozlabs.ru>
4a2fec
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
(cherry picked from commit 202fc01b05572ecb258fdf4c5bd56cf6de8140c7)
4a2fec
4a2fec
Signed-off-by: David Gibson <dgibson@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 memory.c | 16 +++++++++++++---
4a2fec
 1 file changed, 13 insertions(+), 3 deletions(-)
4a2fec
4a2fec
diff --git a/memory.c b/memory.c
4a2fec
index 00d5788..93b4221 100644
4a2fec
--- a/memory.c
4a2fec
+++ b/memory.c
4a2fec
@@ -1009,6 +1009,17 @@ static void address_space_set_flatview(AddressSpace *as)
4a2fec
     }
4a2fec
 }
4a2fec
 
4a2fec
+static void address_space_update_topology(AddressSpace *as)
4a2fec
+{
4a2fec
+    MemoryRegion *physmr = memory_region_get_flatview_root(as->root);
4a2fec
+
4a2fec
+    flatviews_init();
4a2fec
+    if (!g_hash_table_lookup(flat_views, physmr)) {
4a2fec
+        generate_memory_topology(physmr);
4a2fec
+    }
4a2fec
+    address_space_set_flatview(as);
4a2fec
+}
4a2fec
+
4a2fec
 void memory_region_transaction_begin(void)
4a2fec
 {
4a2fec
     qemu_flush_coalesced_mmio_buffer();
4a2fec
@@ -2720,7 +2731,6 @@ void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset,
4a2fec
 void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
4a2fec
 {
4a2fec
     memory_region_ref(root);
4a2fec
-    memory_region_transaction_begin();
4a2fec
     as->root = root;
4a2fec
     as->current_map = NULL;
4a2fec
     as->ioeventfd_nb = 0;
4a2fec
@@ -2728,8 +2738,8 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
4a2fec
     QTAILQ_INIT(&as->listeners);
4a2fec
     QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
4a2fec
     as->name = g_strdup(name ? name : "anonymous");
4a2fec
-    memory_region_update_pending |= root->enabled;
4a2fec
-    memory_region_transaction_commit();
4a2fec
+    address_space_update_topology(as);
4a2fec
+    address_space_update_ioeventfds(as);
4a2fec
 }
4a2fec
 
4a2fec
 static void do_address_space_destroy(AddressSpace *as)
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec