aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2009-08-25 12:02:37 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-26 15:29:52 -0400
commitcc3b13c11c567c69a6356be98d0c03ff11541d5c (patch)
tree7665852e54b8ad951bfdbd898922fa3c54567f43
parentcd0980fc8add25e8ab12fcf1051c0f20cbc7c0c0 (diff)
tracing: Don't trace kernel thread syscalls
Kernel threads don't call syscalls using the sysenter/sysexit path. Instead they directly call the sys_* or do_* functions that implement the syscalls inside the kernel. The current syscall tracepoints only bind the sysenter/sysexit path, then it has no effect to trace the kernel thread calls to syscalls in that path. Setting the TIF_SYSCALL_TRACEPOINT flag is then useless for these. Actually there is only one case when a kernel thread can reach the usual syscall exit tracing path: when we create a kernel thread, the child comes to ret_from_fork and is the fork() return is then traced. But this information alone is useless, then we don't want to set the TIF flags for these threads. Kernel threads have task_struct->mm set to NULL. (Thanks to Heiko for that hint ;-) The idea is then to check the mm field in syscall_regfunc() and set the flag accordingly. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Cc: Jason Baron <jbaron@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> 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: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> LKML-Reference: <20090825160237.GG4639@cetus.boeblingen.de.ibm.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
-rw-r--r--kernel/tracepoint.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 1a6a453b7efb..9489a0a9b1be 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -597,7 +597,9 @@ void syscall_regfunc(void)
597 if (!sys_tracepoint_refcount) { 597 if (!sys_tracepoint_refcount) {
598 read_lock_irqsave(&tasklist_lock, flags); 598 read_lock_irqsave(&tasklist_lock, flags);
599 do_each_thread(g, t) { 599 do_each_thread(g, t) {
600 set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); 600 /* Skip kernel threads. */
601 if (t->mm)
602 set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
601 } while_each_thread(g, t); 603 } while_each_thread(g, t);
602 read_unlock_irqrestore(&tasklist_lock, flags); 604 read_unlock_irqrestore(&tasklist_lock, flags);
603 } 605 }