diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-01-27 09:15:30 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-02-02 21:37:13 -0500 |
commit | e4a9ea5ee7c8812a7bf0c3fb725ceeaa3d4c2fcc (patch) | |
tree | 1b25668508fa302a6ada053c895cd55727f798f1 /include/linux/module.h | |
parent | 9ffdc6c37df131f89d52001e0ef03091b158826f (diff) |
tracing: Replace trace_event struct array with pointer array
Currently the trace_event structures are placed in the _ftrace_events
section, and at link time, the linker makes one large array of all
the trace_event structures. On boot up, this array is read (much like
the initcall sections) and the events are processed.
The problem is that there is no guarantee that gcc will place complex
structures nicely together in an array format. Two structures in the
same file may be placed awkwardly, because gcc has no clue that they
are suppose to be in an array.
A hack was used previous to force the alignment to 4, to pack the
structures together. But this caused alignment issues with other
architectures (sparc).
Instead of packing the structures into an array, the structures' addresses
are now put into the _ftrace_event section. As pointers are always the
natural alignment, gcc should always pack them tightly together
(otherwise initcall, extable, etc would also fail).
By having the pointers to the structures in the section, we can still
iterate the trace_events without causing unnecessary alignment problems
with other architectures, or depending on the current behaviour of
gcc that will likely change in the future just to tick us kernel developers
off a little more.
The _ftrace_event section is also moved into the .init.data section
as it is now only needed at boot up.
Suggested-by: David Miller <davem@davemloft.net>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index e7c6385c6683..7695a303bb55 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -389,7 +389,7 @@ struct module | |||
389 | unsigned int num_trace_bprintk_fmt; | 389 | unsigned int num_trace_bprintk_fmt; |
390 | #endif | 390 | #endif |
391 | #ifdef CONFIG_EVENT_TRACING | 391 | #ifdef CONFIG_EVENT_TRACING |
392 | struct ftrace_event_call *trace_events; | 392 | struct ftrace_event_call **trace_events; |
393 | unsigned int num_trace_events; | 393 | unsigned int num_trace_events; |
394 | #endif | 394 | #endif |
395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |