All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v11 1/3] tracing: Add DEFINE_EVENT_FN() macro
@ 2013-03-15 20:35 Seiji Aguchi
  2013-03-15 21:10 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Seiji Aguchi @ 2013-03-15 20:35 UTC (permalink / raw)
  To: H. Peter Anvin (hpa@zytor.com), rostedt, x86, linux-kernel
  Cc: Thomas Gleixner (tglx@linutronix.de),
	'mingo@elte.hu' (mingo@elte.hu),
	Borislav Petkov (bp@alien8.de),
	Satoru Moriya (smoriya@redhat.com),
	dle-develop, linux-edac, Luck, Tony (tony.luck@intel.com),
	Paul E. McKenney (paulmck@us.ibm.com)

Each TRACE_EVENT() adds several helper functions. If two or more trace events
share the same structure and print format, they can also share most of these
helper functions and save a lot of space from duplicate code. This is why the
DECLARE_EVENT_CLASS() and DEFINE_EVENT() were created.

Some events require a trigger to be called at registering and unregistering of
the event and to do so they use TRACE_EVENT_FN().

If multiple events require a trigger, they currently have no choice but to use
TRACE_EVENT_FN() as there's no DEFINE_EVENT_FN() available. This unfortunately
causes a lot of wasted duplicate code created.

By adding a DEFINE_EVENT_FN(), these events can still use a
DECLARE_EVENT_CLASS() and then define their own triggers.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
---
 include/linux/tracepoint.h   |    2 ++
 include/trace/define_trace.h |    5 +++++
 include/trace/ftrace.h       |    4 ++++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 2f322c3..9bf59e5 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -378,6 +378,8 @@ static inline void tracepoint_synchronize_unregister(void)
 #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
 #define DEFINE_EVENT(template, name, proto, args)		\
 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
+	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 #define DEFINE_EVENT_CONDITION(template, name, proto,		\
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 1905ca8..02e1003 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -44,6 +44,10 @@
 #define DEFINE_EVENT(template, name, proto, args) \
 	DEFINE_TRACE(name)
 
+#undef DEFINE_EVENT_FN
+#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
+	DEFINE_TRACE_FN(name, reg, unreg)
+
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
 	DEFINE_TRACE(name)
@@ -91,6 +95,7 @@
 #undef TRACE_EVENT_CONDITION
 #undef DECLARE_EVENT_CLASS
 #undef DEFINE_EVENT
+#undef DEFINE_EVENT_FN
 #undef DEFINE_EVENT_PRINT
 #undef DEFINE_EVENT_CONDITION
 #undef TRACE_HEADER_MULTI_READ
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 40dc5e8..7bab676 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -71,6 +71,10 @@
 	static struct ftrace_event_call	__used		\
 	__attribute__((__aligned__(4))) event_##name
 
+#undef DEFINE_EVENT_FN
+#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)	\
+	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
+
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
 	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
-- 1.7.1



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

* Re: [PATCH v11 1/3] tracing: Add DEFINE_EVENT_FN() macro
  2013-03-15 20:35 [PATCH v11 1/3] tracing: Add DEFINE_EVENT_FN() macro Seiji Aguchi
@ 2013-03-15 21:10 ` Steven Rostedt
  2013-03-15 21:17   ` Seiji Aguchi
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2013-03-15 21:10 UTC (permalink / raw)
  To: Seiji Aguchi
  Cc: H. Peter Anvin (hpa@zytor.com),
	x86, linux-kernel, Thomas Gleixner (tglx@linutronix.de),
	'mingo@elte.hu' (mingo@elte.hu),
	Borislav Petkov (bp@alien8.de),
	Satoru Moriya (smoriya@redhat.com),
	dle-develop, linux-edac, Luck, Tony (tony.luck@intel.com),
	Paul E. McKenney (paulmck@us.ibm.com)

You still need to add:

From: Steven Rostedt <rostedt@goodmis.org>

Otherwise you get the authorship of this patch.

-- Steve


On Fri, 2013-03-15 at 20:35 +0000, Seiji Aguchi wrote:
> Each TRACE_EVENT() adds several helper functions. If two or more trace events
> share the same structure and print format, they can also share most of these
> helper functions and save a lot of space from duplicate code. This is why the
> DECLARE_EVENT_CLASS() and DEFINE_EVENT() were created.
> 
> Some events require a trigger to be called at registering and unregistering of
> the event and to do so they use TRACE_EVENT_FN().
> 
> If multiple events require a trigger, they currently have no choice but to use
> TRACE_EVENT_FN() as there's no DEFINE_EVENT_FN() available. This unfortunately
> causes a lot of wasted duplicate code created.
> 
> By adding a DEFINE_EVENT_FN(), these events can still use a
> DECLARE_EVENT_CLASS() and then define their own triggers.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
> ---
>  include/linux/tracepoint.h   |    2 ++
>  include/trace/define_trace.h |    5 +++++
>  include/trace/ftrace.h       |    4 ++++
>  3 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 2f322c3..9bf59e5 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -378,6 +378,8 @@ static inline void tracepoint_synchronize_unregister(void)
>  #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
>  #define DEFINE_EVENT(template, name, proto, args)		\
>  	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
> +#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
> +	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>  #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
>  	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>  #define DEFINE_EVENT_CONDITION(template, name, proto,		\
> diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
> index 1905ca8..02e1003 100644
> --- a/include/trace/define_trace.h
> +++ b/include/trace/define_trace.h
> @@ -44,6 +44,10 @@
>  #define DEFINE_EVENT(template, name, proto, args) \
>  	DEFINE_TRACE(name)
>  
> +#undef DEFINE_EVENT_FN
> +#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
> +	DEFINE_TRACE_FN(name, reg, unreg)
> +
>  #undef DEFINE_EVENT_PRINT
>  #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
>  	DEFINE_TRACE(name)
> @@ -91,6 +95,7 @@
>  #undef TRACE_EVENT_CONDITION
>  #undef DECLARE_EVENT_CLASS
>  #undef DEFINE_EVENT
> +#undef DEFINE_EVENT_FN
>  #undef DEFINE_EVENT_PRINT
>  #undef DEFINE_EVENT_CONDITION
>  #undef TRACE_HEADER_MULTI_READ
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index 40dc5e8..7bab676 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -71,6 +71,10 @@
>  	static struct ftrace_event_call	__used		\
>  	__attribute__((__aligned__(4))) event_##name
>  
> +#undef DEFINE_EVENT_FN
> +#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)	\
> +	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
> +
>  #undef DEFINE_EVENT_PRINT
>  #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
>  	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
> -- 1.7.1
> 



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

* RE: [PATCH v11 1/3] tracing: Add DEFINE_EVENT_FN() macro
  2013-03-15 21:10 ` Steven Rostedt
@ 2013-03-15 21:17   ` Seiji Aguchi
  0 siblings, 0 replies; 3+ messages in thread
From: Seiji Aguchi @ 2013-03-15 21:17 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: H. Peter Anvin (hpa@zytor.com),
	x86, linux-kernel, Thomas Gleixner (tglx@linutronix.de),
	'mingo@elte.hu' (mingo@elte.hu),
	Borislav Petkov (bp@alien8.de),
	Satoru Moriya (smoriya@redhat.com),
	dle-develop, linux-edac, Luck, Tony (tony.luck@intel.com),
	Paul E. McKenney (paulmck@us.ibm.com)

> You still need to add:
> 
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> Otherwise you get the authorship of this patch.

My apologies.  I resend my patch 1/3 by adding it shortly.

Seiji

> -----Original Message-----
> From: Steven Rostedt [mailto:rostedt@goodmis.org]
> Sent: Friday, March 15, 2013 5:10 PM
> To: Seiji Aguchi
> Cc: H. Peter Anvin (hpa@zytor.com); x86@kernel.org; linux-kernel@vger.kernel.org; Thomas Gleixner (tglx@linutronix.de);
> 'mingo@elte.hu' (mingo@elte.hu); Borislav Petkov (bp@alien8.de); Satoru Moriya (smoriya@redhat.com); dle-
> develop@lists.sourceforge.net; linux-edac@vger.kernel.org; Luck, Tony (tony.luck@intel.com); Paul E. McKenney
> (paulmck@us.ibm.com)
> Subject: Re: [PATCH v11 1/3] tracing: Add DEFINE_EVENT_FN() macro
> 
> You still need to add:
> 
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> Otherwise you get the authorship of this patch.
> 
> -- Steve
> 
> 
> On Fri, 2013-03-15 at 20:35 +0000, Seiji Aguchi wrote:
> > Each TRACE_EVENT() adds several helper functions. If two or more trace
> > events share the same structure and print format, they can also share
> > most of these helper functions and save a lot of space from duplicate
> > code. This is why the
> > DECLARE_EVENT_CLASS() and DEFINE_EVENT() were created.
> >
> > Some events require a trigger to be called at registering and
> > unregistering of the event and to do so they use TRACE_EVENT_FN().
> >
> > If multiple events require a trigger, they currently have no choice
> > but to use
> > TRACE_EVENT_FN() as there's no DEFINE_EVENT_FN() available. This
> > unfortunately causes a lot of wasted duplicate code created.
> >
> > By adding a DEFINE_EVENT_FN(), these events can still use a
> > DECLARE_EVENT_CLASS() and then define their own triggers.
> >
> > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> > Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
> > ---
> >  include/linux/tracepoint.h   |    2 ++
> >  include/trace/define_trace.h |    5 +++++
> >  include/trace/ftrace.h       |    4 ++++
> >  3 files changed, 11 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> > index 2f322c3..9bf59e5 100644
> > --- a/include/linux/tracepoint.h
> > +++ b/include/linux/tracepoint.h
> > @@ -378,6 +378,8 @@ static inline void
> > tracepoint_synchronize_unregister(void)
> >  #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
> >  #define DEFINE_EVENT(template, name, proto, args)		\
> >  	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
> > +#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
> > +	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
> >  #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
> >  	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
> >  #define DEFINE_EVENT_CONDITION(template, name, proto,		\
> > diff --git a/include/trace/define_trace.h
> > b/include/trace/define_trace.h index 1905ca8..02e1003 100644
> > --- a/include/trace/define_trace.h
> > +++ b/include/trace/define_trace.h
> > @@ -44,6 +44,10 @@
> >  #define DEFINE_EVENT(template, name, proto, args) \
> >  	DEFINE_TRACE(name)
> >
> > +#undef DEFINE_EVENT_FN
> > +#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
> > +	DEFINE_TRACE_FN(name, reg, unreg)
> > +
> >  #undef DEFINE_EVENT_PRINT
> >  #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
> >  	DEFINE_TRACE(name)
> > @@ -91,6 +95,7 @@
> >  #undef TRACE_EVENT_CONDITION
> >  #undef DECLARE_EVENT_CLASS
> >  #undef DEFINE_EVENT
> > +#undef DEFINE_EVENT_FN
> >  #undef DEFINE_EVENT_PRINT
> >  #undef DEFINE_EVENT_CONDITION
> >  #undef TRACE_HEADER_MULTI_READ
> > diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index
> > 40dc5e8..7bab676 100644
> > --- a/include/trace/ftrace.h
> > +++ b/include/trace/ftrace.h
> > @@ -71,6 +71,10 @@
> >  	static struct ftrace_event_call	__used		\
> >  	__attribute__((__aligned__(4))) event_##name
> >
> > +#undef DEFINE_EVENT_FN
> > +#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)	\
> > +	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
> > +
> >  #undef DEFINE_EVENT_PRINT
> >  #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
> >  	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
> > -- 1.7.1
> >
> 


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

end of thread, other threads:[~2013-03-15 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 20:35 [PATCH v11 1/3] tracing: Add DEFINE_EVENT_FN() macro Seiji Aguchi
2013-03-15 21:10 ` Steven Rostedt
2013-03-15 21:17   ` Seiji Aguchi

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.