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.


Cleaned up deinitialization of VMM and free of VMs
[palacios.git] / palacios / src / palacios / vmm_cpu_mapper.c
index b99c626..f3cb4ca 100644 (file)
@@ -32,6 +32,7 @@
 static char default_strategy[] = "default";
 static struct hashtable * master_cpu_mapper_table = NULL;
 static int create_default_cpu_mapper();
+static int destroy_default_cpu_mapper();
 
 static struct vm_cpu_mapper_impl *cpu_mapper = NULL;
 
@@ -56,6 +57,13 @@ int V3_init_cpu_mapper() {
 }
 
 
+int V3_deinit_cpu_mapper() {
+
+    destroy_default_cpu_mapper();
+    v3_free_htable(master_cpu_mapper_table, 1, 1);
+    return 0;
+}
+
 int v3_register_cpu_mapper(struct vm_cpu_mapper_impl *s) {
 
     PrintDebug(VM_NONE, VCORE_NONE,"Registering cpu_mapper (%s)\n", s->name);
@@ -75,6 +83,21 @@ int v3_register_cpu_mapper(struct vm_cpu_mapper_impl *s) {
     return 0;
 }
 
+struct vm_cpu_mapper_impl *v3_unregister_cpu_mapper(char *name) {
+
+    PrintDebug(VM_NONE, VCORE_NONE,"Unregistering cpu_mapper (%s)\n",name);
+
+    struct vm_cpu_mapper_impl *f = (struct vm_cpu_mapper_impl *) v3_htable_remove(master_cpu_mapper_table,(addr_t)(name),0);
+
+    if (!f) { 
+       PrintError(VM_NONE,VCORE_NONE,"Could not find cpu_mapper (%s)\n",name);
+       return NULL;
+    } else {
+       return f;
+    }
+}
+
+
 struct vm_cpu_mapper_impl *v3_cpu_mapper_lookup(char *name)
 {
     return (struct vm_cpu_mapper_impl *)v3_htable_search(master_cpu_mapper_table, (addr_t)(name));
@@ -108,6 +131,15 @@ int V3_enable_cpu_mapper() {
     }
 }
 
+int V3_disable_cpu_mapper()
+{
+    if (cpu_mapper->deinit) { 
+       return cpu_mapper->deinit();
+    } else {
+       return 0;
+    }
+}
+
 int v3_cpu_mapper_register_vm(struct v3_vm_info *vm,unsigned int cpu_mask) {
     if (cpu_mapper->vm_init) {
        return cpu_mapper->vm_init(vm,cpu_mask);
@@ -220,3 +252,9 @@ static int create_default_cpu_mapper()
        v3_register_cpu_mapper(&default_mapper_impl);
        return 0;
 }
+
+static int destroy_default_cpu_mapper()
+{
+       v3_unregister_cpu_mapper(default_mapper_impl.name);
+       return 0;
+}