]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "KVM: VMX: Micro-optimize vmexit time when not exposing PMU"
authorVitaly Kuznetsov <vkuznets@redhat.com>
Fri, 19 Jun 2020 09:40:46 +0000 (11:40 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Jun 2020 12:13:40 +0000 (08:13 -0400)
commitfb745e7662ee6e9b85aa5ce0cdbb962cf6bdd0c6
tree853447931fe925cb40339c8ac61f3cf2accdd33b
parent38b8581be88508c03d2d08195bcd8d363e0d75bf
Revert "KVM: VMX: Micro-optimize vmexit time when not exposing PMU"

Guest crashes are observed on a Cascade Lake system when 'perf top' is
launched on the host, e.g.

 BUG: unable to handle kernel paging request at fffffe0000073038
 PGD 7ffa7067 P4D 7ffa7067 PUD 7ffa6067 PMD 7ffa5067 PTE ffffffffff120
 Oops: 0000 [#1] SMP PTI
 CPU: 1 PID: 1 Comm: systemd Not tainted 4.18.0+ #380
...
 Call Trace:
  serial8250_console_write+0xfe/0x1f0
  call_console_drivers.constprop.0+0x9d/0x120
  console_unlock+0x1ea/0x460

Call traces are different but the crash is imminent. The problem was
blindly bisected to the commit c54086ec378b ("KVM: VMX: Micro-optimize
vmexit time when not exposing PMU"). It was also confirmed that the
issue goes away if PMU is exposed to the guest.

With some instrumentation of the guest we can see what is being switched
(when we do atomic_switch_perf_msrs()):

 vmx_vcpu_run: switching 2 msrs
 vmx_vcpu_run: switching MSR38f guest: 70000000d host: 70000000f
 vmx_vcpu_run: switching MSR3f1 guest: 0 host: 2

The current guess is that PEBS (MSR_IA32_PEBS_ENABLE, 0x3f1) is to blame.
Regardless of whether PMU is exposed to the guest or not, PEBS needs to
be disabled upon switch.

This reverts commit c54086ec378b6c708c9c94fb45545554ac9fcda9.

Reported-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200619094046.654019-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c