diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-10 22:53:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-10 22:53:40 -0400 |
commit | 862366118026a358882eefc70238dbcc3db37aac (patch) | |
tree | 4eb62bc10327a5afac064a95a091ea05ecd2acc1 /arch/x86/include | |
parent | 57eee9ae7bbcfb692dc96c739a5184adb6349733 (diff) | |
parent | 511b01bdf64ad8a38414096eab283c7784aebfc4 (diff) |
Merge branch 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (244 commits)
Revert "x86, bts: reenable ptrace branch trace support"
tracing: do not translate event helper macros in print format
ftrace/documentation: fix typo in function grapher name
tracing/events: convert block trace points to TRACE_EVENT(), fix !CONFIG_BLOCK
tracing: add protection around module events unload
tracing: add trace_seq_vprint interface
tracing: fix the block trace points print size
tracing/events: convert block trace points to TRACE_EVENT()
ring-buffer: fix ret in rb_add_time_stamp
ring-buffer: pass in lockdep class key for reader_lock
tracing: add annotation to what type of stack trace is recorded
tracing: fix multiple use of __print_flags and __print_symbolic
tracing/events: fix output format of user stack
tracing/events: fix output format of kernel stack
tracing/trace_stack: fix the number of entries in the header
ring-buffer: discard timestamps that are at the start of the buffer
ring-buffer: try to discard unneeded timestamps
ring-buffer: fix bug in ring_buffer_discard_commit
ftrace: do not profile functions when disabled
tracing: make trace pipe recognize latency format flag
...
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/ds.h | 82 | ||||
-rw-r--r-- | arch/x86/include/asm/processor.h | 35 | ||||
-rw-r--r-- | arch/x86/include/asm/ptrace.h | 9 | ||||
-rw-r--r-- | arch/x86/include/asm/tlbflush.h | 8 |
4 files changed, 92 insertions, 42 deletions
diff --git a/arch/x86/include/asm/ds.h b/arch/x86/include/asm/ds.h index a8f672ba100..70dac199b09 100644 --- a/arch/x86/include/asm/ds.h +++ b/arch/x86/include/asm/ds.h | |||
@@ -15,8 +15,8 @@ | |||
15 | * - buffer allocation (memory accounting) | 15 | * - buffer allocation (memory accounting) |
16 | * | 16 | * |
17 | * | 17 | * |
18 | * Copyright (C) 2007-2008 Intel Corporation. | 18 | * Copyright (C) 2007-2009 Intel Corporation. |
19 | * Markus Metzger <markus.t.metzger@intel.com>, 2007-2008 | 19 | * Markus Metzger <markus.t.metzger@intel.com>, 2007-2009 |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef _ASM_X86_DS_H | 22 | #ifndef _ASM_X86_DS_H |
@@ -83,8 +83,10 @@ enum ds_feature { | |||
83 | * The interrupt threshold is independent from the overflow callback | 83 | * The interrupt threshold is independent from the overflow callback |
84 | * to allow users to use their own overflow interrupt handling mechanism. | 84 | * to allow users to use their own overflow interrupt handling mechanism. |
85 | * | 85 | * |
86 | * task: the task to request recording for; | 86 | * The function might sleep. |
87 | * NULL for per-cpu recording on the current cpu | 87 | * |
88 | * task: the task to request recording for | ||
89 | * cpu: the cpu to request recording for | ||
88 | * base: the base pointer for the (non-pageable) buffer; | 90 | * base: the base pointer for the (non-pageable) buffer; |
89 | * size: the size of the provided buffer in bytes | 91 | * size: the size of the provided buffer in bytes |
90 | * ovfl: pointer to a function to be called on buffer overflow; | 92 | * ovfl: pointer to a function to be called on buffer overflow; |
@@ -93,19 +95,28 @@ enum ds_feature { | |||
93 | * -1 if no interrupt threshold is requested. | 95 | * -1 if no interrupt threshold is requested. |
94 | * flags: a bit-mask of the above flags | 96 | * flags: a bit-mask of the above flags |
95 | */ | 97 | */ |
96 | extern struct bts_tracer *ds_request_bts(struct task_struct *task, | 98 | extern struct bts_tracer *ds_request_bts_task(struct task_struct *task, |
97 | void *base, size_t size, | 99 | void *base, size_t size, |
98 | bts_ovfl_callback_t ovfl, | 100 | bts_ovfl_callback_t ovfl, |
99 | size_t th, unsigned int flags); | 101 | size_t th, unsigned int flags); |
100 | extern struct pebs_tracer *ds_request_pebs(struct task_struct *task, | 102 | extern struct bts_tracer *ds_request_bts_cpu(int cpu, void *base, size_t size, |
101 | void *base, size_t size, | 103 | bts_ovfl_callback_t ovfl, |
102 | pebs_ovfl_callback_t ovfl, | 104 | size_t th, unsigned int flags); |
103 | 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); | ||
104 | 113 | ||
105 | /* | 114 | /* |
106 | * Release BTS or PEBS resources | 115 | * Release BTS or PEBS resources |
107 | * Suspend and resume BTS or PEBS tracing | 116 | * Suspend and resume BTS or PEBS tracing |
108 | * | 117 | * |
118 | * Must be called with irq's enabled. | ||
119 | * | ||
109 | * tracer: the tracer handle returned from ds_request_~() | 120 | * tracer: the tracer handle returned from ds_request_~() |
110 | */ | 121 | */ |
111 | extern void ds_release_bts(struct bts_tracer *tracer); | 122 | extern void ds_release_bts(struct bts_tracer *tracer); |
@@ -115,6 +126,28 @@ extern void ds_release_pebs(struct pebs_tracer *tracer); | |||
115 | extern void ds_suspend_pebs(struct pebs_tracer *tracer); | 126 | extern void ds_suspend_pebs(struct pebs_tracer *tracer); |
116 | extern void ds_resume_pebs(struct pebs_tracer *tracer); | 127 | extern void ds_resume_pebs(struct pebs_tracer *tracer); |
117 | 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 | |||
118 | 151 | ||
119 | /* | 152 | /* |
120 | * The raw DS buffer state as it is used for BTS and PEBS recording. | 153 | * The raw DS buffer state as it is used for BTS and PEBS recording. |
@@ -170,9 +203,9 @@ struct bts_struct { | |||
170 | } lbr; | 203 | } lbr; |
171 | /* BTS_TASK_ARRIVES or BTS_TASK_DEPARTS */ | 204 | /* BTS_TASK_ARRIVES or BTS_TASK_DEPARTS */ |
172 | struct { | 205 | struct { |
173 | __u64 jiffies; | 206 | __u64 clock; |
174 | pid_t pid; | 207 | pid_t pid; |
175 | } timestamp; | 208 | } event; |
176 | } variant; | 209 | } variant; |
177 | }; | 210 | }; |
178 | 211 | ||
@@ -201,8 +234,12 @@ struct bts_trace { | |||
201 | struct pebs_trace { | 234 | struct pebs_trace { |
202 | struct ds_trace ds; | 235 | struct ds_trace ds; |
203 | 236 | ||
204 | /* the PEBS reset value */ | 237 | /* the number of valid counters in the below array */ |
205 | unsigned long long reset_value; | 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]; | ||
206 | }; | 243 | }; |
207 | 244 | ||
208 | 245 | ||
@@ -237,9 +274,11 @@ extern int ds_reset_pebs(struct pebs_tracer *tracer); | |||
237 | * Returns 0 on success; -Eerrno on error | 274 | * Returns 0 on success; -Eerrno on error |
238 | * | 275 | * |
239 | * tracer: the tracer handle returned from ds_request_pebs() | 276 | * tracer: the tracer handle returned from ds_request_pebs() |
277 | * counter: the index of the counter | ||
240 | * value: the new counter reset value | 278 | * value: the new counter reset value |
241 | */ | 279 | */ |
242 | extern int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value); | 280 | extern int ds_set_pebs_reset(struct pebs_tracer *tracer, |
281 | unsigned int counter, u64 value); | ||
243 | 282 | ||
244 | /* | 283 | /* |
245 | * Initialization | 284 | * Initialization |
@@ -252,21 +291,12 @@ extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *); | |||
252 | */ | 291 | */ |
253 | extern void ds_switch_to(struct task_struct *prev, struct task_struct *next); | 292 | extern void ds_switch_to(struct task_struct *prev, struct task_struct *next); |
254 | 293 | ||
255 | /* | ||
256 | * Task clone/init and cleanup work | ||
257 | */ | ||
258 | extern void ds_copy_thread(struct task_struct *tsk, struct task_struct *father); | ||
259 | extern void ds_exit_thread(struct task_struct *tsk); | ||
260 | |||
261 | #else /* CONFIG_X86_DS */ | 294 | #else /* CONFIG_X86_DS */ |
262 | 295 | ||
263 | struct cpuinfo_x86; | 296 | struct cpuinfo_x86; |
264 | static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {} | 297 | static inline void __cpuinit ds_init_intel(struct cpuinfo_x86 *ignored) {} |
265 | static inline void ds_switch_to(struct task_struct *prev, | 298 | static inline void ds_switch_to(struct task_struct *prev, |
266 | struct task_struct *next) {} | 299 | struct task_struct *next) {} |
267 | static inline void ds_copy_thread(struct task_struct *tsk, | ||
268 | struct task_struct *father) {} | ||
269 | static inline void ds_exit_thread(struct task_struct *tsk) {} | ||
270 | 300 | ||
271 | #endif /* CONFIG_X86_DS */ | 301 | #endif /* CONFIG_X86_DS */ |
272 | #endif /* _ASM_X86_DS_H */ | 302 | #endif /* _ASM_X86_DS_H */ |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 87ede2f31bc..c7768269b1c 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -462,14 +462,8 @@ struct thread_struct { | |||
462 | unsigned io_bitmap_max; | 462 | unsigned io_bitmap_max; |
463 | /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */ | 463 | /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */ |
464 | unsigned long debugctlmsr; | 464 | unsigned long debugctlmsr; |
465 | #ifdef CONFIG_X86_DS | 465 | /* Debug Store context; see asm/ds.h */ |
466 | /* Debug Store context; see include/asm-x86/ds.h; goes into MSR_IA32_DS_AREA */ | ||
467 | struct ds_context *ds_ctx; | 466 | struct ds_context *ds_ctx; |
468 | #endif /* CONFIG_X86_DS */ | ||
469 | #ifdef CONFIG_X86_PTRACE_BTS | ||
470 | /* the signal to send on a bts buffer overflow */ | ||
471 | unsigned int bts_ovfl_signal; | ||
472 | #endif /* CONFIG_X86_PTRACE_BTS */ | ||
473 | }; | 467 | }; |
474 | 468 | ||
475 | static inline unsigned long native_get_debugreg(int regno) | 469 | static inline unsigned long native_get_debugreg(int regno) |
@@ -797,6 +791,21 @@ static inline unsigned long get_debugctlmsr(void) | |||
797 | return debugctlmsr; | 791 | return debugctlmsr; |
798 | } | 792 | } |
799 | 793 | ||
794 | static inline unsigned long get_debugctlmsr_on_cpu(int cpu) | ||
795 | { | ||
796 | u64 debugctlmsr = 0; | ||
797 | u32 val1, val2; | ||
798 | |||
799 | #ifndef CONFIG_X86_DEBUGCTLMSR | ||
800 | if (boot_cpu_data.x86 < 6) | ||
801 | return 0; | ||
802 | #endif | ||
803 | rdmsr_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, &val1, &val2); | ||
804 | debugctlmsr = val1 | ((u64)val2 << 32); | ||
805 | |||
806 | return debugctlmsr; | ||
807 | } | ||
808 | |||
800 | static inline void update_debugctlmsr(unsigned long debugctlmsr) | 809 | static inline void update_debugctlmsr(unsigned long debugctlmsr) |
801 | { | 810 | { |
802 | #ifndef CONFIG_X86_DEBUGCTLMSR | 811 | #ifndef CONFIG_X86_DEBUGCTLMSR |
@@ -806,6 +815,18 @@ static inline void update_debugctlmsr(unsigned long debugctlmsr) | |||
806 | wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); | 815 | wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr); |
807 | } | 816 | } |
808 | 817 | ||
818 | static inline void update_debugctlmsr_on_cpu(int cpu, | ||
819 | unsigned long debugctlmsr) | ||
820 | { | ||
821 | #ifndef CONFIG_X86_DEBUGCTLMSR | ||
822 | if (boot_cpu_data.x86 < 6) | ||
823 | return; | ||
824 | #endif | ||
825 | wrmsr_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, | ||
826 | (u32)((u64)debugctlmsr), | ||
827 | (u32)((u64)debugctlmsr >> 32)); | ||
828 | } | ||
829 | |||
809 | /* | 830 | /* |
810 | * from system description table in BIOS. Mostly for MCA use, but | 831 | * from system description table in BIOS. Mostly for MCA use, but |
811 | * others may find it useful: | 832 | * others may find it useful: |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 624f133943e..0f0d908349a 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
@@ -236,12 +236,11 @@ extern int do_get_thread_area(struct task_struct *p, int idx, | |||
236 | extern int do_set_thread_area(struct task_struct *p, int idx, | 236 | extern int do_set_thread_area(struct task_struct *p, int idx, |
237 | struct user_desc __user *info, int can_allocate); | 237 | struct user_desc __user *info, int can_allocate); |
238 | 238 | ||
239 | extern void x86_ptrace_untrace(struct task_struct *); | 239 | #ifdef CONFIG_X86_PTRACE_BTS |
240 | extern void x86_ptrace_fork(struct task_struct *child, | 240 | extern void ptrace_bts_untrace(struct task_struct *tsk); |
241 | unsigned long clone_flags); | ||
242 | 241 | ||
243 | #define arch_ptrace_untrace(tsk) x86_ptrace_untrace(tsk) | 242 | #define arch_ptrace_untrace(tsk) ptrace_bts_untrace(tsk) |
244 | #define arch_ptrace_fork(child, flags) x86_ptrace_fork(child, flags) | 243 | #endif /* CONFIG_X86_PTRACE_BTS */ |
245 | 244 | ||
246 | #endif /* __KERNEL__ */ | 245 | #endif /* __KERNEL__ */ |
247 | 246 | ||
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 16a5c84b032..a5ecc9c33e9 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | static inline void __native_flush_tlb(void) | 18 | static inline void __native_flush_tlb(void) |
19 | { | 19 | { |
20 | write_cr3(read_cr3()); | 20 | native_write_cr3(native_read_cr3()); |
21 | } | 21 | } |
22 | 22 | ||
23 | static inline void __native_flush_tlb_global(void) | 23 | static inline void __native_flush_tlb_global(void) |
@@ -32,11 +32,11 @@ static inline void __native_flush_tlb_global(void) | |||
32 | */ | 32 | */ |
33 | raw_local_irq_save(flags); | 33 | raw_local_irq_save(flags); |
34 | 34 | ||
35 | cr4 = read_cr4(); | 35 | cr4 = native_read_cr4(); |
36 | /* clear PGE */ | 36 | /* clear PGE */ |
37 | write_cr4(cr4 & ~X86_CR4_PGE); | 37 | native_write_cr4(cr4 & ~X86_CR4_PGE); |
38 | /* write old PGE again and flush TLBs */ | 38 | /* write old PGE again and flush TLBs */ |
39 | write_cr4(cr4); | 39 | native_write_cr4(cr4); |
40 | 40 | ||
41 | raw_local_irq_restore(flags); | 41 | raw_local_irq_restore(flags); |
42 | } | 42 | } |