FreeBSD/sys/amd64/vmm/vmm.c
/*
 * 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.
 */
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.
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 .
static void
vcpu_notify_event_locked(struct vcpu *vcpu, bool lapic_intr)
{
	int hostcpu;
	hostcpu = vcpu->hostcpu;
	if (vcpu->state == VCPU_RUNNING) {
		KASSERT(hostcpu != NOCPU, ("vcpu running on invalid hostcpu"));
		if (hostcpu != curcpu) {
			if (lapic_intr) {
				vlapic_post_intr(vcpu->vlapic, hostcpu,
				    vmm_ipinum);
			} else {
				ipi_cpu(hostcpu, vmm_ipinum);
			}
		} else {
		}
	} else {
		KASSERT(hostcpu == NOCPU, ("vcpu state %d not consistent "
		    "with hostcpu %d", vcpu->state, hostcpu));
		if (vcpu->state == VCPU_SLEEPING)
			wakeup_one(vcpu);
	}
}
static void vcpu_notify_event_locked ( struct vcpu * vcpu , bool lapic_intr ) { int hostcpu ; hostcpu = vcpu -> hostcpu ; if ( vcpu -> state == VCPU_RUNNING ) { KASSERT ( hostcpu != NOCPU , ( " " ) ) ; if ( hostcpu != curcpu ) { if ( lapic_intr ) { vlapic_post_intr ( vcpu -> vlapic , hostcpu , vmm_ipinum ) ; } else { ipi_cpu ( hostcpu , vmm_ipinum ) ; } } else { } } else { KASSERT ( hostcpu == NOCPU , ( " " " " , vcpu -> state , hostcpu ) ) ; if ( vcpu -> state == VCPU_SLEEPING ) wakeup_one ( vcpu ) ; } }
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.
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 'curcpu' then it must
			 * be sending a notification to itself (e.g. SELF_IPI).
			 * The pending event will be picked up when the vcpu
			 * transitions back to guest context.
			 */