[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/66] exec: simplify destruction of the phys map
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 20/66] exec: simplify destruction of the phys map |
Date: |
Thu, 4 Jul 2013 17:13:16 +0200 |
Do not bother visiting the radix tree when an address space is destroyed.
After the previous patch, this has become a pointless exercise. When
called from address_space_destroy_dispatch, all you're doing is zeroing
out a structure that will be freed as soon as you come back. When called
from mem_begin, when phys_page_set_level will call phys_map_node_alloc the
radix tree's array will be zeroed too.
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 34 +---------------------------------
1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/exec.c b/exec.c
index 78be4f5..f926bd7 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)
@@ -755,31 +749,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
@@ -812,6 +781,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)
@@ -1716,7 +1686,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;
}
@@ -1783,7 +1752,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;
}
--
1.8.1.4
- [Qemu-devel] [PATCH 09/66] vt82c686: replace register_ioport*, (continued)
- [Qemu-devel] [PATCH 09/66] vt82c686: replace register_ioport*, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 10/66] Privatize register_ioport_read/write, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 11/66] isa: implement isa_is_ioport_assigned via memory_region_find, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 12/66] vmware-vga: Accept unaligned I/O accesses, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 13/66] xen: Mark fixed platform I/O as unaligned, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 14/66] ioport: Switch dispatching to memory core layer, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 16/66] vmport: Disentangle read handler type from portio, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 15/66] ioport: Remove unused old dispatching services, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 17/66] ioport: Move portio types to ioport.h, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 19/66] memory: destroy phys_sections one by one, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 20/66] exec: simplify destruction of the phys map,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 21/66] memory: add getter for owner, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 22/66] memory: add ref/unref, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 23/66] memory: introduce memory_region_present, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 24/66] memory: add ref/unref calls, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 25/66] exec: check MRU in qemu_ram_addr_from_host, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 26/66] exec: move qemu_ram_addr_from_host_nofail to cputlb.c, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 27/66] memory: return MemoryRegion from qemu_ram_addr_from_host, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 28/66] exec: reorganize address_space_map, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 29/66] memory: ref/unref memory across address_space_map/unmap, Paolo Bonzini, 2013/07/04