[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDispatch
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDispatch to AddressSpace |
Date: |
Fri, 28 Jun 2013 20:26:42 +0200 |
This will help having two copies of AddressSpaceDispatch during the
recreation of the radix tree (one being built, and one that is complete
and accessed under RCU). We do not want to have to unregister and
re-register the listener.
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 17 +++++++++--------
include/exec/memory.h | 2 ++
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/exec.c b/exec.c
index f138e56..dffdf23 100644
--- a/exec.c
+++ b/exec.c
@@ -99,7 +99,6 @@ struct AddressSpaceDispatch {
* The bottom level has pointers to MemoryRegionSections.
*/
PhysPageEntry phys_map;
- MemoryListener listener;
AddressSpace *as;
};
@@ -855,7 +854,8 @@ static void register_multipage(AddressSpaceDispatch *d,
static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
{
- AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch,
listener);
+ AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
+ AddressSpaceDispatch *d = as->dispatch;
MemoryRegionSection now = *section, remain = *section;
Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
@@ -1717,7 +1717,8 @@ static void io_mem_init(void)
static void mem_begin(MemoryListener *listener)
{
- AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch,
listener);
+ AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
+ AddressSpaceDispatch *d = as->dispatch;
d->phys_map.ptr = PHYS_MAP_NODE_NIL;
}
@@ -1786,22 +1787,22 @@ 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->listener = (MemoryListener) {
+ d->as = as;
+ as->dispatch = d;
+ as->dispatch_listener = (MemoryListener) {
.begin = mem_begin,
.region_add = mem_add,
.region_nop = mem_add,
.priority = 0,
};
- d->as = as;
- as->dispatch = d;
- memory_listener_register(&d->listener, as);
+ memory_listener_register(&as->dispatch_listener, as);
}
void address_space_destroy_dispatch(AddressSpace *as)
{
AddressSpaceDispatch *d = as->dispatch;
- memory_listener_unregister(&d->listener);
+ memory_listener_unregister(&as->dispatch_listener);
g_free(d);
as->dispatch = NULL;
}
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 913ac45..1cd1f50 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -212,6 +212,8 @@ struct AddressSpace {
int ioeventfd_nb;
struct MemoryRegionIoeventfd *ioeventfds;
struct AddressSpaceDispatch *dispatch;
+ MemoryListener dispatch_listener;
+
QTAILQ_ENTRY(AddressSpace) address_spaces_link;
};
--
1.8.1.4
- [Qemu-devel] [PATCH 14/30] event loop: report RCU quiescent states, (continued)
- [Qemu-devel] [PATCH 14/30] event loop: report RCU quiescent states, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 10/30] rcu: add call_rcu, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 15/30] cpus: report RCU quiescent states, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 16/30] block: report RCU quiescent states, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 17/30] migration: report RCU quiescent states, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 19/30] memory: avoid ref/unref in memory_region_find, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 18/30] memory: protect current_map by RCU, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 20/30] exec: change well-known physical sections to macros, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 21/30] exec: separate current memory map from the one being built, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 22/30] memory: move MemoryListener declaration earlier, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDispatch to AddressSpace,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 24/30] exec: separate current radix tree from the one being built, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 26/30] exec: remove cur_map, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 25/30] exec: put memory map in AddressSpaceDispatch, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 27/30] exec: change some APIs to take AddressSpaceDispatch, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 28/30] exec: change iotlb APIs to take AddressSpaceDispatch, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 29/30] exec: add a reference to the region returned by address_space_translate, Paolo Bonzini, 2013/06/28
- [Qemu-devel] [PATCH 30/30] exec: put address space dispatch under RCU critical section, Paolo Bonzini, 2013/06/28