提交 00752703 编写于 作者: P Paolo Bonzini

exec: separate current radix tree from the one being built

This same treatment previously done to phys_node_map and phys_sections
is now applied to the dispatch field of AddressSpace.  Topology updates
use as->next_dispatch while accesses use as->dispatch.
Reviewed-by: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 89ae337a
...@@ -841,7 +841,7 @@ static void register_multipage(AddressSpaceDispatch *d, ...@@ -841,7 +841,7 @@ static void register_multipage(AddressSpaceDispatch *d,
static void mem_add(MemoryListener *listener, MemoryRegionSection *section) static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
{ {
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener); AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
AddressSpaceDispatch *d = as->dispatch; AddressSpaceDispatch *d = as->next_dispatch;
MemoryRegionSection now = *section, remain = *section; MemoryRegionSection now = *section, remain = *section;
Int128 page_size = int128_make64(TARGET_PAGE_SIZE); Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
...@@ -1702,11 +1702,23 @@ static void io_mem_init(void) ...@@ -1702,11 +1702,23 @@ static void io_mem_init(void)
} }
static void mem_begin(MemoryListener *listener) static void mem_begin(MemoryListener *listener)
{
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);
d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };
d->as = as;
as->next_dispatch = d;
}
static void mem_commit(MemoryListener *listener)
{ {
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener); AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
AddressSpaceDispatch *d = as->dispatch; AddressSpaceDispatch *d = as->dispatch;
d->phys_map.ptr = PHYS_MAP_NODE_NIL; /* cur_map will soon be switched to next_map, too. */
as->dispatch = as->next_dispatch;
g_free(d);
} }
static void core_begin(MemoryListener *listener) static void core_begin(MemoryListener *listener)
...@@ -1770,13 +1782,10 @@ static MemoryListener tcg_memory_listener = { ...@@ -1770,13 +1782,10 @@ static MemoryListener tcg_memory_listener = {
void address_space_init_dispatch(AddressSpace *as) void address_space_init_dispatch(AddressSpace *as)
{ {
AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1); as->dispatch = NULL;
d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };
d->as = as;
as->dispatch = d;
as->dispatch_listener = (MemoryListener) { as->dispatch_listener = (MemoryListener) {
.begin = mem_begin, .begin = mem_begin,
.commit = mem_commit,
.region_add = mem_add, .region_add = mem_add,
.region_nop = mem_add, .region_nop = mem_add,
.priority = 0, .priority = 0,
......
...@@ -209,6 +209,7 @@ struct AddressSpace { ...@@ -209,6 +209,7 @@ struct AddressSpace {
int ioeventfd_nb; int ioeventfd_nb;
struct MemoryRegionIoeventfd *ioeventfds; struct MemoryRegionIoeventfd *ioeventfds;
struct AddressSpaceDispatch *dispatch; struct AddressSpaceDispatch *dispatch;
struct AddressSpaceDispatch *next_dispatch;
MemoryListener dispatch_listener; MemoryListener dispatch_listener;
QTAILQ_ENTRY(AddressSpace) address_spaces_link; QTAILQ_ENTRY(AddressSpace) address_spaces_link;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册