Date: Tue, 3 Dec 2013 00:43:31 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258859 - in head/sys/amd64: include vmm Message-ID: <201312030043.rB30hVvr070942@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Tue Dec 3 00:43:31 2013 New Revision: 258859 URL: http://svnweb.freebsd.org/changeset/base/258859 Log: 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@ Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_lapic.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Mon Dec 2 22:34:47 2013 (r258858) +++ head/sys/amd64/include/vmm.h Tue Dec 3 00:43:31 2013 (r258859) @@ -156,7 +156,7 @@ vcpu_is_running(struct vm *vm, int vcpu, } 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); Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Mon Dec 2 22:34:47 2013 (r258858) +++ head/sys/amd64/vmm/vmm.c Tue Dec 3 00:43:31 2013 (r258859) @@ -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 v 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; Modified: head/sys/amd64/vmm/vmm_lapic.c ============================================================================== --- head/sys/amd64/vmm/vmm_lapic.c Mon Dec 2 22:34:47 2013 (r258858) +++ head/sys/amd64/vmm/vmm_lapic.c Tue Dec 3 00:43:31 2013 (r258859) @@ -75,7 +75,7 @@ lapic_set_intr(struct vm *vm, int cpu, i vlapic = vm_lapic(vm, cpu); vlapic_set_intr_ready(vlapic, vector, level); - vm_interrupt_hostcpu(vm, cpu); + vcpu_notify_event(vm, cpu); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312030043.rB30hVvr070942>