public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: fix TRACE_EVENT power tracepoint creation
@ 2010-10-28  2:16 Mathieu Desnoyers
  2010-10-28  2:25 ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Desnoyers @ 2010-10-28  2:16 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel

DEFINE_TRACE should also exist when CONFIG_EVENT_TRACING=n. Otherwise, setting
only TRACEPOINTS=y is broken.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 kernel/Makefile             |    1 +
 kernel/trace/Makefile       |    2 +-
 kernel/trace/power-traces.c |    6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/kernel/Makefile
===================================================================
--- linux-2.6-lttng.orig/kernel/Makefile
+++ linux-2.6-lttng/kernel/Makefile
@@ -93,6 +93,7 @@ obj-$(CONFIG_TASKSTATS) += taskstats.o t
 obj-$(USE_IMMEDIATE) += immediate.o
 obj-$(CONFIG_MARKERS) += marker.o
 obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
+obj-$(CONFIG_TRACEPOINTS) += trace/
 obj-$(CONFIG_LATENCYTOP) += latencytop.o
 obj-$(CONFIG_BINFMT_ELF) += elfcore.o
 obj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o
Index: linux-2.6-lttng/kernel/trace/Makefile
===================================================================
--- linux-2.6-lttng.orig/kernel/trace/Makefile
+++ linux-2.6-lttng/kernel/trace/Makefile
@@ -52,7 +52,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_eve
 endif
 obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
-obj-$(CONFIG_EVENT_TRACING) += power-traces.o
+obj-$(CONFIG_TRACEPOINTS) += power-traces.o
 ifeq ($(CONFIG_TRACING),y)
 obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
 endif
Index: linux-2.6-lttng/kernel/trace/power-traces.c
===================================================================
--- linux-2.6-lttng.orig/kernel/trace/power-traces.c
+++ linux-2.6-lttng/kernel/trace/power-traces.c
@@ -10,8 +10,14 @@
 #include <linux/sched.h>
 #include <linux/module.h>
 
+#ifdef CONFIG_EVENT_TRACING
 #define CREATE_TRACE_POINTS
 #include <trace/events/power.h>
+#else
+DEFINE_TRACE(power_start);
+DEFINE_TRACE(power_end);
+DEFINE_TRACE(power_frequency);
+#endif
 
 EXPORT_TRACEPOINT_SYMBOL_GPL(power_frequency);
 
-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

* Re: [PATCH] tracing: fix TRACE_EVENT power tracepoint creation
  2010-10-28  2:16 [PATCH] tracing: fix TRACE_EVENT power tracepoint creation Mathieu Desnoyers
@ 2010-10-28  2:25 ` Steven Rostedt
  2010-10-28 11:03   ` Mathieu Desnoyers
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2010-10-28  2:25 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: linux-kernel

On Wed, 2010-10-27 at 22:16 -0400, Mathieu Desnoyers wrote:
> DEFINE_TRACE should also exist when CONFIG_EVENT_TRACING=n. Otherwise, setting
> only TRACEPOINTS=y is broken.

NAK, DEFINE_TRACE is deprecated from use outside the tracing
infrastructure.

> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> ---
>  kernel/Makefile             |    1 +
>  kernel/trace/Makefile       |    2 +-
>  kernel/trace/power-traces.c |    6 ++++++
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6-lttng/kernel/Makefile
> ===================================================================
> --- linux-2.6-lttng.orig/kernel/Makefile
> +++ linux-2.6-lttng/kernel/Makefile
> @@ -93,6 +93,7 @@ obj-$(CONFIG_TASKSTATS) += taskstats.o t
>  obj-$(USE_IMMEDIATE) += immediate.o
>  obj-$(CONFIG_MARKERS) += marker.o
>  obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
> +obj-$(CONFIG_TRACEPOINTS) += trace/
>  obj-$(CONFIG_LATENCYTOP) += latencytop.o
>  obj-$(CONFIG_BINFMT_ELF) += elfcore.o
>  obj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o
> Index: linux-2.6-lttng/kernel/trace/Makefile
> ===================================================================
> --- linux-2.6-lttng.orig/kernel/trace/Makefile
> +++ linux-2.6-lttng/kernel/trace/Makefile
> @@ -52,7 +52,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_eve
>  endif
>  obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
>  obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
> -obj-$(CONFIG_EVENT_TRACING) += power-traces.o
> +obj-$(CONFIG_TRACEPOINTS) += power-traces.o
>  ifeq ($(CONFIG_TRACING),y)
>  obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
>  endif
> Index: linux-2.6-lttng/kernel/trace/power-traces.c
> ===================================================================
> --- linux-2.6-lttng.orig/kernel/trace/power-traces.c
> +++ linux-2.6-lttng/kernel/trace/power-traces.c
> @@ -10,8 +10,14 @@
>  #include <linux/sched.h>
>  #include <linux/module.h>
>  
> +#ifdef CONFIG_EVENT_TRACING
>  #define CREATE_TRACE_POINTS
>  #include <trace/events/power.h>
> +#else
> +DEFINE_TRACE(power_start);
> +DEFINE_TRACE(power_end);
> +DEFINE_TRACE(power_frequency);
> +#endif

The trace/events/power.h file should handle the DEFINE_TRACE() when
CONFIG_EVENT_TRACING is not set. Thus, this is the wrong fix.

-- Steve

>  
>  EXPORT_TRACEPOINT_SYMBOL_GPL(power_frequency);
>  



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

* Re: [PATCH] tracing: fix TRACE_EVENT power tracepoint creation
  2010-10-28  2:25 ` Steven Rostedt
@ 2010-10-28 11:03   ` Mathieu Desnoyers
  2010-10-28 12:53     ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Desnoyers @ 2010-10-28 11:03 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel

* Steven Rostedt (rostedt@goodmis.org) wrote:
> On Wed, 2010-10-27 at 22:16 -0400, Mathieu Desnoyers wrote:
> > DEFINE_TRACE should also exist when CONFIG_EVENT_TRACING=n. Otherwise, setting
> > only TRACEPOINTS=y is broken.
> 
> NAK, DEFINE_TRACE is deprecated from use outside the tracing
> infrastructure.
> 
[...]
> The trace/events/power.h file should handle the DEFINE_TRACE() when
> CONFIG_EVENT_TRACING is not set. Thus, this is the wrong fix.

DEFINE_TRACE() must only be done once over the whole kernel for a particular
tracepoint. Currently, it is done in power-traces.c when CONFIG_EVENT_TRACING is
activated. This is the only instance where trace/power.h is included with
CREATE_TRACE_POINTS set.

Given that trace/power.h is inluded in more than one .c file, generating
DEFINE_TRACE() when CREATE_TRACE_POINTS is not set does not work. So what
alternative do you suggest ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

* Re: [PATCH] tracing: fix TRACE_EVENT power tracepoint creation
  2010-10-28 11:03   ` Mathieu Desnoyers
@ 2010-10-28 12:53     ` Steven Rostedt
  2010-10-28 13:17       ` Mathieu Desnoyers
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2010-10-28 12:53 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: linux-kernel

On Thu, 2010-10-28 at 07:03 -0400, Mathieu Desnoyers wrote:

> Given that trace/power.h is inluded in more than one .c file, generating
> DEFINE_TRACE() when CREATE_TRACE_POINTS is not set does not work. So what
> alternative do you suggest ?

Right, DEFINE_TRACE should only be set when CREATE_TRACE_POINTS is set,
and that is only set in the C file that the DEFINE_TRACE is to be
defined.

In fact, I don't even see what bug you are trying to fix?

The file include/trace/define_trace.h converts all the TRACE_EVENTS()
into DEFINE_TRACE() when CREATE_TRACE_POINTS is set. No other C file
that includes power.h should have CREATE_TRACE_POINTS set. I guess if it
did, the CONFIG_EVENT_TRACING would break too.

It should just work.

-- Steve



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

* Re: [PATCH] tracing: fix TRACE_EVENT power tracepoint creation
  2010-10-28 12:53     ` Steven Rostedt
@ 2010-10-28 13:17       ` Mathieu Desnoyers
  2010-10-28 14:33         ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Desnoyers @ 2010-10-28 13:17 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel

* Steven Rostedt (rostedt@goodmis.org) wrote:
> On Thu, 2010-10-28 at 07:03 -0400, Mathieu Desnoyers wrote:
> 
> > Given that trace/power.h is inluded in more than one .c file, generating
> > DEFINE_TRACE() when CREATE_TRACE_POINTS is not set does not work. So what
> > alternative do you suggest ?
> 
> Right, DEFINE_TRACE should only be set when CREATE_TRACE_POINTS is set,
> and that is only set in the C file that the DEFINE_TRACE is to be
> defined.
> 
> In fact, I don't even see what bug you are trying to fix?
> 
> The file include/trace/define_trace.h converts all the TRACE_EVENTS()
> into DEFINE_TRACE() when CREATE_TRACE_POINTS is set. No other C file
> that includes power.h should have CREATE_TRACE_POINTS set. I guess if it
> did, the CONFIG_EVENT_TRACING would break too.
> 
> It should just work.

This is the culprit:

kernel/trace/ is not built when CONFIG_TRACING=n
kernel/trace/power-traces.o is only built when CONFIG_EVENT_TRACING=y

So the DEFINE_TRACE is never done when CONFIG_EVENT_TRACING=n or
CONFIG_TRACING=n.

What you are telling me is that changing the makefiles should be enough, and I
don't need to add those DEFINE_TRACE(), correct ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

* Re: [PATCH] tracing: fix TRACE_EVENT power tracepoint creation
  2010-10-28 13:17       ` Mathieu Desnoyers
@ 2010-10-28 14:33         ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2010-10-28 14:33 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: linux-kernel

On Thu, 2010-10-28 at 09:17 -0400, Mathieu Desnoyers wrote:

> What you are telling me is that changing the makefiles should be enough, and I
> don't need to add those DEFINE_TRACE(), correct ?

Correct.

-- Steve



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

end of thread, other threads:[~2010-10-28 14:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28  2:16 [PATCH] tracing: fix TRACE_EVENT power tracepoint creation Mathieu Desnoyers
2010-10-28  2:25 ` Steven Rostedt
2010-10-28 11:03   ` Mathieu Desnoyers
2010-10-28 12:53     ` Steven Rostedt
2010-10-28 13:17       ` Mathieu Desnoyers
2010-10-28 14:33         ` Steven Rostedt

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