Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


almost all deinitialization has been added
Jack Lange [Thu, 13 Jan 2011 18:23:57 +0000 (12:23 -0600)]
palacios/include/palacios/vmm_symbiotic.h
palacios/include/palacios/vmm_symmod.h
palacios/src/devices/pci.c
palacios/src/palacios/vm_guest.c
palacios/src/palacios/vmm_dev_mgr.c
palacios/src/palacios/vmm_symbiotic.c
palacios/src/palacios/vmm_symmod.c

index 530a5fc..0c581fd 100644 (file)
@@ -57,7 +57,10 @@ struct v3_sym_core_state {
 
 
 int v3_init_symbiotic_vm(struct v3_vm_info * vm);
+int v3_deinit_symbiotic_vm(struct v3_vm_info * vm);
+
 int v3_init_symbiotic_core(struct guest_info * core);
+int v3_deinit_symbiotic_core(struct guest_info * core);
 
 
 #endif
index 526a0c5..4d28fff 100644 (file)
@@ -88,6 +88,7 @@ int v3_set_symmod_loader(struct v3_vm_info * vm, struct v3_symmod_loader_ops * o
 int v3_load_sym_capsule(struct v3_vm_info * vm, char * mod_name);
 
 int v3_init_symmod_vm(struct v3_vm_info * vm, v3_cfg_tree_t * cfg);
+int v3_deinit_symmod_vm(struct v3_vm_info * vm);
 
 struct v3_sym_capsule * v3_get_sym_capsule(struct v3_vm_info * vm, char * name);
 
index 04d56f3..1f4976b 100644 (file)
@@ -611,8 +611,24 @@ static void init_pci_busses(struct pci_internal * pci_state) {
 
 
 static int pci_free(struct pci_internal * pci_state) {
+    int i;
+
+
+    // cleanup devices
+    for (i = 0; i < PCI_BUS_COUNT; i++) {
+       struct pci_bus * bus = &(pci_state->bus_list[i]);
+       struct rb_node * node = v3_rb_first(&(bus->devices));
+       struct pci_device * dev = NULL;
 
-    // cleanup devices (?)
+       while (node) {
+           dev = rb_entry(node, struct pci_device, dev_tree_node);
+           node = v3_rb_next(node);
+           
+           v3_rb_erase(&(dev->dev_tree_node), &(bus->devices));
+           V3_Free(dev);
+       }
+
+    }
     
     V3_Free(pci_state);
     return 0;
index 072ffac..b544074 100644 (file)
@@ -537,6 +537,11 @@ int v3_free_vm_internal(struct v3_vm_info * vm) {
     v3_remove_hypercall(vm, GUEST_INFO_HCALL);
 
 
+
+#ifdef CONFIG_SYMBIOTIC
+    v3_deinit_symbiotic_vm(vm);
+#endif
+
     // init SVM/VMX
     switch (cpu_type) {
 #ifdef CONFIG_SVM
@@ -578,6 +583,8 @@ int v3_free_vm_internal(struct v3_vm_info * vm) {
     v3_deinit_telemetry(vm);
 #endif
 
+
+
     return 0;
 }
 
@@ -645,7 +652,7 @@ int v3_free_core(struct guest_info * core) {
 
     
 #ifdef CONFIG_SYMBIOTIC
-    //v3_deinit_symbiotic_core(core);
+    v3_deinit_symbiotic_core(core);
 #endif
 
     v3_deinit_decoder(core);
index d41c331..f578f02 100644 (file)
@@ -120,13 +120,16 @@ int v3_free_vm_devices(struct v3_vm_info * vm) {
     return 0;
 }
 
+static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr);
+
 int v3_deinit_dev_mgr(struct v3_vm_info * vm) {
     struct vmm_dev_mgr * mgr = &(vm->dev_mgr);
+    
+    // clear frontend lists
+
+    free_frontends(vm, mgr);
+
 
-    v3_free_htable(mgr->blk_table, 0, 0);
-    v3_free_htable(mgr->net_table, 0, 0);
-    v3_free_htable(mgr->char_table, 0, 0);
-    v3_free_htable(mgr->cons_table, 0, 0);
 
     v3_free_htable(mgr->dev_table, 0, 0);
 
@@ -553,3 +556,45 @@ int v3_dev_connect_char(struct v3_vm_info * vm,
     return 0;
 }
 
+
+
+static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr) {
+    struct char_frontend * chr = NULL;
+    struct char_frontend * tmp_chr = NULL;
+    struct cons_frontend * cons = NULL;
+    struct cons_frontend * tmp_cons = NULL;
+    struct net_frontend * net = NULL;
+    struct net_frontend * tmp_net = NULL;
+    struct blk_frontend * blk = NULL;
+    struct blk_frontend * tmp_blk = NULL;
+
+
+
+    list_for_each_entry_safe(chr, tmp_chr, &(mgr->char_list), char_node) {
+       list_del(&(chr->char_node));
+       V3_Free(chr);
+    }
+
+    list_for_each_entry_safe(cons, tmp_cons, &(mgr->cons_list), cons_node) {
+       list_del(&(cons->cons_node));
+       V3_Free(cons);
+    }
+
+    list_for_each_entry_safe(net, tmp_net, &(mgr->net_list), net_node) {
+       list_del(&(net->net_node));
+       V3_Free(net);
+    }
+
+    list_for_each_entry_safe(blk, tmp_blk, &(mgr->blk_list), blk_node) {
+       list_del(&(blk->blk_node));
+       V3_Free(blk);
+    }
+
+    v3_free_htable(mgr->blk_table, 0, 0);
+    v3_free_htable(mgr->net_table, 0, 0);
+    v3_free_htable(mgr->char_table, 0, 0);
+    v3_free_htable(mgr->cons_table, 0, 0);
+
+
+    return 0;
+}
index 239efdc..7d9ea4c 100644 (file)
@@ -75,6 +75,22 @@ int v3_init_symbiotic_vm(struct v3_vm_info * vm) {
 }
 
 
+int v3_deinit_symbiotic_vm(struct v3_vm_info * vm) {
+
+#ifdef CONFIG_SYMMOD
+    if (v3_deinit_symmod_vm(vm) == -1) {
+       PrintError("Error deinitializing global SymMod state\n");
+       return -1;
+    }
+#endif
+
+    v3_unhook_cpuid(vm, SYM_CPUID_NUM);
+
+    
+    return 0;
+}
+
+
 
 int v3_init_symbiotic_core(struct guest_info * core) {
     struct v3_sym_core_state * core_state = &(core->sym_core_state);
@@ -88,3 +104,9 @@ int v3_init_symbiotic_core(struct guest_info * core) {
 
     return 0;
 }
+
+
+int v3_deinit_symbiotic_core(struct guest_info * core) {
+
+    return 0;
+}
index 7ca94d2..b037635 100644 (file)
@@ -215,6 +215,22 @@ int v3_init_symmod_vm(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     return 0;
 }
 
+int v3_deinit_symmod_vm(struct v3_vm_info * vm) {
+    struct v3_symmod_state * symmod_state = &(vm->sym_vm_state.symmod_state);
+    struct v3_symbol * sym = NULL;
+    struct v3_symbol * tmp_sym = NULL;
+
+    v3_remove_hypercall(vm, SYMMOD_SYMS_HCALL);
+
+    v3_free_htable(symmod_state->capsule_table, 0, 0);
+
+    list_for_each_entry_safe(sym, tmp_sym, &(symmod_state->v3_sym_list), sym_node) {
+       list_del(&(sym->sym_node));
+       V3_Free(sym);
+    }
+
+    return 0;
+}
 
 
 int v3_set_symmod_loader(struct v3_vm_info * vm, struct v3_symmod_loader_ops * ops, void * priv_data) {