mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
memory: Open code FlatView rendering
We are going to share FlatView's between AddressSpace's and per-AS memory listeners won't suit the purpose anymore so open code the dispatch tree rendering. Since there is a good chance that dispatch_listener was the only listener, this avoids address_space_update_topology_pass() if there is no registered listeners; this should improve starting time. This should cause no behavioural change. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Message-Id: <20170921085110.25598-3-aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e76bb18f7e
commit
9a62e24f45
4 changed files with 21 additions and 32 deletions
19
memory.c
19
memory.c
|
|
@ -884,14 +884,24 @@ static void address_space_update_topology_pass(AddressSpace *as,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void address_space_update_topology(AddressSpace *as)
|
||||
{
|
||||
FlatView *old_view = address_space_get_flatview(as);
|
||||
FlatView *new_view = generate_memory_topology(as->root);
|
||||
int i;
|
||||
|
||||
address_space_update_topology_pass(as, old_view, new_view, false);
|
||||
address_space_update_topology_pass(as, old_view, new_view, true);
|
||||
mem_begin(as);
|
||||
for (i = 0; i < new_view->nr; i++) {
|
||||
MemoryRegionSection mrs =
|
||||
section_from_flat_range(&new_view->ranges[i], as);
|
||||
mem_add(as, &mrs);
|
||||
}
|
||||
mem_commit(as);
|
||||
|
||||
if (!QTAILQ_EMPTY(&as->listeners)) {
|
||||
address_space_update_topology_pass(as, old_view, new_view, false);
|
||||
address_space_update_topology_pass(as, old_view, new_view, true);
|
||||
}
|
||||
|
||||
/* Writes are protected by the BQL. */
|
||||
atomic_rcu_set(&as->current_map, new_view);
|
||||
|
|
@ -2626,7 +2636,7 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
|
|||
QTAILQ_INIT(&as->listeners);
|
||||
QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
|
||||
as->name = g_strdup(name ? name : "anonymous");
|
||||
address_space_init_dispatch(as);
|
||||
as->dispatch = NULL;
|
||||
memory_region_update_pending |= root->enabled;
|
||||
memory_region_transaction_commit();
|
||||
}
|
||||
|
|
@ -2677,7 +2687,6 @@ void address_space_destroy(AddressSpace *as)
|
|||
as->root = NULL;
|
||||
memory_region_transaction_commit();
|
||||
QTAILQ_REMOVE(&address_spaces, as, address_spaces_link);
|
||||
address_space_unregister(as);
|
||||
|
||||
/* At this point, as->dispatch and as->current_map are dummy
|
||||
* entries that the guest should never use. Wait for the old
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue