KVM: nVMX: Rework event injection and recovery
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 14 Apr 2013 10:12:46 +0000 (12:12 +0200)
committerGleb Natapov <gleb@redhat.com>
Sun, 14 Apr 2013 15:27:07 +0000 (18:27 +0300)
commit5f3d5799974b89100268ba813cec8db7bd0693fb
tree592f3cb2453bcbb2644db0d4ae41dd58aacad742
parent3b656cf764cbc43d3efb9bf5f45c618d4cf0989f
KVM: nVMX: Rework event injection and recovery

The basic idea is to always transfer the pending event injection on
vmexit into the architectural state of the VCPU and then drop it from
there if it turns out that we left L2 to enter L1, i.e. if we enter
prepare_vmcs12.

vmcs12_save_pending_events takes care to transfer pending L0 events into
the queue of L1. That is mandatory as L1 may decide to switch the guest
state completely, invalidating or preserving the pending events for
later injection (including on a different node, once we support
migration).

This concept is based on the rule that a pending vmlaunch/vmresume is
not canceled. Otherwise, we would risk to lose injected events or leak
them into the wrong queues. Encode this rule via a WARN_ON_ONCE at the
entry of nested_vmx_vmexit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/x86/kvm/vmx.c