From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsdOd-0006gm-Fr for qemu-devel@nongnu.org; Fri, 28 Jun 2013 14:27:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsdOb-0000We-EL for qemu-devel@nongnu.org; Fri, 28 Jun 2013 14:27:47 -0400 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:63272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsdOb-0000WM-6F for qemu-devel@nongnu.org; Fri, 28 Jun 2013 14:27:45 -0400 Received: by mail-ea0-f176.google.com with SMTP id z15so1190307ead.7 for ; Fri, 28 Jun 2013 11:27:44 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id o5sm12035344eef.5.2013.06.28.11.27.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Jun 2013 11:27:43 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 28 Jun 2013 20:26:43 +0200 Message-Id: <1372444009-11544-25-git-send-email-pbonzini@redhat.com> In-Reply-To: <1372444009-11544-1-git-send-email-pbonzini@redhat.com> References: <1372444009-11544-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 24/30] exec: separate current radix tree from the one being built List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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. Signed-off-by: Paolo Bonzini --- exec.c | 23 ++++++++++++++++------- include/exec/memory.h | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/exec.c b/exec.c index dffdf23..0d852ee 100644 --- a/exec.c +++ b/exec.c @@ -855,7 +855,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); @@ -1718,9 +1718,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) @@ -1784,13 +1796,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 1cd1f50..b21a460 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -212,6 +212,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