summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorRobert O'Callahan <robert@ocallahan.org>2017-02-01 17:06:11 +1300
committerRadim Krčmář <rkrcmar@redhat.com>2017-03-01 14:19:46 +0100
commitbba82fd75694832b59433bf4e9d7ede8de1dfd42 (patch)
treecaa0c64d07c5f5178ad0c102888fb49bc81930fa /virt
parentfd7e9a88348472521d999434ee02f25735c7dadf (diff)
KVM: x86: never specify a sample period for virtualized in_tx_cp counters
pmc_reprogram_counter() always sets a sample period based on the value of pmc->counter. However, hsw_hw_config() rejects sample periods less than 2^31 - 1. So for example, if a KVM guest does struct perf_event_attr attr; memset(&attr, 0, sizeof(attr)); attr.type = PERF_TYPE_RAW; attr.size = sizeof(attr); attr.config = 0x2005101c4; // conditional branches retired IN_TXCP attr.sample_period = 0; int fd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0); ioctl(fd, PERF_EVENT_IOC_DISABLE, 0); ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); the guest kernel counts some conditional branch events, then updates the virtual PMU register with a nonzero count. The host reaches pmc_reprogram_counter() with nonzero pmc->counter, triggers EOPNOTSUPP in hsw_hw_config(), prints "kvm_pmu: event creation failed" in pmc_reprogram_counter(), and silently (from the guest's point of view) stops counting events. We fix event counting by forcing attr.sample_period to always be zero for in_tx_cp counters. Sampling doesn't work, but it already didn't work and can't be fixed without major changes to the approach in hsw_hw_config(). Signed-off-by: Robert O'Callahan <robert@ocallahan.org> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions