kvm: nVMX: don't flush VMCS12 during VMXOFF or VCPU teardown
authorDavid Matlack <dmatlack@google.com>
Tue, 1 Aug 2017 21:00:39 +0000 (14:00 -0700)
committerRadim Krčmář <rkrcmar@redhat.com>
Wed, 2 Aug 2017 20:41:03 +0000 (22:41 +0200)
commit8ca44e88c32f86721c6ceca8e5e9b0b40c98907d
tree563f86f01ecc6e7da419cd7e2d9d0f4c81a12338
parent9f744c59746078280ef28163aa136ef3f625804e
kvm: nVMX: don't flush VMCS12 during VMXOFF or VCPU teardown

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: David Matlack <dmatlack@google.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/vmx.c