All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [git pull] for tip/tracing/ftrace
@ 2009-02-25 22:13 Steven Rostedt
  2009-02-25 22:13 ` [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-02-25 22:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
	Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
	Pekka Paalanen, Arnaldo Carvalho de Melo, Jason Baron,
	Martin Bligh, Mathieu Desnoyers, Frank Ch. Eigler,
	KOSAKI Motohiro, Jens Axboe, Masami Hiramatsu


Ingo,

Please pull the latest tip/tracing/ftrace tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/ftrace


Steven Rostedt (2):
      tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT
      tracing: wrap arguments with PARAMS

----
 include/linux/tracepoint.h        |    5 +++--
 include/trace/sched_event_types.h |   26 +++++++++++++-------------
 kernel/trace/trace_events.h       |    4 ++--
 3 files changed, 18 insertions(+), 17 deletions(-)

-- 

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

* [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT
  2009-02-25 22:13 [PATCH 0/2] [git pull] for tip/tracing/ftrace Steven Rostedt
@ 2009-02-25 22:13 ` Steven Rostedt
  2009-02-25 23:07   ` Mathieu Desnoyers
  2009-02-25 22:13 ` [PATCH 2/2] tracing: wrap arguments with PARAMS Steven Rostedt
  2009-02-26  2:49 ` [PATCH 0/2] [git pull] for tip/tracing/ftrace Ingo Molnar
  2 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2009-02-25 22:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
	Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
	Pekka Paalanen, Arnaldo Carvalho de Melo, Jason Baron,
	Martin Bligh, Mathieu Desnoyers, Frank Ch. Eigler,
	KOSAKI Motohiro, Jens Axboe, Masami Hiramatsu, Steven Rostedt

[-- Attachment #1: 0001-tracing-rename-DEFINE_TRACE_FMT-to-just-TRACE_FORMA.patch --]
[-- Type: text/plain, Size: 4274 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

There's been a bit confusion to whether DEFINE/DECLARE_TRACE_FMT should
be a DEFINE or a DECLARE. Ingo Molnar suggested simply calling it
TRACE_FORMAT.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 include/linux/tracepoint.h        |    2 +-
 include/trace/sched_event_types.h |   26 +++++++++++++-------------
 kernel/trace/trace_events.h       |    4 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 34ae464..3de09fa 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -153,7 +153,7 @@ static inline void tracepoint_synchronize_unregister(void)
 	synchronize_sched();
 }
 
-#define DEFINE_TRACE_FMT(name, proto, args, fmt)		\
+#define TRACE_FORMAT(name, proto, args, fmt)		\
 	DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))
 
 #endif
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
index a4f6629..a3d3d66 100644
--- a/include/trace/sched_event_types.h
+++ b/include/trace/sched_event_types.h
@@ -1,72 +1,72 @@
 
 /* use <trace/sched.h> instead */
-#ifndef DEFINE_TRACE_FMT
+#ifndef TRACE_FORMAT
 # error Do not include this file directly.
 # error Unless you know what you are doing.
 #endif
 
-DEFINE_TRACE_FMT(sched_kthread_stop,
+TRACE_FORMAT(sched_kthread_stop,
 	TPPROTO(struct task_struct *t),
 	TPARGS(t),
 	TPFMT("task %s:%d", t->comm, t->pid));
 
-DEFINE_TRACE_FMT(sched_kthread_stop_ret,
+TRACE_FORMAT(sched_kthread_stop_ret,
 	TPPROTO(int ret),
 	TPARGS(ret),
 	TPFMT("ret=%d", ret));
 
-DEFINE_TRACE_FMT(sched_wait_task,
+TRACE_FORMAT(sched_wait_task,
 	TPPROTO(struct rq *rq, struct task_struct *p),
 	TPARGS(rq, p),
 	TPFMT("task %s:%d", p->comm, p->pid));
 
-DEFINE_TRACE_FMT(sched_wakeup,
+TRACE_FORMAT(sched_wakeup,
 	TPPROTO(struct rq *rq, struct task_struct *p, int success),
 	TPARGS(rq, p, success),
 	TPFMT("task %s:%d %s",
 	      p->comm, p->pid, success?"succeeded":"failed"));
 
-DEFINE_TRACE_FMT(sched_wakeup_new,
+TRACE_FORMAT(sched_wakeup_new,
 	TPPROTO(struct rq *rq, struct task_struct *p, int success),
 	TPARGS(rq, p, success),
 	TPFMT("task %s:%d",
 	      p->comm, p->pid, success?"succeeded":"failed"));
 
-DEFINE_TRACE_FMT(sched_switch,
+TRACE_FORMAT(sched_switch,
 	TPPROTO(struct rq *rq, struct task_struct *prev,
 		struct task_struct *next),
 	TPARGS(rq, prev, next),
 	TPFMT("task %s:%d ==> %s:%d",
 	      prev->comm, prev->pid, next->comm, next->pid));
 
-DEFINE_TRACE_FMT(sched_migrate_task,
+TRACE_FORMAT(sched_migrate_task,
 	TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
 	TPARGS(p, orig_cpu, dest_cpu),
 	TPFMT("task %s:%d from: %d  to: %d",
 	      p->comm, p->pid, orig_cpu, dest_cpu));
 
-DEFINE_TRACE_FMT(sched_process_free,
+TRACE_FORMAT(sched_process_free,
 	TPPROTO(struct task_struct *p),
 	TPARGS(p),
 	TPFMT("task %s:%d", p->comm, p->pid));
 
-DEFINE_TRACE_FMT(sched_process_exit,
+TRACE_FORMAT(sched_process_exit,
 	TPPROTO(struct task_struct *p),
 	TPARGS(p),
 	TPFMT("task %s:%d", p->comm, p->pid));
 
-DEFINE_TRACE_FMT(sched_process_wait,
+TRACE_FORMAT(sched_process_wait,
 	TPPROTO(struct pid *pid),
 	TPARGS(pid),
 	TPFMT("pid %d", pid));
 
-DEFINE_TRACE_FMT(sched_process_fork,
+TRACE_FORMAT(sched_process_fork,
 	TPPROTO(struct task_struct *parent, struct task_struct *child),
 	TPARGS(parent, child),
 	TPFMT("parent %s:%d  child %s:%d",
 	      parent->comm, parent->pid, child->comm, child->pid));
 
-DEFINE_TRACE_FMT(sched_signal_send,
+TRACE_FORMAT(sched_signal_send,
 	TPPROTO(int sig, struct task_struct *p),
 	TPARGS(sig, p),
 	TPFMT("sig: %d   task %s:%d", sig, p->comm, p->pid));
diff --git a/kernel/trace/trace_events.h b/kernel/trace/trace_events.h
index cb8455b..deb95e5 100644
--- a/kernel/trace/trace_events.h
+++ b/kernel/trace/trace_events.h
@@ -17,8 +17,8 @@ struct ftrace_event_call {
 #undef TPFMT
 #define TPFMT(fmt, args...)	fmt "\n", ##args
 
-#undef DEFINE_TRACE_FMT
-#define DEFINE_TRACE_FMT(call, proto, args, fmt)			\
+#undef TRACE_FORMAT
+#define TRACE_FORMAT(call, proto, args, fmt)				\
 static void ftrace_event_##call(proto)					\
 {									\
 	event_trace_printk(_RET_IP_, "(" #call ") " fmt);		\
-- 
1.5.6.5

-- 

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

* [PATCH 2/2] tracing: wrap arguments with PARAMS
  2009-02-25 22:13 [PATCH 0/2] [git pull] for tip/tracing/ftrace Steven Rostedt
  2009-02-25 22:13 ` [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT Steven Rostedt
@ 2009-02-25 22:13 ` Steven Rostedt
  2009-02-26  2:49 ` [PATCH 0/2] [git pull] for tip/tracing/ftrace Ingo Molnar
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-02-25 22:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
	Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
	Pekka Paalanen, Arnaldo Carvalho de Melo, Jason Baron,
	Martin Bligh, Mathieu Desnoyers, Frank Ch. Eigler,
	KOSAKI Motohiro, Jens Axboe, Masami Hiramatsu, Steven Rostedt

[-- Attachment #1: 0002-tracing-wrap-arguments-with-PARAMS.patch --]
[-- Type: text/plain, Size: 969 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Peter Zijlstra warned that TPPROTO and TPARGS might become something
other than a simple copy of itself. To prevent this from having
side effects in the TRACE_FORMAT macro in tracepoint.h, we add a
PARAMS() macro to be defined as just a wrapper.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 include/linux/tracepoint.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 3de09fa..62d1339 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -153,7 +153,8 @@ static inline void tracepoint_synchronize_unregister(void)
 	synchronize_sched();
 }
 
+#define PARAMS(args...) args
 #define TRACE_FORMAT(name, proto, args, fmt)		\
-	DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))
+	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
 #endif
-- 
1.5.6.5

-- 

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

* Re: [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT
  2009-02-25 22:13 ` [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT Steven Rostedt
@ 2009-02-25 23:07   ` Mathieu Desnoyers
  2009-02-26  3:07     ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Desnoyers @ 2009-02-25 23:07 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
	Peter Zijlstra, Frederic Weisbecker, Theodore Tso,
	Arjan van de Ven, Pekka Paalanen, Arnaldo Carvalho de Melo,
	Jason Baron, Martin Bligh, Frank Ch. Eigler, KOSAKI Motohiro,
	Jens Axboe, Masami Hiramatsu, Steven Rostedt

* Steven Rostedt (rostedt@goodmis.org) wrote:
> From: Steven Rostedt <srostedt@redhat.com>
> 
> There's been a bit confusion to whether DEFINE/DECLARE_TRACE_FMT should
> be a DEFINE or a DECLARE. Ingo Molnar suggested simply calling it
> TRACE_FORMAT.
> 
> Reported-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
> ---
>  include/linux/tracepoint.h        |    2 +-
>  include/trace/sched_event_types.h |   26 +++++++++++++-------------
>  kernel/trace/trace_events.h       |    4 ++--
>  3 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 34ae464..3de09fa 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -153,7 +153,7 @@ static inline void tracepoint_synchronize_unregister(void)
>  	synchronize_sched();
>  }
>  
> -#define DEFINE_TRACE_FMT(name, proto, args, fmt)		\
> +#define TRACE_FORMAT(name, proto, args, fmt)		\
>  	DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))
>  

Hi Steven,

Just to synchronize.. Does the tree you are basing your work on has both
DEFINE_TRACE and DECLARE_TRACE ? If yes, then I think your TRACE_FORMAT
should be put in the .c files (not in the headers) and add the format
string to a supplementary tracepoint field (passed as a supplementary
parameter to DEFINE_TRACE). Then this format string would become
available to all tracers which connect to the tracepoints.

Your probe could then connect to the tracepoint just like any other
probe, and use the new "format" string available in the tracepoint data
structure.

This format string would indeed be NULL if tracepoints are declared
without any format string.

What do you think of this proposal ?

Mathieu


>  #endif
> diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
> index a4f6629..a3d3d66 100644
> --- a/include/trace/sched_event_types.h
> +++ b/include/trace/sched_event_types.h
> @@ -1,72 +1,72 @@
>  
>  /* use <trace/sched.h> instead */
> -#ifndef DEFINE_TRACE_FMT
> +#ifndef TRACE_FORMAT
>  # error Do not include this file directly.
>  # error Unless you know what you are doing.
>  #endif
>  
> -DEFINE_TRACE_FMT(sched_kthread_stop,
> +TRACE_FORMAT(sched_kthread_stop,
>  	TPPROTO(struct task_struct *t),
>  	TPARGS(t),
>  	TPFMT("task %s:%d", t->comm, t->pid));
>  
> -DEFINE_TRACE_FMT(sched_kthread_stop_ret,
> +TRACE_FORMAT(sched_kthread_stop_ret,
>  	TPPROTO(int ret),
>  	TPARGS(ret),
>  	TPFMT("ret=%d", ret));
>  
> -DEFINE_TRACE_FMT(sched_wait_task,
> +TRACE_FORMAT(sched_wait_task,
>  	TPPROTO(struct rq *rq, struct task_struct *p),
>  	TPARGS(rq, p),
>  	TPFMT("task %s:%d", p->comm, p->pid));
>  
> -DEFINE_TRACE_FMT(sched_wakeup,
> +TRACE_FORMAT(sched_wakeup,
>  	TPPROTO(struct rq *rq, struct task_struct *p, int success),
>  	TPARGS(rq, p, success),
>  	TPFMT("task %s:%d %s",
>  	      p->comm, p->pid, success?"succeeded":"failed"));
>  
> -DEFINE_TRACE_FMT(sched_wakeup_new,
> +TRACE_FORMAT(sched_wakeup_new,
>  	TPPROTO(struct rq *rq, struct task_struct *p, int success),
>  	TPARGS(rq, p, success),
>  	TPFMT("task %s:%d",
>  	      p->comm, p->pid, success?"succeeded":"failed"));
>  
> -DEFINE_TRACE_FMT(sched_switch,
> +TRACE_FORMAT(sched_switch,
>  	TPPROTO(struct rq *rq, struct task_struct *prev,
>  		struct task_struct *next),
>  	TPARGS(rq, prev, next),
>  	TPFMT("task %s:%d ==> %s:%d",
>  	      prev->comm, prev->pid, next->comm, next->pid));
>  
> -DEFINE_TRACE_FMT(sched_migrate_task,
> +TRACE_FORMAT(sched_migrate_task,
>  	TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
>  	TPARGS(p, orig_cpu, dest_cpu),
>  	TPFMT("task %s:%d from: %d  to: %d",
>  	      p->comm, p->pid, orig_cpu, dest_cpu));
>  
> -DEFINE_TRACE_FMT(sched_process_free,
> +TRACE_FORMAT(sched_process_free,
>  	TPPROTO(struct task_struct *p),
>  	TPARGS(p),
>  	TPFMT("task %s:%d", p->comm, p->pid));
>  
> -DEFINE_TRACE_FMT(sched_process_exit,
> +TRACE_FORMAT(sched_process_exit,
>  	TPPROTO(struct task_struct *p),
>  	TPARGS(p),
>  	TPFMT("task %s:%d", p->comm, p->pid));
>  
> -DEFINE_TRACE_FMT(sched_process_wait,
> +TRACE_FORMAT(sched_process_wait,
>  	TPPROTO(struct pid *pid),
>  	TPARGS(pid),
>  	TPFMT("pid %d", pid));
>  
> -DEFINE_TRACE_FMT(sched_process_fork,
> +TRACE_FORMAT(sched_process_fork,
>  	TPPROTO(struct task_struct *parent, struct task_struct *child),
>  	TPARGS(parent, child),
>  	TPFMT("parent %s:%d  child %s:%d",
>  	      parent->comm, parent->pid, child->comm, child->pid));
>  
> -DEFINE_TRACE_FMT(sched_signal_send,
> +TRACE_FORMAT(sched_signal_send,
>  	TPPROTO(int sig, struct task_struct *p),
>  	TPARGS(sig, p),
>  	TPFMT("sig: %d   task %s:%d", sig, p->comm, p->pid));
> diff --git a/kernel/trace/trace_events.h b/kernel/trace/trace_events.h
> index cb8455b..deb95e5 100644
> --- a/kernel/trace/trace_events.h
> +++ b/kernel/trace/trace_events.h
> @@ -17,8 +17,8 @@ struct ftrace_event_call {
>  #undef TPFMT
>  #define TPFMT(fmt, args...)	fmt "\n", ##args
>  
> -#undef DEFINE_TRACE_FMT
> -#define DEFINE_TRACE_FMT(call, proto, args, fmt)			\
> +#undef TRACE_FORMAT
> +#define TRACE_FORMAT(call, proto, args, fmt)				\
>  static void ftrace_event_##call(proto)					\
>  {									\
>  	event_trace_printk(_RET_IP_, "(" #call ") " fmt);		\
> -- 
> 1.5.6.5
> 
> -- 
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

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

* Re: [PATCH 0/2] [git pull] for tip/tracing/ftrace
  2009-02-25 22:13 [PATCH 0/2] [git pull] for tip/tracing/ftrace Steven Rostedt
  2009-02-25 22:13 ` [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT Steven Rostedt
  2009-02-25 22:13 ` [PATCH 2/2] tracing: wrap arguments with PARAMS Steven Rostedt
@ 2009-02-26  2:49 ` Ingo Molnar
  2 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-02-26  2:49 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
	Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
	Pekka Paalanen, Arnaldo Carvalho de Melo, Jason Baron,
	Martin Bligh, Mathieu Desnoyers, Frank Ch. Eigler,
	KOSAKI Motohiro, Jens Axboe, Masami Hiramatsu


* Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> Ingo,
> 
> Please pull the latest tip/tracing/ftrace tree, which can be found at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/tracing/ftrace
> 
> 
> Steven Rostedt (2):
>       tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT
>       tracing: wrap arguments with PARAMS
> 
> ----
>  include/linux/tracepoint.h        |    5 +++--
>  include/trace/sched_event_types.h |   26 +++++++++++++-------------
>  kernel/trace/trace_events.h       |    4 ++--
>  3 files changed, 18 insertions(+), 17 deletions(-)

Pulled into tip/tracing, thanks Steve!

	Ingo

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

* Re: [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT
  2009-02-25 23:07   ` Mathieu Desnoyers
@ 2009-02-26  3:07     ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2009-02-26  3:07 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
	Peter Zijlstra, Frederic Weisbecker, Theodore Tso,
	Arjan van de Ven, Pekka Paalanen, Arnaldo Carvalho de Melo,
	Jason Baron, Martin Bligh, Frank Ch. Eigler, KOSAKI Motohiro,
	Jens Axboe, Masami Hiramatsu, Steven Rostedt


On Wed, 25 Feb 2009, Mathieu Desnoyers wrote:

> * Steven Rostedt (rostedt@goodmis.org) wrote:
> > From: Steven Rostedt <srostedt@redhat.com>
> > 
> > There's been a bit confusion to whether DEFINE/DECLARE_TRACE_FMT should
> > be a DEFINE or a DECLARE. Ingo Molnar suggested simply calling it
> > TRACE_FORMAT.
> > 
> > Reported-by: Ingo Molnar <mingo@elte.hu>
> > Signed-off-by: Steven Rostedt <srostedt@redhat.com>
> > ---
> >  include/linux/tracepoint.h        |    2 +-
> >  include/trace/sched_event_types.h |   26 +++++++++++++-------------
> >  kernel/trace/trace_events.h       |    4 ++--
> >  3 files changed, 16 insertions(+), 16 deletions(-)
> > 
> > diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> > index 34ae464..3de09fa 100644
> > --- a/include/linux/tracepoint.h
> > +++ b/include/linux/tracepoint.h
> > @@ -153,7 +153,7 @@ static inline void tracepoint_synchronize_unregister(void)
> >  	synchronize_sched();
> >  }
> >  
> > -#define DEFINE_TRACE_FMT(name, proto, args, fmt)		\
> > +#define TRACE_FORMAT(name, proto, args, fmt)		\
> >  	DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))
> >  
> 
> Hi Steven,
> 
> Just to synchronize.. Does the tree you are basing your work on has both
> DEFINE_TRACE and DECLARE_TRACE ? If yes, then I think your TRACE_FORMAT
> should be put in the .c files (not in the headers) and add the format
> string to a supplementary tracepoint field (passed as a supplementary
> parameter to DEFINE_TRACE). Then this format string would become
> available to all tracers which connect to the tracepoints.

There is a DEFINE_TRACE. But those are nicely allocated in files spread
out in the kernel. For example, in kernel/sched.c:

DEFINE_TRACE(sched_wait_task);
DEFINE_TRACE(sched_wakeup);
DEFINE_TRACE(sched_wakeup_new);
DEFINE_TRACE(sched_switch);
DEFINE_TRACE(sched_migrate_task);

and in kernel/fork.c:

DEFINE_TRACE(sched_process_fork);

and in kernel/kthread.c:

DEFINE_TRACE(sched_kthread_stop);
DEFINE_TRACE(sched_kthread_stop_ret);


Since DECLARE_TRACE already has the proto type and names of the variables,
it is easier to work with them in the headers.

Note, any tracer can access these strings. That is what the event tracer 
does:

in kernel/trace/trace_event.h:

#undef DECLARE_TRACE_FMT
#define DECLARE_TRACE_FMT(call, proto, args, fmt, fmt_args)             \
static void ftrace_event_##call(proto)                                  \
{                                                                       \
        event_trace_printk(_RET_IP_, "(%s) " fmt "\n", #call, fmt_args); \
}                                                                       \
                                                                        \
static int ftrace_reg_event_##call(void)                                \
{                                                                       \
        int ret;                                                        \
                                                                        \
        ret = register_trace_##call(ftrace_event_##call);               \
        if (!ret)                                                       \
                pr_info("event trace: Could not activate trace point "  \
                        "probe to " #call);                             \
        return ret;                                                     \
}                                                                       \
                                                                        \
static void ftrace_unreg_event_##call(void)                             \
{                                                                       \
        unregister_trace_##call(ftrace_event_##call);                   \
}                                                                       \
                                                                        \
static struct ftrace_event_call __used                                  \
__attribute__((__aligned__(4)))                                         \
__attribute__((section("_ftrace_events"))) event_##call = {             \
        .name                   = #call,                                \
        .regfunc                = ftrace_reg_event_##call,              \
        .unregfunc              = ftrace_unreg_event_##call,            \
}

And now in events.c:

/* trace/<type>.h here */
#include <trace/sched.h>

#include "trace_events.h"

/* trace/<type>_event_types.h here */
#include <trace/sched_event_types.h>


This makes it very easy to tap into the events. Just by adding these 
headers, I automatically have the events registered, and the ability to 
read the trace points.


> 
> Your probe could then connect to the tracepoint just like any other
> probe, and use the new "format" string available in the tracepoint data
> structure.

But how would it know to read it? The idea is to automatically have the
trace point appear to the tracer, and not have to worry about how to
parse the string.

-- Steve

> 
> This format string would indeed be NULL if tracepoints are declared
> without any format string.
> 
> What do you think of this proposal ?
> 
> Mathieu
> 
> 
> >  #endif
> > diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
> > index a4f6629..a3d3d66 100644
> > --- a/include/trace/sched_event_types.h
> > +++ b/include/trace/sched_event_types.h
> > @@ -1,72 +1,72 @@
> >  
> >  /* use <trace/sched.h> instead */
> > -#ifndef DEFINE_TRACE_FMT
> > +#ifndef TRACE_FORMAT
> >  # error Do not include this file directly.
> >  # error Unless you know what you are doing.
> >  #endif
> >  
> > -DEFINE_TRACE_FMT(sched_kthread_stop,
> > +TRACE_FORMAT(sched_kthread_stop,
> >  	TPPROTO(struct task_struct *t),
> >  	TPARGS(t),
> >  	TPFMT("task %s:%d", t->comm, t->pid));
> >  
> > -DEFINE_TRACE_FMT(sched_kthread_stop_ret,
> > +TRACE_FORMAT(sched_kthread_stop_ret,
> >  	TPPROTO(int ret),
> >  	TPARGS(ret),
> >  	TPFMT("ret=%d", ret));
> >  
> > -DEFINE_TRACE_FMT(sched_wait_task,
> > +TRACE_FORMAT(sched_wait_task,
> >  	TPPROTO(struct rq *rq, struct task_struct *p),
> >  	TPARGS(rq, p),
> >  	TPFMT("task %s:%d", p->comm, p->pid));
> >  
> > -DEFINE_TRACE_FMT(sched_wakeup,
> > +TRACE_FORMAT(sched_wakeup,
> >  	TPPROTO(struct rq *rq, struct task_struct *p, int success),
> >  	TPARGS(rq, p, success),
> >  	TPFMT("task %s:%d %s",
> >  	      p->comm, p->pid, success?"succeeded":"failed"));
> >  
> > -DEFINE_TRACE_FMT(sched_wakeup_new,
> > +TRACE_FORMAT(sched_wakeup_new,
> >  	TPPROTO(struct rq *rq, struct task_struct *p, int success),
> >  	TPARGS(rq, p, success),
> >  	TPFMT("task %s:%d",
> >  	      p->comm, p->pid, success?"succeeded":"failed"));
> >  
> > -DEFINE_TRACE_FMT(sched_switch,
> > +TRACE_FORMAT(sched_switch,
> >  	TPPROTO(struct rq *rq, struct task_struct *prev,
> >  		struct task_struct *next),
> >  	TPARGS(rq, prev, next),
> >  	TPFMT("task %s:%d ==> %s:%d",
> >  	      prev->comm, prev->pid, next->comm, next->pid));
> >  
> > -DEFINE_TRACE_FMT(sched_migrate_task,
> > +TRACE_FORMAT(sched_migrate_task,
> >  	TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
> >  	TPARGS(p, orig_cpu, dest_cpu),
> >  	TPFMT("task %s:%d from: %d  to: %d",
> >  	      p->comm, p->pid, orig_cpu, dest_cpu));
> >  
> > -DEFINE_TRACE_FMT(sched_process_free,
> > +TRACE_FORMAT(sched_process_free,
> >  	TPPROTO(struct task_struct *p),
> >  	TPARGS(p),
> >  	TPFMT("task %s:%d", p->comm, p->pid));
> >  
> > -DEFINE_TRACE_FMT(sched_process_exit,
> > +TRACE_FORMAT(sched_process_exit,
> >  	TPPROTO(struct task_struct *p),
> >  	TPARGS(p),
> >  	TPFMT("task %s:%d", p->comm, p->pid));
> >  
> > -DEFINE_TRACE_FMT(sched_process_wait,
> > +TRACE_FORMAT(sched_process_wait,
> >  	TPPROTO(struct pid *pid),
> >  	TPARGS(pid),
> >  	TPFMT("pid %d", pid));
> >  
> > -DEFINE_TRACE_FMT(sched_process_fork,
> > +TRACE_FORMAT(sched_process_fork,
> >  	TPPROTO(struct task_struct *parent, struct task_struct *child),
> >  	TPARGS(parent, child),
> >  	TPFMT("parent %s:%d  child %s:%d",
> >  	      parent->comm, parent->pid, child->comm, child->pid));
> >  
> > -DEFINE_TRACE_FMT(sched_signal_send,
> > +TRACE_FORMAT(sched_signal_send,
> >  	TPPROTO(int sig, struct task_struct *p),
> >  	TPARGS(sig, p),
> >  	TPFMT("sig: %d   task %s:%d", sig, p->comm, p->pid));
> > diff --git a/kernel/trace/trace_events.h b/kernel/trace/trace_events.h
> > index cb8455b..deb95e5 100644
> > --- a/kernel/trace/trace_events.h
> > +++ b/kernel/trace/trace_events.h
> > @@ -17,8 +17,8 @@ struct ftrace_event_call {
> >  #undef TPFMT
> >  #define TPFMT(fmt, args...)	fmt "\n", ##args
> >  
> > -#undef DEFINE_TRACE_FMT
> > -#define DEFINE_TRACE_FMT(call, proto, args, fmt)			\
> > +#undef TRACE_FORMAT
> > +#define TRACE_FORMAT(call, proto, args, fmt)				\
> >  static void ftrace_event_##call(proto)					\
> >  {									\
> >  	event_trace_printk(_RET_IP_, "(" #call ") " fmt);		\
> > -- 
> > 1.5.6.5
> > 
> > -- 
> > 
> 
> -- 
> Mathieu Desnoyers
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
> 
> 

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

end of thread, other threads:[~2009-02-26  3:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-25 22:13 [PATCH 0/2] [git pull] for tip/tracing/ftrace Steven Rostedt
2009-02-25 22:13 ` [PATCH 1/2] tracing: rename DEFINE_TRACE_FMT to just TRACE_FORMAT Steven Rostedt
2009-02-25 23:07   ` Mathieu Desnoyers
2009-02-26  3:07     ` Steven Rostedt
2009-02-25 22:13 ` [PATCH 2/2] tracing: wrap arguments with PARAMS Steven Rostedt
2009-02-26  2:49 ` [PATCH 0/2] [git pull] for tip/tracing/ftrace Ingo Molnar

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.