aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorK.Prasad <prasad@linux.vnet.ibm.com>2009-06-01 14:16:40 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-06-02 16:47:00 -0400
commit0722db015c246204044299eae3b02d18d3ca4faf (patch)
treecc9a6b21961d62e1788ee2b9cbd0ae23b43f11a0 /kernel/trace/trace.h
parent432039933a16b8227b7b267f46ac1c1b9b3adf14 (diff)
hw-breakpoints: ftrace plugin for kernel symbol tracing using HW Breakpoint interfaces
This patch adds an ftrace plugin to detect and profile memory access over kernel variables. It uses HW Breakpoint interfaces to 'watch memory addresses. Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 6e735d4771f8..7d5cc37b8fca 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -15,6 +15,10 @@
15#include <linux/trace_seq.h> 15#include <linux/trace_seq.h>
16#include <linux/ftrace_event.h> 16#include <linux/ftrace_event.h>
17 17
18#ifdef CONFIG_KSYM_TRACER
19#include <asm/hw_breakpoint.h>
20#endif
21
18enum trace_type { 22enum trace_type {
19 __TRACE_FIRST_TYPE = 0, 23 __TRACE_FIRST_TYPE = 0,
20 24
@@ -40,6 +44,7 @@ enum trace_type {
40 TRACE_KMEM_FREE, 44 TRACE_KMEM_FREE,
41 TRACE_POWER, 45 TRACE_POWER,
42 TRACE_BLK, 46 TRACE_BLK,
47 TRACE_KSYM,
43 48
44 __TRACE_LAST_TYPE, 49 __TRACE_LAST_TYPE,
45}; 50};
@@ -207,6 +212,21 @@ struct syscall_trace_exit {
207 unsigned long ret; 212 unsigned long ret;
208}; 213};
209 214
215#define KSYM_SELFTEST_ENTRY "ksym_selftest_dummy"
216extern int process_new_ksym_entry(char *ksymname, int op, unsigned long addr);
217
218struct trace_ksym {
219 struct trace_entry ent;
220 struct hw_breakpoint *ksym_hbp;
221 unsigned long ksym_addr;
222 unsigned long ip;
223#ifdef CONFIG_PROFILE_KSYM_TRACER
224 unsigned long counter;
225#endif
226 struct hlist_node ksym_hlist;
227 char ksym_name[KSYM_NAME_LEN];
228 char p_name[TASK_COMM_LEN];
229};
210 230
211/* 231/*
212 * trace_flag_type is an enumeration that holds different 232 * trace_flag_type is an enumeration that holds different
@@ -323,6 +343,7 @@ extern void __ftrace_bad_type(void);
323 TRACE_SYSCALL_ENTER); \ 343 TRACE_SYSCALL_ENTER); \
324 IF_ASSIGN(var, ent, struct syscall_trace_exit, \ 344 IF_ASSIGN(var, ent, struct syscall_trace_exit, \
325 TRACE_SYSCALL_EXIT); \ 345 TRACE_SYSCALL_EXIT); \
346 IF_ASSIGN(var, ent, struct trace_ksym, TRACE_KSYM); \
326 __ftrace_bad_type(); \ 347 __ftrace_bad_type(); \
327 } while (0) 348 } while (0)
328 349
@@ -540,6 +561,8 @@ extern int trace_selftest_startup_branch(struct tracer *trace,
540 struct trace_array *tr); 561 struct trace_array *tr);
541extern int trace_selftest_startup_hw_branches(struct tracer *trace, 562extern int trace_selftest_startup_hw_branches(struct tracer *trace,
542 struct trace_array *tr); 563 struct trace_array *tr);
564extern int trace_selftest_startup_ksym(struct tracer *trace,
565 struct trace_array *tr);
543#endif /* CONFIG_FTRACE_STARTUP_TEST */ 566#endif /* CONFIG_FTRACE_STARTUP_TEST */
544 567
545extern void *head_page(struct trace_array_cpu *data); 568extern void *head_page(struct trace_array_cpu *data);