x86: vmm: Track state for handling vmexits as KERNEL
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 23 Aug 2017 14:24:01 +0000 (10:24 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 25 Aug 2017 18:41:49 +0000 (14:41 -0400)
When we vmexited, we didn't set the cpu state to KERNEL, keeping it as
USER.  This would show up in mpstat as higher USER time.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/trap.c

index 0c24cad..9f168fa 100644 (file)
@@ -1130,6 +1130,7 @@ void handle_vmexit(struct vm_trapframe *tf)
        tf->tf_guest_pa = vmcs_read(GUEST_PHYSICAL_ADDRESS);
 
        set_current_ctx_vm(pcpui, tf);
+       __set_cpu_state(pcpui, CPU_STATE_KERNEL);
        tf = &pcpui->cur_ctx->tf.vm_tf;
        vmexit_dispatch(tf);
        /* We're either restarting a partial VM ctx (vmcs was launched, loaded on