diff options
author | neel <neel@FreeBSD.org> | 2013-12-03 00:43:31 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2013-12-03 00:43:31 +0000 |
commit | a581c446d66d684359df9582c6a14855d6e3cdb1 (patch) | |
tree | e093dc29b32757625454b62ae109d5a5d20603e8 /sys | |
parent | b07191879f76139f3566e59eff6486140b735878 (diff) | |
download | FreeBSD-src-a581c446d66d684359df9582c6a14855d6e3cdb1.zip FreeBSD-src-a581c446d66d684359df9582c6a14855d6e3cdb1.tar.gz |
Rename 'vm_interrupt_hostcpu()' to 'vcpu_notify_event()' because the function
has outgrown its original name. Originally this function simply sent an IPI
to the host cpu that a vcpu was executing on but now it does a lot more than
just that.
Reviewed by: grehan@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/include/vmm.h | 2 | ||||
-rw-r--r-- | sys/amd64/vmm/vmm.c | 11 | ||||
-rw-r--r-- | sys/amd64/vmm/vmm_lapic.c | 2 |
3 files changed, 11 insertions, 4 deletions
diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index b6bb309..15dabdc 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -156,7 +156,7 @@ vcpu_is_running(struct vm *vm, int vcpu, int *hostcpu) } void *vcpu_stats(struct vm *vm, int vcpu); -void vm_interrupt_hostcpu(struct vm *vm, int vcpu); +void vcpu_notify_event(struct vm *vm, int vcpuid); struct vmspace *vm_get_vmspace(struct vm *vm); int vm_assign_pptdev(struct vm *vm, int bus, int slot, int func); int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func); diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 3e52a8e..d2df5b1 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1099,7 +1099,7 @@ vm_inject_nmi(struct vm *vm, int vcpuid) vcpu = &vm->vcpu[vcpuid]; vcpu->nmi_pending = 1; - vm_interrupt_hostcpu(vm, vcpuid); + vcpu_notify_event(vm, vcpuid); return (0); } @@ -1319,8 +1319,15 @@ vm_set_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state state) return (0); } +/* + * This function is called to ensure that a vcpu "sees" a pending event + * as soon as possible: + * - If the vcpu thread is sleeping then it is woken up. + * - If the vcpu is running on a different host_cpu then an IPI will be directed + * to the host_cpu to cause the vcpu to trap into the hypervisor. + */ void -vm_interrupt_hostcpu(struct vm *vm, int vcpuid) +vcpu_notify_event(struct vm *vm, int vcpuid) { int hostcpu; struct vcpu *vcpu; diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 465ce6c..5217529 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -75,7 +75,7 @@ lapic_set_intr(struct vm *vm, int cpu, int vector, bool level) vlapic = vm_lapic(vm, cpu); vlapic_set_intr_ready(vlapic, vector, level); - vm_interrupt_hostcpu(vm, cpu); + vcpu_notify_event(vm, cpu); return (0); } |