LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, paulus@samba.org,
	davem@davemloft.net, fweisbec@gmail.com,
	perfmon2-devel@lists.sf.net, eranian@gmail.com,
	eranian@google.com, robert.richter@amd.com, acme@redhat.com,
	gorcunov@gmail.com, ming.m.lin@intel.com
Subject: [PATCH 0/2] perf_events: add support for Intel fixed counter 2
Date: Fri, 4 Feb 2011 14:00:01 +0200	[thread overview]
Message-ID: <4d4bf9ac.cf03d90a.2908.2186@mx.google.com> (raw)

This short series of patches adds support for Intel fixed counter 2
on processors which implement architectural perfmon v2 and later.

Fixed counter 2 is wired to count reference cycles. It corrresponds
to architected event UNHALTED_REFERENCE_CYCLES. This is a very useful
event because:
	- it is imune to Turbo Mode on Intel Nehalem and follow-ons
	- it is imune to frequency scaling, including during idle

In other words, it keeps a constant correlation to time. It is
therefore a good source a reliable timings comparable to TSC.

The other advantage of providing access to this counter is that
it offers an additional cycle-counting counter. This is useful
when the NMI watchdog is active because it already consumes one
such counter.

The difficulty in providing access to the counter (and event) is
that the encoding 0x013c is ambiguous. It also corresponds to event
CPU_CLK_UNHALTED:REF_P (or BUS) which is measured on generic counters.
The issue is that this event counts a different kind of cycles: bus cycles.
Thus, the event code 0x13c is not enough to differentiate what the user
wants.

This series of patches solves this problem by introducing a custom
encoding for UNHALTED_REFERENCE_CYCLES (0xff3c) and improving
the constraint infrastructure to handle events which can ONLY be
measured on fixed counters.

The UNHALTED_REFERENCE_CYCLES (and fixed counter 2) is available on
all Intel processors since architectural perfmon v2 (Intel Yonah).

[PATCH 0/2] - Introduction
[PATCH 1/2] - Improvement to X86 constraints management
[PATCH 0/2] - add fixed counter 2 support

Signed-off-by: Stephane Eranian <eranian@google.com>
---

             reply	other threads:[~2011-02-04 13:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04 12:00 Stephane Eranian [this message]
2011-02-04 13:12 ` Peter Zijlstra
2011-02-04 13:19   ` Stephane Eranian
2011-02-05 15:19     ` Stephane Eranian
2011-02-06 19:55       ` Cyrill Gorcunov

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=4d4bf9ac.cf03d90a.2908.2186@mx.google.com \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    --subject='Re: [PATCH 0/2] perf_events: add support for Intel fixed counter 2' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).