linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Cc: ming.m.lin@intel.com, eranian@google.com, peterz@infradead.org,
	Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [rfc 1/3] perf, x86: P4 PMU - describe config format
Date: Wed, 24 Nov 2010 01:46:02 +0300	[thread overview]
Message-ID: <20101123224800.294919307@openvz.org> (raw)
In-Reply-To: 20101123224601.766827604@openvz.org

[-- Attachment #1: perf-x86-export-p4-bits --]
[-- Type: text/plain, Size: 3124 bytes --]

Add description of .config in a sake of RAW events.
At least this should bring some light to those who
will be reading this code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Lin Ming <ming.m.lin@intel.com>
CC: Stephane Eranian <eranian@google.com>
CC: Peter Zijlstra <peterz@infradead.org>
---
 arch/x86/include/asm/perf_event_p4.h |   62 ++++++++++++++++++++++++++++++-----
 1 file changed, 54 insertions(+), 8 deletions(-)

Index: linux-2.6.git/arch/x86/include/asm/perf_event_p4.h
=====================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/perf_event_p4.h
+++ linux-2.6.git/arch/x86/include/asm/perf_event_p4.h
@@ -744,14 +744,6 @@ enum P4_ESCR_EMASKS {
 };
 
 /*
- * P4 PEBS specifics (Replay Event only)
- *
- * Format (bits):
- *   0-6: metric from P4_PEBS_METRIC enum
- *    7 : reserved
- *    8 : reserved
- * 9-11 : reserved
- *
  * Note we have UOP and PEBS bits reserved for now
  * just in case if we will need them once
  */
@@ -788,5 +780,59 @@ enum P4_PEBS_METRIC {
 	P4_PEBS_METRIC__max
 };
 
+/*
+ * Notes on internal configuration of ESCR+CCCR tuples
+ *
+ * Since P4 has quite the different architecture of
+ * performance registers in compare with "architectural"
+ * once and we have on 64 bits to keep configuration
+ * of performance event, the following trick is used.
+ *
+ * 1) Since both ESCR and CCCR registers have only low
+ *    32 bits valuable, we pack them into a single 64 bit
+ *    configuration. Low 32 bits of such config correspond
+ *    to low 32 bits of CCCR register and high 32 bits
+ *    correspond to low 32 bits of ESCR register.
+ *
+ * 2) The meaning of every bit of such config field can
+ *    be found in Intel SDM but it should be noted that
+ *    we "borrow" some reserved bits for own usage and
+ *    clean them or set to a proper value when we do
+ *    a real write to hardware registers.
+ *
+ * 3) The format of bits of config is the following
+ *    and should be either 0 or set to some predefined
+ *    values:
+ *
+ *    Low 32 bits
+ *    -----------
+ *      0-6: P4_PEBS_METRIC enum
+ *     7-11:                    reserved
+ *       12: Active thread
+ *    13-15:                    reserved (ESCR select)
+ *    16-17: Compare
+ *       18: Complement
+ *    20-23: Threshold
+ *       24: Edge
+ *       25:                    reserved (FORCE_OVF)
+ *       26:                    reserved (OVF_PMI_T0)
+ *       27:                    reserved (OVF_PMI_T1)
+ *    28-29:                    reserved
+ *       30:                    reserved (Cascade)
+ *       31:                    reserved (OVF)
+ *
+ *    High 32 bits
+ *    ------------
+ *        0:                    reserved (T1_USR)
+ *        1:                    reserved (T1_OS)
+ *        2:                    reserved (T0_USR)
+ *        3:                    reserved (T0_OS)
+ *        4: Tag Enable
+ *      5-8: Tag Value
+ *     9-24: Event Mask (may use P4_ESCR_EMASK_BIT helper)
+ *    25-30: enum P4_EVENTS
+ *       31:                    reserved (HT thread)
+ */
+
 #endif /* PERF_EVENT_P4_H */
 


  reply	other threads:[~2010-11-23 22:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 22:46 [rfc 0/3] perf,x86: p4 pmu series Cyrill Gorcunov
2010-11-23 22:46 ` Cyrill Gorcunov [this message]
2010-11-26 10:57   ` [rfc 1/3] perf, x86: P4 PMU - describe config format Stephane Eranian
2010-11-26 11:14     ` Cyrill Gorcunov
2010-11-26 11:32       ` Cyrill Gorcunov
2010-11-26 11:35         ` Stephane Eranian
2010-11-26 11:58           ` Cyrill Gorcunov
2010-11-26 12:46             ` Stephane Eranian
2010-11-26 13:04               ` Cyrill Gorcunov
2010-11-26 13:06                 ` Peter Zijlstra
2010-11-26 13:47                   ` Cyrill Gorcunov
2010-11-26 13:10                 ` Stephane Eranian
2010-11-26 13:50                   ` Cyrill Gorcunov
2010-11-26 13:54                     ` Stephane Eranian
2010-11-26 15:27                       ` Cyrill Gorcunov
2010-11-26 16:22                         ` Stephane Eranian
2010-11-26 17:16                           ` Cyrill Gorcunov
2010-11-26 18:05                             ` Stephane Eranian
2010-11-26 20:11                               ` Cyrill Gorcunov
2010-11-26 12:48   ` Stephane Eranian
2010-11-26 12:59     ` Peter Zijlstra
2010-11-26 13:07       ` Stephane Eranian
2010-11-26 13:07       ` Cyrill Gorcunov
2010-11-23 22:46 ` [rfc 2/3] perf, x86: P4 PMU - Fix unflagged overflows handling v4 Cyrill Gorcunov
2010-11-23 22:46 ` [rfc 3/3] perf, x86: P4 PMU -- export ABI part of event config to userspace Cyrill Gorcunov
2010-11-24  8:32   ` Peter Zijlstra
2010-11-24  8:48     ` Cyrill Gorcunov
2010-11-24  9:02       ` Peter Zijlstra
2010-11-24  9:39         ` Cyrill Gorcunov
2010-11-24 11:46           ` 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=20101123224800.294919307@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).