aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/vmm/vmm.c
diff options
context:
space:
mode:
authorNeel Natu <neel@FreeBSD.org>2014-05-05 16:19:24 +0000
committerNeel Natu <neel@FreeBSD.org>2014-05-05 16:19:24 +0000
commit055fc2cb5e25d0de418e7552835e39b896b65282 (patch)
tree8f01a84416a7b59305f56b2785a3357635908366 /sys/amd64/vmm/vmm.c
parent1237b6d9eda3fc4f76ca18f210df30634368e87f (diff)
downloadsrc-055fc2cb5e25d0de418e7552835e39b896b65282.tar.gz
src-055fc2cb5e25d0de418e7552835e39b896b65282.zip
Virtual machine halt detection is turned on by default. Allow it to be
disabled via the tunable 'hw.vmm.halt_detection'.
Notes
Notes: svn path=/head/; revision=265364
Diffstat (limited to 'sys/amd64/vmm/vmm.c')
-rw-r--r--sys/amd64/vmm/vmm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
index cd16608b4c37..9aed5f5bb0bb 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -189,6 +189,16 @@ static VMM_STAT(VCPU_TOTAL_RUNTIME, "vcpu total runtime");
SYSCTL_NODE(_hw, OID_AUTO, vmm, CTLFLAG_RW, NULL, NULL);
+/*
+ * Halt the guest if all vcpus are executing a HLT instruction with
+ * interrupts disabled.
+ */
+static int halt_detection_enabled = 1;
+TUNABLE_INT("hw.vmm.halt_detection", &halt_detection_enabled);
+SYSCTL_INT(_hw_vmm, OID_AUTO, halt_detection, CTLFLAG_RDTUN,
+ &halt_detection_enabled, 0,
+ "Halt VM if all vcpus execute HLT with interrupts disabled");
+
static int vmm_ipinum;
SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0,
"IPI vector used for vcpu notifications");
@@ -1047,7 +1057,7 @@ vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_disabled, bool *retu)
if (intr_disabled) {
wmesg = "vmhalt";
VCPU_CTR0(vm, vcpuid, "Halted");
- if (!vcpu_halted) {
+ if (!vcpu_halted && halt_detection_enabled) {
vcpu_halted = 1;
CPU_SET_ATOMIC(vcpuid, &vm->halted_cpus);
}