Commit Graph

11 Commits

Author SHA1 Message Date
AKASHI Takahiro eed542d696 ftrace: Make CALLER_ADDRx macros more generic
Most archs with HAVE_ARCH_CALLER_ADDR have pretty much the same
definitions of CALLER_ADDRx(n). Instead of duplicating the code for all
the archs, define a ftrace_return_address0() and
ftrace_return_address(n) that can be overwritten by the archs if they
need to do something different. Instead of 7 macros in every arch, we
now only have at most 2 (and actually only 1 as
ftrace_return_address0() should be the same for all archs).

The CALLER_ADDRx(n) will now be defined in linux/ftrace.h and use the
ftrace_return_address*(n?) macros. This removes a lot of the duplicate
code.

Link: http://lkml.kernel.org/p/1400585464-30333-1-git-send-email-takahiro.akashi@linaro.org

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-05-21 03:10:32 -04:00
Paul Mundt 36c8719926 sh: Provide CALLER_ADDRx definitions even when ftrace is disabled.
Despite being located in the ftrace header, the CALLER_ADDRx definitions
are used by generic code. As such, we have to provide it generically, and
given that there is no real dependence on ftrace in the first place, the
definitions can just be moved out.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 11:49:49 +09:00
Paul Mundt ac4fac8cb2 sh: Generalize CALLER_ADDRx support.
This splits out the unwinder implementation and adds a new
return_address() abstraction modelled after the ARM code. The DWARF
unwinder is tied in to this, returning NULL otherwise in the case of
being unable to support arbitrary depths.

This enables us to get correct behaviour with the unwinder enabled,
as well as disabling the arbitrary depth support when frame pointers are
enabled, as arbitrary depths with __builtin_return_address() are not
supported regardless.

With this abstraction it's also possible to layer on a simplified
implementation with frame pointers in the event that the unwinder isn't
enabled, although this is left as a future exercise.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 13:10:14 +09:00
Matt Fleming d26cddbbd2 sh: tracing: Use the DWARF unwinder for CALLER_ADDRx
The major reason for implementing the DWARF unwinder in the first place
was so that we could stop using __builtin_return_address(n), which
doesn't work on SH for n > 0.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-10-11 17:56:17 +01:00
Paul Mundt c68e320686 sh: Fix an off-by-1 in FTRACE_SYSCALL_MAX.
This is supposed to be the equivalent of __NR_syscalls, not
__NR_syscalls -1. The x86 code this was based on had simply fallen
out of sync at the time this was implemented. Fix it up now.

As a result, tracing of __NR_perf_counter_open works as advertised.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-25 18:39:33 +09:00
Paul Mundt f13327864f sh: Move the FTRACE_SYSCALL_MAX definition in to asm/ftrace.h.
Needed by ftrace changes in -tip.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 22:48:27 +09:00
Matt Fleming 327933f5d6 sh: Function graph tracer support
Add both dynamic and static function graph tracer support for sh.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 10:08:01 +09:00
Matt Fleming ca0d17277f sh: Fix the value of MCOUNT_INSN_OFFSET
It seems that MCOUNT_INSN_OFFSET was calculating the distance between
the wrong functions. The value that should have actually been computed
is the distance between ftrace_call and ftrace_stub. I discovered this
when I added some code to ftrace_caller.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-06 19:52:08 +09:00
Paul Mundt 22f131aa8d sh: Provide a dyn_arch_ftrace struct definition.
Needed for dynamic ftrace API changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Matt Fleming fad57feba7 sh: dynamic ftrace support.
First cut at dynamic ftrace support.

Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:52 +09:00
Paul Mundt 4b4cf7595a sh: Add missing asm/ftrace.h.
This was missed with the ftrace support commit.. check it in now.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-21 17:17:53 +09:00