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

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