Skip to contentSkip to conversation

tracing: create events only when configed

PATCH In review Lai Jiangshan 3 participants 6 messages May 22, 2009 – May 27, 2009 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: create events only when configed

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

---

include/trace/define_trace.h +1 -1
index f7a7ae1..e4e0e7a 100644
@@ -52,7 +52,7 @@
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_TRACING
+#ifdef CONFIG_ENABLE_EVENT_TRACING
 #include <trace/ftrace.h>
 #endif
 
kernel/trace/trace_event_types.h +12 -0
index 5e32e37..5c9813e 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Lai Jiangshan

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.

Quoted 7 lines

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

[Impact:] cleanup

Looks good.

Quoted 101 lines

---

include/trace/define_trace.h +1 -1
index f7a7ae1..e4e0e7a 100644
@@ -52,7 +52,7 @@
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_TRACING
+#ifdef CONFIG_ENABLE_EVENT_TRACING
 #include <trace/ftrace.h>
 #endif
 
kernel/trace/trace_event_types.h +12 -0
index 5e32e37..5c9813e 100644
@@ -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
#2 lore raw
Quoted 10 lines · Frederic Weisbecker
Quoted 9 lines · Lai Jiangshan

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.

Quoted 11 lines
Quoted 4 lines

[Impact:] cleanup

Looks good.

Thanx, changelog is rewrote

Frome: Lai Jiangshan <[email protected]>

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

---

include/trace/define_trace.h +1 -1
index f7a7ae1..e4e0e7a 100644
@@ -52,7 +52,7 @@
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_TRACING
+#ifdef CONFIG_ENABLE_EVENT_TRACING
 #include <trace/ftrace.h>
 #endif
 
kernel/trace/trace_event_types.h +12 -0
index 5e32e37..5c9813e 100644
@@ -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
#3 lore raw
Quoted 8 lines · Lai Jiangshan
Quoted 7 lines · Frederic Weisbecker
Quoted 6 lines · Lai Jiangshan

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.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

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.

Quoted 124 lines
Quoted 11 lines
Quoted 4 lines

[Impact:] cleanup

Looks good.

Thanx, changelog is rewrote

Frome: Lai Jiangshan <[email protected]>

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

---

include/trace/define_trace.h +1 -1
index f7a7ae1..e4e0e7a 100644
@@ -52,7 +52,7 @@
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-#ifdef CONFIG_EVENT_TRACING
+#ifdef CONFIG_ENABLE_EVENT_TRACING
 #include <trace/ftrace.h>
 #endif
 
kernel/trace/trace_event_types.h +12 -0
index 5e32e37..5c9813e 100644
@@ -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
maintainer
#4 lore raw
In reply to Lai Jiangshan
Quoted 4 lines · Lai Jiangshan

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

Quoted 8 lines

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

#5 lore raw
Quoted 14 lines · Steven Rostedt
Quoted 11 lines · Lai Jiangshan

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

Quoted 7 lines

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.)

Quoted 2 lines

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. ^_^

Quoted 7 lines

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