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.


added inspection framework
[palacios.git] / linux_module / palacios-vm.c
index cd3ba2c..943bbff 100644 (file)
@@ -17,6 +17,9 @@
 #include <linux/file.h>
 #include <linux/spinlock.h>
 
+#ifdef CONFIG_DEBUG_FS
+#include <linux/debugfs.h>
+#endif
 
 #include <palacios/vmm.h>
 
@@ -25,6 +28,7 @@
 #include "palacios-serial.h"
 #include "palacios-vm.h"
 
+
 extern struct class * v3_class;
 #define STREAM_NAME_LEN 128
 
@@ -102,6 +106,7 @@ extern u32 pg_frees;
 extern u32 mallocs;
 extern u32 frees;
 
+#include <palacios/vmm_inspector.h>
 
 int start_palacios_vm(void * arg)  {
     struct v3_guest * guest = (struct v3_guest *)arg;
@@ -113,8 +118,6 @@ int start_palacios_vm(void * arg)  {
     unlock_kernel();
     
 
-
-
     guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name);
 
     if (guest->v3_ctx == NULL) { 
@@ -143,19 +146,48 @@ int start_palacios_vm(void * arg)  {
        return -1;
     }
 
-    complete(&(guest->thread_done));
-
+    complete(&(guest->start_done));
 
     printk("palacios: launching vm\n");   
 
+
+
+#if 0
+    // Inspection Test
+    {
+       struct v3_inspection_value rax;
+       v3_inspect_node_t * core = NULL;
+       v3_inspect_node_t * gprs = NULL;
+       v3_inspect_node_t * root = v3_get_inspection_root(guest->v3_ctx);
+       
+       if (!root) {
+           printk("NULL root inspection tree\n");
+       }
+
+       core = v3_get_inspection_subtree(root, "core.0");
+       if (!core) {
+           printk("NULL core inspection tree\n");
+       }
+
+       gprs = v3_get_inspection_subtree(core, "GPRS");
+       if (!gprs) {
+           printk("NULL gprs inspection tree\n");
+       }
+       
+       v3_get_inspection_value(gprs, "RAX", &rax);
+
+       debugfs_create_u64("RAX", 0644, NULL, (u64 *)rax.value);
+    }
+#endif
+
+
     if (v3_start_vm(guest->v3_ctx, 0xffffffff) < 0) { 
        printk("palacios: launch of vm failed\n");
        return -1;
-    } 
+    }
     
     complete(&(guest->thread_done));
 
-
     printk("palacios: vm completed.  returning.\n");
 
     return 0;
@@ -165,13 +197,19 @@ int start_palacios_vm(void * arg)  {
 
 
 int stop_palacios_vm(struct v3_guest * guest) {
-    
+
     v3_stop_vm(guest->v3_ctx);
 
     wait_for_completion(&(guest->thread_done));
 
     v3_free_vm(guest->v3_ctx);
     
+    device_destroy(v3_class, guest->vm_dev);
+
+    cdev_del(&(guest->cdev));
+
+    kfree(guest->img);
+    kfree(guest);
 
     return 0;
 }