From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751190AbdBAEG7 (ORCPT ); Tue, 31 Jan 2017 23:06:59 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35518 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946AbdBAEG5 (ORCPT ); Tue, 31 Jan 2017 23:06:57 -0500 From: "Robert O'Callahan" To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, "Robert O'Callahan" Subject: [PATCH v2 00/01] KVM: x86: never specify a sample period for virtualized in_tx_cp counters Date: Wed, 1 Feb 2017 17:06:10 +1300 Message-Id: <20170201040611.16732-1-robert@ocallahan.org> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes in version 2: - Fixed block comment formatting as requested by Ingo Molnar - Changed commit summary to refer to a testcase that more easily shows the problem. For reference here's a complete testcase for an Intel TSX-enabled KVM guest: #include #include #include #include #include #include int main(void) { struct perf_event_attr attr; int fd; long long count; 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; attr.exclude_kernel = 1; attr.exclude_guest = 1; 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); for (int i = 0; i < 500; ++i) { putchar('.'); } read(fd, &count, sizeof(count)); printf("\nConditional branches: %lld\n%s\n", count, count < 500 ? "FAILED" : "PASSED"); return 0; } Robert O'Callahan (1): KVM: x86: never specify a sample period for virtualized in_tx_cp counters arch/x86/kvm/pmu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.9.3