Bring sparc64 dynamic ftrace up to snuff...
Subsystems (2)
David Miller
maintainerPATCH 1/1 Bring sparc64 dynamic ftrace up to snuff...
Do the ftrace maintainers mind if I merge the following in via my sparc-next-2.6 tree?
Thanks!
sparc64: Add proper dynamic ftrace support.
--- arch/sparc/Kconfig | 2 + arch/sparc/include/asm/ftrace.h | 11 +++++++++ arch/sparc/kernel/ftrace.c | 47 ++++++++++++++++++++++++++------------ scripts/recordmcount.pl | 20 ++++++++++++++++ 4 files changed, 65 insertions(+), 15 deletions(-)
arch/sparc/Kconfig +2 -0
@@ -37,6 +37,8 @@ config SPARC64 select HAVE_KPROBES select HAVE_LMB select HAVE_SYSCALL_WRAPPERS + select HAVE_DYNAMIC_FTRACE + select HAVE_FTRACE_MCOUNT_RECORD select USE_GENERIC_SMP_HELPERS if SMP select RTC_DRV_CMOS select RTC_DRV_BQ4802
arch/sparc/include/asm/ftrace.h +11 -0
@@ -11,4 +11,15 @@ extern void _mcount(void);#endif +#ifdef CONFIG_DYNAMIC_FTRACE +/* reloction of mcount call site is the same as the address */ +static inline unsigned long ftrace_call_adjust (unsigned long addr) +{ +return addr; +} + +struct dyn_arch_ftrace { +}; +#endif /* CONFIG_DYNAMIC_FTRACE */ +#endif /* _ASM_SPARC64_FTRACE */
arch/sparc/kernel/ftrace.c +32 -15
79 lines not on this page · raw message
scripts/recordmcount.pl +20 -0
@@ -213,6 +213,26 @@ if ($arch eq "x86_64") { if ($is_module eq "0") { $cc .= " -mconstant-gp"; } +} elsif ($arch eq "sparc64") { + # In the objdump output there are giblets like: + # 0000000000000000 <igmp_net_exit-0x18>: + # As there's some data blobs that get emitted into the + # text section before the first instructions and the first + # real symbols. We don't want to match that, so to combat + # this we use '\w' so we'll match just plain symbol names, + # and not those that also include hex offsets inside of the + # '<>' brackets. Actually the generic function_regex setting + # could safely use this too. + $function_regex = "^([0-9a-fA-F]+)\\s+<(\\w*?)>:"; + + # Sparc64 calls '_mcount' instead of plain 'mcount'. + $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; + + $alignment = 8; + $type = ".xword"; + $ld .= " -m elf64_sparc"; + $cc .= " -m64"; + $objcopy .= " -O elf64-sparc"; } else { die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; }
Signature · 1 line
1.6.3.2
Quoted 3 lines · David Miller
Do the ftrace maintainers mind if I merge the following in via my sparc-next-2.6 tree?
Not at all.
Quoted 38 lines
Thanks!
sparc64: Add proper dynamic ftrace support.
Signed-off-by David S. Miller <[email protected]>--- arch/sparc/Kconfig | 2 + arch/sparc/include/asm/ftrace.h | 11 +++++++++ arch/sparc/kernel/ftrace.c | 47 ++++++++++++++++++++++++++------------ scripts/recordmcount.pl | 20 ++++++++++++++++ 4 files changed, 65 insertions(+), 15 deletions(-)arch/sparc/kernel/ftrace.c +2
-0+#endif +scripts/recordmcount.pl +13
-0@@ -213,6 +213,26 @@ if ($arch eq "x86_64") { if ($is_module eq "0") { $cc .= " -mconstant-gp"; } +} elsif ($arch eq "sparc64") { + # In the objdump output there are giblets like: + # 0000000000000000 <igmp_net_exit-0x18>: + # As there's some data blobs that get emitted into the + # text section before the first instructions and the first + # real symbols. We don't want to match that, so to combat + # this we use '\w' so we'll match just plain symbol names, + # and not those that also include hex offsets inside of the + # '<>' brackets. Actually the generic function_regex setting + # could safely use this too. + $function_regex = "^([0-9a-fA-F]+)\\s+<(\\w*?)>:"; + + # Sparc64 calls '_mcount' instead of plain 'mcount'.
scripts/recordmcount.pl if ($arch eq "x86_64") { · line 238
Quoted 10 lines
scripts/recordmcount.pl +7
-0+ $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; + + $alignment = 8; + $type = ".xword"; + $ld .= " -m elf64_sparc"; + $cc .= " -m64"; + $objcopy .= " -O elf64-sparc"; } else { die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; }
The only thing outside of arch/sparc is this recordmcount.pl, and that too is arch specific.
I'm fine with it.
-- Steve
Ingo Molnar
Acked-byQuoted 61 lines · Steven Rostedt
Quoted 3 lines · David Miller
Do the ftrace maintainers mind if I merge the following in via my sparc-next-2.6 tree?
Not at all.
Quoted 38 lines
Thanks!
sparc64: Add proper dynamic ftrace support.
Signed-off-by David S. Miller <[email protected]>--- arch/sparc/Kconfig | 2 + arch/sparc/include/asm/ftrace.h | 11 +++++++++ arch/sparc/kernel/ftrace.c | 47 ++++++++++++++++++++++++++------------ scripts/recordmcount.pl | 20 ++++++++++++++++ 4 files changed, 65 insertions(+), 15 deletions(-)arch/sparc/kernel/ftrace.c +2
-0+#endif +scripts/recordmcount.pl +13
-0@@ -213,6 +213,26 @@ if ($arch eq "x86_64") { if ($is_module eq "0") { $cc .= " -mconstant-gp"; } +} elsif ($arch eq "sparc64") { + # In the objdump output there are giblets like: + # 0000000000000000 <igmp_net_exit-0x18>: + # As there's some data blobs that get emitted into the + # text section before the first instructions and the first + # real symbols. We don't want to match that, so to combat + # this we use '\w' so we'll match just plain symbol names, + # and not those that also include hex offsets inside of the + # '<>' brackets. Actually the generic function_regex setting + # could safely use this too. + $function_regex = "^([0-9a-fA-F]+)\\s+<(\\w*?)>:"; + + # Sparc64 calls '_mcount' instead of plain 'mcount'.scripts/recordmcount.pl if ($arch eq "x86_64") { · line 238
Quoted 10 lines
scripts/recordmcount.pl +7
-0+ $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; + + $alignment = 8; + $type = ".xword"; + $ld .= " -m elf64_sparc"; + $cc .= " -m64"; + $objcopy .= " -O elf64-sparc"; } else { die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; }The only thing outside of
arch/sparcis this recordmcount.pl, and that too is arch specific.
Quoted 3 lines
I'm fine with it.
Acked-by Steven Rostedt <[email protected]>
Me too - thanks David!
Ingo
arch/sparc/kernel/ftrace.c ftrace_modify_code(unsigned long ip, unsigned char *old_code, · line 79
Quoted 8 lines · David Miller
int
ftrace_update_ftrace_func(ftrace_func_t func){arch/sparc/kernel/ftrace.c +2
-2unsigned long ip = (unsigned long )(&ftrace_call); -unsigned char old[MCOUNT_INSN_SIZE ], *new; +u32 old, new; -memcpy (old, &ftrace_call,MCOUNT_INSN_SIZE ); + old = *(u32 *) &ftrace_call;
btw., just one (really stupid) question here: can ftrace_call be misaligned, and is misalignment a problem on Sparc? If it's not a problem then disregard the rest of the mail.
I dont see a particular alignment done in mcount.S:
ftrace_caller:
mov %i7, %o1
mov %o7, %o0
.globl ftrace_callftrace_call:
call ftrace_stub
so replacing an memcpy (which can copy misaligned buffers) with a direct assignment (which cannot) - wont that cause misalignment on Sparc?
Ingo
David Miller
maintainerFrom: Ingo Molnar <[email protected]>
Date: Sat, 13 Jun 2009 21:40:27 +0200
Quoted 3 lines
btw., just one (really stupid) question here: can
ftrace_callbe misaligned, and is misalignment a problem on Sparc? If it's not a problem then disregard the rest of the mail.
Every instruction must be 4-byte aligned on sparc.
Any instruction in the .text.* sections will thus always be 4-byte aligned.