aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-01-27 09:15:30 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-02-02 21:37:13 -0500
commite4a9ea5ee7c8812a7bf0c3fb725ceeaa3d4c2fcc (patch)
tree1b25668508fa302a6ada053c895cd55727f798f1 /include/asm-generic
parent9ffdc6c37df131f89d52001e0ef03091b158826f (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/asm-generic')
-rw-r--r--include/asm-generic/vmlinux.lds.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 6ebb81030d2d..f53708be95eb 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,7 +124,8 @@
124#endif 124#endif
125 125
126#ifdef CONFIG_EVENT_TRACING 126#ifdef CONFIG_EVENT_TRACING
127#define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 127#define FTRACE_EVENTS() . = ALIGN(8); \
128 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
128 *(_ftrace_events) \ 129 *(_ftrace_events) \
129 VMLINUX_SYMBOL(__stop_ftrace_events) = .; 130 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
130#else 131#else
@@ -179,9 +180,6 @@
179 TRACE_PRINTKS() \ 180 TRACE_PRINTKS() \
180 \ 181 \
181 STRUCT_ALIGN(); \ 182 STRUCT_ALIGN(); \
182 FTRACE_EVENTS() \
183 \
184 STRUCT_ALIGN(); \
185 TRACE_SYSCALLS() 183 TRACE_SYSCALLS()
186 184
187/* 185/*
@@ -482,6 +480,7 @@
482 KERNEL_CTORS() \ 480 KERNEL_CTORS() \
483 *(.init.rodata) \ 481 *(.init.rodata) \
484 MCOUNT_REC() \ 482 MCOUNT_REC() \
483 FTRACE_EVENTS() \
485 DEV_DISCARD(init.rodata) \ 484 DEV_DISCARD(init.rodata) \
486 CPU_DISCARD(init.rodata) \ 485 CPU_DISCARD(init.rodata) \
487 MEM_DISCARD(init.rodata) \ 486 MEM_DISCARD(init.rodata) \