From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
Hendrik Brueckner <brueckner@linux.vnet.ibm.com>,
Jason Baron <jbaron@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>, Lai Jiangshan <laijs@cn.fujitsu.com>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
Jiaying Zhang <jiayingz@google.com>,
Martin Bligh <mbligh@google.com>, Li Zefan <lizf@cn.fujitsu.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Paul Mundt <lethal@linux-sh.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: [PATCH 3/7] tracing: Don't trace kernel thread syscalls
Date: Thu, 27 Aug 2009 19:43:31 +0200 [thread overview]
Message-ID: <1251395015-6329-4-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1251395015-6329-1-git-send-email-fweisbec@gmail.com>
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
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>
---
kernel/tracepoint.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 1a6a453..9489a0a 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -597,7 +597,9 @@ void syscall_regfunc(void)
if (!sys_tracepoint_refcount) {
read_lock_irqsave(&tasklist_lock, flags);
do_each_thread(g, t) {
- set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
+ /* Skip kernel threads. */
+ if (t->mm)
+ set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
} while_each_thread(g, t);
read_unlock_irqrestore(&tasklist_lock, flags);
}
--
1.6.2.3
next prev parent reply other threads:[~2009-08-27 17:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-27 17:43 [GIT PULL] tracing/syscalls: The next bunch Frederic Weisbecker
2009-08-27 17:43 ` [PATCH 1/7] tracing: Add syscall tracepoints - s390 arch update Frederic Weisbecker
2009-08-27 17:50 ` Frederic Weisbecker
2009-08-27 17:43 ` [PATCH 2/7] tracing: Check invalid syscall nr while tracing syscalls Frederic Weisbecker
2009-08-27 17:43 ` Frederic Weisbecker [this message]
2009-08-27 17:43 ` [PATCH 4/7] tracing: Define NR_syscalls for x86 (32) Frederic Weisbecker
2009-08-27 17:43 ` [PATCH 5/7] tracing: Define NR_syscalls for x86_64 Frederic Weisbecker
2009-08-27 17:43 ` [PATCH 6/7] tracing: Convert event tracing code to use NR_syscalls Frederic Weisbecker
2009-08-27 17:43 ` [PATCH 7/7] tracing: Remove FTRACE_SYSCALL_MAX definitions Frederic Weisbecker
2009-08-29 10:43 ` [GIT PULL] tracing/syscalls: The next bunch Ingo Molnar
2009-08-29 23:33 ` Frederic Weisbecker
2009-08-31 8:35 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1251395015-6329-4-git-send-email-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=brueckner@linux.vnet.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=jbaron@redhat.com \
--cc=jiayingz@google.com \
--cc=laijs@cn.fujitsu.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mbligh@google.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome