From: Jack Lange Date: Thu, 13 Jan 2011 20:34:20 +0000 (-0600) Subject: fixed bug where deleting the memory map caused additional shadow page table allocations X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=559b7a07d8d5d783f0f2c2a64820ceaeda834a9e;p=palacios.git fixed bug where deleting the memory map caused additional shadow page table allocations --- diff --git a/palacios/src/palacios/vm_guest.c b/palacios/src/palacios/vm_guest.c index b544074..1e96747 100644 --- a/palacios/src/palacios/vm_guest.c +++ b/palacios/src/palacios/vm_guest.c @@ -567,9 +567,9 @@ int v3_free_vm_internal(struct v3_vm_info * vm) { v3_deinit_time_vm(vm); - v3_deinit_shdw_impl(vm); v3_deinit_mem_hooks(vm); v3_delete_mem_map(vm); + v3_deinit_shdw_impl(vm); v3_deinit_intr_routers(vm); v3_deinit_host_events(vm); diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index 56dcbbb..64c83c7 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -411,6 +411,19 @@ void v3_delete_mem_region(struct v3_vm_info * vm, struct v3_mem_region * reg) { return; } + + v3_rb_erase(&(reg->tree_node), &(vm->mem_map.mem_regions)); + + V3_Free(reg); + + + // If the guest isn't running then there shouldn't be anything to invalidate. + // Page tables should __always__ be created on demand during execution + // NOTE: This is a sanity check, and can be removed if that assumption changes + if (vm->run_state != VM_RUNNING) { + return; + } + for (i = 0; i < vm->num_cores; i++) { struct guest_info * info = &(vm->cores[i]); @@ -444,10 +457,6 @@ void v3_delete_mem_region(struct v3_vm_info * vm, struct v3_mem_region * reg) { } } - v3_rb_erase(&(reg->tree_node), &(vm->mem_map.mem_regions)); - - V3_Free(reg); - // flush virtual page tables // 3 cases shadow, shadow passthrough, and nested