X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fvm.c;h=08ae7e016e59be8ed60c2d9cef24e299d8015a1c;hb=793f9cd53a472668dbeb16341085e5512484485c;hp=967ecf6d78301bdc4562cc39f6248c9a0a3e5dad;hpb=9a9c14099c09e9ed86d8ac2f73f7406d0ac8a90b;p=palacios.git diff --git a/linux_module/vm.c b/linux_module/vm.c index 967ecf6..08ae7e0 100644 --- a/linux_module/vm.c +++ b/linux_module/vm.c @@ -12,7 +12,7 @@ #include #include #include - +#include #include #include #include @@ -127,12 +127,6 @@ static long v3_vm_ioctl(struct file * filp, printk("V3 IOCTL %d\n", ioctl); switch (ioctl) { - - case V3_VM_STOP: { - printk("Stopping VM (%s)\n", guest->name); - stop_palacios_vm(guest); - break; - } case V3_VM_PAUSE: { printk("Pausing VM (%s)\n", guest->name); v3_pause_vm(guest->v3_ctx); @@ -143,7 +137,65 @@ static long v3_vm_ioctl(struct file * filp, v3_continue_vm(guest->v3_ctx); break; } +#ifdef V3_CONFIG_CHECKPOINT + case V3_VM_SAVE: { + struct v3_chkpt_info chkpt; + void __user * argp = (void __user *)arg; + + memset(&chkpt, 0, sizeof(struct v3_chkpt_info)); + + if (copy_from_user(&chkpt, argp, sizeof(struct v3_chkpt_info))) { + printk("Copy from user error getting checkpoint info\n"); + return -EFAULT; + } + + printk("Saving Guest to %s:%s\n", chkpt.store, chkpt.url); + + if (v3_save_vm(guest->v3_ctx, chkpt.store, chkpt.url) == -1) { + printk("Error checkpointing VM state\n"); + return -EFAULT; + } + + break; + } + case V3_VM_LOAD: { + struct v3_chkpt_info chkpt; + void __user * argp = (void __user *)arg; + + memset(&chkpt, 0, sizeof(struct v3_chkpt_info)); + if (copy_from_user(&chkpt, argp, sizeof(struct v3_chkpt_info))) { + printk("Copy from user error getting checkpoint info\n"); + return -EFAULT; + } + + printk("Loading Guest to %s:%s\n", chkpt.store, chkpt.url); + + if (v3_load_vm(guest->v3_ctx, chkpt.store, chkpt.url) == -1) { + printk("Error Loading VM state\n"); + return -EFAULT; + } + + break; + } +#endif + case V3_VM_MOVE_CORE: { + struct v3_core_move_cmd cmd; + void __user * argp = (void __user *)arg; + + memset(&cmd, 0, sizeof(struct v3_core_move_cmd)); + + if (copy_from_user(&cmd, argp, sizeof(struct v3_core_move_cmd))) { + printk("copy from user error getting migrate command...\n"); + return -EFAULT; + } + + printk("moving guest %s vcore %d to CPU %d\n", guest->name, cmd.vcore_id, cmd.pcore_id); + + v3_move_vm_core(guest->v3_ctx, cmd.vcore_id, cmd.pcore_id); + + break; + } default: { struct vm_ctrl * ctrl = get_ctrl(guest, ioctl); @@ -264,17 +316,18 @@ 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); + vfree(guest->img); kfree(guest); return 0;