• Nadav Har'El's avatar
    KVM: VMX: Keep list of loaded VMCSs, instead of vcpus · d462b819
    Nadav Har'El authored
    In VMX, before we bring down a CPU we must VMCLEAR all VMCSs loaded on it
    because (at least in theory) the processor might not have written all of its
    content back to memory. Since a patch from June 26, 2008, this is done using
    a per-cpu "vcpus_on_cpu" linked list of vcpus loaded on each CPU.
    
    The problem is that with nested VMX, we no longer have the concept of a
    vcpu being loaded on a cpu: A vcpu has multiple VMCSs (one for L1, a pool for
    L2s), and each of those may be have been last loaded on a different cpu.
    
    So instead of linking the vcpus, we link the VMCSs, using a new structure
    loaded_vmcs. This structure contains the VMCS, and the information pertaining
    to its loading on a specific cpu (namely, the cpu number, and whether it
    was already launched on this cpu once). In nested we will also use the same
    structure to hold L2 VMCSs, and vmx->loaded_vmcs is a pointer to the
    currently active VMCS.
    Signed-off-by: default avatarNadav Har'El <nyh@il.ibm.com>
    Acked-by: default avatarAcked-by: Kevin Tian <kevin.tian@intel.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    d462b819
vmx.c 122 KB