public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] perf, x86: Don't assume the alternative cycles encoding is architectural
@ 2012-06-06  0:56 Andi Kleen
  2012-06-06  0:56 ` [PATCH 2/5] perf, x86: Don't assume there can be only 4 PEBS events Andi Kleen
                   ` (4 more replies)
  0 siblings, 5 replies; 34+ messages in thread
From: Andi Kleen @ 2012-06-06  0:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: eranian, a.p.zijlstra, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

cycles:p uses an special cycles encoding by default. However that is not
architectural, so it can only be used when the CPU is known
(it already caused problems on Sandy Bridge). It may or may not work
on future CPUs.

So make it opt-in only. Right now I enabled it on Core2, Nehalem, Westmere
and not on Sandy-Bridge or Atom.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/kernel/cpu/perf_event.h       |    1 +
 arch/x86/kernel/cpu/perf_event_intel.c |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 6638aaf..cdddcef 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -355,6 +355,7 @@ struct x86_pmu {
 	 */
 	u64			intel_ctrl;
 	union perf_capabilities intel_cap;
+	bool			pebs_cycles;
 
 	/*
 	 * Intel DebugStore bits
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 166546e..2e40391 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1308,7 +1308,8 @@ static int intel_pmu_hw_config(struct perf_event *event)
 		return ret;
 
 	if (event->attr.precise_ip &&
-	    (event->hw.config & X86_RAW_EVENT_MASK) == 0x003c) {
+	    (event->hw.config & X86_RAW_EVENT_MASK) == 0x003c &&
+            x86_pmu.pebs_cycles) {
 		/*
 		 * Use an alternative encoding for CPU_CLK_UNHALTED.THREAD_P
 		 * (0x003c) so that we can use it with PEBS.
@@ -1772,6 +1773,7 @@ __init int intel_pmu_init(void)
 
 		x86_pmu.event_constraints = intel_core2_event_constraints;
 		x86_pmu.pebs_constraints = intel_core2_pebs_event_constraints;
+		x86_pmu.pebs_cycles = true;
 		pr_cont("Core2 events, ");
 		break;
 
@@ -1799,6 +1801,7 @@ __init int intel_pmu_init(void)
 
 		x86_add_quirk(intel_nehalem_quirk);
 
+		x86_pmu.pebs_cycles = true;
 		pr_cont("Nehalem events, ");
 		break;
 
@@ -1836,6 +1839,7 @@ __init int intel_pmu_init(void)
 		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] =
 			X86_CONFIG(.event=0xb1, .umask=0x3f, .inv=1, .cmask=1);
 
+		x86_pmu.pebs_cycles = true;
 		pr_cont("Westmere events, ");
 		break;
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2012-06-06 17:48 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06  0:56 [PATCH 1/5] perf, x86: Don't assume the alternative cycles encoding is architectural Andi Kleen
2012-06-06  0:56 ` [PATCH 2/5] perf, x86: Don't assume there can be only 4 PEBS events Andi Kleen
2012-06-06 15:00   ` Peter Zijlstra
2012-06-06 16:10     ` Andi Kleen
2012-06-06 17:25       ` Peter Zijlstra
2012-06-06 16:17   ` [tip:perf/core] perf/x86: Don' t " tip-bot for Andi Kleen
2012-06-06  0:56 ` [PATCH 3/5] perf, x86: Check LBR format capability Andi Kleen
2012-06-06  4:29   ` Andi Kleen
2012-06-06 10:40   ` Peter Zijlstra
2012-06-06 14:14     ` Andi Kleen
2012-06-06 14:22       ` Peter Zijlstra
2012-06-06 14:37         ` Andi Kleen
2012-06-06  0:56 ` [PATCH 4/5] x86: Add rdpmcl() Andi Kleen
2012-06-06 16:16   ` [tip:perf/core] " tip-bot for Andi Kleen
2012-06-06  0:56 ` [PATCH 5/5] perf, x86: Prefer RDPMC over RDMSR for reading counters Andi Kleen
2012-06-06 10:46   ` Peter Zijlstra
2012-06-06 14:16     ` Andi Kleen
2012-06-06 14:21       ` Peter Zijlstra
2012-06-06 14:33         ` Stephane Eranian
2012-06-06 14:38           ` Peter Zijlstra
2012-06-06 14:41         ` Andi Kleen
2012-06-06 14:45           ` Peter Zijlstra
2012-06-06 10:39 ` [PATCH 1/5] perf, x86: Don't assume the alternative cycles encoding is architectural Peter Zijlstra
2012-06-06 14:12   ` Andi Kleen
2012-06-06 14:14     ` Peter Zijlstra
2012-06-06 14:23       ` Andi Kleen
2012-06-06 14:28         ` Peter Zijlstra
2012-06-06 14:35           ` Andi Kleen
2012-06-06 14:42             ` Peter Zijlstra
2012-06-06 14:49               ` Andi Kleen
2012-06-06 14:53                 ` Peter Zijlstra
2012-06-06 16:08                   ` Andi Kleen
2012-06-06 17:10                     ` Peter Zijlstra
2012-06-06 17:48                       ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox