vmm: Rename SYS_vmm_setup -> SYS_vmm_add_gpcs (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 8 Sep 2017 20:06:25 +0000 (16:06 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 14 Sep 2017 20:37:58 +0000 (16:37 -0400)
You can call it as many times as you want, adding more guest physical cores
as you go.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/trap.c
kern/include/ros/bits/syscall.h
kern/src/syscall.c
tests/strace.c
user/vmm/sched.c

index f9d6999..da5d83c 100644 (file)
@@ -884,6 +884,8 @@ static bool handle_vmexit_cpuid(struct vm_trapframe *tf)
 
        cpuid(tf->tf_rax, tf->tf_rcx, &eax, &ebx, &ecx, &edx);
        switch (tf->tf_rax) {
+               /* TODO: If we can move this to userspace, vmrunkernel can make GPCS on
+                * the fly. */
                case 0x01:
                        /* Set the hypervisor bit to let the guest know it is virtualized */
                        ecx |= 1 << 31;
index f92bc52..00f3182 100644 (file)
@@ -36,7 +36,7 @@
 #define SYS_abort_sysc                         31
 #define SYS_populate_va                                32
 #define SYS_abort_sysc_fd                      33
-#define SYS_vmm_setup                          34
+#define SYS_vmm_add_gpcs                       34
 #define SYS_vc_entry                           35
 #define SYS_nanosleep                          36
 #define SYS_pop_ctx                                    37
index 5d103b9..64ed4c5 100644 (file)
@@ -1490,8 +1490,8 @@ static int sys_pop_ctx(struct proc *p, struct user_context *ctx)
        return 0;
 }
 
-static int sys_vmm_setup(struct proc *p, unsigned int nr_more_gpcs,
-                         struct vmm_gpcore_init *gpcis)
+static int sys_vmm_add_gpcs(struct proc *p, unsigned int nr_more_gpcs,
+                            struct vmm_gpcore_init *gpcis)
 {
        ERRSTACK(1);
        struct vmm *vmm = &p->vmm;
@@ -2638,7 +2638,7 @@ const struct sys_table_entry syscall_table[] = {
        [SYS_init_arsc] = {(syscall_t)sys_init_arsc, "init_arsc"},
 #endif
        [SYS_change_to_m] = {(syscall_t)sys_change_to_m, "change_to_m"},
-       [SYS_vmm_setup] = {(syscall_t)sys_vmm_setup, "vmm_setup"},
+       [SYS_vmm_add_gpcs] = {(syscall_t)sys_vmm_add_gpcs, "vmm_add_gpcs"},
        [SYS_vmm_poke_guest] = {(syscall_t)sys_vmm_poke_guest, "vmm_poke_guest"},
        [SYS_vmm_ctl] = {(syscall_t)sys_vmm_ctl, "vmm_ctl"},
        [SYS_poke_ksched] = {(syscall_t)sys_poke_ksched, "poke_ksched"},
index 407f572..f9aa624 100644 (file)
@@ -220,7 +220,7 @@ static struct trace_set sched_trace_set = { "sched",
 };
 
 static struct trace_set vmm_trace_set = { "vmm",
-       {SYS_vmm_setup,
+       {SYS_vmm_add_gpcs,
         SYS_vmm_poke_guest,
         SYS_vmm_ctl,
         SYS_pop_ctx,
index d3a9dfe..ac51a5f 100644 (file)
@@ -567,7 +567,16 @@ int vmm_init(struct virtual_machine *vm, int flags)
        if (current_vm)
                return -1;
        current_vm = vm;
-       if (syscall(SYS_vmm_setup, vm->nr_gpcs, vm->gpcis) != vm->nr_gpcs)
+       /* We should tell the kernel to create all of the GPCs we'll need in
+        * advance.
+        *
+        * We could create the others on the fly, but the kernel's answer for
+        * CPUID[0x1] will not have to total number of cores.  If we move that
+        * handler to userspace, we can create the SMP-booted GPCs on the fly.
+        *
+        * We'd also have to deal with gths[] and gpcis[] growing dynamically, which
+        * would require synchronization. */
+       if (syscall(SYS_vmm_add_gpcs, vm->nr_gpcs, vm->gpcis) != vm->nr_gpcs)
                return -1;
        if (flags) {
                if (syscall(SYS_vmm_ctl, VMM_CTL_SET_FLAGS, flags))