summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2016-07-23 07:17:21 +0000
committermlarkin <mlarkin@openbsd.org>2016-07-23 07:17:21 +0000
commit71f5e94a53f96c16f2cf005cacc2bf9498933f8d (patch)
treeae8a8ec5ff8feb9a2d67d24517229cce25296746
parentEnsure some undesirable entry controls are cleared, instead of relying (diff)
downloadwireguard-openbsd-71f5e94a53f96c16f2cf005cacc2bf9498933f8d.tar.xz
wireguard-openbsd-71f5e94a53f96c16f2cf005cacc2bf9498933f8d.zip
Dump vcpu state on unknown exit type, and add a diagnostic message
(including vcpu state dump) on failure to enter due to an incorrect guest state. Added as a debug facility when diagnosing interruptibility state problems seen while testing NetBSD guest VMs.
-rw-r--r--sys/arch/amd64/amd64/vmm.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 4723108417d..bb19cb1f2fe 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.69 2016/07/23 07:00:39 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.70 2016/07/23 07:17:21 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -40,7 +40,7 @@
#include <dev/isa/isareg.h>
-#ifdef VMM_DEBUG
+#ifdef VMM_DEBUG
int vmm_debug = 0;
#define DPRINTF(x...) do { if (vmm_debug) printf(x); } while(0)
#else
@@ -2721,13 +2721,34 @@ vcpu_run_vmx(struct vcpu *vcpu, uint8_t from_exit, int16_t *injint)
case VMX_EXIT_HLT:
break;
case VMX_EXIT_TRIPLE_FAULT:
+ DPRINTF("%s: vm %d vcpu %d triple fault\n",
+ __func__, vcpu->vc_parent->vm_id,
+ vcpu->vc_id);
+#ifdef VMM_DEBUG
+ vmx_vcpu_dump_regs(vcpu);
+ dump_vcpu(vcpu);
+#endif /* VMM_DEBUG */
break;
+ case VMX_EXIT_ENTRY_FAILED_GUEST_STATE:
+ DPRINTF("%s: vm %d vcpu %d failed entry "
+ "due to invalid guest state\n",
+ __func__, vcpu->vc_parent->vm_id,
+ vcpu->vc_id);
+#ifdef VMM_DEBUG
+ vmx_vcpu_dump_regs(vcpu);
+ dump_vcpu(vcpu);
+#endif /* VMM_DEBUG */
+ return EINVAL;
default:
- printf("vcpu_run_vmx: returning from exit "
- "with unknown reason %d (%s)\n",
+ printf("%s: unimplemented exit type %d (%s)\n",
+ __func__,
vcpu->vc_gueststate.vg_exit_reason,
vmx_exit_reason_decode(
vcpu->vc_gueststate.vg_exit_reason));
+#ifdef VMM_DEBUG
+ vmx_vcpu_dump_regs(vcpu);
+ dump_vcpu(vcpu);
+#endif /* VMM_DEBUG */
break;
}
}