aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2013-09-09 15:53:50 -0400
committerIngo Molnar <mingo@kernel.org>2013-09-12 02:42:37 -0400
commitdbc33f7016747bfce64f3d1e3af63f1251fcbf85 (patch)
tree8523036d438767c26acd85da2b083861730b9537 /arch/x86
parent878b5a6efd38030c7a90895dc8346e8fb1e09b4c (diff)
perf/x86: Fix uncore PCI fixed counter handling
There was a bug in the handling of SNB-EP/IVB-EP uncore PCI fixed counters, e.g., IMC. It would cause erratic values to be returned for the IMC clockticks event. This was due to a bogus hwc->config value which was then written to PCI config space. The erratic values can be seen via: $ perf stat -a -C 0 -e uncore_imc_0/clockticks/ -I 1000 sleep 10 The fixed counter has most fields marked as reserved with hw reset values of 0. Yet the kernel was defaulting to a hwc->config = ~0 and that was causing the issues. This patch sets the hwc->config values for fixed uncore event to 0. Now, the values of IMC clockticks is correct. Signed-off-by: Stephane Eranian <eranian@google.com> Reviewed-by: Andi Kleen <ak@linux.intel.com> Cc: peterz@infradead.org Cc: zheng.z.yan@intel.com Link: http://lkml.kernel.org/r/20130909195350.GA17643@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index fd8011ed4dcd..8ed44589b0e4 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2808,7 +2808,7 @@ uncore_get_event_constraint(struct intel_uncore_box *box, struct perf_event *eve
2808 return c; 2808 return c;
2809 } 2809 }
2810 2810
2811 if (event->hw.config == ~0ULL) 2811 if (event->attr.config == UNCORE_FIXED_EVENT)
2812 return &constraint_fixed; 2812 return &constraint_fixed;
2813 2813
2814 if (type->constraints) { 2814 if (type->constraints) {
@@ -3112,7 +3112,9 @@ static int uncore_pmu_event_init(struct perf_event *event)
3112 */ 3112 */
3113 if (pmu->type->single_fixed && pmu->pmu_idx > 0) 3113 if (pmu->type->single_fixed && pmu->pmu_idx > 0)
3114 return -EINVAL; 3114 return -EINVAL;
3115 hwc->config = ~0ULL; 3115
3116 /* fixed counters have event field hardcoded to zero */
3117 hwc->config = 0ULL;
3116 } else { 3118 } else {
3117 hwc->config = event->attr.config & pmu->type->event_mask; 3119 hwc->config = event->attr.config & pmu->type->event_mask;
3118 if (pmu->type->ops->hw_config) { 3120 if (pmu->type->ops->hw_config) {