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.


update linux module to support multicore
[palacios.git] / linux_module / palacios-vm.c
index 29cafd7..7380285 100644 (file)
@@ -36,7 +36,6 @@
 #endif
 
 
-
 extern struct class * v3_class;
 #define STREAM_NAME_LEN 128
 
@@ -64,6 +63,7 @@ static long v3_vm_ioctl(struct file * filp,
 #endif
            break;
        }
+
        case V3_VM_STREAM_CONNECT: {
 #ifdef V3_CONFIG_STREAM
            void __user * argp = (void __user *)arg;
@@ -104,7 +104,6 @@ static ssize_t v3_vm_read(struct file * filp, char __user * buf, size_t size, lo
 
 
 static ssize_t v3_vm_write(struct file * filp, const char __user * buf, size_t size, loff_t * offset) {
-    
 
     return 0;
 }
@@ -120,7 +119,6 @@ static struct file_operations v3_vm_fops = {
 };
 
 
-
 extern int vm_running;
 extern u32 pg_allocs;
 extern u32 pg_frees;
@@ -133,7 +131,7 @@ int start_palacios_vm(void * arg)  {
 
     lock_kernel();
     daemonize(guest->name);
-//    allow_signal(SIGKILL);
+    // allow_signal(SIGKILL);
     unlock_kernel();
     
 
@@ -141,12 +139,13 @@ int start_palacios_vm(void * arg)  {
 
     if (guest->v3_ctx == NULL) { 
        printk("palacios: failed to create vm\n");
+       complete(&(guest->start_done));
        return -1;
     }
 
     printk("Creating VM device: Major %d, Minor %d\n", MAJOR(guest->vm_dev), MINOR(guest->vm_dev));
 
-    cdev_init(&(guest->cdev), &v3_vm_fops);    
+    cdev_init(&(guest->cdev), &v3_vm_fops);
 
     guest->cdev.owner = THIS_MODULE;
     guest->cdev.ops = &v3_vm_fops;
@@ -157,18 +156,22 @@ int start_palacios_vm(void * arg)  {
 
     if (err) {
        printk("Fails to add cdev\n");
+       v3_free_vm(guest->v3_ctx);
+       complete(&(guest->start_done));
        return -1;
     }
 
     if (device_create(v3_class, NULL, guest->vm_dev, guest, "v3-vm%d", MINOR(guest->vm_dev)) == NULL){
        printk("Fails to create device\n");
+       cdev_del(&(guest->cdev));
+       v3_free_vm(guest->v3_ctx);
+       complete(&(guest->start_done));
        return -1;
     }
 
     complete(&(guest->start_done));
 
-    printk("palacios: launching vm\n");   
-
+    printk("palacios: launching vm\n");
 
 
 #if V3_CONFIG_EXT_INSPECTOR
@@ -178,6 +181,9 @@ int start_palacios_vm(void * arg)  {
 
     if (v3_start_vm(guest->v3_ctx, 0xffffffff) < 0) { 
        printk("palacios: launch of vm failed\n");
+       device_destroy(v3_class, guest->vm_dev);
+       cdev_del(&(guest->cdev));
+       v3_free_vm(guest->v3_ctx);
        return -1;
     }