From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Lin Ming <ming.m.lin@intel.com>, Ingo Molnar <mingo@elte.hu>
Cc: "Stephane Eranian" <eranian@google.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH -tip] perf, x86: P4 PMU - check for INSTR_COMPLETED being supported by cpu
Date: Wed, 18 Aug 2010 22:54:45 +0400 [thread overview]
Message-ID: <20100818185445.GA11949@lenovo> (raw)
INSTR_COMPLETED is supported on particular cpu models of Netburst family,
add a check for that.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Lin Ming <ming.m.lin@intel.com>
CC: Stephane Eranian <eranian@google.com>
CC: Ingo Molnar <mingo@elte.hu>
CC: Frédéric Weisbecker <fweisbec@gmail.com>
CC: Arnaldo Carvalho de Melo <acme@redhat.com>
CC: Peter Zijlstra <peterz@infradead.org>
---
Hi Ming, please review this patch, and if you happened to have this
cpu models give it a try please (if you manage to find some spare time
of course). To test it we need RAW event P4_EVENT_INSTR_COMPLETED passed
on any model not mentioned in p4_event_match_cpu_model, and reverse ;)
arch/x86/kernel/cpu/perf_event_p4.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event_p4.c
+++ linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
@@ -350,6 +350,11 @@ static __initconst const u64 p4_hw_cache
},
};
+/*
+ * If general events will ever have a reference to the
+ * P4_EVENT_INSTR_COMPLETED we would ought to check for
+ * cpu model match (see how it's done for RAW events)
+ */
static u64 p4_general_events[PERF_COUNT_HW_MAX] = {
/* non-halted CPU clocks */
[PERF_COUNT_HW_CPU_CYCLES] =
@@ -428,6 +433,27 @@ static u64 p4_pmu_event_map(int hw_event
return config;
}
+/* check cpu model specifics */
+static bool p4_event_match_cpu_model(unsigned int event_idx)
+{
+ /* INSTR_COMPLETED event only exist for model 3, 4, 6 (Prescott) */
+ if (event_idx == P4_EVENT_INSTR_COMPLETED) {
+ if (boot_cpu_data.x86_model != 3 &&
+ boot_cpu_data.x86_model != 4 &&
+ boot_cpu_data.x86_model != 6) {
+ pr_warning("P4 PMU: Unsupported event: INSTR_COMPLETED\n");
+ return false;
+ }
+ }
+
+ /*
+ * note the IQ_ESCR0, IQ_ESCR1 are available on models 1 and 2
+ * only but since we don't use them at moment -- no check
+ */
+
+ return true;
+}
+
static int p4_validate_raw_event(struct perf_event *event)
{
unsigned int v;
@@ -439,6 +465,10 @@ static int p4_validate_raw_event(struct
return -EINVAL;
}
+ /* it may be unsupported */
+ if (!p4_event_match_cpu_model(v))
+ return -EINVAL;
+
/*
* it may have some screwed PEBS bits
*/
next reply other threads:[~2010-08-18 18:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 18:54 Cyrill Gorcunov [this message]
2010-08-19 6:07 ` [PATCH -tip] perf, x86: P4 PMU - check for INSTR_COMPLETED being supported by cpu Lin Ming
2010-08-19 6:19 ` Cyrill Gorcunov
2010-08-19 6:27 ` Lin Ming
2010-08-19 6:39 ` 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=20100818185445.GA11949@lenovo \
--to=gorcunov@openvz.org \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.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