#include <palacios/vmm_sprintf.h>
#include <palacios/vmm_extensions.h>
#include <palacios/vmm_timeout.h>
-
+#include <palacios/vmm_options.h>
#ifdef V3_CONFIG_SVM
#include <palacios/svm.h>
}
}
-
-void Init_V3(struct v3_os_hooks * hooks, char * cpu_mask, int num_cpus) {
+void Init_V3(struct v3_os_hooks * hooks, char * cpu_mask, int num_cpus, char *options) {
int i = 0;
int minor = 0;
int major = 0;
v3_cpu_types[i] = V3_INVALID_CPU;
}
+ // Parse host-os defined options into an easily-accessed format.
+ v3_parse_options(options);
+
// Register all the possible device types
V3_init_devices();
// Register all shadow paging handlers
V3_init_shdw_paging();
+ // Initialize the scheduler framework (must be before extensions)
+ V3_init_scheduling();
+
// Register all extensions
V3_init_extensions();
+ // Enabling scheduler
+ V3_enable_scheduler();
+
#ifdef V3_CONFIG_SYMMOD
V3_init_symmod();
memset(vm->name, 0, 128);
strncpy(vm->name, name, 127);
+ /*
+ * Register this VM with the palacios scheduler. It will ask for admission
+ * prior to launch.
+ */
+ if(v3_scheduler_register_vm(vm) == -1) {
+
+ PrintError(vm, VCORE_NONE,"Error registering VM with scheduler\n");
+ }
+
return vm;
}
{
struct guest_info * core = (struct guest_info *)p;
+ if (v3_scheduler_register_core(core) == -1){
+ PrintError(core->vm_info, core,"Error initializing scheduling in core %d\n", core->vcpu_id);
+ }
PrintDebug(core->vm_info,core,"virtual core %u (on logical core %u): in start_core (RIP=%p)\n",
core->vcpu_id, core->pcpu_id, (void *)(addr_t)core->rip);
}
- if (vm->num_cores > avail_cores) {
- PrintError(vm, VCORE_NONE, "Attempted to start a VM with too many cores (vm->num_cores = %d, avail_cores = %d, MAX=%d)\n",
- vm->num_cores, avail_cores, MAX_CORES);
- return -1;
+ vm->avail_cores = avail_cores;
+
+ if (v3_scheduler_admit_vm(vm) != 0){
+ PrintError(vm, VCORE_NONE,"Error admitting VM %s for scheduling", vm->name);
}
vm->run_state = VM_RUNNING;
#ifdef V3_CONFIG_CHECKPOINT
#include <palacios/vmm_checkpoint.h>
-int v3_save_vm(struct v3_vm_info * vm, char * store, char * url) {
- return v3_chkpt_save_vm(vm, store, url);
+int v3_save_vm(struct v3_vm_info * vm, char * store, char * url, v3_chkpt_options_t opts) {
+ return v3_chkpt_save_vm(vm, store, url, opts);
}
-int v3_load_vm(struct v3_vm_info * vm, char * store, char * url) {
- return v3_chkpt_load_vm(vm, store, url);
+int v3_load_vm(struct v3_vm_info * vm, char * store, char * url, v3_chkpt_options_t opts) {
+ return v3_chkpt_load_vm(vm, store, url, opts);
}
#ifdef V3_CONFIG_LIVE_MIGRATION
-int v3_send_vm(struct v3_vm_info * vm, char * store, char * url) {
- return v3_chkpt_send_vm(vm, store, url);
+int v3_send_vm(struct v3_vm_info * vm, char * store, char * url, v3_chkpt_options_t opts) {
+ return v3_chkpt_send_vm(vm, store, url, opts);
}
-int v3_receive_vm(struct v3_vm_info * vm, char * store, char * url) {
- return v3_chkpt_receive_vm(vm, store, url);
+int v3_receive_vm(struct v3_vm_info * vm, char * store, char * url, v3_chkpt_options_t opts) {
+ return v3_chkpt_receive_vm(vm, store, url, opts);
}
#endif
#endif
-
-
-
-
-void v3_yield_cond(struct guest_info * info, int usec) {
- uint64_t cur_cycle;
- cur_cycle = v3_get_host_time(&info->time_state);
-
- if (cur_cycle > (info->yield_start_cycle + info->vm_info->yield_cycle_period)) {
- //PrintDebug(info->vm_info, info, "Conditional Yield (cur_cyle=%p, start_cycle=%p, period=%p)\n",
- // (void *)cur_cycle, (void *)info->yield_start_cycle,
- // (void *)info->yield_cycle_period);
-
- if (usec < 0) {
- V3_Yield();
- } else {
- V3_Sleep(usec);
- }
-
- info->yield_start_cycle += info->vm_info->yield_cycle_period;
- }
-}
-
-
-/*
- * unconditional cpu yield
- * if the yielding thread is a guest context, the guest quantum is reset on resumption
- * Non guest context threads should call this function with a NULL argument
- *
- * usec <0 => the non-timed yield is used
- * usec >=0 => the timed yield is used, which also usually implies interruptible
- */
-void v3_yield(struct guest_info * info, int usec) {
- if (usec < 0) {
- V3_Yield();
- } else {
- V3_Sleep(usec);
- }
-
- if (info) {
- info->yield_start_cycle += info->vm_info->yield_cycle_period;
- }
-}
-
-
-
-
void v3_print_cond(const char * fmt, ...) {
if (v3_dbg_enable == 1) {
char buf[2048];