From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Steven Rostedt <rostedt@goodmis.org>,
tglx@linutronix.de, Jason Baron <jbaron@redhat.com>,
"Frank Ch. Eigler" <fche@redhat.com>,
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Jiaying Zhang <jiayingz@google.com>,
Michael Rubin <mrubin@google.com>,
Martin Bligh <mbligh@google.com>,
Michael Davidson <md@google.com>
Subject: [PATCH 0/2 v2] Syscalls tracing
Date: Fri, 13 Mar 2009 15:42:10 +0100 [thread overview]
Message-ID: <1236955332-10133-1-git-send-email-fweisbec@gmail.com> (raw)
tracing/syscalls: core infrastructure to trace syscalls
This new iteration addresses a good part of the previous reviews.
As suggested by Ingo Molnar and Peter Zijlstra, the syscalls
prototypes probing is done by abusing the SYSCALL_DEFINE family
macros.
We now store automatically the arguments names, their types, their number
and the name of the syscall.
Also some fixes on output newlines and dangerous exporting of global_trace
are provided.
An example of the trace:
echo syscall > /debugfs/tracing/current_tracer
# tracer: syscall
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
<...>-5080 [001] 132.192228: sys_dup2(oldfd: a, newfd: 1)
<...>-5080 [001] 132.192239: sys_dup2 -> 0x1
<...>-5080 [001] 132.192242: sys_fcntl(fd: a, cmd: 1, arg: 0)
<...>-5080 [001] 132.192245: sys_fcntl -> 0x1
<...>-5080 [001] 132.192248: sys_close(fd: a)
<...>-5080 [001] 132.192250: sys_close -> 0x0
<...>-5080 [001] 132.192265: sys_rt_sigprocmask(how: 0, set: 0, oset: 6cf808, sigsetsize: 8)
<...>-5080 [001] 132.192267: sys_rt_sigprocmask -> 0x0
<...>-5080 [001] 132.192271: sys_rt_sigaction(sig: 2, act: 7fffff4338f0, oact: 7fffff433850, sigsetsize: 8)
<...>-5080 [001] 132.192273: sys_rt_sigaction -> 0x0
<...>-5080 [001] 132.192285: sys_rt_sigprocmask(how: 0, set: 0, oset: 6cf808, sigsetsize: 8)
<...>-5080 [001] 132.192287: sys_rt_sigprocmask -> 0x0
<...>-5080 [001] 132.192415: sys_write(fd: 1, buf: 15dfc08, count: 21)
<...>-5080 [001] 132.192436: sys_write -> 0x21
<...>-4754 [000] 132.192478: sys_read(fd: 8, buf: 2a9340e, count: 1fee)
<...>-5080 [001] 132.192487: sys_rt_sigprocmask(how: 0, set: 7fffff432a70, oset: 7fffff4329f0, sigsetsize: 8)
And if you ask for the parameters types:
echo syscall_arg_type > trace_options
# tracer: syscall
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
<...>-5080 [001] 132.192228: sys_dup2(unsigned int oldfd: a, unsigned int newfd: 1)
<...>-5080 [001] 132.192239: sys_dup2 -> 0x1
<...>-5080 [001] 132.192242: sys_fcntl(unsigned int fd: a, unsigned int cmd: 1, unsigned long arg: 0)
<...>-5080 [001] 132.192245: sys_fcntl -> 0x1
<...>-5080 [001] 132.192248: sys_close(unsigned int fd: a)
<...>-5080 [001] 132.192250: sys_close -> 0x0
<...>-5080 [001] 132.192265: sys_rt_sigprocmask(int how: 0, sigset_t * set: 0, sigset_t * oset: 6cf808, size_t sigsetsize: 8)
<...>-5080 [001] 132.192267: sys_rt_sigprocmask -> 0x0
<...>-5080 [001] 132.192271: sys_rt_sigaction(int sig: 2, const struct sigaction * act: 7fffff4338f0, struct sigaction * oact: 7fffff433850, size_t sigsetsize: 8)
<...>-5080 [001] 132.192273: sys_rt_sigaction -> 0x0
<...>-5080 [001] 132.192285: sys_rt_sigprocmask(int how: 0, sigset_t * set: 0, sigset_t * oset: 6cf808, size_t sigsetsize: 8)
<...>-5080 [001] 132.192287: sys_rt_sigprocmask -> 0x0
<...>-5080 [001] 132.192415: sys_write(unsigned int fd: 1, const char * buf: 15dfc08, size_t count: 21)
<...>-5080 [001] 132.192436: sys_write -> 0x21
TODO:
- add a single mask on the struct syscall_metadata to provide quickly which arguments is
a pointer (usually type __user *p) so that the user can decide if he wants to save them of tracing time
- now that we have each parameter type as strings, add a new field on struct syscall_metadata to have the parameter types
encoded as single enum values (for quick checks) so that we can use specific callbacks for each parameter type
to be displayed.
NOTE: this is still not overlapping with a potential future merge of utrace, since the low-level hooks on
the syscalls remain somewhat basic.
NOTE2: I've only tested it on x86-64 for now, so only x86-64 support is provided.
--
Frederic Weisbecker (2):
tracing/syscalls: core infrastructure for syscalls tracing
tracing/syscalls: support for syscalls tracing on x86-64
arch/x86/Kconfig | 1 +
arch/x86/include/asm/ftrace.h | 7 +
arch/x86/include/asm/thread_info.h | 9 +-
arch/x86/kernel/ftrace.c | 63 +++++++++
arch/x86/kernel/ptrace.c | 7 +
include/asm-generic/vmlinux.lds.h | 11 ++-
include/linux/ftrace.h | 29 +++++
include/linux/syscalls.h | 60 +++++++++-
kernel/trace/Kconfig | 10 ++
kernel/trace/Makefile | 1 +
kernel/trace/trace.h | 19 +++
kernel/trace/trace_syscalls.c | 243 ++++++++++++++++++++++++++++++++++++
12 files changed, 454 insertions(+), 6 deletions(-)
create mode 100644 kernel/trace/trace_syscalls.c
next reply other threads:[~2009-03-13 14:42 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 14:42 Frederic Weisbecker [this message]
2009-03-13 14:42 ` [PATCH 1/2 v2] tracing/syscalls: core infrastructure for syscalls tracing Frederic Weisbecker
2009-03-13 16:09 ` [tip:tracing/syscalls] tracing/syscalls: core infrastructure for syscalls tracing, enhancements Frederic Weisbecker
2009-03-15 3:51 ` [PATCH 1/2 v2] tracing/syscalls: core infrastructure for syscalls tracing Andrew Morton
2009-03-15 4:59 ` Ingo Molnar
2009-03-15 8:02 ` Andrew Morton
2009-03-15 16:17 ` Frederic Weisbecker
2009-04-06 21:55 ` Tony Luck
2009-04-06 22:12 ` Frederic Weisbecker
2009-04-07 0:30 ` Steven Rostedt
2009-04-08 18:40 ` [PATCH] tracing/syscalls: use a dedicated file header Frederic Weisbecker
2009-04-08 19:36 ` Luck, Tony
2009-04-08 22:44 ` Steven Rostedt
2009-04-08 22:51 ` Luck, Tony
2009-04-08 23:02 ` Steven Rostedt
2009-04-08 23:08 ` Luck, Tony
2009-04-08 23:32 ` Steven Rostedt
2009-04-08 23:32 ` Joe Perches
2009-04-09 0:15 ` [GIT PULL][PATCH] " Steven Rostedt
2009-04-09 4:36 ` [tip:tracing/urgent] " Frederic Weisbecker
2009-03-13 14:42 ` [PATCH 2/2 v2] tracing/syscalls: support for syscalls tracing on x86-64 Frederic Weisbecker
2009-03-13 16:09 ` [tip:tracing/syscalls] tracing/syscalls: support for syscalls tracing on x86 Frederic Weisbecker
2009-03-15 3:53 ` [PATCH 2/2 v2] tracing/syscalls: support for syscalls tracing on x86-64 Andrew Morton
2009-03-15 5:30 ` Ingo Molnar
2009-03-15 16:05 ` Frederic Weisbecker
2009-03-13 15:16 ` [PATCH 0/2 v2] Syscalls tracing Frederic Weisbecker
2009-03-13 15:55 ` Ingo Molnar
2009-03-13 16:17 ` Ingo Molnar
2009-03-15 15:25 ` Frederic Weisbecker
2009-03-13 16:47 ` Mathieu Desnoyers
2009-03-15 16:01 ` Frederic Weisbecker
2009-03-23 16:32 ` Mathieu Desnoyers
2009-03-23 19:27 ` Frederic Weisbecker
2009-03-23 19:40 ` Ingo Molnar
2009-03-23 20:37 ` Mathieu Desnoyers
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=1236955332-10133-1-git-send-email-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=fche@redhat.com \
--cc=jbaron@redhat.com \
--cc=jiayingz@google.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mbligh@google.com \
--cc=md@google.com \
--cc=mingo@elte.hu \
--cc=mrubin@google.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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