diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-05-17 22:26:53 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-18 00:35:23 -0400 |
commit | f0218b3e9974f06014b61be8987159f4a20e011e (patch) | |
tree | 29a593c4d71ab18cb0c450a34e79bf6bea66877e /arch/x86/include | |
parent | 1eaa4787a774c4896518c81f24e8bccaa2244924 (diff) | |
parent | 9d192e118a094087494997ea1c8a2faf39af38c5 (diff) |
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-6
Conflicts:
include/trace/ftrace.h
kernel/trace/trace_kprobe.c
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/apic.h | 13 | ||||
-rw-r--r-- | arch/x86/include/asm/ds.h | 302 | ||||
-rw-r--r-- | arch/x86/include/asm/hw_breakpoint.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/insn.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/io.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/kprobes.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/msr-index.h | 15 | ||||
-rw-r--r-- | arch/x86/include/asm/perf_event.h | 76 | ||||
-rw-r--r-- | arch/x86/include/asm/perf_event_p4.h | 794 | ||||
-rw-r--r-- | arch/x86/include/asm/processor.h | 35 | ||||
-rw-r--r-- | arch/x86/include/asm/ptrace-abi.h | 57 | ||||
-rw-r--r-- | arch/x86/include/asm/ptrace.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/thread_info.h | 8 |
13 files changed, 872 insertions, 449 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index b4ac2cdcb64f..1fa03e04ae44 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -373,6 +373,7 @@ extern atomic_t init_deasserted; | |||
373 | extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip); | 373 | extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip); |
374 | #endif | 374 | #endif |
375 | 375 | ||
376 | #ifdef CONFIG_X86_LOCAL_APIC | ||
376 | static inline u32 apic_read(u32 reg) | 377 | static inline u32 apic_read(u32 reg) |
377 | { | 378 | { |
378 | return apic->read(reg); | 379 | return apic->read(reg); |
@@ -403,10 +404,19 @@ static inline u32 safe_apic_wait_icr_idle(void) | |||
403 | return apic->safe_wait_icr_idle(); | 404 | return apic->safe_wait_icr_idle(); |
404 | } | 405 | } |
405 | 406 | ||
407 | #else /* CONFIG_X86_LOCAL_APIC */ | ||
408 | |||
409 | static inline u32 apic_read(u32 reg) { return 0; } | ||
410 | static inline void apic_write(u32 reg, u32 val) { } | ||
411 | static inline u64 apic_icr_read(void) { return 0; } | ||
412 | static inline void apic_icr_write(u32 low, u32 high) { } | ||
413 | static inline void apic_wait_icr_idle(void) { } | ||
414 | static inline u32 safe_apic_wait_icr_idle(void) { return 0; } | ||
415 | |||
416 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
406 | 417 | ||
407 | static inline void ack_APIC_irq(void) | 418 | static inline void ack_APIC_irq(void) |
408 | { | 419 | { |
409 | #ifdef CONFIG_X86_LOCAL_APIC | ||
410 | /* | 420 | /* |
411 | * ack_APIC_irq() actually gets compiled as a single instruction | 421 | * ack_APIC_irq() actually gets compiled as a single instruction |
412 | * ... yummie. | 422 | * ... yummie. |
@@ -414,7 +424,6 @@ static inline void ack_APIC_irq(void) | |||
414 | 424 | ||
415 | /* Docs say use 0 for future compatibility */ | 425 | /* Docs say use 0 for future compatibility */ |
416 | apic_write(APIC_EOI, 0); | 426 | apic_write(APIC_EOI, 0); |
417 | #endif | ||
418 | } | 427 | } |
419 | 428 | ||
420 | static inline unsigned default_get_apic_id(unsigned long x) | 429 | static inline unsigned default_get_apic_id(unsigned long x) |
diff --git a/arch/x86/include/asm/ds.h b/arch/x86/include/asm/ds.h deleted file mode 100644 index 70dac199b093..000000000000 --- a/arch/x86/include/asm/ds.h +++ /dev/null | |||
@@ -1,302 +0,0 @@ | |||
1 | /* | ||
2 | * Debug Store (DS) support | ||
3 | * | ||
4 | * This provides a low-level interface to the hardware's Debug Store | ||
5 | * feature that is used for branch trace store (BTS) and | ||
6 | * precise-event based sampling (PEBS). | ||
7 | * | ||
8 | * It manages: | ||
9 | * - DS and BTS hardware configuration | ||
10 | * - buffer overflow handling (to be done) | ||
11 | * - buffer access | ||
12 | * | ||
13 | * It does not do: | ||
14 | * - security checking (is the caller allowed to trace the task) | ||
15 | * - buffer allocation (memory accounting) | ||
16 | * | ||
17 | * | ||
18 | * Copyright (C) 2007-2009 Intel Corporation. | ||
19 | * Markus Metzger <markus.t.metzger@intel.com>, 2007-2009 | ||
20 | */ | ||
21 | |||
22 | #ifndef _ASM_X86_DS_H | ||
23 | #define _ASM_X86_DS_H | ||
24 | |||
25 | |||
26 | #include <linux/types.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/err.h> | ||
29 | |||
30 | |||
31 | #ifdef CONFIG_X86_DS | ||
32 | |||
33 | struct task_struct; | ||
34 | struct ds_context; | ||
35 | struct ds_tracer; | ||
36 | struct bts_tracer; | ||
37 | struct pebs_tracer; | ||
38 | |||
39 | typedef void (*bts_ovfl_callback_t)(struct bts_tracer *); | ||
40 | typedef void (*pebs_ovfl_callback_t)(struct pebs_tracer *); | ||
41 | |||
42 | |||
43 | /* | ||
44 | * A list of features plus corresponding macros to talk about them in | ||
45 | * the ds_request function's flags parameter. | ||
46 | * | ||
47 | * We use the enum to index an array of corresponding control bits; | ||
48 | * we use the macro to index a flags bit-vector. | ||
49 | */ | ||
50 | enum ds_feature { | ||
51 | dsf_bts = 0, | ||
52 | dsf_bts_kernel, | ||
53 | #define BTS_KERNEL (1 << dsf_bts_kernel) | ||
54 | /* trace kernel-mode branches */ | ||
55 | |||
56 | dsf_bts_user, | ||
57 | #define BTS_USER (1 << dsf_bts_user) | ||
58 | /* trace user-mode branches */ | ||
59 | |||
60 | dsf_bts_overflow, | ||
61 | dsf_bts_max, | ||
62 | dsf_pebs = dsf_bts_max, | ||
63 | |||
64 | dsf_pebs_max, | ||
65 | dsf_ctl_max = dsf_pebs_max, | ||
66 | dsf_bts_timestamps = dsf_ctl_max, | ||
67 | #define BTS_TIMESTAMPS (1 << dsf_bts_timestamps) | ||
68 | /* add timestamps into BTS trace */ | ||
69 | |||
70 | #define BTS_USER_FLAGS (BTS_KERNEL | BTS_USER | BTS_TIMESTAMPS) | ||
71 | }; | ||
72 | |||
73 | |||
74 | /* | ||
75 | * Request BTS or PEBS | ||
76 | * | ||
77 | * Due to alignement constraints, the actual buffer may be slightly | ||
78 | * smaller than the requested or provided buffer. | ||
79 | * | ||
80 | * Returns a pointer to a tracer structure on success, or | ||
81 | * ERR_PTR(errcode) on failure. | ||
82 | * | ||
83 | * The interrupt threshold is independent from the overflow callback | ||
84 | * to allow users to use their own overflow interrupt handling mechanism. | ||
85 | * | ||
86 | * The function might sleep. | ||
87 | * | ||
88 | * task: the task to request recording for | ||
89 | * cpu: the cpu to request recording for | ||
90 | * base: the base pointer for the (non-pageable) buffer; | ||
91 | * size: the size of the provided buffer in bytes | ||
92 | * ovfl: pointer to a function to be called on buffer overflow; | ||
93 | * NULL if cyclic buffer requested | ||
94 | * th: the interrupt threshold in records from the end of the buffer; | ||
95 | * -1 if no interrupt threshold is requested. | ||
96 | * flags: a bit-mask of the above flags | ||
97 | */ | ||
98 | extern struct bts_tracer *ds_request_bts_task(struct task_struct *task, | ||
99 | void *base, size_t size, | ||
100 | bts_ovfl_callback_t ovfl, | ||
101 | size_t th, unsigned int flags); | ||
102 | extern struct bts_tracer *ds_request_bts_cpu(int cpu, void *base, size_t size, | ||
103 | bts_ovfl_callback_t ovfl, | ||
104 | size_t th, unsigned int flags); | ||
105 | extern struct pebs_tracer *ds_request_pebs_task(struct task_struct *task, | ||
106 | void *base, size_t size, | ||
107 | pebs_ovfl_callback_t ovfl, | ||
108 | size_t th, unsigned int flags); | ||
109 | extern struct pebs_tracer *ds_request_pebs_cpu(int cpu, | ||
110 | void *base, size_t size, | ||
111 | pebs_ovfl_callback_t ovfl, | ||
112 | size_t th, unsigned int flags); | ||
113 | |||
114 | /* | ||
115 | * Release BTS or PEBS resources | ||
116 | * Suspend and resume BTS or PEBS tracing | ||
117 | * | ||
118 | * Must be called with irq's enabled. | ||
119 | * | ||
120 | * tracer: the tracer handle returned from ds_request_~() | ||
121 | */ | ||
122 | extern void ds_release_bts(struct bts_tracer *tracer); | ||
123 | extern void ds_suspend_bts(struct bts_tracer *tracer); | ||
124 | extern void ds_resume_bts(struct bts_tracer *tracer); | ||
125 | extern void ds_release_pebs(struct pebs_tracer *tracer); | ||
126 | extern void ds_suspend_pebs(struct pebs_tracer *tracer); | ||
127 | extern void ds_resume_pebs(struct pebs_tracer *tracer); | ||
128 | |||
129 | /* | ||
130 | * Release BTS or PEBS resources | ||
131 | * Suspend and resume BTS or PEBS tracing | ||
132 | * | ||
133 | * Cpu tracers must call this on the traced cpu. | ||
134 | * Task tracers must call ds_release_~_noirq() for themselves. | ||
135 | * | ||
136 | * May be called with irq's disabled. | ||
137 | * | ||
138 | * Returns 0 if successful; | ||
139 | * -EPERM if the cpu tracer does not trace the current cpu. | ||
140 | * -EPERM if the task tracer does not trace itself. | ||
141 | * | ||
142 | * tracer: the tracer handle returned from ds_request_~() | ||
143 | */ | ||
144 | extern int ds_release_bts_noirq(struct bts_tracer *tracer); | ||
145 | extern int ds_suspend_bts_noirq(struct bts_tracer *tracer); | ||
146 | extern int ds_resume_bts_noirq(struct bts_tracer *tracer); | ||
147 | extern int ds_release_pebs_noirq(struct pebs_tracer *tracer); | ||
148 | extern int ds_suspend_pebs_noirq(struct pebs_tracer *tracer); | ||
149 | extern int ds_resume_pebs_noirq(struct pebs_tracer *tracer); | ||
150 | |||
151 | |||
152 | /* | ||
153 | * The raw DS buffer state as it is used for BTS and PEBS recording. | ||
154 | * | ||
155 | * This is the low-level, arch-dependent interface for working | ||
156 | * directly on the raw trace data. | ||
157 | */ | ||
158 | struct ds_trace { | ||
159 | /* the number of bts/pebs records */ | ||
160 | size_t n; | ||
161 | /* the size of a bts/pebs record in bytes */ | ||
162 | size_t size; | ||
163 | /* pointers into the raw buffer: | ||
164 | - to the first entry */ | ||
165 | void *begin; | ||
166 | /* - one beyond the last entry */ | ||
167 | void *end; | ||
168 | /* - one beyond the newest entry */ | ||
169 | void *top; | ||
170 | /* - the interrupt threshold */ | ||
171 | void *ith; | ||
172 | /* flags given on ds_request() */ | ||
173 | unsigned int flags; | ||
174 | }; | ||
175 | |||
176 | /* | ||
177 | * An arch-independent view on branch trace data. | ||
178 | */ | ||
179 | enum bts_qualifier { | ||
180 | bts_invalid, | ||
181 | #define BTS_INVALID bts_invalid | ||
182 | |||
183 | bts_branch, | ||
184 | #define BTS_BRANCH bts_branch | ||
185 | |||
186 | bts_task_arrives, | ||
187 | #define BTS_TASK_ARRIVES bts_task_arrives | ||
188 | |||
189 | bts_task_departs, | ||
190 | #define BTS_TASK_DEPARTS bts_task_departs | ||
191 | |||
192 | bts_qual_bit_size = 4, | ||
193 | bts_qual_max = (1 << bts_qual_bit_size), | ||
194 | }; | ||
195 | |||
196 | struct bts_struct { | ||
197 | __u64 qualifier; | ||
198 | union { | ||
199 | /* BTS_BRANCH */ | ||
200 | struct { | ||
201 | __u64 from; | ||
202 | __u64 to; | ||
203 | } lbr; | ||
204 | /* BTS_TASK_ARRIVES or BTS_TASK_DEPARTS */ | ||
205 | struct { | ||
206 | __u64 clock; | ||
207 | pid_t pid; | ||
208 | } event; | ||
209 | } variant; | ||
210 | }; | ||
211 | |||
212 | |||
213 | /* | ||
214 | * The BTS state. | ||
215 | * | ||
216 | * This gives access to the raw DS state and adds functions to provide | ||
217 | * an arch-independent view of the BTS data. | ||
218 | */ | ||
219 | struct bts_trace { | ||
220 | struct ds_trace ds; | ||
221 | |||
222 | int (*read)(struct bts_tracer *tracer, const void *at, | ||
223 | struct bts_struct *out); | ||
224 | int (*write)(struct bts_tracer *tracer, const struct bts_struct *in); | ||
225 | }; | ||
226 | |||
227 | |||
228 | /* | ||
229 | * The PEBS state. | ||
230 | * | ||
231 | * This gives access to the raw DS state and the PEBS-specific counter | ||
232 | * reset value. | ||
233 | */ | ||
234 | struct pebs_trace { | ||
235 | struct ds_trace ds; | ||
236 | |||
237 | /* the number of valid counters in the below array */ | ||
238 | unsigned int counters; | ||
239 | |||
240 | #define MAX_PEBS_COUNTERS 4 | ||
241 | /* the counter reset value */ | ||
242 | unsigned long long counter_reset[MAX_PEBS_COUNTERS]; | ||
243 | }; | ||
244 | |||
245 | |||
246 | /* | ||
247 | * Read the BTS or PEBS trace. | ||
248 | * | ||
249 | * Returns a view on the trace collected for the parameter tracer. | ||
250 | * | ||
251 | * The view remains valid as long as the traced task is not running or | ||
252 | * the tracer is suspended. | ||
253 | * Writes into the trace buffer are not reflected. | ||
254 | * | ||
255 | * tracer: the tracer handle returned from ds_request_~() | ||
256 | */ | ||
257 | extern const struct bts_trace *ds_read_bts(struct bts_tracer *tracer); | ||
258 | extern const struct pebs_trace *ds_read_pebs(struct pebs_tracer *tracer); | ||
259 | |||
260 | |||
261 | /* | ||
262 | * Reset the write pointer of the BTS/PEBS buffer. | ||
263 | * | ||
264 | * Returns 0 on success; -Eerrno on error | ||
265 | * | ||
266 | * tracer: the tracer handle returned from ds_request_~() | ||
267 | */ | ||
268 | extern int ds_reset_bts(struct bts_tracer *tracer); | ||
269 | extern int ds_reset_pebs(struct pebs_tracer *tracer); | ||
270 | |||
271 | /* | ||
272 | * Set the PEBS counter reset value. | ||
273 | * | ||
274 | * Returns 0 on success; -Eerrno on error | ||
275 | * | ||
276 | * tracer: the tracer handle returned from ds_request_pebs() | ||
277 | * counter: the index of the counter | ||
278 | * value: the new counter reset value | ||
279 | */ | ||
280 | extern int ds_set_pebs_reset(struct pebs_tracer *tracer, | ||
281 | unsigned int counter, u64 value); | ||
282 | |||
283 | /* | ||
284 | * Initialization | ||
285 | */ | ||
286 | struct cpuinfo_x86; | ||
287 | extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *); | ||
288 | |||
289 | /* | ||
290 | * Context switch work | ||
291 | */ | ||
292 | extern void ds_switch_to(struct task_struct *prev, struct task_struct *next); | ||
293 | |||
294 | #else /* CONFIG_X86_DS */ | ||
295 | |||
296 | struct cpuinfo_x86; | ||
297 | static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {} | ||
298 | static inline void ds_switch_to(struct task_struct *prev, | ||
299 | struct task_struct *next) {} | ||
300 | |||
301 | #endif /* CONFIG_X86_DS */ | ||
302 | #endif /* _ASM_X86_DS_H */ | ||
diff --git a/arch/x86/include/asm/hw_breakpoint.h b/arch/x86/include/asm/hw_breakpoint.h index 2a1bd8f4f23a..942255310e6a 100644 --- a/arch/x86/include/asm/hw_breakpoint.h +++ b/arch/x86/include/asm/hw_breakpoint.h | |||
@@ -41,12 +41,16 @@ struct arch_hw_breakpoint { | |||
41 | /* Total number of available HW breakpoint registers */ | 41 | /* Total number of available HW breakpoint registers */ |
42 | #define HBP_NUM 4 | 42 | #define HBP_NUM 4 |
43 | 43 | ||
44 | static inline int hw_breakpoint_slots(int type) | ||
45 | { | ||
46 | return HBP_NUM; | ||
47 | } | ||
48 | |||
44 | struct perf_event; | 49 | struct perf_event; |
45 | struct pmu; | 50 | struct pmu; |
46 | 51 | ||
47 | extern int arch_check_va_in_userspace(unsigned long va, u8 hbp_len); | 52 | extern int arch_check_bp_in_kernelspace(struct perf_event *bp); |
48 | extern int arch_validate_hwbkpt_settings(struct perf_event *bp, | 53 | extern int arch_validate_hwbkpt_settings(struct perf_event *bp); |
49 | struct task_struct *tsk); | ||
50 | extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, | 54 | extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, |
51 | unsigned long val, void *data); | 55 | unsigned long val, void *data); |
52 | 56 | ||
diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h index 96c2e0ad04ca..88c765e16410 100644 --- a/arch/x86/include/asm/insn.h +++ b/arch/x86/include/asm/insn.h | |||
@@ -68,6 +68,8 @@ struct insn { | |||
68 | const insn_byte_t *next_byte; | 68 | const insn_byte_t *next_byte; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #define MAX_INSN_SIZE 16 | ||
72 | |||
71 | #define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6) | 73 | #define X86_MODRM_MOD(modrm) (((modrm) & 0xc0) >> 6) |
72 | #define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3) | 74 | #define X86_MODRM_REG(modrm) (((modrm) & 0x38) >> 3) |
73 | #define X86_MODRM_RM(modrm) ((modrm) & 0x07) | 75 | #define X86_MODRM_RM(modrm) ((modrm) & 0x07) |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index a1dcfa3ab17d..30a3e9776123 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -347,6 +347,7 @@ extern void __iomem *early_ioremap(resource_size_t phys_addr, | |||
347 | extern void __iomem *early_memremap(resource_size_t phys_addr, | 347 | extern void __iomem *early_memremap(resource_size_t phys_addr, |
348 | unsigned long size); | 348 | unsigned long size); |
349 | extern void early_iounmap(void __iomem *addr, unsigned long size); | 349 | extern void early_iounmap(void __iomem *addr, unsigned long size); |
350 | extern void fixup_early_ioremap(void); | ||
350 | 351 | ||
351 | #define IO_SPACE_LIMIT 0xffff | 352 | #define IO_SPACE_LIMIT 0xffff |
352 | 353 | ||
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h index 4ffa345a8ccb..547882539157 100644 --- a/arch/x86/include/asm/kprobes.h +++ b/arch/x86/include/asm/kprobes.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/ptrace.h> | 25 | #include <linux/ptrace.h> |
26 | #include <linux/percpu.h> | 26 | #include <linux/percpu.h> |
27 | #include <asm/insn.h> | ||
27 | 28 | ||
28 | #define __ARCH_WANT_KPROBES_INSN_SLOT | 29 | #define __ARCH_WANT_KPROBES_INSN_SLOT |
29 | 30 | ||
@@ -36,7 +37,6 @@ typedef u8 kprobe_opcode_t; | |||
36 | #define RELATIVEJUMP_SIZE 5 | 37 | #define RELATIVEJUMP_SIZE 5 |
37 | #define RELATIVECALL_OPCODE 0xe8 | 38 | #define RELATIVECALL_OPCODE 0xe8 |
38 | #define RELATIVE_ADDR_SIZE 4 | 39 | #define RELATIVE_ADDR_SIZE 4 |
39 | #define MAX_INSN_SIZE 16 | ||
40 | #define MAX_STACK_SIZE 64 | 40 | #define MAX_STACK_SIZE 64 |
41 | #define MIN_STACK_SIZE(ADDR) \ | 41 | #define MIN_STACK_SIZE(ADDR) \ |
42 | (((MAX_STACK_SIZE) < (((unsigned long)current_thread_info()) + \ | 42 | (((MAX_STACK_SIZE) < (((unsigned long)current_thread_info()) + \ |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 4604e6a54d36..bc473acfa7f9 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 |
@@ -359,6 +362,8 @@ | |||
359 | #define MSR_P4_U2L_ESCR0 0x000003b0 | 362 | #define MSR_P4_U2L_ESCR0 0x000003b0 |
360 | #define MSR_P4_U2L_ESCR1 0x000003b1 | 363 | #define MSR_P4_U2L_ESCR1 0x000003b1 |
361 | 364 | ||
365 | #define MSR_P4_PEBS_MATRIX_VERT 0x000003f2 | ||
366 | |||
362 | /* Intel Core-based CPU performance counters */ | 367 | /* Intel Core-based CPU performance counters */ |
363 | #define MSR_CORE_PERF_FIXED_CTR0 0x00000309 | 368 | #define MSR_CORE_PERF_FIXED_CTR0 0x00000309 |
364 | #define MSR_CORE_PERF_FIXED_CTR1 0x0000030a | 369 | #define MSR_CORE_PERF_FIXED_CTR1 0x0000030a |
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index db6109a885a7..254883d0c7e0 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * Performance event hw details: | 5 | * Performance event hw details: |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define X86_PMC_MAX_GENERIC 8 | 8 | #define X86_PMC_MAX_GENERIC 32 |
9 | #define X86_PMC_MAX_FIXED 3 | 9 | #define X86_PMC_MAX_FIXED 3 |
10 | 10 | ||
11 | #define X86_PMC_IDX_GENERIC 0 | 11 | #define X86_PMC_IDX_GENERIC 0 |
@@ -18,39 +18,31 @@ | |||
18 | #define MSR_ARCH_PERFMON_EVENTSEL0 0x186 | 18 | #define MSR_ARCH_PERFMON_EVENTSEL0 0x186 |
19 | #define MSR_ARCH_PERFMON_EVENTSEL1 0x187 | 19 | #define MSR_ARCH_PERFMON_EVENTSEL1 0x187 |
20 | 20 | ||
21 | #define ARCH_PERFMON_EVENTSEL_ENABLE (1 << 22) | 21 | #define ARCH_PERFMON_EVENTSEL_EVENT 0x000000FFULL |
22 | #define ARCH_PERFMON_EVENTSEL_ANY (1 << 21) | 22 | #define ARCH_PERFMON_EVENTSEL_UMASK 0x0000FF00ULL |
23 | #define ARCH_PERFMON_EVENTSEL_INT (1 << 20) | 23 | #define ARCH_PERFMON_EVENTSEL_USR (1ULL << 16) |
24 | #define ARCH_PERFMON_EVENTSEL_OS (1 << 17) | 24 | #define ARCH_PERFMON_EVENTSEL_OS (1ULL << 17) |
25 | #define ARCH_PERFMON_EVENTSEL_USR (1 << 16) | 25 | #define ARCH_PERFMON_EVENTSEL_EDGE (1ULL << 18) |
26 | 26 | #define ARCH_PERFMON_EVENTSEL_INT (1ULL << 20) | |
27 | /* | 27 | #define ARCH_PERFMON_EVENTSEL_ANY (1ULL << 21) |
28 | * Includes eventsel and unit mask as well: | 28 | #define ARCH_PERFMON_EVENTSEL_ENABLE (1ULL << 22) |
29 | */ | 29 | #define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23) |
30 | 30 | #define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL | |
31 | 31 | ||
32 | #define INTEL_ARCH_EVTSEL_MASK 0x000000FFULL | 32 | #define AMD64_EVENTSEL_EVENT \ |
33 | #define INTEL_ARCH_UNIT_MASK 0x0000FF00ULL | 33 | (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32)) |
34 | #define INTEL_ARCH_EDGE_MASK 0x00040000ULL | 34 | #define INTEL_ARCH_EVENT_MASK \ |
35 | #define INTEL_ARCH_INV_MASK 0x00800000ULL | 35 | (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT) |
36 | #define INTEL_ARCH_CNT_MASK 0xFF000000ULL | 36 | |
37 | #define INTEL_ARCH_EVENT_MASK (INTEL_ARCH_UNIT_MASK|INTEL_ARCH_EVTSEL_MASK) | 37 | #define X86_RAW_EVENT_MASK \ |
38 | 38 | (ARCH_PERFMON_EVENTSEL_EVENT | \ | |
39 | /* | 39 | ARCH_PERFMON_EVENTSEL_UMASK | \ |
40 | * filter mask to validate fixed counter events. | 40 | ARCH_PERFMON_EVENTSEL_EDGE | \ |
41 | * the following filters disqualify for fixed counters: | 41 | ARCH_PERFMON_EVENTSEL_INV | \ |
42 | * - inv | 42 | ARCH_PERFMON_EVENTSEL_CMASK) |
43 | * - edge | 43 | #define AMD64_RAW_EVENT_MASK \ |
44 | * - cnt-mask | 44 | (X86_RAW_EVENT_MASK | \ |
45 | * The other filters are supported by fixed counters. | 45 | AMD64_EVENTSEL_EVENT) |
46 | * The any-thread option is supported starting with v3. | ||
47 | */ | ||
48 | #define INTEL_ARCH_FIXED_MASK \ | ||
49 | (INTEL_ARCH_CNT_MASK| \ | ||
50 | INTEL_ARCH_INV_MASK| \ | ||
51 | INTEL_ARCH_EDGE_MASK|\ | ||
52 | INTEL_ARCH_UNIT_MASK|\ | ||
53 | INTEL_ARCH_EVENT_MASK) | ||
54 | 46 | ||
55 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c | 47 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c |
56 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) | 48 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) |
@@ -67,7 +59,7 @@ | |||
67 | union cpuid10_eax { | 59 | union cpuid10_eax { |
68 | struct { | 60 | struct { |
69 | unsigned int version_id:8; | 61 | unsigned int version_id:8; |
70 | unsigned int num_events:8; | 62 | unsigned int num_counters:8; |
71 | unsigned int bit_width:8; | 63 | unsigned int bit_width:8; |
72 | unsigned int mask_length:8; | 64 | unsigned int mask_length:8; |
73 | } split; | 65 | } split; |
@@ -76,7 +68,7 @@ union cpuid10_eax { | |||
76 | 68 | ||
77 | union cpuid10_edx { | 69 | union cpuid10_edx { |
78 | struct { | 70 | struct { |
79 | unsigned int num_events_fixed:4; | 71 | unsigned int num_counters_fixed:4; |
80 | unsigned int reserved:28; | 72 | unsigned int reserved:28; |
81 | } split; | 73 | } split; |
82 | unsigned int full; | 74 | unsigned int full; |
@@ -136,6 +128,18 @@ extern void perf_events_lapic_init(void); | |||
136 | 128 | ||
137 | #define PERF_EVENT_INDEX_OFFSET 0 | 129 | #define PERF_EVENT_INDEX_OFFSET 0 |
138 | 130 | ||
131 | /* | ||
132 | * Abuse bit 3 of the cpu eflags register to indicate proper PEBS IP fixups. | ||
133 | * This flag is otherwise unused and ABI specified to be 0, so nobody should | ||
134 | * care what we do with it. | ||
135 | */ | ||
136 | #define PERF_EFLAGS_EXACT (1UL << 3) | ||
137 | |||
138 | struct pt_regs; | ||
139 | extern unsigned long perf_instruction_pointer(struct pt_regs *regs); | ||
140 | extern unsigned long perf_misc_flags(struct pt_regs *regs); | ||
141 | #define perf_misc_flags(regs) perf_misc_flags(regs) | ||
142 | |||
139 | #else | 143 | #else |
140 | static inline void init_hw_perf_events(void) { } | 144 | static inline void init_hw_perf_events(void) { } |
141 | static inline void perf_events_lapic_init(void) { } | 145 | static inline void perf_events_lapic_init(void) { } |
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h new file mode 100644 index 000000000000..b05400a542ff --- /dev/null +++ b/arch/x86/include/asm/perf_event_p4.h | |||
@@ -0,0 +1,794 @@ | |||
1 | /* | ||
2 | * Netburst Perfomance Events (P4, old Xeon) | ||
3 | */ | ||
4 | |||
5 | #ifndef PERF_EVENT_P4_H | ||
6 | #define PERF_EVENT_P4_H | ||
7 | |||
8 | #include <linux/cpu.h> | ||
9 | #include <linux/bitops.h> | ||
10 | |||
11 | /* | ||
12 | * NetBurst has perfomance MSRs shared between | ||
13 | * threads if HT is turned on, ie for both logical | ||
14 | * processors (mem: in turn in Atom with HT support | ||
15 | * perf-MSRs are not shared and every thread has its | ||
16 | * own perf-MSRs set) | ||
17 | */ | ||
18 | #define ARCH_P4_TOTAL_ESCR (46) | ||
19 | #define ARCH_P4_RESERVED_ESCR (2) /* IQ_ESCR(0,1) not always present */ | ||
20 | #define ARCH_P4_MAX_ESCR (ARCH_P4_TOTAL_ESCR - ARCH_P4_RESERVED_ESCR) | ||
21 | #define ARCH_P4_MAX_CCCR (18) | ||
22 | #define ARCH_P4_MAX_COUNTER (ARCH_P4_MAX_CCCR / 2) | ||
23 | |||
24 | #define P4_ESCR_EVENT_MASK 0x7e000000U | ||
25 | #define P4_ESCR_EVENT_SHIFT 25 | ||
26 | #define P4_ESCR_EVENTMASK_MASK 0x01fffe00U | ||
27 | #define P4_ESCR_EVENTMASK_SHIFT 9 | ||
28 | #define P4_ESCR_TAG_MASK 0x000001e0U | ||
29 | #define P4_ESCR_TAG_SHIFT 5 | ||
30 | #define P4_ESCR_TAG_ENABLE 0x00000010U | ||
31 | #define P4_ESCR_T0_OS 0x00000008U | ||
32 | #define P4_ESCR_T0_USR 0x00000004U | ||
33 | #define P4_ESCR_T1_OS 0x00000002U | ||
34 | #define P4_ESCR_T1_USR 0x00000001U | ||
35 | |||
36 | #define P4_ESCR_EVENT(v) ((v) << P4_ESCR_EVENT_SHIFT) | ||
37 | #define P4_ESCR_EMASK(v) ((v) << P4_ESCR_EVENTMASK_SHIFT) | ||
38 | #define P4_ESCR_TAG(v) ((v) << P4_ESCR_TAG_SHIFT) | ||
39 | |||
40 | /* Non HT mask */ | ||
41 | #define P4_ESCR_MASK \ | ||
42 | (P4_ESCR_EVENT_MASK | \ | ||
43 | P4_ESCR_EVENTMASK_MASK | \ | ||
44 | P4_ESCR_TAG_MASK | \ | ||
45 | P4_ESCR_TAG_ENABLE | \ | ||
46 | P4_ESCR_T0_OS | \ | ||
47 | P4_ESCR_T0_USR) | ||
48 | |||
49 | /* HT mask */ | ||
50 | #define P4_ESCR_MASK_HT \ | ||
51 | (P4_ESCR_MASK | P4_ESCR_T1_OS | P4_ESCR_T1_USR) | ||
52 | |||
53 | #define P4_CCCR_OVF 0x80000000U | ||
54 | #define P4_CCCR_CASCADE 0x40000000U | ||
55 | #define P4_CCCR_OVF_PMI_T0 0x04000000U | ||
56 | #define P4_CCCR_OVF_PMI_T1 0x08000000U | ||
57 | #define P4_CCCR_FORCE_OVF 0x02000000U | ||
58 | #define P4_CCCR_EDGE 0x01000000U | ||
59 | #define P4_CCCR_THRESHOLD_MASK 0x00f00000U | ||
60 | #define P4_CCCR_THRESHOLD_SHIFT 20 | ||
61 | #define P4_CCCR_COMPLEMENT 0x00080000U | ||
62 | #define P4_CCCR_COMPARE 0x00040000U | ||
63 | #define P4_CCCR_ESCR_SELECT_MASK 0x0000e000U | ||
64 | #define P4_CCCR_ESCR_SELECT_SHIFT 13 | ||
65 | #define P4_CCCR_ENABLE 0x00001000U | ||
66 | #define P4_CCCR_THREAD_SINGLE 0x00010000U | ||
67 | #define P4_CCCR_THREAD_BOTH 0x00020000U | ||
68 | #define P4_CCCR_THREAD_ANY 0x00030000U | ||
69 | #define P4_CCCR_RESERVED 0x00000fffU | ||
70 | |||
71 | #define P4_CCCR_THRESHOLD(v) ((v) << P4_CCCR_THRESHOLD_SHIFT) | ||
72 | #define P4_CCCR_ESEL(v) ((v) << P4_CCCR_ESCR_SELECT_SHIFT) | ||
73 | |||
74 | /* Custom bits in reerved CCCR area */ | ||
75 | #define P4_CCCR_CACHE_OPS_MASK 0x0000003fU | ||
76 | |||
77 | |||
78 | /* Non HT mask */ | ||
79 | #define P4_CCCR_MASK \ | ||
80 | (P4_CCCR_OVF | \ | ||
81 | P4_CCCR_CASCADE | \ | ||
82 | P4_CCCR_OVF_PMI_T0 | \ | ||
83 | P4_CCCR_FORCE_OVF | \ | ||
84 | P4_CCCR_EDGE | \ | ||
85 | P4_CCCR_THRESHOLD_MASK | \ | ||
86 | P4_CCCR_COMPLEMENT | \ | ||
87 | P4_CCCR_COMPARE | \ | ||
88 | P4_CCCR_ESCR_SELECT_MASK | \ | ||
89 | P4_CCCR_ENABLE) | ||
90 | |||
91 | /* HT mask */ | ||
92 | #define P4_CCCR_MASK_HT (P4_CCCR_MASK | P4_CCCR_THREAD_ANY) | ||
93 | |||
94 | #define P4_GEN_ESCR_EMASK(class, name, bit) \ | ||
95 | class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT) | ||
96 | #define P4_ESCR_EMASK_BIT(class, name) class##__##name | ||
97 | |||
98 | /* | ||
99 | * config field is 64bit width and consists of | ||
100 | * HT << 63 | ESCR << 32 | CCCR | ||
101 | * where HT is HyperThreading bit (since ESCR | ||
102 | * has it reserved we may use it for own purpose) | ||
103 | * | ||
104 | * note that this is NOT the addresses of respective | ||
105 | * ESCR and CCCR but rather an only packed value should | ||
106 | * be unpacked and written to a proper addresses | ||
107 | * | ||
108 | * the base idea is to pack as much info as | ||
109 | * possible | ||
110 | */ | ||
111 | #define p4_config_pack_escr(v) (((u64)(v)) << 32) | ||
112 | #define p4_config_pack_cccr(v) (((u64)(v)) & 0xffffffffULL) | ||
113 | #define p4_config_unpack_escr(v) (((u64)(v)) >> 32) | ||
114 | #define p4_config_unpack_cccr(v) (((u64)(v)) & 0xffffffffULL) | ||
115 | |||
116 | #define p4_config_unpack_emask(v) \ | ||
117 | ({ \ | ||
118 | u32 t = p4_config_unpack_escr((v)); \ | ||
119 | t = t & P4_ESCR_EVENTMASK_MASK; \ | ||
120 | t = t >> P4_ESCR_EVENTMASK_SHIFT; \ | ||
121 | t; \ | ||
122 | }) | ||
123 | |||
124 | #define p4_config_unpack_event(v) \ | ||
125 | ({ \ | ||
126 | u32 t = p4_config_unpack_escr((v)); \ | ||
127 | t = t & P4_ESCR_EVENT_MASK; \ | ||
128 | t = t >> P4_ESCR_EVENT_SHIFT; \ | ||
129 | t; \ | ||
130 | }) | ||
131 | |||
132 | #define p4_config_unpack_cache_event(v) (((u64)(v)) & P4_CCCR_CACHE_OPS_MASK) | ||
133 | |||
134 | #define P4_CONFIG_HT_SHIFT 63 | ||
135 | #define P4_CONFIG_HT (1ULL << P4_CONFIG_HT_SHIFT) | ||
136 | |||
137 | static inline bool p4_is_event_cascaded(u64 config) | ||
138 | { | ||
139 | u32 cccr = p4_config_unpack_cccr(config); | ||
140 | return !!(cccr & P4_CCCR_CASCADE); | ||
141 | } | ||
142 | |||
143 | static inline int p4_ht_config_thread(u64 config) | ||
144 | { | ||
145 | return !!(config & P4_CONFIG_HT); | ||
146 | } | ||
147 | |||
148 | static inline u64 p4_set_ht_bit(u64 config) | ||
149 | { | ||
150 | return config | P4_CONFIG_HT; | ||
151 | } | ||
152 | |||
153 | static inline u64 p4_clear_ht_bit(u64 config) | ||
154 | { | ||
155 | return config & ~P4_CONFIG_HT; | ||
156 | } | ||
157 | |||
158 | static inline int p4_ht_active(void) | ||
159 | { | ||
160 | #ifdef CONFIG_SMP | ||
161 | return smp_num_siblings > 1; | ||
162 | #endif | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static inline int p4_ht_thread(int cpu) | ||
167 | { | ||
168 | #ifdef CONFIG_SMP | ||
169 | if (smp_num_siblings == 2) | ||
170 | return cpu != cpumask_first(__get_cpu_var(cpu_sibling_map)); | ||
171 | #endif | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static inline int p4_should_swap_ts(u64 config, int cpu) | ||
176 | { | ||
177 | return p4_ht_config_thread(config) ^ p4_ht_thread(cpu); | ||
178 | } | ||
179 | |||
180 | static inline u32 p4_default_cccr_conf(int cpu) | ||
181 | { | ||
182 | /* | ||
183 | * Note that P4_CCCR_THREAD_ANY is "required" on | ||
184 | * non-HT machines (on HT machines we count TS events | ||
185 | * regardless the state of second logical processor | ||
186 | */ | ||
187 | u32 cccr = P4_CCCR_THREAD_ANY; | ||
188 | |||
189 | if (!p4_ht_thread(cpu)) | ||
190 | cccr |= P4_CCCR_OVF_PMI_T0; | ||
191 | else | ||
192 | cccr |= P4_CCCR_OVF_PMI_T1; | ||
193 | |||
194 | return cccr; | ||
195 | } | ||
196 | |||
197 | static inline u32 p4_default_escr_conf(int cpu, int exclude_os, int exclude_usr) | ||
198 | { | ||
199 | u32 escr = 0; | ||
200 | |||
201 | if (!p4_ht_thread(cpu)) { | ||
202 | if (!exclude_os) | ||
203 | escr |= P4_ESCR_T0_OS; | ||
204 | if (!exclude_usr) | ||
205 | escr |= P4_ESCR_T0_USR; | ||
206 | } else { | ||
207 | if (!exclude_os) | ||
208 | escr |= P4_ESCR_T1_OS; | ||
209 | if (!exclude_usr) | ||
210 | escr |= P4_ESCR_T1_USR; | ||
211 | } | ||
212 | |||
213 | return escr; | ||
214 | } | ||
215 | |||
216 | enum P4_EVENTS { | ||
217 | P4_EVENT_TC_DELIVER_MODE, | ||
218 | P4_EVENT_BPU_FETCH_REQUEST, | ||
219 | P4_EVENT_ITLB_REFERENCE, | ||
220 | P4_EVENT_MEMORY_CANCEL, | ||
221 | P4_EVENT_MEMORY_COMPLETE, | ||
222 | P4_EVENT_LOAD_PORT_REPLAY, | ||
223 | P4_EVENT_STORE_PORT_REPLAY, | ||
224 | P4_EVENT_MOB_LOAD_REPLAY, | ||
225 | P4_EVENT_PAGE_WALK_TYPE, | ||
226 | P4_EVENT_BSQ_CACHE_REFERENCE, | ||
227 | P4_EVENT_IOQ_ALLOCATION, | ||
228 | P4_EVENT_IOQ_ACTIVE_ENTRIES, | ||
229 | P4_EVENT_FSB_DATA_ACTIVITY, | ||
230 | P4_EVENT_BSQ_ALLOCATION, | ||
231 | P4_EVENT_BSQ_ACTIVE_ENTRIES, | ||
232 | P4_EVENT_SSE_INPUT_ASSIST, | ||
233 | P4_EVENT_PACKED_SP_UOP, | ||
234 | P4_EVENT_PACKED_DP_UOP, | ||
235 | P4_EVENT_SCALAR_SP_UOP, | ||
236 | P4_EVENT_SCALAR_DP_UOP, | ||
237 | P4_EVENT_64BIT_MMX_UOP, | ||
238 | P4_EVENT_128BIT_MMX_UOP, | ||
239 | P4_EVENT_X87_FP_UOP, | ||
240 | P4_EVENT_TC_MISC, | ||
241 | P4_EVENT_GLOBAL_POWER_EVENTS, | ||
242 | P4_EVENT_TC_MS_XFER, | ||
243 | P4_EVENT_UOP_QUEUE_WRITES, | ||
244 | P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE, | ||
245 | P4_EVENT_RETIRED_BRANCH_TYPE, | ||
246 | P4_EVENT_RESOURCE_STALL, | ||
247 | P4_EVENT_WC_BUFFER, | ||
248 | P4_EVENT_B2B_CYCLES, | ||
249 | P4_EVENT_BNR, | ||
250 | P4_EVENT_SNOOP, | ||
251 | P4_EVENT_RESPONSE, | ||
252 | P4_EVENT_FRONT_END_EVENT, | ||
253 | P4_EVENT_EXECUTION_EVENT, | ||
254 | P4_EVENT_REPLAY_EVENT, | ||
255 | P4_EVENT_INSTR_RETIRED, | ||
256 | P4_EVENT_UOPS_RETIRED, | ||
257 | P4_EVENT_UOP_TYPE, | ||
258 | P4_EVENT_BRANCH_RETIRED, | ||
259 | P4_EVENT_MISPRED_BRANCH_RETIRED, | ||
260 | P4_EVENT_X87_ASSIST, | ||
261 | P4_EVENT_MACHINE_CLEAR, | ||
262 | P4_EVENT_INSTR_COMPLETED, | ||
263 | }; | ||
264 | |||
265 | #define P4_OPCODE(event) event##_OPCODE | ||
266 | #define P4_OPCODE_ESEL(opcode) ((opcode & 0x00ff) >> 0) | ||
267 | #define P4_OPCODE_EVNT(opcode) ((opcode & 0xff00) >> 8) | ||
268 | #define P4_OPCODE_PACK(event, sel) (((event) << 8) | sel) | ||
269 | |||
270 | /* | ||
271 | * Comments below the event represent ESCR restriction | ||
272 | * for this event and counter index per ESCR | ||
273 | * | ||
274 | * MSR_P4_IQ_ESCR0 and MSR_P4_IQ_ESCR1 are available only on early | ||
275 | * processor builds (family 0FH, models 01H-02H). These MSRs | ||
276 | * are not available on later versions, so that we don't use | ||
277 | * them completely | ||
278 | * | ||
279 | * Also note that CCCR1 do not have P4_CCCR_ENABLE bit properly | ||
280 | * working so that we should not use this CCCR and respective | ||
281 | * counter as result | ||
282 | */ | ||
283 | enum P4_EVENT_OPCODES { | ||
284 | P4_OPCODE(P4_EVENT_TC_DELIVER_MODE) = P4_OPCODE_PACK(0x01, 0x01), | ||
285 | /* | ||
286 | * MSR_P4_TC_ESCR0: 4, 5 | ||
287 | * MSR_P4_TC_ESCR1: 6, 7 | ||
288 | */ | ||
289 | |||
290 | P4_OPCODE(P4_EVENT_BPU_FETCH_REQUEST) = P4_OPCODE_PACK(0x03, 0x00), | ||
291 | /* | ||
292 | * MSR_P4_BPU_ESCR0: 0, 1 | ||
293 | * MSR_P4_BPU_ESCR1: 2, 3 | ||
294 | */ | ||
295 | |||
296 | P4_OPCODE(P4_EVENT_ITLB_REFERENCE) = P4_OPCODE_PACK(0x18, 0x03), | ||
297 | /* | ||
298 | * MSR_P4_ITLB_ESCR0: 0, 1 | ||
299 | * MSR_P4_ITLB_ESCR1: 2, 3 | ||
300 | */ | ||
301 | |||
302 | P4_OPCODE(P4_EVENT_MEMORY_CANCEL) = P4_OPCODE_PACK(0x02, 0x05), | ||
303 | /* | ||
304 | * MSR_P4_DAC_ESCR0: 8, 9 | ||
305 | * MSR_P4_DAC_ESCR1: 10, 11 | ||
306 | */ | ||
307 | |||
308 | P4_OPCODE(P4_EVENT_MEMORY_COMPLETE) = P4_OPCODE_PACK(0x08, 0x02), | ||
309 | /* | ||
310 | * MSR_P4_SAAT_ESCR0: 8, 9 | ||
311 | * MSR_P4_SAAT_ESCR1: 10, 11 | ||
312 | */ | ||
313 | |||
314 | P4_OPCODE(P4_EVENT_LOAD_PORT_REPLAY) = P4_OPCODE_PACK(0x04, 0x02), | ||
315 | /* | ||
316 | * MSR_P4_SAAT_ESCR0: 8, 9 | ||
317 | * MSR_P4_SAAT_ESCR1: 10, 11 | ||
318 | */ | ||
319 | |||
320 | P4_OPCODE(P4_EVENT_STORE_PORT_REPLAY) = P4_OPCODE_PACK(0x05, 0x02), | ||
321 | /* | ||
322 | * MSR_P4_SAAT_ESCR0: 8, 9 | ||
323 | * MSR_P4_SAAT_ESCR1: 10, 11 | ||
324 | */ | ||
325 | |||
326 | P4_OPCODE(P4_EVENT_MOB_LOAD_REPLAY) = P4_OPCODE_PACK(0x03, 0x02), | ||
327 | /* | ||
328 | * MSR_P4_MOB_ESCR0: 0, 1 | ||
329 | * MSR_P4_MOB_ESCR1: 2, 3 | ||
330 | */ | ||
331 | |||
332 | P4_OPCODE(P4_EVENT_PAGE_WALK_TYPE) = P4_OPCODE_PACK(0x01, 0x04), | ||
333 | /* | ||
334 | * MSR_P4_PMH_ESCR0: 0, 1 | ||
335 | * MSR_P4_PMH_ESCR1: 2, 3 | ||
336 | */ | ||
337 | |||
338 | P4_OPCODE(P4_EVENT_BSQ_CACHE_REFERENCE) = P4_OPCODE_PACK(0x0c, 0x07), | ||
339 | /* | ||
340 | * MSR_P4_BSU_ESCR0: 0, 1 | ||
341 | * MSR_P4_BSU_ESCR1: 2, 3 | ||
342 | */ | ||
343 | |||
344 | P4_OPCODE(P4_EVENT_IOQ_ALLOCATION) = P4_OPCODE_PACK(0x03, 0x06), | ||
345 | /* | ||
346 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
347 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
348 | */ | ||
349 | |||
350 | P4_OPCODE(P4_EVENT_IOQ_ACTIVE_ENTRIES) = P4_OPCODE_PACK(0x1a, 0x06), | ||
351 | /* | ||
352 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
353 | */ | ||
354 | |||
355 | P4_OPCODE(P4_EVENT_FSB_DATA_ACTIVITY) = P4_OPCODE_PACK(0x17, 0x06), | ||
356 | /* | ||
357 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
358 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
359 | */ | ||
360 | |||
361 | P4_OPCODE(P4_EVENT_BSQ_ALLOCATION) = P4_OPCODE_PACK(0x05, 0x07), | ||
362 | /* | ||
363 | * MSR_P4_BSU_ESCR0: 0, 1 | ||
364 | */ | ||
365 | |||
366 | P4_OPCODE(P4_EVENT_BSQ_ACTIVE_ENTRIES) = P4_OPCODE_PACK(0x06, 0x07), | ||
367 | /* | ||
368 | * NOTE: no ESCR name in docs, it's guessed | ||
369 | * MSR_P4_BSU_ESCR1: 2, 3 | ||
370 | */ | ||
371 | |||
372 | P4_OPCODE(P4_EVENT_SSE_INPUT_ASSIST) = P4_OPCODE_PACK(0x34, 0x01), | ||
373 | /* | ||
374 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
375 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
376 | */ | ||
377 | |||
378 | P4_OPCODE(P4_EVENT_PACKED_SP_UOP) = P4_OPCODE_PACK(0x08, 0x01), | ||
379 | /* | ||
380 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
381 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
382 | */ | ||
383 | |||
384 | P4_OPCODE(P4_EVENT_PACKED_DP_UOP) = P4_OPCODE_PACK(0x0c, 0x01), | ||
385 | /* | ||
386 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
387 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
388 | */ | ||
389 | |||
390 | P4_OPCODE(P4_EVENT_SCALAR_SP_UOP) = P4_OPCODE_PACK(0x0a, 0x01), | ||
391 | /* | ||
392 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
393 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
394 | */ | ||
395 | |||
396 | P4_OPCODE(P4_EVENT_SCALAR_DP_UOP) = P4_OPCODE_PACK(0x0e, 0x01), | ||
397 | /* | ||
398 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
399 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
400 | */ | ||
401 | |||
402 | P4_OPCODE(P4_EVENT_64BIT_MMX_UOP) = P4_OPCODE_PACK(0x02, 0x01), | ||
403 | /* | ||
404 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
405 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
406 | */ | ||
407 | |||
408 | P4_OPCODE(P4_EVENT_128BIT_MMX_UOP) = P4_OPCODE_PACK(0x1a, 0x01), | ||
409 | /* | ||
410 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
411 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
412 | */ | ||
413 | |||
414 | P4_OPCODE(P4_EVENT_X87_FP_UOP) = P4_OPCODE_PACK(0x04, 0x01), | ||
415 | /* | ||
416 | * MSR_P4_FIRM_ESCR0: 8, 9 | ||
417 | * MSR_P4_FIRM_ESCR1: 10, 11 | ||
418 | */ | ||
419 | |||
420 | P4_OPCODE(P4_EVENT_TC_MISC) = P4_OPCODE_PACK(0x06, 0x01), | ||
421 | /* | ||
422 | * MSR_P4_TC_ESCR0: 4, 5 | ||
423 | * MSR_P4_TC_ESCR1: 6, 7 | ||
424 | */ | ||
425 | |||
426 | P4_OPCODE(P4_EVENT_GLOBAL_POWER_EVENTS) = P4_OPCODE_PACK(0x13, 0x06), | ||
427 | /* | ||
428 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
429 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
430 | */ | ||
431 | |||
432 | P4_OPCODE(P4_EVENT_TC_MS_XFER) = P4_OPCODE_PACK(0x05, 0x00), | ||
433 | /* | ||
434 | * MSR_P4_MS_ESCR0: 4, 5 | ||
435 | * MSR_P4_MS_ESCR1: 6, 7 | ||
436 | */ | ||
437 | |||
438 | P4_OPCODE(P4_EVENT_UOP_QUEUE_WRITES) = P4_OPCODE_PACK(0x09, 0x00), | ||
439 | /* | ||
440 | * MSR_P4_MS_ESCR0: 4, 5 | ||
441 | * MSR_P4_MS_ESCR1: 6, 7 | ||
442 | */ | ||
443 | |||
444 | P4_OPCODE(P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE) = P4_OPCODE_PACK(0x05, 0x02), | ||
445 | /* | ||
446 | * MSR_P4_TBPU_ESCR0: 4, 5 | ||
447 | * MSR_P4_TBPU_ESCR1: 6, 7 | ||
448 | */ | ||
449 | |||
450 | P4_OPCODE(P4_EVENT_RETIRED_BRANCH_TYPE) = P4_OPCODE_PACK(0x04, 0x02), | ||
451 | /* | ||
452 | * MSR_P4_TBPU_ESCR0: 4, 5 | ||
453 | * MSR_P4_TBPU_ESCR1: 6, 7 | ||
454 | */ | ||
455 | |||
456 | P4_OPCODE(P4_EVENT_RESOURCE_STALL) = P4_OPCODE_PACK(0x01, 0x01), | ||
457 | /* | ||
458 | * MSR_P4_ALF_ESCR0: 12, 13, 16 | ||
459 | * MSR_P4_ALF_ESCR1: 14, 15, 17 | ||
460 | */ | ||
461 | |||
462 | P4_OPCODE(P4_EVENT_WC_BUFFER) = P4_OPCODE_PACK(0x05, 0x05), | ||
463 | /* | ||
464 | * MSR_P4_DAC_ESCR0: 8, 9 | ||
465 | * MSR_P4_DAC_ESCR1: 10, 11 | ||
466 | */ | ||
467 | |||
468 | P4_OPCODE(P4_EVENT_B2B_CYCLES) = P4_OPCODE_PACK(0x16, 0x03), | ||
469 | /* | ||
470 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
471 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
472 | */ | ||
473 | |||
474 | P4_OPCODE(P4_EVENT_BNR) = P4_OPCODE_PACK(0x08, 0x03), | ||
475 | /* | ||
476 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
477 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
478 | */ | ||
479 | |||
480 | P4_OPCODE(P4_EVENT_SNOOP) = P4_OPCODE_PACK(0x06, 0x03), | ||
481 | /* | ||
482 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
483 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
484 | */ | ||
485 | |||
486 | P4_OPCODE(P4_EVENT_RESPONSE) = P4_OPCODE_PACK(0x04, 0x03), | ||
487 | /* | ||
488 | * MSR_P4_FSB_ESCR0: 0, 1 | ||
489 | * MSR_P4_FSB_ESCR1: 2, 3 | ||
490 | */ | ||
491 | |||
492 | P4_OPCODE(P4_EVENT_FRONT_END_EVENT) = P4_OPCODE_PACK(0x08, 0x05), | ||
493 | /* | ||
494 | * MSR_P4_CRU_ESCR2: 12, 13, 16 | ||
495 | * MSR_P4_CRU_ESCR3: 14, 15, 17 | ||
496 | */ | ||
497 | |||
498 | P4_OPCODE(P4_EVENT_EXECUTION_EVENT) = P4_OPCODE_PACK(0x0c, 0x05), | ||
499 | /* | ||
500 | * MSR_P4_CRU_ESCR2: 12, 13, 16 | ||
501 | * MSR_P4_CRU_ESCR3: 14, 15, 17 | ||
502 | */ | ||
503 | |||
504 | P4_OPCODE(P4_EVENT_REPLAY_EVENT) = P4_OPCODE_PACK(0x09, 0x05), | ||
505 | /* | ||
506 | * MSR_P4_CRU_ESCR2: 12, 13, 16 | ||
507 | * MSR_P4_CRU_ESCR3: 14, 15, 17 | ||
508 | */ | ||
509 | |||
510 | P4_OPCODE(P4_EVENT_INSTR_RETIRED) = P4_OPCODE_PACK(0x02, 0x04), | ||
511 | /* | ||
512 | * MSR_P4_CRU_ESCR0: 12, 13, 16 | ||
513 | * MSR_P4_CRU_ESCR1: 14, 15, 17 | ||
514 | */ | ||
515 | |||
516 | P4_OPCODE(P4_EVENT_UOPS_RETIRED) = P4_OPCODE_PACK(0x01, 0x04), | ||
517 | /* | ||
518 | * MSR_P4_CRU_ESCR0: 12, 13, 16 | ||
519 | * MSR_P4_CRU_ESCR1: 14, 15, 17 | ||
520 | */ | ||
521 | |||
522 | P4_OPCODE(P4_EVENT_UOP_TYPE) = P4_OPCODE_PACK(0x02, 0x02), | ||
523 | /* | ||
524 | * MSR_P4_RAT_ESCR0: 12, 13, 16 | ||
525 | * MSR_P4_RAT_ESCR1: 14, 15, 17 | ||
526 | */ | ||
527 | |||
528 | P4_OPCODE(P4_EVENT_BRANCH_RETIRED) = P4_OPCODE_PACK(0x06, 0x05), | ||
529 | /* | ||
530 | * MSR_P4_CRU_ESCR2: 12, 13, 16 | ||
531 | * MSR_P4_CRU_ESCR3: 14, 15, 17 | ||
532 | */ | ||
533 | |||
534 | P4_OPCODE(P4_EVENT_MISPRED_BRANCH_RETIRED) = P4_OPCODE_PACK(0x03, 0x04), | ||
535 | /* | ||
536 | * MSR_P4_CRU_ESCR0: 12, 13, 16 | ||
537 | * MSR_P4_CRU_ESCR1: 14, 15, 17 | ||
538 | */ | ||
539 | |||
540 | P4_OPCODE(P4_EVENT_X87_ASSIST) = P4_OPCODE_PACK(0x03, 0x05), | ||
541 | /* | ||
542 | * MSR_P4_CRU_ESCR2: 12, 13, 16 | ||
543 | * MSR_P4_CRU_ESCR3: 14, 15, 17 | ||
544 | */ | ||
545 | |||
546 | P4_OPCODE(P4_EVENT_MACHINE_CLEAR) = P4_OPCODE_PACK(0x02, 0x05), | ||
547 | /* | ||
548 | * MSR_P4_CRU_ESCR2: 12, 13, 16 | ||
549 | * MSR_P4_CRU_ESCR3: 14, 15, 17 | ||
550 | */ | ||
551 | |||
552 | P4_OPCODE(P4_EVENT_INSTR_COMPLETED) = P4_OPCODE_PACK(0x07, 0x04), | ||
553 | /* | ||
554 | * MSR_P4_CRU_ESCR0: 12, 13, 16 | ||
555 | * MSR_P4_CRU_ESCR1: 14, 15, 17 | ||
556 | */ | ||
557 | }; | ||
558 | |||
559 | /* | ||
560 | * a caller should use P4_ESCR_EMASK_NAME helper to | ||
561 | * pick the EventMask needed, for example | ||
562 | * | ||
563 | * P4_ESCR_EMASK_NAME(P4_EVENT_TC_DELIVER_MODE, DD) | ||
564 | */ | ||
565 | enum P4_ESCR_EMASKS { | ||
566 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, DD, 0), | ||
567 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, DB, 1), | ||
568 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, DI, 2), | ||
569 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, BD, 3), | ||
570 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, BB, 4), | ||
571 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, BI, 5), | ||
572 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, ID, 6), | ||
573 | |||
574 | P4_GEN_ESCR_EMASK(P4_EVENT_BPU_FETCH_REQUEST, TCMISS, 0), | ||
575 | |||
576 | P4_GEN_ESCR_EMASK(P4_EVENT_ITLB_REFERENCE, HIT, 0), | ||
577 | P4_GEN_ESCR_EMASK(P4_EVENT_ITLB_REFERENCE, MISS, 1), | ||
578 | P4_GEN_ESCR_EMASK(P4_EVENT_ITLB_REFERENCE, HIT_UK, 2), | ||
579 | |||
580 | P4_GEN_ESCR_EMASK(P4_EVENT_MEMORY_CANCEL, ST_RB_FULL, 2), | ||
581 | P4_GEN_ESCR_EMASK(P4_EVENT_MEMORY_CANCEL, 64K_CONF, 3), | ||
582 | |||
583 | P4_GEN_ESCR_EMASK(P4_EVENT_MEMORY_COMPLETE, LSC, 0), | ||
584 | P4_GEN_ESCR_EMASK(P4_EVENT_MEMORY_COMPLETE, SSC, 1), | ||
585 | |||
586 | P4_GEN_ESCR_EMASK(P4_EVENT_LOAD_PORT_REPLAY, SPLIT_LD, 1), | ||
587 | |||
588 | P4_GEN_ESCR_EMASK(P4_EVENT_STORE_PORT_REPLAY, SPLIT_ST, 1), | ||
589 | |||
590 | P4_GEN_ESCR_EMASK(P4_EVENT_MOB_LOAD_REPLAY, NO_STA, 1), | ||
591 | P4_GEN_ESCR_EMASK(P4_EVENT_MOB_LOAD_REPLAY, NO_STD, 3), | ||
592 | P4_GEN_ESCR_EMASK(P4_EVENT_MOB_LOAD_REPLAY, PARTIAL_DATA, 4), | ||
593 | P4_GEN_ESCR_EMASK(P4_EVENT_MOB_LOAD_REPLAY, UNALGN_ADDR, 5), | ||
594 | |||
595 | P4_GEN_ESCR_EMASK(P4_EVENT_PAGE_WALK_TYPE, DTMISS, 0), | ||
596 | P4_GEN_ESCR_EMASK(P4_EVENT_PAGE_WALK_TYPE, ITMISS, 1), | ||
597 | |||
598 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_HITS, 0), | ||
599 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_HITE, 1), | ||
600 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_HITM, 2), | ||
601 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_HITS, 3), | ||
602 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_HITE, 4), | ||
603 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_HITM, 5), | ||
604 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_2ndL_MISS, 8), | ||
605 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, RD_3rdL_MISS, 9), | ||
606 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_CACHE_REFERENCE, WR_2ndL_MISS, 10), | ||
607 | |||
608 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, DEFAULT, 0), | ||
609 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, ALL_READ, 5), | ||
610 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, ALL_WRITE, 6), | ||
611 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, MEM_UC, 7), | ||
612 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, MEM_WC, 8), | ||
613 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, MEM_WT, 9), | ||
614 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, MEM_WP, 10), | ||
615 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, MEM_WB, 11), | ||
616 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, OWN, 13), | ||
617 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, OTHER, 14), | ||
618 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ALLOCATION, PREFETCH, 15), | ||
619 | |||
620 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, DEFAULT, 0), | ||
621 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, ALL_READ, 5), | ||
622 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, ALL_WRITE, 6), | ||
623 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, MEM_UC, 7), | ||
624 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, MEM_WC, 8), | ||
625 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, MEM_WT, 9), | ||
626 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, MEM_WP, 10), | ||
627 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, MEM_WB, 11), | ||
628 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, OWN, 13), | ||
629 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, OTHER, 14), | ||
630 | P4_GEN_ESCR_EMASK(P4_EVENT_IOQ_ACTIVE_ENTRIES, PREFETCH, 15), | ||
631 | |||
632 | P4_GEN_ESCR_EMASK(P4_EVENT_FSB_DATA_ACTIVITY, DRDY_DRV, 0), | ||
633 | P4_GEN_ESCR_EMASK(P4_EVENT_FSB_DATA_ACTIVITY, DRDY_OWN, 1), | ||
634 | P4_GEN_ESCR_EMASK(P4_EVENT_FSB_DATA_ACTIVITY, DRDY_OTHER, 2), | ||
635 | P4_GEN_ESCR_EMASK(P4_EVENT_FSB_DATA_ACTIVITY, DBSY_DRV, 3), | ||
636 | P4_GEN_ESCR_EMASK(P4_EVENT_FSB_DATA_ACTIVITY, DBSY_OWN, 4), | ||
637 | P4_GEN_ESCR_EMASK(P4_EVENT_FSB_DATA_ACTIVITY, DBSY_OTHER, 5), | ||
638 | |||
639 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_TYPE0, 0), | ||
640 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_TYPE1, 1), | ||
641 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_LEN0, 2), | ||
642 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_LEN1, 3), | ||
643 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_IO_TYPE, 5), | ||
644 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_LOCK_TYPE, 6), | ||
645 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_CACHE_TYPE, 7), | ||
646 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_SPLIT_TYPE, 8), | ||
647 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_DEM_TYPE, 9), | ||
648 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, REQ_ORD_TYPE, 10), | ||
649 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, MEM_TYPE0, 11), | ||
650 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, MEM_TYPE1, 12), | ||
651 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ALLOCATION, MEM_TYPE2, 13), | ||
652 | |||
653 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_TYPE0, 0), | ||
654 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_TYPE1, 1), | ||
655 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_LEN0, 2), | ||
656 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_LEN1, 3), | ||
657 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_IO_TYPE, 5), | ||
658 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_LOCK_TYPE, 6), | ||
659 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_CACHE_TYPE, 7), | ||
660 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_SPLIT_TYPE, 8), | ||
661 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_DEM_TYPE, 9), | ||
662 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, REQ_ORD_TYPE, 10), | ||
663 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, MEM_TYPE0, 11), | ||
664 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, MEM_TYPE1, 12), | ||
665 | P4_GEN_ESCR_EMASK(P4_EVENT_BSQ_ACTIVE_ENTRIES, MEM_TYPE2, 13), | ||
666 | |||
667 | P4_GEN_ESCR_EMASK(P4_EVENT_SSE_INPUT_ASSIST, ALL, 15), | ||
668 | |||
669 | P4_GEN_ESCR_EMASK(P4_EVENT_PACKED_SP_UOP, ALL, 15), | ||
670 | |||
671 | P4_GEN_ESCR_EMASK(P4_EVENT_PACKED_DP_UOP, ALL, 15), | ||
672 | |||
673 | P4_GEN_ESCR_EMASK(P4_EVENT_SCALAR_SP_UOP, ALL, 15), | ||
674 | |||
675 | P4_GEN_ESCR_EMASK(P4_EVENT_SCALAR_DP_UOP, ALL, 15), | ||
676 | |||
677 | P4_GEN_ESCR_EMASK(P4_EVENT_64BIT_MMX_UOP, ALL, 15), | ||
678 | |||
679 | P4_GEN_ESCR_EMASK(P4_EVENT_128BIT_MMX_UOP, ALL, 15), | ||
680 | |||
681 | P4_GEN_ESCR_EMASK(P4_EVENT_X87_FP_UOP, ALL, 15), | ||
682 | |||
683 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_MISC, FLUSH, 4), | ||
684 | |||
685 | P4_GEN_ESCR_EMASK(P4_EVENT_GLOBAL_POWER_EVENTS, RUNNING, 0), | ||
686 | |||
687 | P4_GEN_ESCR_EMASK(P4_EVENT_TC_MS_XFER, CISC, 0), | ||
688 | |||
689 | P4_GEN_ESCR_EMASK(P4_EVENT_UOP_QUEUE_WRITES, FROM_TC_BUILD, 0), | ||
690 | P4_GEN_ESCR_EMASK(P4_EVENT_UOP_QUEUE_WRITES, FROM_TC_DELIVER, 1), | ||
691 | P4_GEN_ESCR_EMASK(P4_EVENT_UOP_QUEUE_WRITES, FROM_ROM, 2), | ||
692 | |||
693 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE, CONDITIONAL, 1), | ||
694 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE, CALL, 2), | ||
695 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE, RETURN, 3), | ||
696 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE, INDIRECT, 4), | ||
697 | |||
698 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_BRANCH_TYPE, CONDITIONAL, 1), | ||
699 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_BRANCH_TYPE, CALL, 2), | ||
700 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_BRANCH_TYPE, RETURN, 3), | ||
701 | P4_GEN_ESCR_EMASK(P4_EVENT_RETIRED_BRANCH_TYPE, INDIRECT, 4), | ||
702 | |||
703 | P4_GEN_ESCR_EMASK(P4_EVENT_RESOURCE_STALL, SBFULL, 5), | ||
704 | |||
705 | P4_GEN_ESCR_EMASK(P4_EVENT_WC_BUFFER, WCB_EVICTS, 0), | ||
706 | P4_GEN_ESCR_EMASK(P4_EVENT_WC_BUFFER, WCB_FULL_EVICTS, 1), | ||
707 | |||
708 | P4_GEN_ESCR_EMASK(P4_EVENT_FRONT_END_EVENT, NBOGUS, 0), | ||
709 | P4_GEN_ESCR_EMASK(P4_EVENT_FRONT_END_EVENT, BOGUS, 1), | ||
710 | |||
711 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, NBOGUS0, 0), | ||
712 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, NBOGUS1, 1), | ||
713 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, NBOGUS2, 2), | ||
714 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, NBOGUS3, 3), | ||
715 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, BOGUS0, 4), | ||
716 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, BOGUS1, 5), | ||
717 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, BOGUS2, 6), | ||
718 | P4_GEN_ESCR_EMASK(P4_EVENT_EXECUTION_EVENT, BOGUS3, 7), | ||
719 | |||
720 | P4_GEN_ESCR_EMASK(P4_EVENT_REPLAY_EVENT, NBOGUS, 0), | ||
721 | P4_GEN_ESCR_EMASK(P4_EVENT_REPLAY_EVENT, BOGUS, 1), | ||
722 | |||
723 | P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_RETIRED, NBOGUSNTAG, 0), | ||
724 | P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_RETIRED, NBOGUSTAG, 1), | ||
725 | P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_RETIRED, BOGUSNTAG, 2), | ||
726 | P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_RETIRED, BOGUSTAG, 3), | ||
727 | |||
728 | P4_GEN_ESCR_EMASK(P4_EVENT_UOPS_RETIRED, NBOGUS, 0), | ||
729 | P4_GEN_ESCR_EMASK(P4_EVENT_UOPS_RETIRED, BOGUS, 1), | ||
730 | |||
731 | P4_GEN_ESCR_EMASK(P4_EVENT_UOP_TYPE, TAGLOADS, 1), | ||
732 | P4_GEN_ESCR_EMASK(P4_EVENT_UOP_TYPE, TAGSTORES, 2), | ||
733 | |||
734 | P4_GEN_ESCR_EMASK(P4_EVENT_BRANCH_RETIRED, MMNP, 0), | ||
735 | P4_GEN_ESCR_EMASK(P4_EVENT_BRANCH_RETIRED, MMNM, 1), | ||
736 | P4_GEN_ESCR_EMASK(P4_EVENT_BRANCH_RETIRED, MMTP, 2), | ||
737 | P4_GEN_ESCR_EMASK(P4_EVENT_BRANCH_RETIRED, MMTM, 3), | ||
738 | |||
739 | P4_GEN_ESCR_EMASK(P4_EVENT_MISPRED_BRANCH_RETIRED, NBOGUS, 0), | ||
740 | |||
741 | P4_GEN_ESCR_EMASK(P4_EVENT_X87_ASSIST, FPSU, 0), | ||
742 | P4_GEN_ESCR_EMASK(P4_EVENT_X87_ASSIST, FPSO, 1), | ||
743 | P4_GEN_ESCR_EMASK(P4_EVENT_X87_ASSIST, POAO, 2), | ||
744 | P4_GEN_ESCR_EMASK(P4_EVENT_X87_ASSIST, POAU, 3), | ||
745 | P4_GEN_ESCR_EMASK(P4_EVENT_X87_ASSIST, PREA, 4), | ||
746 | |||
747 | P4_GEN_ESCR_EMASK(P4_EVENT_MACHINE_CLEAR, CLEAR, 0), | ||
748 | P4_GEN_ESCR_EMASK(P4_EVENT_MACHINE_CLEAR, MOCLEAR, 1), | ||
749 | P4_GEN_ESCR_EMASK(P4_EVENT_MACHINE_CLEAR, SMCLEAR, 2), | ||
750 | |||
751 | P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_COMPLETED, NBOGUS, 0), | ||
752 | P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_COMPLETED, BOGUS, 1), | ||
753 | }; | ||
754 | |||
755 | /* P4 PEBS: stale for a while */ | ||
756 | #define P4_PEBS_METRIC_MASK 0x00001fffU | ||
757 | #define P4_PEBS_UOB_TAG 0x01000000U | ||
758 | #define P4_PEBS_ENABLE 0x02000000U | ||
759 | |||
760 | /* Replay metrics for MSR_IA32_PEBS_ENABLE and MSR_P4_PEBS_MATRIX_VERT */ | ||
761 | #define P4_PEBS__1stl_cache_load_miss_retired 0x3000001 | ||
762 | #define P4_PEBS__2ndl_cache_load_miss_retired 0x3000002 | ||
763 | #define P4_PEBS__dtlb_load_miss_retired 0x3000004 | ||
764 | #define P4_PEBS__dtlb_store_miss_retired 0x3000004 | ||
765 | #define P4_PEBS__dtlb_all_miss_retired 0x3000004 | ||
766 | #define P4_PEBS__tagged_mispred_branch 0x3018000 | ||
767 | #define P4_PEBS__mob_load_replay_retired 0x3000200 | ||
768 | #define P4_PEBS__split_load_retired 0x3000400 | ||
769 | #define P4_PEBS__split_store_retired 0x3000400 | ||
770 | |||
771 | #define P4_VERT__1stl_cache_load_miss_retired 0x0000001 | ||
772 | #define P4_VERT__2ndl_cache_load_miss_retired 0x0000001 | ||
773 | #define P4_VERT__dtlb_load_miss_retired 0x0000001 | ||
774 | #define P4_VERT__dtlb_store_miss_retired 0x0000002 | ||
775 | #define P4_VERT__dtlb_all_miss_retired 0x0000003 | ||
776 | #define P4_VERT__tagged_mispred_branch 0x0000010 | ||
777 | #define P4_VERT__mob_load_replay_retired 0x0000001 | ||
778 | #define P4_VERT__split_load_retired 0x0000001 | ||
779 | #define P4_VERT__split_store_retired 0x0000002 | ||
780 | |||
781 | enum P4_CACHE_EVENTS { | ||
782 | P4_CACHE__NONE, | ||
783 | |||
784 | P4_CACHE__1stl_cache_load_miss_retired, | ||
785 | P4_CACHE__2ndl_cache_load_miss_retired, | ||
786 | P4_CACHE__dtlb_load_miss_retired, | ||
787 | P4_CACHE__dtlb_store_miss_retired, | ||
788 | P4_CACHE__itlb_reference_hit, | ||
789 | P4_CACHE__itlb_reference_miss, | ||
790 | |||
791 | P4_CACHE__MAX | ||
792 | }; | ||
793 | |||
794 | #endif /* PERF_EVENT_P4_H */ | ||
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index b753ea59703a..32428b410b55 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -21,7 +21,6 @@ struct mm_struct; | |||
21 | #include <asm/msr.h> | 21 | #include <asm/msr.h> |
22 | #include <asm/desc_defs.h> | 22 | #include <asm/desc_defs.h> |
23 | #include <asm/nops.h> | 23 | #include <asm/nops.h> |
24 | #include <asm/ds.h> | ||
25 | 24 | ||
26 | #include <linux/personality.h> | 25 | #include <linux/personality.h> |
27 | #include <linux/cpumask.h> | 26 | #include <linux/cpumask.h> |
@@ -29,6 +28,7 @@ struct mm_struct; | |||
29 | #include <linux/threads.h> | 28 | #include <linux/threads.h> |
30 | #include <linux/math64.h> | 29 | #include <linux/math64.h> |
31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/err.h> | ||
32 | 32 | ||
33 | #define HBP_NUM 4 | 33 | #define HBP_NUM 4 |
34 | /* | 34 | /* |
@@ -473,10 +473,6 @@ struct thread_struct { | |||
473 | unsigned long iopl; | 473 | unsigned long iopl; |
474 | /* Max allowed port in the bitmap, in bytes: */ | 474 | /* Max allowed port in the bitmap, in bytes: */ |
475 | unsigned io_bitmap_max; | 475 | unsigned io_bitmap_max; |
476 | /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */ | ||
477 | unsigned long debugctlmsr; | ||
478 | /* Debug Store context; see asm/ds.h */ | ||
479 | struct ds_context *ds_ctx; | ||
480 | }; | 476 | }; |
481 | 477 | ||
482 | static inline unsigned long native_get_debugreg(int regno) | 478 | static inline unsigned long native_get_debugreg(int regno) |
@@ -803,7 +799,7 @@ extern void cpu_init(void); | |||
803 | 799 | ||
804 | static inline unsigned long get_debugctlmsr(void) | 800 | static inline unsigned long get_debugctlmsr(void) |
805 | { | 801 | { |
806 | unsigned long debugctlmsr = 0; | 802 | unsigned long debugctlmsr = 0; |
807 | 803 | ||
808 | #ifndef CONFIG_X86_DEBUGCTLMSR | 804 | #ifndef CONFIG_X86_DEBUGCTLMSR |
809 | if (boot_cpu_data.x86 < 6) | 805 | if (boot_cpu_data.x86 < 6) |
@@ -811,21 +807,6 @@ static inline unsigned long get_debugctlmsr(void) | |||
811 | #endif | 807 | #endif |
812 | rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); | 808 | rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); |
813 | 809 | ||
814 | return debugctlmsr; | ||
815 | } | ||
816 | |||
817 | static inline unsigned long get_debugctlmsr_on_cpu(int cpu) | ||
818 | { | ||
819 | u64 debugctlmsr = 0; | ||
820 | u32 val1, val2; | ||
821 | |||
822 | #ifndef CONFIG_X86_DEBUGCTLMSR | ||
823 | if (boot_cpu_data.x86 < 6) | ||
824 | return 0; | ||
825 | #endif | ||
826 | rdmsr_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, &val1, &val2); | ||
827 | debugctlmsr = val1 | ((u64)val2 << 32); | ||
828 | |||
829 | return debugctlmsr; | 810 | return debugctlmsr; |
830 | } | 811 | } |
831 | 812 | ||
@@ -838,18 +819,6 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr) | |||
838 | wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); | 819 | wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); |
839 | } | 820 | } |
840 | 821 | ||
841 | static inline void update_debugctlmsr_on_cpu(int cpu, | ||
842 | unsigned long debugctlmsr) | ||
843 | { | ||
844 | #ifndef CONFIG_X86_DEBUGCTLMSR | ||
845 | if (boot_cpu_data.x86 < 6) | ||
846 | return; | ||
847 | #endif | ||
848 | wrmsr_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, | ||
849 | (u32)((u64)debugctlmsr), | ||
850 | (u32)((u64)debugctlmsr >> 32)); | ||
851 | } | ||
852 | |||
853 | /* | 822 | /* |
854 | * from system description table in BIOS. Mostly for MCA use, but | 823 | * from system description table in BIOS. Mostly for MCA use, but |
855 | * others may find it useful: | 824 | * others may find it useful: |
diff --git a/arch/x86/include/asm/ptrace-abi.h b/arch/x86/include/asm/ptrace-abi.h index 86723035a515..52b098a6eebb 100644 --- a/arch/x86/include/asm/ptrace-abi.h +++ b/arch/x86/include/asm/ptrace-abi.h | |||
@@ -82,61 +82,6 @@ | |||
82 | 82 | ||
83 | #ifndef __ASSEMBLY__ | 83 | #ifndef __ASSEMBLY__ |
84 | #include <linux/types.h> | 84 | #include <linux/types.h> |
85 | 85 | #endif | |
86 | /* configuration/status structure used in PTRACE_BTS_CONFIG and | ||
87 | PTRACE_BTS_STATUS commands. | ||
88 | */ | ||
89 | struct ptrace_bts_config { | ||
90 | /* requested or actual size of BTS buffer in bytes */ | ||
91 | __u32 size; | ||
92 | /* bitmask of below flags */ | ||
93 | __u32 flags; | ||
94 | /* buffer overflow signal */ | ||
95 | __u32 signal; | ||
96 | /* actual size of bts_struct in bytes */ | ||
97 | __u32 bts_size; | ||
98 | }; | ||
99 | #endif /* __ASSEMBLY__ */ | ||
100 | |||
101 | #define PTRACE_BTS_O_TRACE 0x1 /* branch trace */ | ||
102 | #define PTRACE_BTS_O_SCHED 0x2 /* scheduling events w/ jiffies */ | ||
103 | #define PTRACE_BTS_O_SIGNAL 0x4 /* send SIG<signal> on buffer overflow | ||
104 | instead of wrapping around */ | ||
105 | #define PTRACE_BTS_O_ALLOC 0x8 /* (re)allocate buffer */ | ||
106 | |||
107 | #define PTRACE_BTS_CONFIG 40 | ||
108 | /* Configure branch trace recording. | ||
109 | ADDR points to a struct ptrace_bts_config. | ||
110 | DATA gives the size of that buffer. | ||
111 | A new buffer is allocated, if requested in the flags. | ||
112 | An overflow signal may only be requested for new buffers. | ||
113 | Returns the number of bytes read. | ||
114 | */ | ||
115 | #define PTRACE_BTS_STATUS 41 | ||
116 | /* Return the current configuration in a struct ptrace_bts_config | ||
117 | pointed to by ADDR; DATA gives the size of that buffer. | ||
118 | Returns the number of bytes written. | ||
119 | */ | ||
120 | #define PTRACE_BTS_SIZE 42 | ||
121 | /* Return the number of available BTS records for draining. | ||
122 | DATA and ADDR are ignored. | ||
123 | */ | ||
124 | #define PTRACE_BTS_GET 43 | ||
125 | /* Get a single BTS record. | ||
126 | DATA defines the index into the BTS array, where 0 is the newest | ||
127 | entry, and higher indices refer to older entries. | ||
128 | ADDR is pointing to struct bts_struct (see asm/ds.h). | ||
129 | */ | ||
130 | #define PTRACE_BTS_CLEAR 44 | ||
131 | /* Clear the BTS buffer. | ||
132 | DATA and ADDR are ignored. | ||
133 | */ | ||
134 | #define PTRACE_BTS_DRAIN 45 | ||
135 | /* Read all available BTS records and clear the buffer. | ||
136 | ADDR points to an array of struct bts_struct. | ||
137 | DATA gives the size of that buffer. | ||
138 | BTS records are read from oldest to newest. | ||
139 | Returns number of BTS records drained. | ||
140 | */ | ||
141 | 86 | ||
142 | #endif /* _ASM_X86_PTRACE_ABI_H */ | 87 | #endif /* _ASM_X86_PTRACE_ABI_H */ |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 69a686a7dff0..78cd1ea94500 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
@@ -289,12 +289,6 @@ extern int do_get_thread_area(struct task_struct *p, int idx, | |||
289 | extern int do_set_thread_area(struct task_struct *p, int idx, | 289 | extern int do_set_thread_area(struct task_struct *p, int idx, |
290 | struct user_desc __user *info, int can_allocate); | 290 | struct user_desc __user *info, int can_allocate); |
291 | 291 | ||
292 | #ifdef CONFIG_X86_PTRACE_BTS | ||
293 | extern void ptrace_bts_untrace(struct task_struct *tsk); | ||
294 | |||
295 | #define arch_ptrace_untrace(tsk) ptrace_bts_untrace(tsk) | ||
296 | #endif /* CONFIG_X86_PTRACE_BTS */ | ||
297 | |||
298 | #endif /* __KERNEL__ */ | 292 | #endif /* __KERNEL__ */ |
299 | 293 | ||
300 | #endif /* !__ASSEMBLY__ */ | 294 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index e0d28901e969..d017ed5502e2 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -92,8 +92,7 @@ struct thread_info { | |||
92 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ | 92 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ |
93 | #define TIF_FREEZE 23 /* is freezing for suspend */ | 93 | #define TIF_FREEZE 23 /* is freezing for suspend */ |
94 | #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ | 94 | #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ |
95 | #define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */ | 95 | #define TIF_BLOCKSTEP 25 /* set when we want DEBUGCTLMSR_BTF */ |
96 | #define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */ | ||
97 | #define TIF_LAZY_MMU_UPDATES 27 /* task is updating the mmu lazily */ | 96 | #define TIF_LAZY_MMU_UPDATES 27 /* task is updating the mmu lazily */ |
98 | #define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */ | 97 | #define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */ |
99 | 98 | ||
@@ -115,8 +114,7 @@ struct thread_info { | |||
115 | #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) | 114 | #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) |
116 | #define _TIF_FREEZE (1 << TIF_FREEZE) | 115 | #define _TIF_FREEZE (1 << TIF_FREEZE) |
117 | #define _TIF_FORCED_TF (1 << TIF_FORCED_TF) | 116 | #define _TIF_FORCED_TF (1 << TIF_FORCED_TF) |
118 | #define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR) | 117 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) |
119 | #define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR) | ||
120 | #define _TIF_LAZY_MMU_UPDATES (1 << TIF_LAZY_MMU_UPDATES) | 118 | #define _TIF_LAZY_MMU_UPDATES (1 << TIF_LAZY_MMU_UPDATES) |
121 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) | 119 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) |
122 | 120 | ||
@@ -147,7 +145,7 @@ struct thread_info { | |||
147 | 145 | ||
148 | /* flags to check in __switch_to() */ | 146 | /* flags to check in __switch_to() */ |
149 | #define _TIF_WORK_CTXSW \ | 147 | #define _TIF_WORK_CTXSW \ |
150 | (_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_NOTSC) | 148 | (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP) |
151 | 149 | ||
152 | #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) | 150 | #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) |
153 | #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) | 151 | #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) |