From: Masami Hiramatsu <mhiramat@redhat.com>
To: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
systemtap-ml <systemtap@sources.redhat.com>
Subject: [RFC][PATCH -tip 5/5 V2] tracing: kprobe-tracer plugin supports module init/exit
Date: Fri, 20 Mar 2009 21:34:10 -0400 [thread overview]
Message-ID: <49C44412.5080408@redhat.com> (raw)
Use register/unregister_module_*probe functions for tracing
module .init/.exit functions.
changes from v1:
- simplify activate_handler().
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/trace_kprobe.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index def322f..afcfa4a 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -228,6 +228,11 @@ static void free_trace_probe(struct trace_probe *tp)
kfree(tp);
}
+static int activate_handler(void *offset, struct module *mod)
+{
+ return !offset;
+}
+
static int register_trace_probe(struct trace_probe *tp)
{
int ret;
@@ -236,9 +241,10 @@ static int register_trace_probe(struct trace_probe *tp)
list_add_tail(&tp->list, &probe_list);
if (probe_is_return(tp))
- ret = register_kretprobe(&tp->rp);
+ ret = register_module_kretprobe(&tp->rp, activate_handler, 0);
else
- ret = register_kprobe(&tp->kp);
+ ret = register_module_kprobe(&tp->kp, activate_handler,
+ (void *)(tp->kp.offset));
if (ret) {
pr_warning("Probe registering error: %d\n", ret);
@@ -251,9 +257,9 @@ static int register_trace_probe(struct trace_probe *tp)
static void unregister_trace_probe(struct trace_probe *tp)
{
if (probe_is_return(tp))
- unregister_kretprobe(&tp->rp);
+ unregister_module_kretprobe(&tp->rp);
else
- unregister_kprobe(&tp->kp);
+ unregister_module_kprobe(&tp->kp);
list_del(&tp->list);
}
@@ -303,7 +309,6 @@ static int create_trace_probe(int argc, char **argv)
} else {
/* a symbol specified */
symbol = argv[1];
- /* TODO: support .init module functions */
tmp = strchr(symbol, '+');
if (!tmp)
tmp = strchr(symbol, '-');
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com
reply other threads:[~2009-03-21 1:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=49C44412.5080408@redhat.com \
--to=mhiramat@redhat.com \
--cc=ananth@in.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=systemtap@sources.redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.