History log of /arch/sh/include/asm/ftrace.h
Revision Date Author Comments
eed542d6962ba33a689b4007a389f466e407bd74 20-May-2014 AKASHI Takahiro <takahiro.akashi@linaro.org> 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>
36c871992697eaaf88a3682c2c3003a41c54b8c0 14-Oct-2009 Paul Mundt <lethal@linux-sh.org> 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>
ac4fac8cb24ab209ae373a3e3e9995dff7d0c394 13-Oct-2009 Paul Mundt <lethal@linux-sh.org> 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>
d26cddbbd23b81eac4fcf340b633e97b40b8d3a1 11-Oct-2009 Matt Fleming <matt@console-pimps.org> 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>
c68e3206862f647117a46a73af76764d750c05bd 25-Aug-2009 Paul Mundt <lethal@linux-sh.org> 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>
f13327864f94c3a0e6acca923df537d20059639f 24-Aug-2009 Paul Mundt <lethal@linux-sh.org> 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>
327933f5d6cdf083284d3c06e0370d1de464aef4 11-Jul-2009 Matt Fleming <matt@console-pimps.org> 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>
ca0d17277fd101ce4878f92b398b6ab71fb2c287 28-Jun-2009 Matt Fleming <matt@console-pimps.org> 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>
22f131aa8de7a534339bf7051680234462f2e877 27-Nov-2008 Paul Mundt <lethal@linux-sh.org> sh: Provide a dyn_arch_ftrace struct definition.

Needed for dynamic ftrace API changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fad57feba77d2e5b183e068cb6b90693e4567b40 12-Nov-2008 Matt Fleming <mjf@gentoo.org> 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>
7e5e26a3d8ac4bcadb380073dc9604c07a9a6198 31-Oct-2008 Steven Rostedt <rostedt@goodmis.org> ftrace: fix hardirq header for non ftrace archs

Impact: build fix for non-ftrace architectures

Not all archs implement ftrace, and therefore do not have an asm/ftrace.h.
This patch corrects the problem.

The ftrace_nmi_enter/exit now must be defined for all archs that implement
dynamic ftrace. Currently, only x86 does.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
a26a2a27396c0a0877aa701f8f92d08ba550a6c9 31-Oct-2008 Steven Rostedt <rostedt@goodmis.org> ftrace: nmi safe code clean ups

Impact: cleanup

This patch cleans up the NMI safe code for dynamic ftrace as suggested
by Andrew Morton.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17666f02b118099028522dfc3df00a235700e216 30-Oct-2008 Steven Rostedt <rostedt@goodmis.org> ftrace: nmi safe code modification

Impact: fix crashes that can occur in NMI handlers, if their code is modified

Modifying code is something that needs special care. On SMP boxes,
if code that is being modified is also being executed on another CPU,
that CPU will have undefined results.

The dynamic ftrace uses kstop_machine to make the system act like a
uniprocessor system. But this does not address NMIs, that can still
run on other CPUs.

One approach to handle this is to make all code that are used by NMIs
not be traced. But NMIs can call notifiers that spread throughout the
kernel and this will be very hard to maintain, and the chance of missing
a function is very high.

The approach that this patch takes is to have the NMIs modify the code
if the modification is taking place. The way this works is that just
writing to code executing on another CPU is not harmful if what is
written is the same as what exists.

Two buffers are used: an IP buffer and a "code" buffer.

The steps that the patcher takes are:

1) Put in the instruction pointer into the IP buffer
and the new code into the "code" buffer.
2) Set a flag that says we are modifying code
3) Wait for any running NMIs to finish.
4) Write the code
5) clear the flag.
6) Wait for any running NMIs to finish.

If an NMI is executed, it will also write the pending code.
Multiple writes are OK, because what is being written is the same.
Then the patcher must wait for all running NMIs to finish before
going to the next line that must be patched.

This is basically the RCU approach to code modification.

Thanks to Ingo Molnar for suggesting the idea, and to Arjan van de Ven
for his guidence on what is safe and what is not.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
4b4cf7595a8bce9b4dd64c241a8cb7336ecb9489 21-Sep-2008 Paul Mundt <lethal@linux-sh.org> 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>