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.


Add load-time configurable memory block size
[palacios.git] / palacios / src / palacios / vmm_scheduler.c
index 36286cf..25a84fc 100644 (file)
@@ -7,8 +7,9 @@
  * and the University of New Mexico.  You can find out more at 
  * http://www.v3vee.org
  *
- * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
- * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+ * Copyright (c) 2013, Oscar Mondragon <omondrag@cs.unm.edu> 
+ * Copyright (c) 2013, Patrick G. Bridges <bridges@cs.unm.edu>
+ * Copyright (c) 2013, The V3VEE Project <http://www.v3vee.org> 
  * All rights reserved.
  *
  * Author: Oscar Mondragon <omondrag@cs.unm.edu>
@@ -63,8 +64,6 @@ int v3_register_scheduler(struct vm_scheduler_impl *s) {
         PrintError(VM_NONE, VCORE_NONE, "Multiple instances of scheduler (%s)\n", s->name);
         return -1;
     }
-    PrintDebug(VM_NONE, VCORE_NONE,"Registering Scheduler (%s) 2\n", s->name);
-
   
     if (v3_htable_insert(master_scheduler_table,
                          (addr_t)(s->name),
@@ -73,7 +72,6 @@ int v3_register_scheduler(struct vm_scheduler_impl *s) {
         return -1;
     }
 
-    PrintDebug(VM_NONE, VCORE_NONE,"Scheduler registered\n");
     return 0;
 }
 
@@ -83,12 +81,26 @@ struct vm_scheduler_impl *v3_scheduler_lookup(char *name)
 }
 
 int V3_enable_scheduler() {
-    /* XXX Lookup the specified scheduler to use for palacios and use it */
-    scheduler = v3_scheduler_lookup(default_strategy);
+    char *sched_name;
+
+    scheduler = NULL;
+    sched_name = v3_lookup_option("scheduler");
+
+    if (sched_name) {
+       scheduler = v3_scheduler_lookup(sched_name);
+    } 
+
+    if (!scheduler) {
+        scheduler = v3_scheduler_lookup(default_strategy);
+    }
+
     if (!scheduler) {
        PrintError(VM_NONE, VCORE_NONE,"Specified Palacios scheduler \"%s\" not found.\n", default_strategy);
        return -1;
     }
+
+    PrintDebug(VM_NONE, VCORE_NONE,"Scheduler %s found",scheduler->name);
+
     if (scheduler->init) {
        return scheduler->init();
     } else {
@@ -207,9 +219,11 @@ void host_sched_yield(struct guest_info * core, int usec) {
     } else {
         V3_Sleep(usec);
     }
-    yield_start_cycle = (uint64_t) core->sched_priv_data
-                        + (uint64_t)core->vm_info->sched_priv_data;
-    core->sched_priv_data = (void *)yield_start_cycle;
+    if(core){
+        yield_start_cycle = (uint64_t) core->sched_priv_data
+                            + (uint64_t)core->vm_info->sched_priv_data;
+        core->sched_priv_data = (void *)yield_start_cycle;
+    }
 }