diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-07-16 10:30:06 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-07-16 11:50:35 -0400 |
commit | 136a08dbe8c28e751b01e932420f715edb229f6b (patch) | |
tree | c988a0025de9455b622aabd0d3cc98596284060a | |
parent | cbc5d49e4973400737aab50b60dc5d86e71f5420 (diff) |
Bugfix: avoid link error in Feather-Trace on x86
If no events are defined but Feater-Trace support is enabled, then the current
implementation generates a link error because the __event_table sections is
absent.
> arch/x86/built-in.o: In function `ft_disable_all_events':
> (.text+0x242af): undefined reference to `__start___event_table'
As a simple work around, we force zero-element array to always be "allocated"
in the __event_table section. This ensures that we end up with a zero-byte
section if no events are enabled, and does not affect the layout of the section
if events are present.
> bbb@ludwig:~/dev/litmus2010$ nm vmlinux | grep event_table
> ffffffff81950cdc D __event_table_dummy
> ffffffff81950cdc A __start___event_table
> ffffffff81950cdc A __stop___event_table
-rw-r--r-- | arch/x86/kernel/ft_event.c | 7 | ||||
-rw-r--r-- | litmus/Kconfig | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kernel/ft_event.c b/arch/x86/kernel/ft_event.c index 6552e2741ecf..37cc33252713 100644 --- a/arch/x86/kernel/ft_event.c +++ b/arch/x86/kernel/ft_event.c | |||
@@ -22,6 +22,13 @@ struct trace_event { | |||
22 | extern struct trace_event __start___event_table[]; | 22 | extern struct trace_event __start___event_table[]; |
23 | extern struct trace_event __stop___event_table[]; | 23 | extern struct trace_event __stop___event_table[]; |
24 | 24 | ||
25 | /* Workaround: if no events are defined, then the event_table section does not | ||
26 | * exist and the above references cause linker errors. This could probably be | ||
27 | * fixed by adjusting the linker script, but it is easier to maintain for us if | ||
28 | * we simply create a dummy symbol in the event table section. | ||
29 | */ | ||
30 | int __event_table_dummy[0] __attribute__ ((section("__event_table"))); | ||
31 | |||
25 | int ft_enable_event(unsigned long id) | 32 | int ft_enable_event(unsigned long id) |
26 | { | 33 | { |
27 | struct trace_event* te = __start___event_table; | 34 | struct trace_event* te = __start___event_table; |
diff --git a/litmus/Kconfig b/litmus/Kconfig index f3aa7478faf7..9888589ef126 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig | |||
@@ -90,6 +90,10 @@ config FEATHER_TRACE | |||
90 | 90 | ||
91 | Bottom line: to avoid increased overheads, choose DEBUG_RODATA=n. | 91 | Bottom line: to avoid increased overheads, choose DEBUG_RODATA=n. |
92 | 92 | ||
93 | Note that this option only enables the basic Feather-Trace infrastructure; | ||
94 | you still need to enable SCHED_TASK_TRACE and/or SCHED_OVERHEAD_TRACE to | ||
95 | actually enable any events. | ||
96 | |||
93 | config SCHED_TASK_TRACE | 97 | config SCHED_TASK_TRACE |
94 | bool "Trace real-time tasks" | 98 | bool "Trace real-time tasks" |
95 | depends on FEATHER_TRACE | 99 | depends on FEATHER_TRACE |