vmm.c (269042) | vmm.c (269109) |
---|---|
1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/amd64/vmm/vmm.c 269042 2014-07-24 01:38:11Z neel $ | 26 * $FreeBSD: head/sys/amd64/vmm/vmm.c 269109 2014-07-26 02:53:51Z neel $ |
27 */ 28 29#include <sys/cdefs.h> | 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 269042 2014-07-24 01:38:11Z neel $"); | 30__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 269109 2014-07-26 02:53:51Z neel $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/sysctl.h> 37#include <sys/malloc.h> 38#include <sys/pcpu.h> --- 1061 unchanged lines hidden (view full) --- 1100 break; 1101 if (!intr_disabled) { 1102 if (vm_extint_pending(vm, vcpuid) || 1103 vlapic_pending_intr(vcpu->vlapic, NULL)) { 1104 break; 1105 } 1106 } 1107 | 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/sysctl.h> 37#include <sys/malloc.h> 38#include <sys/pcpu.h> --- 1061 unchanged lines hidden (view full) --- 1100 break; 1101 if (!intr_disabled) { 1102 if (vm_extint_pending(vm, vcpuid) || 1103 vlapic_pending_intr(vcpu->vlapic, NULL)) { 1104 break; 1105 } 1106 } 1107 |
1108 /* Don't go to sleep if the vcpu thread needs to yield */ 1109 if (vcpu_should_yield(vm, vcpuid)) 1110 break; 1111 |
|
1108 /* 1109 * Some Linux guests implement "halt" by having all vcpus 1110 * execute HLT with interrupts disabled. 'halted_cpus' keeps 1111 * track of the vcpus that have entered this state. When all 1112 * vcpus enter the halted state the virtual machine is halted. 1113 */ 1114 if (intr_disabled) { 1115 wmesg = "vmhalt"; --- 7 unchanged lines hidden (view full) --- 1123 break; 1124 } 1125 } else { 1126 wmesg = "vmidle"; 1127 } 1128 1129 t = ticks; 1130 vcpu_require_state_locked(vcpu, VCPU_SLEEPING); | 1112 /* 1113 * Some Linux guests implement "halt" by having all vcpus 1114 * execute HLT with interrupts disabled. 'halted_cpus' keeps 1115 * track of the vcpus that have entered this state. When all 1116 * vcpus enter the halted state the virtual machine is halted. 1117 */ 1118 if (intr_disabled) { 1119 wmesg = "vmhalt"; --- 7 unchanged lines hidden (view full) --- 1127 break; 1128 } 1129 } else { 1130 wmesg = "vmidle"; 1131 } 1132 1133 t = ticks; 1134 vcpu_require_state_locked(vcpu, VCPU_SLEEPING); |
1131 msleep_spin(vcpu, &vcpu->mtx, wmesg, 0); | 1135 /* 1136 * XXX msleep_spin() cannot be interrupted by signals so 1137 * wake up periodically to check pending signals. 1138 */ 1139 msleep_spin(vcpu, &vcpu->mtx, wmesg, hz); |
1132 vcpu_require_state_locked(vcpu, VCPU_FROZEN); 1133 vmm_stat_incr(vm, vcpuid, VCPU_IDLE_TICKS, ticks - t); 1134 } 1135 1136 if (vcpu_halted) 1137 CPU_CLR_ATOMIC(vcpuid, &vm->halted_cpus); 1138 1139 vcpu_unlock(vcpu); --- 1148 unchanged lines hidden --- | 1140 vcpu_require_state_locked(vcpu, VCPU_FROZEN); 1141 vmm_stat_incr(vm, vcpuid, VCPU_IDLE_TICKS, ticks - t); 1142 } 1143 1144 if (vcpu_halted) 1145 CPU_CLR_ATOMIC(vcpuid, &vm->halted_cpus); 1146 1147 vcpu_unlock(vcpu); --- 1148 unchanged lines hidden --- |