[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 63/66] exec: separate current radix tree from the on
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 63/66] exec: separate current radix tree from the one being built |
Date: |
Thu, 4 Jul 2013 17:13:59 +0200 |
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: Jan Kiszka <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 23 ++++++++++++++++-------
include/exec/memory.h | 1 +
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/exec.c b/exec.c
index 2eb279c..bd05c40 100644
--- a/exec.c
+++ b/exec.c
@@ -841,7 +841,7 @@ static void register_multipage(AddressSpaceDispatch *d,
static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
{
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
- AddressSpaceDispatch *d = as->dispatch;
+ AddressSpaceDispatch *d = as->next_dispatch;
MemoryRegionSection now = *section, remain = *section;
Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
@@ -1704,9 +1704,21 @@ static void io_mem_init(void)
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);
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)
@@ -1770,13 +1782,10 @@ static MemoryListener tcg_memory_listener = {
void address_space_init_dispatch(AddressSpace *as)
{
- AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);
-
- d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };
- d->as = as;
- as->dispatch = d;
+ as->dispatch = NULL;
as->dispatch_listener = (MemoryListener) {
.begin = mem_begin,
+ .commit = mem_commit,
.region_add = mem_add,
.region_nop = mem_add,
.priority = 0,
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 248c89b..ebe0d24 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -209,6 +209,7 @@ struct AddressSpace {
int ioeventfd_nb;
struct MemoryRegionIoeventfd *ioeventfds;
struct AddressSpaceDispatch *dispatch;
+ struct AddressSpaceDispatch *next_dispatch;
MemoryListener dispatch_listener;
QTAILQ_ENTRY(AddressSpace) address_spaces_link;
--
1.8.1.4
- [Qemu-devel] [PATCH 51/66] hw/s*: pass owner to memory_region_init* functions, (continued)
- [Qemu-devel] [PATCH 51/66] hw/s*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 50/66] hw/p*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 55/66] memory: access FlatView from a local variable, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 56/66] memory: use a new FlatView pointer on every topology update, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 54/66] add a header file for atomic operations, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 57/66] memory: add reference counting to FlatView, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 58/66] qom: Use atomics for object refcounting, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 59/66] exec: change well-known physical sections to macros, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 60/66] exec: separate current memory map from the one being built, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 61/66] memory: move MemoryListener declaration earlier, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 63/66] exec: separate current radix tree from the one being built,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 62/66] exec: move listener from AddressSpaceDispatch to AddressSpace, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 64/66] exec: put memory map in AddressSpaceDispatch, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 65/66] exec: remove cur_map, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 66/66] exec: change some APIs to take AddressSpaceDispatch, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 53/66] hw/[u-x]*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- Re: [Qemu-devel] [PULL 00/66] Memory API changes for 1.6: ownership, I/O ports, RCU preparation, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 52/66] hw/t*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04