• David Matlack's avatar
    kvm: nVMX: don't flush VMCS12 during VMXOFF or VCPU teardown · 8ca44e88
    David Matlack authored
    According to the Intel SDM, software cannot rely on the current VMCS to be
    coherent after a VMXOFF or shutdown. So this is a valid way to handle VMCS12
    flushes.
    
    24.11.1 Software Use of Virtual-Machine Control Structures
    ...
      If a logical processor leaves VMX operation, any VMCSs active on
      that logical processor may be corrupted (see below). To prevent
      such corruption of a VMCS that may be used either after a return
      to VMX operation or on another logical processor, software should
      execute VMCLEAR for that VMCS before executing the VMXOFF instruction
      or removing power from the processor (e.g., as part of a transition
      to the S3 and S4 power states).
    ...
    
    This fixes a "suspicious rcu_dereference_check() usage!" warning during
    kvm_vm_release() because nested_release_vmcs12() calls
    kvm_vcpu_write_guest_page() without holding kvm->srcu.
    Signed-off-by: default avatarDavid Matlack <dmatlack@google.com>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    8ca44e88
vmx.c 333 KB