All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: create events only when configed
@ 2009-05-22  9:40 Lai Jiangshan
  2009-05-24 21:05 ` Frederic Weisbecker
  2009-05-26 16:38 ` Steven Rostedt
  0 siblings, 2 replies; 6+ messages in thread
From: Lai Jiangshan @ 2009-05-22  9:40 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, LKML, Frederic Weisbecker


There some unneeded events in debugfs/tracing/ftrace/ when the
corresponding CONFIG_XXXX=n.

And when CONFIG_ENABLE_EVENT_TRACING=n, various events
are still created.

Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
not created, trace_export.c is compiled only for creating
TRACEPOINTs.

[Impact:] cleanup

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index f7a7ae1..e4e0e7a 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -52,7 +52,7 @@
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_TRACING
+#ifdef CONFIG_ENABLE_EVENT_TRACING
 #include <trace/ftrace.h>
 #endif
 
diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h
index 5e32e37..5c9813e 100644
--- a/kernel/trace/trace_event_types.h
+++ b/kernel/trace/trace_event_types.h
@@ -13,6 +13,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
 	TP_RAW_FMT(" %lx <-- %lx")
 );
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
 		   ftrace_graph_ent_entry, ignore,
 	TRACE_STRUCT(
@@ -30,6 +31,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
 	),
 	TP_RAW_FMT("<-- %lx (%d)")
 );
+#endif
 
 TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
 	TRACE_STRUCT(
@@ -66,6 +68,7 @@ TRACE_EVENT_FORMAT_NOFILTER(special, TRACE_SPECIAL, special_entry, ignore,
 	TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
 );
 
+#ifdef CONFIG_STACKTRACE
 /*
  * Stack-trace entry:
  */
@@ -101,6 +104,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
 	TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
 		 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
 );
+#endif
 
 TRACE_EVENT_FORMAT(bprint, TRACE_BPRINT, bprint_entry, ignore,
 	TRACE_STRUCT(
@@ -119,6 +123,7 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
 	TP_RAW_FMT("%08lx (%d) fmt:%p %s")
 );
 
+#ifdef CONFIG_BRANCH_TRACER
 TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD(unsigned int, line, line)
@@ -130,7 +135,9 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
 	),
 	TP_RAW_FMT("%u:%s:%s (%u)")
 );
+#endif
 
+#ifdef CONFIG_HW_BRANCH_TRACER
 TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD(u64, from, from)
@@ -138,7 +145,9 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
 	),
 	TP_RAW_FMT("from: %llx to: %llx")
 );
+#endif
 
+#ifdef CONFIG_POWER_TRACER
 TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD_SIGN(ktime_t, state_data.stamp, stamp, 1)
@@ -148,7 +157,9 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
 	),
 	TP_RAW_FMT("%llx->%llx type:%u state:%u")
 );
+#endif
 
+#ifdef CONFIG_KMEMTRACE
 TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD(enum kmemtrace_type_id, type_id, type_id)
@@ -171,5 +182,6 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
 	),
 	TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
 );
+#endif
 
 #undef TRACE_SYSTEM







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

* Re: [PATCH] tracing: create events only when configed
  2009-05-22  9:40 [PATCH] tracing: create events only when configed Lai Jiangshan
@ 2009-05-24 21:05 ` Frederic Weisbecker
  2009-05-25  1:03   ` Lai Jiangshan
  2009-05-26 16:38 ` Steven Rostedt
  1 sibling, 1 reply; 6+ messages in thread
From: Frederic Weisbecker @ 2009-05-24 21:05 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Ingo Molnar, Steven Rostedt, LKML

On Fri, May 22, 2009 at 05:40:23PM +0800, Lai Jiangshan wrote:
> 
> There some unneeded events in debugfs/tracing/ftrace/ when the
> corresponding CONFIG_XXXX=n.
> 
> And when CONFIG_ENABLE_EVENT_TRACING=n, various events
> are still created.
> 
> Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
> not created, trace_export.c is compiled only for creating
> TRACEPOINTs.
> 
> [Impact:] cleanup
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>


Looks good.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>


> ---
> diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
> index f7a7ae1..e4e0e7a 100644
> --- a/include/trace/define_trace.h
> +++ b/include/trace/define_trace.h
> @@ -52,7 +52,7 @@
>  
>  #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
>  
> -#ifdef CONFIG_EVENT_TRACING
> +#ifdef CONFIG_ENABLE_EVENT_TRACING
>  #include <trace/ftrace.h>
>  #endif
>  
> diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h
> index 5e32e37..5c9813e 100644
> --- a/kernel/trace/trace_event_types.h
> +++ b/kernel/trace/trace_event_types.h
> @@ -13,6 +13,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
>  	TP_RAW_FMT(" %lx <-- %lx")
>  );
>  
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>  TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
>  		   ftrace_graph_ent_entry, ignore,
>  	TRACE_STRUCT(
> @@ -30,6 +31,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
>  	),
>  	TP_RAW_FMT("<-- %lx (%d)")
>  );
> +#endif
>  
>  TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
>  	TRACE_STRUCT(
> @@ -66,6 +68,7 @@ TRACE_EVENT_FORMAT_NOFILTER(special, TRACE_SPECIAL, special_entry, ignore,
>  	TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
>  );
>  
> +#ifdef CONFIG_STACKTRACE
>  /*
>   * Stack-trace entry:
>   */
> @@ -101,6 +104,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
>  	TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
>  		 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
>  );
> +#endif
>  
>  TRACE_EVENT_FORMAT(bprint, TRACE_BPRINT, bprint_entry, ignore,
>  	TRACE_STRUCT(
> @@ -119,6 +123,7 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
>  	TP_RAW_FMT("%08lx (%d) fmt:%p %s")
>  );
>  
> +#ifdef CONFIG_BRANCH_TRACER
>  TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD(unsigned int, line, line)
> @@ -130,7 +135,9 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
>  	),
>  	TP_RAW_FMT("%u:%s:%s (%u)")
>  );
> +#endif
>  
> +#ifdef CONFIG_HW_BRANCH_TRACER
>  TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD(u64, from, from)
> @@ -138,7 +145,9 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
>  	),
>  	TP_RAW_FMT("from: %llx to: %llx")
>  );
> +#endif
>  
> +#ifdef CONFIG_POWER_TRACER
>  TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD_SIGN(ktime_t, state_data.stamp, stamp, 1)
> @@ -148,7 +157,9 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
>  	),
>  	TP_RAW_FMT("%llx->%llx type:%u state:%u")
>  );
> +#endif
>  
> +#ifdef CONFIG_KMEMTRACE
>  TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD(enum kmemtrace_type_id, type_id, type_id)
> @@ -171,5 +182,6 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
>  	),
>  	TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
>  );
> +#endif
>  
>  #undef TRACE_SYSTEM
> 
> 
> 
> 
> 
> 


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

* Re: [PATCH] tracing: create events only when configed
  2009-05-24 21:05 ` Frederic Weisbecker
@ 2009-05-25  1:03   ` Lai Jiangshan
  2009-05-25 23:18     ` Frederic Weisbecker
  0 siblings, 1 reply; 6+ messages in thread
From: Lai Jiangshan @ 2009-05-25  1:03 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Ingo Molnar, Steven Rostedt, LKML

Frederic Weisbecker wrote:
> On Fri, May 22, 2009 at 05:40:23PM +0800, Lai Jiangshan wrote:
>> There some unneeded events in debugfs/tracing/ftrace/ when the
>> corresponding CONFIG_XXXX=n.
>>
>> And when CONFIG_ENABLE_EVENT_TRACING=n, various events
>> are still created.
>>
>> Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
>> not created, trace_export.c is compiled only for creating
>> TRACEPOINTs.

I'm sorry for this incorrect changelog.
The TRACEPOINTs are not defined in trace_export.c.

>>
>> [Impact:] cleanup
>>
>> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> 
> 
> Looks good.
> 
> Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> 
> 

Thanx, changelog is rewrote

Frome: Lai Jiangshan <laijs@cn.fujitsu.com>

There some unneeded events in debugfs/tracing/ftrace/ when the
corresponding CONFIG_XXXX=n.

And when CONFIG_ENABLE_EVENT_TRACING=n, various events
are still created.

Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
not created. And TRACEPOINTs are created.

[Impact:] cleanup

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index f7a7ae1..e4e0e7a 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -52,7 +52,7 @@
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_TRACING
+#ifdef CONFIG_ENABLE_EVENT_TRACING
 #include <trace/ftrace.h>
 #endif
 
diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h
index 5e32e37..5c9813e 100644
--- a/kernel/trace/trace_event_types.h
+++ b/kernel/trace/trace_event_types.h
@@ -13,6 +13,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
 	TP_RAW_FMT(" %lx <-- %lx")
 );
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
 		   ftrace_graph_ent_entry, ignore,
 	TRACE_STRUCT(
@@ -30,6 +31,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
 	),
 	TP_RAW_FMT("<-- %lx (%d)")
 );
+#endif
 
 TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
 	TRACE_STRUCT(
@@ -66,6 +68,7 @@ TRACE_EVENT_FORMAT_NOFILTER(special, TRACE_SPECIAL, special_entry, ignore,
 	TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
 );
 
+#ifdef CONFIG_STACKTRACE
 /*
  * Stack-trace entry:
  */
@@ -101,6 +104,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
 	TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
 		 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
 );
+#endif
 
 TRACE_EVENT_FORMAT(bprint, TRACE_BPRINT, bprint_entry, ignore,
 	TRACE_STRUCT(
@@ -119,6 +123,7 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
 	TP_RAW_FMT("%08lx (%d) fmt:%p %s")
 );
 
+#ifdef CONFIG_BRANCH_TRACER
 TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD(unsigned int, line, line)
@@ -130,7 +135,9 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
 	),
 	TP_RAW_FMT("%u:%s:%s (%u)")
 );
+#endif
 
+#ifdef CONFIG_HW_BRANCH_TRACER
 TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD(u64, from, from)
@@ -138,7 +145,9 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
 	),
 	TP_RAW_FMT("from: %llx to: %llx")
 );
+#endif
 
+#ifdef CONFIG_POWER_TRACER
 TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD_SIGN(ktime_t, state_data.stamp, stamp, 1)
@@ -148,7 +157,9 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
 	),
 	TP_RAW_FMT("%llx->%llx type:%u state:%u")
 );
+#endif
 
+#ifdef CONFIG_KMEMTRACE
 TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
 	TRACE_STRUCT(
 		TRACE_FIELD(enum kmemtrace_type_id, type_id, type_id)
@@ -171,5 +182,6 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
 	),
 	TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
 );
+#endif
 
 #undef TRACE_SYSTEM


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

* Re: [PATCH] tracing: create events only when configed
  2009-05-25  1:03   ` Lai Jiangshan
@ 2009-05-25 23:18     ` Frederic Weisbecker
  0 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-05-25 23:18 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Ingo Molnar, Steven Rostedt, LKML

On Mon, May 25, 2009 at 09:03:36AM +0800, Lai Jiangshan wrote:
> Frederic Weisbecker wrote:
> > On Fri, May 22, 2009 at 05:40:23PM +0800, Lai Jiangshan wrote:
> >> There some unneeded events in debugfs/tracing/ftrace/ when the
> >> corresponding CONFIG_XXXX=n.
> >>
> >> And when CONFIG_ENABLE_EVENT_TRACING=n, various events
> >> are still created.
> >>
> >> Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
> >> not created, trace_export.c is compiled only for creating
> >> TRACEPOINTs.
> 
> I'm sorry for this incorrect changelog.
> The TRACEPOINTs are not defined in trace_export.c.


Thanks Lai.
The patch is fine and fixes a real waste of memory.

Well, the problem is that it fixes two wastes of memory:

- the creation of tracer events when the corresponding tracers are
  not configured

- the creation of events when CONFIG_ENABLE_EVENT_TRACING is not set
  but CONFIG_EVENT_TRACING=y


It would be nice if you could split it up in two patches.

Also you seem to have missed some tracers in the CPP checks,
such as function tracer, sched switch tracer, ...

Thanks.

Frederic.

 
> >>
> >> [Impact:] cleanup
> >>
> >> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > 
> > 
> > Looks good.
> > 
> > Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> > 
> > 
> 
> Thanx, changelog is rewrote
> 
> Frome: Lai Jiangshan <laijs@cn.fujitsu.com>
> 
> There some unneeded events in debugfs/tracing/ftrace/ when the
> corresponding CONFIG_XXXX=n.
> 
> And when CONFIG_ENABLE_EVENT_TRACING=n, various events
> are still created.
> 
> Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
> not created. And TRACEPOINTs are created.
> 
> [Impact:] cleanup
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
> index f7a7ae1..e4e0e7a 100644
> --- a/include/trace/define_trace.h
> +++ b/include/trace/define_trace.h
> @@ -52,7 +52,7 @@
>  
>  #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
>  
> -#ifdef CONFIG_EVENT_TRACING
> +#ifdef CONFIG_ENABLE_EVENT_TRACING
>  #include <trace/ftrace.h>
>  #endif
>  
> diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h
> index 5e32e37..5c9813e 100644
> --- a/kernel/trace/trace_event_types.h
> +++ b/kernel/trace/trace_event_types.h
> @@ -13,6 +13,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
>  	TP_RAW_FMT(" %lx <-- %lx")
>  );
>  
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>  TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
>  		   ftrace_graph_ent_entry, ignore,
>  	TRACE_STRUCT(
> @@ -30,6 +31,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
>  	),
>  	TP_RAW_FMT("<-- %lx (%d)")
>  );
> +#endif
>  
>  TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
>  	TRACE_STRUCT(
> @@ -66,6 +68,7 @@ TRACE_EVENT_FORMAT_NOFILTER(special, TRACE_SPECIAL, special_entry, ignore,
>  	TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
>  );
>  
> +#ifdef CONFIG_STACKTRACE
>  /*
>   * Stack-trace entry:
>   */
> @@ -101,6 +104,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
>  	TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
>  		 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
>  );
> +#endif
>  
>  TRACE_EVENT_FORMAT(bprint, TRACE_BPRINT, bprint_entry, ignore,
>  	TRACE_STRUCT(
> @@ -119,6 +123,7 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
>  	TP_RAW_FMT("%08lx (%d) fmt:%p %s")
>  );
>  
> +#ifdef CONFIG_BRANCH_TRACER
>  TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD(unsigned int, line, line)
> @@ -130,7 +135,9 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
>  	),
>  	TP_RAW_FMT("%u:%s:%s (%u)")
>  );
> +#endif
>  
> +#ifdef CONFIG_HW_BRANCH_TRACER
>  TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD(u64, from, from)
> @@ -138,7 +145,9 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
>  	),
>  	TP_RAW_FMT("from: %llx to: %llx")
>  );
> +#endif
>  
> +#ifdef CONFIG_POWER_TRACER
>  TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD_SIGN(ktime_t, state_data.stamp, stamp, 1)
> @@ -148,7 +157,9 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
>  	),
>  	TP_RAW_FMT("%llx->%llx type:%u state:%u")
>  );
> +#endif
>  
> +#ifdef CONFIG_KMEMTRACE
>  TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
>  	TRACE_STRUCT(
>  		TRACE_FIELD(enum kmemtrace_type_id, type_id, type_id)
> @@ -171,5 +182,6 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
>  	),
>  	TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
>  );
> +#endif
>  
>  #undef TRACE_SYSTEM
> 


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

* Re: [PATCH] tracing: create events only when configed
  2009-05-22  9:40 [PATCH] tracing: create events only when configed Lai Jiangshan
  2009-05-24 21:05 ` Frederic Weisbecker
@ 2009-05-26 16:38 ` Steven Rostedt
  2009-05-27  8:19   ` Lai Jiangshan
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2009-05-26 16:38 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Ingo Molnar, LKML, Frederic Weisbecker


On Fri, 22 May 2009, Lai Jiangshan wrote:

> 
> There some unneeded events in debugfs/tracing/ftrace/ when the
> corresponding CONFIG_XXXX=n.
> 
> And when CONFIG_ENABLE_EVENT_TRACING=n, various events
> are still created.
> 
> Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
> not created, trace_export.c is compiled only for creating
> TRACEPOINTs.
> 
> [Impact:] cleanup

I have an issue with this patch. I purposely kept the 
debugfs/tracing/ftrace events there since you may have a binary buffer 
that you want to read that has those events but you are not running a 
kernel that enabled them. But I guess the counter arguement for that is 
then those events may not be the same offset as the kernel that ran it. 
OK, maybe it would be fine to disable the events if the kernel does not 
use them. We should also put the same #ifdef's around the structs to make 
sure no other trace uses them.

Still seems a bit messy with all those ifdefs :-/

The second change with the CONFIG_ENABLE_EVENT_TRACER is something that we 
are having issue with the make scripts. We want EVENT_TRACE enabled 
anytime TRACING is enabled. We do _not_ want to disable it.

The config option is there to enable event_tracer when on other tracing is 
enabled. But we can't get rid of the option when tracing is enabled, 
because we run into circular dependecies. Here's what we want:

	config TRACING
		select CONFIG_EVENT_TRACER

	config CONFIG_ENABLE_EVENT_TRACING
		prompt "select event tracer"
		depends on !TRACING
		select CONFIG_EVENT_TRACER

but!

	config CONFIG_EVENT_TRACER
		select TRACING

Which we then get an error creating the kbuild system due to dependency 
problems.

The event tracer prompt should not be there when tracing is selected, 
since we already have events, but I have yet to figure out how to get rid 
of it.

Thus, I'll be OK with the first part of your patch, but I'm against the 
second part.

-- Steve



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

* Re: [PATCH] tracing: create events only when configed
  2009-05-26 16:38 ` Steven Rostedt
@ 2009-05-27  8:19   ` Lai Jiangshan
  0 siblings, 0 replies; 6+ messages in thread
From: Lai Jiangshan @ 2009-05-27  8:19 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Ingo Molnar, LKML, Frederic Weisbecker

Steven Rostedt wrote:
> On Fri, 22 May 2009, Lai Jiangshan wrote:
> 
>> There some unneeded events in debugfs/tracing/ftrace/ when the
>> corresponding CONFIG_XXXX=n.
>>
>> And when CONFIG_ENABLE_EVENT_TRACING=n, various events
>> are still created.
>>
>> Now when CONFIG_ENABLE_EVENT_TRACING=n, various events are
>> not created, trace_export.c is compiled only for creating
>> TRACEPOINTs.
>>
>> [Impact:] cleanup
> 
> I have an issue with this patch. I purposely kept the 
> debugfs/tracing/ftrace events there since you may have a binary buffer 
> that you want to read that has those events but you are not running a 
> kernel that enabled them. But I guess the counter arguement for that is 
> then those events may not be the same offset as the kernel that ran it. 
> OK, maybe it would be fine to disable the events if the kernel does not 
> use them. 

All these offset/format/id(except TRACE_EVENT's id) are constant
when kernel built.

Could we GENERATE all these info when kernel built?

This info will be installed to system when we 'make modules_install',
and this info will be put into kernel-XXXXX.rpm by distributions
which enable ftrace.

This will highly help for reading a binary buffer which events
are not for current running kernel. (And this binary buffer is
maybe extracted a vmcore.)

> We should also put the same #ifdef's around the structs to make 
> sure no other trace uses them.

Maybe I miss something,  I have no idea around WHICH structs
we should also put the same #ifdef's. ^_^

> 
> Still seems a bit messy with all those ifdefs :-/
> 
> The second change with the CONFIG_ENABLE_EVENT_TRACER is something that we 
> are having issue with the make scripts. We want EVENT_TRACE enabled 
> anytime TRACING is enabled. We do _not_ want to disable it.
> 

Thank you for told me.

One other thing:

config EVENT_TRACING
	bool

config TRACING
	bool
	select DEBUG_FS
	select RING_BUFFER
	select STACKTRACE if STACKTRACE_SUPPORT
	select TRACEPOINTS
	select NOP_TRACER
	select BINARY_PRINTF
	select EVENT_TRACING

No other config slects EVENT_TRACING, it means TRACING and EVENT_TRACING are the same thing, can we covert all config EVENT_TRACING to config TRACING, and remove EVENT_TRACING? (or reverse)

Lai


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

end of thread, other threads:[~2009-05-27  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-22  9:40 [PATCH] tracing: create events only when configed Lai Jiangshan
2009-05-24 21:05 ` Frederic Weisbecker
2009-05-25  1:03   ` Lai Jiangshan
2009-05-25 23:18     ` Frederic Weisbecker
2009-05-26 16:38 ` Steven Rostedt
2009-05-27  8:19   ` Lai Jiangshan

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.