aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/msr-index.h13
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c23
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c7
3 files changed, 17 insertions, 26 deletions
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index aef562c0a647..06e4cf0d3846 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -71,11 +71,14 @@
71#define MSR_IA32_LASTINTTOIP 0x000001de 71#define MSR_IA32_LASTINTTOIP 0x000001de
72 72
73/* DEBUGCTLMSR bits (others vary by model): */ 73/* DEBUGCTLMSR bits (others vary by model): */
74#define _DEBUGCTLMSR_LBR 0 /* last branch recording */ 74#define DEBUGCTLMSR_LBR (1UL << 0) /* last branch recording */
75#define _DEBUGCTLMSR_BTF 1 /* single-step on branches */ 75#define DEBUGCTLMSR_BTF (1UL << 1) /* single-step on branches */
76 76#define DEBUGCTLMSR_TR (1UL << 6)
77#define DEBUGCTLMSR_LBR (1UL << _DEBUGCTLMSR_LBR) 77#define DEBUGCTLMSR_BTS (1UL << 7)
78#define DEBUGCTLMSR_BTF (1UL << _DEBUGCTLMSR_BTF) 78#define DEBUGCTLMSR_BTINT (1UL << 8)
79#define DEBUGCTLMSR_BTS_OFF_OS (1UL << 9)
80#define DEBUGCTLMSR_BTS_OFF_USR (1UL << 10)
81#define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11)
79 82
80#define MSR_IA32_MC0_CTL 0x00000400 83#define MSR_IA32_MC0_CTL 0x00000400
81#define MSR_IA32_MC0_STATUS 0x00000401 84#define MSR_IA32_MC0_STATUS 0x00000401
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index c59678a14a2e..2fea3622af7f 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -38,15 +38,6 @@ struct pebs_record_nhm {
38}; 38};
39 39
40/* 40/*
41 * Bits in the debugctlmsr controlling branch tracing.
42 */
43#define X86_DEBUGCTL_TR (1 << 6)
44#define X86_DEBUGCTL_BTS (1 << 7)
45#define X86_DEBUGCTL_BTINT (1 << 8)
46#define X86_DEBUGCTL_BTS_OFF_OS (1 << 9)
47#define X86_DEBUGCTL_BTS_OFF_USR (1 << 10)
48
49/*
50 * A debug store configuration. 41 * A debug store configuration.
51 * 42 *
52 * We only support architectures that use 64bit fields. 43 * We only support architectures that use 64bit fields.
@@ -193,15 +184,15 @@ static void intel_pmu_enable_bts(u64 config)
193 184
194 debugctlmsr = get_debugctlmsr(); 185 debugctlmsr = get_debugctlmsr();
195 186
196 debugctlmsr |= X86_DEBUGCTL_TR; 187 debugctlmsr |= DEBUGCTLMSR_TR;
197 debugctlmsr |= X86_DEBUGCTL_BTS; 188 debugctlmsr |= DEBUGCTLMSR_BTS;
198 debugctlmsr |= X86_DEBUGCTL_BTINT; 189 debugctlmsr |= DEBUGCTLMSR_BTINT;
199 190
200 if (!(config & ARCH_PERFMON_EVENTSEL_OS)) 191 if (!(config & ARCH_PERFMON_EVENTSEL_OS))
201 debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS; 192 debugctlmsr |= DEBUGCTLMSR_BTS_OFF_OS;
202 193
203 if (!(config & ARCH_PERFMON_EVENTSEL_USR)) 194 if (!(config & ARCH_PERFMON_EVENTSEL_USR))
204 debugctlmsr |= X86_DEBUGCTL_BTS_OFF_USR; 195 debugctlmsr |= DEBUGCTLMSR_BTS_OFF_USR;
205 196
206 update_debugctlmsr(debugctlmsr); 197 update_debugctlmsr(debugctlmsr);
207} 198}
@@ -217,8 +208,8 @@ static void intel_pmu_disable_bts(void)
217 debugctlmsr = get_debugctlmsr(); 208 debugctlmsr = get_debugctlmsr();
218 209
219 debugctlmsr &= 210 debugctlmsr &=
220 ~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT | 211 ~(DEBUGCTLMSR_TR | DEBUGCTLMSR_BTS | DEBUGCTLMSR_BTINT |
221 X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR); 212 DEBUGCTLMSR_BTS_OFF_OS | DEBUGCTLMSR_BTS_OFF_USR);
222 213
223 update_debugctlmsr(debugctlmsr); 214 update_debugctlmsr(debugctlmsr);
224} 215}
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index df4c98e26c5b..d202c1bece1a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -12,15 +12,12 @@ enum {
12 * otherwise it becomes near impossible to get a reliable stack. 12 * otherwise it becomes near impossible to get a reliable stack.
13 */ 13 */
14 14
15#define X86_DEBUGCTL_LBR (1 << 0)
16#define X86_DEBUGCTL_FREEZE_LBRS_ON_PMI (1 << 11)
17
18static void __intel_pmu_lbr_enable(void) 15static void __intel_pmu_lbr_enable(void)
19{ 16{
20 u64 debugctl; 17 u64 debugctl;
21 18
22 rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl); 19 rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
23 debugctl |= (X86_DEBUGCTL_LBR | X86_DEBUGCTL_FREEZE_LBRS_ON_PMI); 20 debugctl |= (DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI);
24 wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl); 21 wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
25} 22}
26 23
@@ -29,7 +26,7 @@ static void __intel_pmu_lbr_disable(void)
29 u64 debugctl; 26 u64 debugctl;
30 27
31 rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl); 28 rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
32 debugctl &= ~(X86_DEBUGCTL_LBR | X86_DEBUGCTL_FREEZE_LBRS_ON_PMI); 29 debugctl &= ~(DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI);
33 wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl); 30 wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
34} 31}
35 32