diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2008-04-08 05:01:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:27:53 -0400 |
commit | 93fa7636dfdc059b25df148f230c0991096afdef (patch) | |
tree | cf277bd09091ac69abb5f7fdc21c705b8f186f88 /include/asm-x86/ptrace.h | |
parent | 492c2e476eac010962850006c49df326919b284c (diff) |
x86, ptrace: PEBS support
Polish the ds.h interface and add support for PEBS.
Ds.c is meant to be the resource allocator for per-thread and per-cpu
BTS and PEBS recording.
It is used by ptrace/utrace to provide execution tracing of debugged tasks.
It will be used by profilers (e.g. perfmon2).
It may be used by kernel debuggers to provide a kernel execution trace.
Changes in detail:
- guard DS and ptrace by CONFIG macros
- separate DS and BTS more clearly
- simplify field accesses
- add functions to manage PEBS buffers
- add simple protection/allocation mechanism
- added support for Atom
Opens:
- buffer overflow handling
Currently, only circular buffers are supported. This is all we need
for debugging. Profilers would want an overflow notification.
This is planned to be added when perfmon2 is made to use the ds.h
interface.
- utrace intermediate layer
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/ptrace.h')
-rw-r--r-- | include/asm-x86/ptrace.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h index 9f922b0b95d6..6303701d18e3 100644 --- a/include/asm-x86/ptrace.h +++ b/include/asm-x86/ptrace.h | |||
@@ -125,14 +125,48 @@ struct pt_regs { | |||
125 | #endif /* __KERNEL__ */ | 125 | #endif /* __KERNEL__ */ |
126 | #endif /* !__i386__ */ | 126 | #endif /* !__i386__ */ |
127 | 127 | ||
128 | |||
129 | #ifdef CONFIG_X86_PTRACE_BTS | ||
130 | /* a branch trace record entry | ||
131 | * | ||
132 | * In order to unify the interface between various processor versions, | ||
133 | * we use the below data structure for all processors. | ||
134 | */ | ||
135 | enum bts_qualifier { | ||
136 | BTS_INVALID = 0, | ||
137 | BTS_BRANCH, | ||
138 | BTS_TASK_ARRIVES, | ||
139 | BTS_TASK_DEPARTS | ||
140 | }; | ||
141 | |||
142 | struct bts_struct { | ||
143 | __u64 qualifier; | ||
144 | union { | ||
145 | /* BTS_BRANCH */ | ||
146 | struct { | ||
147 | __u64 from_ip; | ||
148 | __u64 to_ip; | ||
149 | } lbr; | ||
150 | /* BTS_TASK_ARRIVES or | ||
151 | BTS_TASK_DEPARTS */ | ||
152 | __u64 jiffies; | ||
153 | } variant; | ||
154 | }; | ||
155 | #endif /* CONFIG_X86_PTRACE_BTS */ | ||
156 | |||
128 | #ifdef __KERNEL__ | 157 | #ifdef __KERNEL__ |
129 | 158 | ||
130 | /* the DS BTS struct is used for ptrace as well */ | 159 | #include <linux/init.h> |
131 | #include <asm/ds.h> | ||
132 | 160 | ||
161 | struct cpuinfo_x86; | ||
133 | struct task_struct; | 162 | struct task_struct; |
134 | 163 | ||
164 | #ifdef CONFIG_X86_PTRACE_BTS | ||
165 | extern void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *); | ||
135 | extern void ptrace_bts_take_timestamp(struct task_struct *, enum bts_qualifier); | 166 | extern void ptrace_bts_take_timestamp(struct task_struct *, enum bts_qualifier); |
167 | #else | ||
168 | #define ptrace_bts_init_intel(config) do {} while (0) | ||
169 | #endif /* CONFIG_X86_PTRACE_BTS */ | ||
136 | 170 | ||
137 | extern unsigned long profile_pc(struct pt_regs *regs); | 171 | extern unsigned long profile_pc(struct pt_regs *regs); |
138 | 172 | ||