mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert O'Callahan" <robert@ocallahan.org>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	"Robert O'Callahan" <robert@ocallahan.org>
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	[thread overview]
Message-ID: <20170201040611.16732-1-robert@ocallahan.org> (raw)

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 <linux/perf_event.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <unistd.h>
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

             reply	other threads:[~2017-02-01  4:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01  4:06 Robert O'Callahan [this message]
2017-02-01  4:06 ` [PATCH v2 01/01] " Robert O'Callahan
2017-02-23  2:56 ` [PATCH v2 00/01] " Robert O'Callahan
2017-02-23  8:31   ` Paolo Bonzini
2017-02-23  9:43     ` Robert O'Callahan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170201040611.16732-1-robert@ocallahan.org \
    --to=robert@ocallahan.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®