aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/vmm/vmm.c
diff options
context:
space:
mode:
authorNeel Natu <neel@FreeBSD.org>2014-12-23 02:14:49 +0000
committerNeel Natu <neel@FreeBSD.org>2014-12-23 02:14:49 +0000
commitb053814333808bd3c86dc6a5f1fa3a7ec6ac2368 (patch)
tree214ececda8814adad1716ad57d4b116659587d74 /sys/amd64/vmm/vmm.c
parent0b327b634a6fc79050f4c5801c647cad1ae4e351 (diff)
downloadsrc-b053814333808bd3c86dc6a5f1fa3a7ec6ac2368.tar.gz
src-b053814333808bd3c86dc6a5f1fa3a7ec6ac2368.zip
Allow ktr(4) tracing of all guest exceptions via the tunable
"hw.vmm.trace_guest_exceptions". To enable this feature set the tunable to "1" before loading vmm.ko. Tracing the guest exceptions can be useful when debugging guest triple faults. Note that there is a performance impact when exception tracing is enabled since every exception will now trigger a VM-exit. Also, handle machine check exceptions that happen during guest execution by vectoring to the host's machine check handler via "int $18". Discussed with: grehan MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=276098
Diffstat (limited to 'sys/amd64/vmm/vmm.c')
-rw-r--r--sys/amd64/vmm/vmm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
index e7fbada39fc2..d9cb6f3c1254 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -207,6 +207,11 @@ static int vmm_ipinum;
SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0,
"IPI vector used for vcpu notifications");
+static int trace_guest_exceptions;
+SYSCTL_INT(_hw_vmm, OID_AUTO, trace_guest_exceptions, CTLFLAG_RDTUN,
+ &trace_guest_exceptions, 0,
+ "Trap into hypervisor on all guest exceptions and reflect them back");
+
static void
vcpu_cleanup(struct vm *vm, int i, bool destroy)
{
@@ -250,6 +255,13 @@ vcpu_init(struct vm *vm, int vcpu_id, bool create)
vmm_stat_init(vcpu->stats);
}
+int
+vcpu_trace_exceptions(struct vm *vm, int vcpuid)
+{
+
+ return (trace_guest_exceptions);
+}
+
struct vm_exit *
vm_exitinfo(struct vm *vm, int cpuid)
{