public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH tip 1/1] tracing: handle unregistering the current tracer
@ 2009-02-07 20:52 Arnaldo Carvalho de Melo
  2009-02-09  9:58 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-02-07 20:52 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Ingo Molnar, Linux Kernel Mailing List

Impact: simplification

Instead of requiring that plugins have the sequence:

  my_tracer_stop(my_trace_array);
  unregister_tracer(my_tracer);

it should be possible just do a:

  unregister_tracer(my_tracer);

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/trace/trace.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ef4dbac..d247555 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -559,6 +559,15 @@ void unregister_tracer(struct tracer *type)
 
  found:
 	*t = (*t)->next;
+
+	if (type == current_trace && tracer_enabled) {
+		tracer_enabled = 0;
+		tracing_stop();
+		if (current_trace->stop)
+			current_trace->stop(&global_trace);
+		current_trace = &nop_trace;
+	}
+
 	if (strlen(type->name) != max_tracer_type_len)
 		goto out;
 
-- 
1.6.0.6


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

* Re: [PATCH tip 1/1] tracing: handle unregistering the current tracer
  2009-02-07 20:52 [PATCH tip 1/1] tracing: handle unregistering the current tracer Arnaldo Carvalho de Melo
@ 2009-02-09  9:58 ` Ingo Molnar
  2009-02-09 11:51   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-02-09  9:58 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Steven Rostedt, Linux Kernel Mailing List


* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:

> Impact: simplification
> 
> Instead of requiring that plugins have the sequence:
> 
>   my_tracer_stop(my_trace_array);
>   unregister_tracer(my_tracer);
> 
> it should be possible just do a:
> 
>   unregister_tracer(my_tracer);
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  kernel/trace/trace.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)

Applied to tip/tracing/ftrace, thanks Arnaldo!

Nice one - we should try to shoot for the smallest physically
possible linecount for any new (possibly trivial) tracer plugin.

	Ingo

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

* Re: [PATCH tip 1/1] tracing: handle unregistering the current tracer
  2009-02-09  9:58 ` Ingo Molnar
@ 2009-02-09 11:51   ` Arnaldo Carvalho de Melo
  2009-02-09 11:58     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-02-09 11:51 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Linux Kernel Mailing List

Em Mon, Feb 09, 2009 at 10:58:16AM +0100, Ingo Molnar escreveu:
> 
> * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> 
> > Impact: simplification
> > 
> > Instead of requiring that plugins have the sequence:
> > 
> >   my_tracer_stop(my_trace_array);
> >   unregister_tracer(my_tracer);
> > 
> > it should be possible just do a:
> > 
> >   unregister_tracer(my_tracer);
> > 
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> >  kernel/trace/trace.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> Applied to tip/tracing/ftrace, thanks Arnaldo!
> 
> Nice one - we should try to shoot for the smallest physically
> possible linecount for any new (possibly trivial) tracer plugin.

That and also for as few as possible EXPORT_SYMBOL_GPL entries, now, for
converting net/ipv4/tcp_probe.c to an ftrace plugin + one tracepoint at
tcp_rcv_established we need:

doppio linux-2.6-tip]$ grep ^+EXPORT_SYMBOL ~/tcp_cwnd_tracer.patch 
+EXPORT_SYMBOL_GPL(register_tracer);
+EXPORT_SYMBOL_GPL(unregister_tracer);
+EXPORT_SYMBOL_GPL(tracing_record_cmdline);
+EXPORT_SYMBOL_GPL(trace_buffer_lock_reserve);
+EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
+EXPORT_SYMBOL_GPL(trace_seq_printf);
+EXPORT_SYMBOL_GPL(register_ftrace_event);
+EXPORT_SYMBOL_GPL(unregister_ftrace_event);
[acme@doppio linux-2.6-tip]$

- Arnaldo

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

* Re: [PATCH tip 1/1] tracing: handle unregistering the current tracer
  2009-02-09 11:51   ` Arnaldo Carvalho de Melo
@ 2009-02-09 11:58     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-02-09 11:58 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Steven Rostedt, Linux Kernel Mailing List


* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:

> Em Mon, Feb 09, 2009 at 10:58:16AM +0100, Ingo Molnar escreveu:
> > 
> > * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> > 
> > > Impact: simplification
> > > 
> > > Instead of requiring that plugins have the sequence:
> > > 
> > >   my_tracer_stop(my_trace_array);
> > >   unregister_tracer(my_tracer);
> > > 
> > > it should be possible just do a:
> > > 
> > >   unregister_tracer(my_tracer);
> > > 
> > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > ---
> > >  kernel/trace/trace.c |    9 +++++++++
> > >  1 files changed, 9 insertions(+), 0 deletions(-)
> > 
> > Applied to tip/tracing/ftrace, thanks Arnaldo!
> > 
> > Nice one - we should try to shoot for the smallest physically
> > possible linecount for any new (possibly trivial) tracer plugin.
> 
> That and also for as few as possible EXPORT_SYMBOL_GPL entries, now, for
> converting net/ipv4/tcp_probe.c to an ftrace plugin + one tracepoint at
> tcp_rcv_established we need:
> 
> doppio linux-2.6-tip]$ grep ^+EXPORT_SYMBOL ~/tcp_cwnd_tracer.patch 
> +EXPORT_SYMBOL_GPL(register_tracer);
> +EXPORT_SYMBOL_GPL(unregister_tracer);
> +EXPORT_SYMBOL_GPL(tracing_record_cmdline);
> +EXPORT_SYMBOL_GPL(trace_buffer_lock_reserve);
> +EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
> +EXPORT_SYMBOL_GPL(trace_seq_printf);
> +EXPORT_SYMBOL_GPL(register_ftrace_event);
> +EXPORT_SYMBOL_GPL(unregister_ftrace_event);
> [acme@doppio linux-2.6-tip]$

ok. For in-kernel plugins it's of course fine to do those exports in any case.

	Ingo

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

end of thread, other threads:[~2009-02-09 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07 20:52 [PATCH tip 1/1] tracing: handle unregistering the current tracer Arnaldo Carvalho de Melo
2009-02-09  9:58 ` Ingo Molnar
2009-02-09 11:51   ` Arnaldo Carvalho de Melo
2009-02-09 11:58     ` Ingo Molnar

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