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.


Deallocation bug fix in device manager to allow backing out from VM creation failure
Peter Dinda [Sun, 2 Aug 2015 23:03:22 +0000 (18:03 -0500)]
if VM creation fails before the device manager is inited, for example on
running out of memory, device manager deinit needs to avoid running

palacios/include/palacios/vmm_dev_mgr.h
palacios/src/palacios/vmm_dev_mgr.c

index f90232a..0f60313 100644 (file)
@@ -58,6 +58,7 @@ struct vm_device {
 
 
 struct vmm_dev_mgr {
+    int    inited;
     uint_t num_devs;
     struct list_head dev_list;
     struct hashtable * dev_table;
index c75e633..0904ea1 100644 (file)
@@ -119,7 +119,9 @@ int v3_init_dev_mgr(struct v3_vm_info * vm) {
     mgr->net_table = v3_create_htable(0, dev_hash_fn, dev_eq_fn);
     mgr->char_table = v3_create_htable(0, dev_hash_fn, dev_eq_fn);
     mgr->cons_table = v3_create_htable(0, dev_hash_fn, dev_eq_fn);
-    
+
+    mgr->inited = 1;
+
     return 0;
 }
 
@@ -328,8 +330,17 @@ int v3_load_vm_devices(struct v3_vm_info * vm, struct v3_chkpt * chkpt) {
 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);
-    
+    struct vmm_dev_mgr * mgr=0;
+
+    if (vm) { 
+       mgr = &(vm->dev_mgr);
+       if (!mgr->inited) { 
+           return 0;
+       }
+    } else {
+       return 0;
+    }
+
     // clear frontend lists
 
     free_frontends(vm, mgr);
@@ -866,7 +877,7 @@ static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr) {
     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);