KVM: nVMX: Enable nested posted interrupt processing
authorWincy Van <fanwenyi0529@gmail.com>
Tue, 3 Feb 2015 15:58:17 +0000 (23:58 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 3 Feb 2015 16:15:08 +0000 (17:15 +0100)
commit705699a139948a671cd66b915e8095c95fdf44d9
tree7660d5125c4bf6039a62b43ab5fb84d9b62969a8
parent608406e290ca31d8f217cb765ee50152b41a7c9c
KVM: nVMX: Enable nested posted interrupt processing

If vcpu has a interrupt in vmx non-root mode, injecting that interrupt
requires a vmexit.  With posted interrupt processing, the vmexit
is not needed, and interrupts are fully taken care of by hardware.
In nested vmx, this feature avoids much more vmexits than non-nested vmx.

When L1 asks L0 to deliver L1's posted interrupt vector, and the target
VCPU is in non-root mode, we use a physical ipi to deliver POSTED_INTR_NV
to the target vCPU.  Using POSTED_INTR_NV avoids unexpected interrupts
if a concurrent vmexit happens and L1's vector is different with L0's.
The IPI triggers posted interrupt processing in the target physical CPU.

In case the target vCPU was not in guest mode, complete the posted
interrupt delivery on the next entry to L2.

Signed-off-by: Wincy Van <fanwenyi0529@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/vmx.c