public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH -tip 9/9] tracing: kprobe-tracer plugin supports module_probe
@ 2009-03-19 21:10 Masami Hiramatsu
  2009-03-20  0:08 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2009-03-19 21:10 UTC (permalink / raw)
  To: Steven Rostedt, Ananth N Mavinakayanahalli, Ingo Molnar
  Cc: systemtap-ml, LKML

Use register/unregister_module_*probe functions for tracing
module .init/.exit functions.

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>
---
 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 e801e8c..7b7ab53 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -226,6 +226,11 @@ static void free_trace_probe(struct trace_probe *tp)
 	kfree(tp);
 }

+static int activate_handler(void *offset, struct module *mod)
+{
+	return ((unsigned long)offset == 0) ? 1 : 0;
+}
+
 static int register_trace_probe(struct trace_probe *tp)
 {
 	int ret;
@@ -234,9 +239,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);
@@ -249,9 +255,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);
 }

@@ -301,7 +307,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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC][PATCH -tip 9/9] tracing: kprobe-tracer plugin supports module_probe
  2009-03-19 21:10 [RFC][PATCH -tip 9/9] tracing: kprobe-tracer plugin supports module_probe Masami Hiramatsu
@ 2009-03-20  0:08 ` Steven Rostedt
  2009-03-20  3:57   ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2009-03-20  0:08 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Ananth N Mavinakayanahalli, Ingo Molnar, systemtap-ml, LKML


On Thu, 19 Mar 2009, Masami Hiramatsu wrote:

> Use register/unregister_module_*probe functions for tracing
> module .init/.exit functions.
> 
> 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>
> ---
>  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 e801e8c..7b7ab53 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -226,6 +226,11 @@ static void free_trace_probe(struct trace_probe *tp)
>  	kfree(tp);
>  }
> 
> +static int activate_handler(void *offset, struct module *mod)
> +{
> +	return ((unsigned long)offset == 0) ? 1 : 0;

This is a strange way to implement:

	return !offset;

-- Steve

> +}
> +
>  static int register_trace_probe(struct trace_probe *tp)
>  {
>  	int ret;
> @@ -234,9 +239,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);
> @@ -249,9 +255,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);
>  }
> 
> @@ -301,7 +307,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
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC][PATCH -tip 9/9] tracing: kprobe-tracer plugin supports module_probe
  2009-03-20  0:08 ` Steven Rostedt
@ 2009-03-20  3:57   ` Masami Hiramatsu
  0 siblings, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2009-03-20  3:57 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Ananth N Mavinakayanahalli, Ingo Molnar, systemtap-ml, LKML

Steven Rostedt wrote:
> On Thu, 19 Mar 2009, Masami Hiramatsu wrote:
> 
>> Use register/unregister_module_*probe functions for tracing
>> module .init/.exit functions.
>>
>> 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>
>> ---
>>  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 e801e8c..7b7ab53 100644
>> --- a/kernel/trace/trace_kprobe.c
>> +++ b/kernel/trace/trace_kprobe.c
>> @@ -226,6 +226,11 @@ static void free_trace_probe(struct trace_probe *tp)
>>  	kfree(tp);
>>  }
>>
>> +static int activate_handler(void *offset, struct module *mod)
>> +{
>> +	return ((unsigned long)offset == 0) ? 1 : 0;
> 
> This is a strange way to implement:
> 
> 	return !offset;

Yes. Thanks!

> 
> -- Steve
> 
>> +}
>> +
>>  static int register_trace_probe(struct trace_probe *tp)
>>  {
>>  	int ret;
>> @@ -234,9 +239,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);
>> @@ -249,9 +255,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);
>>  }
>>
>> @@ -301,7 +307,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
>>
>>
>>

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-20  3:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 21:10 [RFC][PATCH -tip 9/9] tracing: kprobe-tracer plugin supports module_probe Masami Hiramatsu
2009-03-20  0:08 ` Steven Rostedt
2009-03-20  3:57   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox