aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/tracepoint.c
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2009-08-10 16:52:31 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-11 14:35:26 -0400
commita871bd33a6c0bc86fb47cd02ea2650dd43d3d95f (patch)
treeb5720cdb3168ba0894b4bd2c1acc004cb19a692c /kernel/tracepoint.c
parent63fbdab3157b72467013fe4dcf88c85e45280ef7 (diff)
tracing: Add syscall tracepoints
add two tracepoints in syscall exit and entry path, conditioned on TIF_SYSCALL_FTRACE. Supports the syscall trace event code. Signed-off-by: Jason Baron <jbaron@redhat.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Jiaying Zhang <jiayingz@google.com> Cc: Martin Bligh <mbligh@google.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/tracepoint.c')
-rw-r--r--kernel/tracepoint.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 1ef5d3a601c7..070a42bb8920 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -24,6 +24,7 @@
24#include <linux/tracepoint.h> 24#include <linux/tracepoint.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/sched.h>
27 28
28extern struct tracepoint __start___tracepoints[]; 29extern struct tracepoint __start___tracepoints[];
29extern struct tracepoint __stop___tracepoints[]; 30extern struct tracepoint __stop___tracepoints[];
@@ -577,3 +578,40 @@ static int init_tracepoints(void)
577__initcall(init_tracepoints); 578__initcall(init_tracepoints);
578 579
579#endif /* CONFIG_MODULES */ 580#endif /* CONFIG_MODULES */
581
582static DEFINE_MUTEX(regfunc_mutex);
583static int sys_tracepoint_refcount;
584
585void syscall_regfunc(void)
586{
587 unsigned long flags;
588 struct task_struct *g, *t;
589
590 mutex_lock(&regfunc_mutex);
591 if (!sys_tracepoint_refcount) {
592 read_lock_irqsave(&tasklist_lock, flags);
593 do_each_thread(g, t) {
594 set_tsk_thread_flag(t, TIF_SYSCALL_FTRACE);
595 } while_each_thread(g, t);
596 read_unlock_irqrestore(&tasklist_lock, flags);
597 }
598 sys_tracepoint_refcount++;
599 mutex_unlock(&regfunc_mutex);
600}
601
602void syscall_unregfunc(void)
603{
604 unsigned long flags;
605 struct task_struct *g, *t;
606
607 mutex_lock(&regfunc_mutex);
608 sys_tracepoint_refcount--;
609 if (!sys_tracepoint_refcount) {
610 read_lock_irqsave(&tasklist_lock, flags);
611 do_each_thread(g, t) {
612 clear_tsk_thread_flag(t, TIF_SYSCALL_FTRACE);
613 } while_each_thread(g, t);
614 read_unlock_irqrestore(&tasklist_lock, flags);
615 }
616 mutex_unlock(&regfunc_mutex);
617}