From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utf1I-0001nW-MS for qemu-devel@nongnu.org; Mon, 01 Jul 2013 10:24:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Utf1H-0007KI-E9 for qemu-devel@nongnu.org; Mon, 01 Jul 2013 10:23:56 -0400 Received: from goliath.siemens.de ([192.35.17.28]:27164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utf1H-0007K8-40 for qemu-devel@nongnu.org; Mon, 01 Jul 2013 10:23:55 -0400 Message-ID: <51D190F7.5090601@siemens.com> Date: Mon, 01 Jul 2013 16:23:51 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1372438702-20491-1-git-send-email-pbonzini@redhat.com> <1372438702-20491-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1372438702-20491-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 03/11] exec: simplify destruction of the phys map List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: "peter.maydell@linaro.org" , "qemu-devel@nongnu.org" On 2013-06-28 18:58, Paolo Bonzini wrote: > Do not bother visiting the radix tree when an address space is destroyed. The "because" is missing, see my comment on the previous patch. If you can clarify this, the rest is fine. Jan > > 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; > } > -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux