From patchwork Fri Jun 28 16:58:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 255481 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 E2FE72C008A for ; Sat, 29 Jun 2013 03:01:42 +1000 (EST) Received: from localhost ([::1]:40281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usc3I-0007UR-R3 for incoming@patchwork.ozlabs.org; Fri, 28 Jun 2013 13:01:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usc0T-0003cI-D3 for qemu-devel@nongnu.org; Fri, 28 Jun 2013 12:58:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Usc0R-0001io-2n for qemu-devel@nongnu.org; Fri, 28 Jun 2013 12:58:45 -0400 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:42096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usc0Q-0001iP-TY for qemu-devel@nongnu.org; Fri, 28 Jun 2013 12:58:43 -0400 Received: by mail-ea0-f175.google.com with SMTP id z7so1146612eaf.20 for ; Fri, 28 Jun 2013 09:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=t/K2kRyExFJ65WqRq644bI+frg2rsxG2381/EQAFH+U=; b=ZJvbB3ua6nqBlqb8n77EWV2U7cIgHcUmlYFrvSRIpAxcT78b775uYf9LqVY80lDisV SwzVZF+f0v3aHEwcQENgjjbhRtnzAUyaYeg7OAaeyxHlncmCrC/HVl1LSc2KFqIkGsq5 Gk0+jZ7TQHpvCwAHnRTmgw0cnLhEW/vbqOcg3CpETNciQ2rl4EZQcMJgCDyWI+o5a6PV LeMzfG8E/+X29q8TvQhiLQfUvXz3ifqh6vKVIgGKbHjqADbof6HBZDphzMOXy+U4XUHz nXzZk9oQfqbGJH3FmoRK9PVfUX0qSfV8x7ITdUMws1J6MLiUL42tK9fl15W69/yOPl79 tUhg== X-Received: by 10.14.6.198 with SMTP id 46mr14390272een.121.1372438721943; Fri, 28 Jun 2013 09:58:41 -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 w43sm11609000eez.6.2013.06.28.09.58.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Jun 2013 09:58:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 28 Jun 2013 18:58:14 +0200 Message-Id: <1372438702-20491-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372438702-20491-1-git-send-email-pbonzini@redhat.com> References: <1372438702-20491-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:4013:c01::22f Cc: jan.kiszka@siemens.com, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH v2 03/11] exec: simplify destruction of the phys map 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 Do not bother visiting the radix tree when an address space is destroyed. Signed-off-by: Paolo Bonzini --- exec.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/exec.c b/exec.c index e7eadf5..9c77285 100644 --- a/exec.c +++ b/exec.c @@ -154,12 +154,6 @@ static uint16_t phys_map_node_alloc(void) return ret; } -static void phys_map_nodes_reset(void) -{ - phys_map_nodes_nb = 0; -} - - static void phys_page_set_level(PhysPageEntry *lp, hwaddr *index, hwaddr *nb, uint16_t leaf, int level) @@ -763,31 +757,6 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, uint16_t section); static subpage_t *subpage_init(AddressSpace *as, hwaddr base); -static void destroy_l2_mapping(PhysPageEntry *lp, unsigned level) -{ - unsigned i; - PhysPageEntry *p; - - if (lp->ptr == PHYS_MAP_NODE_NIL) { - return; - } - - p = phys_map_nodes[lp->ptr]; - for (i = 0; i < L2_SIZE; ++i) { - if (!p[i].is_leaf) { - destroy_l2_mapping(&p[i], level - 1); - } - } - lp->is_leaf = 0; - lp->ptr = PHYS_MAP_NODE_NIL; -} - -static void destroy_all_mappings(AddressSpaceDispatch *d) -{ - destroy_l2_mapping(&d->phys_map, P_L2_LEVELS - 1); - phys_map_nodes_reset(); -} - static uint16_t phys_section_add(MemoryRegionSection *section) { /* The physical section number is ORed with a page-aligned @@ -820,6 +789,7 @@ static void phys_sections_clear(void) MemoryRegionSection *section = &phys_sections[--phys_sections_nb]; phys_section_destroy(section->mr); } + phys_map_nodes_nb = 0; } static void register_subpage(AddressSpaceDispatch *d, MemoryRegionSection *section) @@ -1724,7 +1694,6 @@ static void mem_begin(MemoryListener *listener) { AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener); - destroy_all_mappings(d); d->phys_map.ptr = PHYS_MAP_NODE_NIL; } @@ -1791,7 +1760,6 @@ void address_space_destroy_dispatch(AddressSpace *as) AddressSpaceDispatch *d = as->dispatch; memory_listener_unregister(&d->listener); - destroy_l2_mapping(&d->phys_map, P_L2_LEVELS - 1); g_free(d); as->dispatch = NULL; }