]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: vmx: ensure VMCS is current while enabling PML
authorPeter Feiner <pfeiner@google.com>
Thu, 7 Jul 2016 21:49:58 +0000 (14:49 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2016 17:11:19 +0000 (19:11 +0200)
commitc62b45c3362419b6e6861e642e748eead36022d8
tree679def54f0735826312d63b690d811f4022e68df
parent2ef3f0d68cf80a6f6d7d79be5b66f8c6992943af
kvm: vmx: ensure VMCS is current while enabling PML

Between loading the new VMCS and enabling PML, the CPU was unpinned.
If the vCPU thread were migrated to another CPU in the interim (e.g.,
due to preemption or sleeping alloc_page), then the VMWRITEs to enable
PML would target the wrong VMCS -- or no VMCS at all:

  [ 2087.266950] vmwrite error: reg 200e value 3fe1d52000 (err -506126336)
  [ 2087.267062] vmwrite error: reg 812 value 1ff (err 511)
  [ 2087.267125] vmwrite error: reg 401e value 12229c00 (err 304258048)

This patch ensures that the VMCS remains current while enabling PML by
doing the VMWRITEs while the CPU is pinned. Allocation of the PML buffer
is hoisted out of the critical section.

Signed-off-by: Peter Feiner <pfeiner@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c