aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event_intel.c
diff options
context:
space:
mode:
authorKan Liang <kan.liang@intel.com>2015-06-24 14:23:35 -0400
committerIngo Molnar <mingo@kernel.org>2015-08-04 04:16:54 -0400
commitae3f011fc25104a218caf4448b1d47ef1c9b3a42 (patch)
tree0aa5659b07801b2943c07f761eb70ea725f34c6e /arch/x86/kernel/cpu/perf_event_intel.c
parentc749b3e96398fcc39286267b72fb8b85c0f757ea (diff)
perf/x86/intel: Fix SLM MSR_OFFCORE_RSP1 valid_mask
AVG_LATENCY(bit 38) is only available on MSR_OFFCORE_RSP0. So the bit should be removed from RSP1 valid_mask. Since RSP0 and RSP1 may have different valid_mask, intel_alt_er should validate the config on the alternate offcore reg before replacing it. Signed-off-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1435170215-5017-1-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event_intel.c')
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index b9826a981fb2..71815cf3d2d3 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1114,7 +1114,7 @@ static struct extra_reg intel_slm_extra_regs[] __read_mostly =
1114{ 1114{
1115 /* must define OFFCORE_RSP_X first, see intel_fixup_er() */ 1115 /* must define OFFCORE_RSP_X first, see intel_fixup_er() */
1116 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x768005ffffull, RSP_0), 1116 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x768005ffffull, RSP_0),
1117 INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OFFCORE_RSP_1, 0x768005ffffull, RSP_1), 1117 INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OFFCORE_RSP_1, 0x368005ffffull, RSP_1),
1118 EVENT_EXTRA_END 1118 EVENT_EXTRA_END
1119}; 1119};
1120 1120
@@ -1699,18 +1699,22 @@ intel_bts_constraints(struct perf_event *event)
1699 return NULL; 1699 return NULL;
1700} 1700}
1701 1701
1702static int intel_alt_er(int idx) 1702static int intel_alt_er(int idx, u64 config)
1703{ 1703{
1704 int alt_idx;
1704 if (!(x86_pmu.flags & PMU_FL_HAS_RSP_1)) 1705 if (!(x86_pmu.flags & PMU_FL_HAS_RSP_1))
1705 return idx; 1706 return idx;
1706 1707
1707 if (idx == EXTRA_REG_RSP_0) 1708 if (idx == EXTRA_REG_RSP_0)
1708 return EXTRA_REG_RSP_1; 1709 alt_idx = EXTRA_REG_RSP_1;
1709 1710
1710 if (idx == EXTRA_REG_RSP_1) 1711 if (idx == EXTRA_REG_RSP_1)
1711 return EXTRA_REG_RSP_0; 1712 alt_idx = EXTRA_REG_RSP_0;
1712 1713
1713 return idx; 1714 if (config & ~x86_pmu.extra_regs[alt_idx].valid_mask)
1715 return idx;
1716
1717 return alt_idx;
1714} 1718}
1715 1719
1716static void intel_fixup_er(struct perf_event *event, int idx) 1720static void intel_fixup_er(struct perf_event *event, int idx)
@@ -1799,7 +1803,7 @@ again:
1799 */ 1803 */
1800 c = NULL; 1804 c = NULL;
1801 } else { 1805 } else {
1802 idx = intel_alt_er(idx); 1806 idx = intel_alt_er(idx, reg->config);
1803 if (idx != reg->idx) { 1807 if (idx != reg->idx) {
1804 raw_spin_unlock_irqrestore(&era->lock, flags); 1808 raw_spin_unlock_irqrestore(&era->lock, flags);
1805 goto again; 1809 goto again;