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.


Expose swapping and pinning to host + add visibility to linux module
[palacios.git] / palacios / src / palacios / vmm.c
index 88fa79a..e16e2fa 100644 (file)
@@ -31,6 +31,7 @@
 #include <palacios/vmm_cpu_mapper.h>
 #include <palacios/vmm_direct_paging.h>
 #include <interfaces/vmm_numa.h>
+#include <interfaces/vmm_file.h>
 
 #ifdef V3_CONFIG_SVM
 #include <palacios/svm.h>
@@ -162,6 +163,10 @@ void Init_V3(struct v3_os_hooks * hooks, char * cpu_mask, int num_cpus, char *op
     // Register all shadow paging handlers
     V3_init_shdw_paging();
 
+#ifdef V3_CONFIG_SWAPPING
+    v3_init_swapping();
+#endif
+
     // Initialize the cpu_mapper framework (must be before extensions)
     V3_init_cpu_mapper();
 
@@ -239,6 +244,10 @@ void Shutdown_V3() {
     V3_deinit_scheduling();
     
     V3_deinit_cpu_mapper();
+
+#ifdef V3_CONFIG_SWAPPING
+    v3_deinit_swapping();
+#endif
     
     V3_deinit_shdw_paging();
     
@@ -387,7 +396,14 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) {
         PrintDebug(vm, VCORE_NONE, "run: core=%u, func=0x%p, arg=0x%p, name=%s\n",
                   core->pcpu_id, start_core, core, core->exec_name);
 
-       core->core_run_state = CORE_STOPPED;  // core zero will turn itself on
+       if (core->core_run_state==CORE_INVALID) { 
+         // launch of a fresh VM
+         core->core_run_state = CORE_STOPPED;  
+         // core zero will turn itself on
+       } else {
+         // this is a resume - use whatever its current run_state is
+       }
+
        core->core_thread = V3_CREATE_THREAD_ON_CPU(core->pcpu_id, start_core, core, core->exec_name);
 
        if (core->core_thread == NULL) {
@@ -846,6 +862,14 @@ int v3_get_state_vm(struct v3_vm_info        *vm,
     for (i=0;i<vm->mem_map.num_base_regions;i++) {
        mem->region[i].host_paddr =  (void*)(vm->mem_map.base_regions[i].host_addr);
        mem->region[i].size = v3_mem_block_size;
+#ifdef V3_CONFIG_SWAPPING
+       mem->region[i].swapped = vm->mem_map.base_regions[i].flags.swapped;
+       mem->region[i].pinned = vm->mem_map.base_regions[i].flags.pinned;
+#else
+       mem->region[i].swapped = 0;
+       mem->region[i].pinned = 0;
+#endif
+
     }
 
     mem->num_regions=numregions;