]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM: x86: Fix wrong/stuck PMU when guest does not use PMI
authorNadav Amit <namit@cs.technion.ac.il>
Fri, 18 Apr 2014 00:35:08 +0000 (03:35 +0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 23 Apr 2014 20:46:52 +0000 (17:46 -0300)
commit671bd9934a861288a248b051751061b11654aef9
treea245e44f34cb15e7fc5ec237c73133f5a56f0e35
parente0ba1a6ffcfe8dc95586943bbe56badb1459bf25
KVM: x86: Fix wrong/stuck PMU when guest does not use PMI

If a guest enables a performance counter but does not enable PMI, the
hypervisor currently does not reprogram the performance counter once it
overflows.  As a result the host performance counter is kept with the original
sampling period which was configured according to the value of the guest's
counter when the counter was enabled.

Such behaviour can cause very bad consequences. The most distrubing one can
cause the guest not to make any progress at all, and keep exiting due to host
PMI before any guest instructions is exeucted. This situation occurs when the
performance counter holds a very high value when the guest enables the
performance counter. As a result the host's sampling period is configured to be
very short. The host then never reconfigures the sampling period and get stuck
at entry->PMI->exit loop. We encountered such a scenario in our experiments.

The solution is to reprogram the counter even if the guest does not use PMI.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/pmu.c