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.


More init checks to allow graceful fail out when VM cannot be created
Peter Dinda [Tue, 8 Sep 2015 22:32:22 +0000 (17:32 -0500)]
palacios/include/palacios/vmm_direct_paging.h
palacios/include/palacios/vmm_mem_hook.h
palacios/src/palacios/vmm_direct_paging.c
palacios/src/palacios/vmm_mem_hook.c

index 07aec18..fc9d924 100644 (file)
@@ -40,6 +40,7 @@ struct v3_passthrough_impl_state {
     // The externally visible state is just the callbacks
     v3_rw_lock_t     event_callback_lock;
     struct list_head event_callback_list;
+    int              inited; 
 };
 
 
index 65e3322..21d0eef 100644 (file)
@@ -42,6 +42,8 @@ struct v3_mem_hooks {
     /* We track memory hooks via a hash table */
     /* keyed to the memory region pointer */
     struct hashtable * reg_table; 
+
+    int inited; // structure needs to be deinited
 };
 
 
index 7c3e72f..b747ef1 100644 (file)
@@ -407,6 +407,7 @@ int v3_init_passthrough_paging(struct v3_vm_info *vm)
 {
   INIT_LIST_HEAD(&(vm->passthrough_impl.event_callback_list));
   v3_rw_lock_init(&(vm->passthrough_impl.event_callback_lock));
+  vm->passthrough_impl.inited=1;
   return 0;
 }
 
@@ -415,6 +416,10 @@ int v3_deinit_passthrough_paging(struct v3_vm_info *vm)
   struct passthrough_event_callback *cb,*temp;
   addr_t flags;
   
+  if (!vm->passthrough_impl.inited) { 
+      return 0;
+  }
+
   flags=v3_write_lock_irqsave(&(vm->passthrough_impl.event_callback_lock));
   
   list_for_each_entry_safe(cb,
index 1d49294..e4e1d98 100644 (file)
@@ -81,6 +81,8 @@ int v3_init_mem_hooks(struct v3_vm_info * vm) {
 
     hooks->reg_table = v3_create_htable(0, mem_hash_fn, mem_eq_fn);
 
+    hooks->inited=1;
+
     return 0;
 }
 
@@ -93,6 +95,10 @@ int v3_deinit_mem_hooks(struct v3_vm_info * vm) {
     struct mem_hook * tmp = NULL;
 
 
+    if (!hooks->inited) { 
+       return 0;
+    }
+
     // This is nasty...
     // We delete the hook info but leave its memory region intact
     // We rely on the memory map to clean up any orphaned regions as a result of this