From patchwork Thu Jul 4 15:13:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 256946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BEE1C2C0091 for ; Fri, 5 Jul 2013 01:39:35 +1000 (EST) Received: from localhost ([::1]:49506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uuld6-0002SL-Pp for incoming@patchwork.ozlabs.org; Thu, 04 Jul 2013 11:39:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulH1-0003Lh-1N for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:16:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UulGz-00066Z-JJ for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:16:42 -0400 Received: from mail-we0-x230.google.com ([2a00:1450:400c:c03::230]:50840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulGz-00066V-94 for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:16:41 -0400 Received: by mail-we0-f176.google.com with SMTP id t56so1221620wes.35 for ; Thu, 04 Jul 2013 08:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=jjC5rAYnUA4j3kqMdCNIAqYac37GTrA0tenk8nXGxX8=; b=ljPByzL6BjJ2vq2biThbH/yKBhWXjkxnTIb+9/dUi0iW2ZA/hwemwCB/fqmIHBKpvk a3jRP3wzzyHBf3imYg+gl/9VWrVvK1ooOeUxfyy+Zf5tpzxVU8FgkIbLgBpUqO3mIeNf hHX7AiO2RHhfMavVYysBOXFjLNPILxZols4F8KybvQERNCAthbiszZKUVjqe3/UO3NIO /2Lf12qiLq6ENGtULTmkSFz/nl6sNqSuo1tBN4ngOAhpCyHlBKBJIgjwz1XJIHFC3H5P NeG1UjoJ4SBp9NsX2Lxt6alU35lsPM1NbPocLFVzsrjuXaunKzCLYzBNvtQB3gouw2zZ UBJQ== X-Received: by 10.194.1.226 with SMTP id 2mr3809692wjp.91.1372951000718; Thu, 04 Jul 2013 08:16:40 -0700 (PDT) Received: from playground.station (net-37-117-148-210.cust.dsl.vodafone.it. [37.117.148.210]) by mx.google.com with ESMTPSA id d8sm4212546wiz.0.2013.07.04.08.16.38 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Jul 2013 08:16:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 4 Jul 2013 17:13:59 +0200 Message-Id: <1372950842-32422-64-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372950842-32422-1-git-send-email-pbonzini@redhat.com> References: <1372950842-32422-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::230 Subject: [Qemu-devel] [PATCH 63/66] exec: separate current radix tree from the one being built X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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. Reviewed-by: Jan Kiszka 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 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;