Modified vmx_launch in vmx.c to track the phy core of the vm every exit
authorGanShun <ganshun@gmail.com>
Wed, 4 Nov 2015 15:24:08 +0000 (07:24 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 13 Nov 2015 20:10:41 +0000 (15:10 -0500)
This change updates the vmctl every time we exit from the vm to ensure
that we keep track of the correct core to send the IPIs to.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/vmm/intel/vmx.c
kern/arch/x86/vmm/vmm.c
tests/vmm/vmrunkernel.c

index cbca000..9278a77 100644 (file)
@@ -1912,6 +1912,8 @@ int vmx_launch(struct vmctl *v) {
                //dumpmsrs();
                enable_irq();
 
+               // Update the core the vm is running on in case it has changed.
+               v->core = core_id();
                current_proc->vmm.vmexits[ret] += 1;
 
                v->intrinfo1 = vmcs_readl(GUEST_INTERRUPTIBILITY_INFO);
@@ -1951,6 +1953,7 @@ int vmx_launch(struct vmctl *v) {
                        vmx_dump_cpu(vcpu);
                        vcpu->shutdown = SHUTDOWN_UNHANDLED_EXIT_REASON;
                } else if (ret == EXIT_REASON_CPUID) {
+                       printk("CPUID EXIT RIP: %p\n", vcpu->regs.tf_rip);
                        vmx_handle_cpuid(vcpu);
                        vmx_get_cpu(vcpu);
                        vmcs_writel(GUEST_RIP, vcpu->regs.tf_rip + 2);
index 937e140..c078b04 100644 (file)
@@ -41,7 +41,8 @@ void vmm_init(void)
                printd("intel_vmm_init worked\n");
 
                //Register I_VMMCP_POSTED IRQ
-               register_irq(I_VMMCP_POSTED, vmmcp_posted_handler, NULL, MKBUS(BusLAPIC, 0, 0, 0));
+               //register_irq(I_VMMCP_POSTED, vmmcp_posted_handler, NULL,
+               //              MKBUS(BusLAPIC, 0, 0, 0));
                x86_supports_vmx = TRUE;
                return;
        }
index 5a94e54..c685a7d 100644 (file)
@@ -424,7 +424,10 @@ int main(int argc, char **argv)
        uint8_t csum;
        void *coreboot_tables = (void *) 0x1165000;
        void *a_page;
-fprintf(stderr, "%p %p %p %p\n", PGSIZE, PGSHIFT, PML1_SHIFT, PML1_PTE_REACH);
+
+
+       fprintf(stderr, "%p %p %p %p\n", PGSIZE, PGSHIFT, PML1_SHIFT,
+                       PML1_PTE_REACH);
 
        // mmap is not working for us at present.
        if ((uint64_t)_kernel > GKERNBASE) {