Ftrace Function Graph ARM

This page holds information from Tim Bird's talk at Linux Symposium Montreal (July, 2009), and at ELC Europe and the Japan Linux Symposium (October, 2009).

In Canada, Tim talked about patches against the 2.6.31-rc1 kernel tree for adding function graph tracing to the ARM architecture, for the Ftrace system.

In France and Japan, Tim talked about patches against 2.6.32-rc5.

Presentation
Here is the presentation from the Japan Linux Symposium (also given at ELC Europe, in Grenoble France) Here is the presentation from the Canada Linux Symposium session:
 * [[Media:Measuring-function-duration-with-ftrace-october-2009.pdf|Measuring Function Duration with Ftrace (october 2009 update) (PDF)]]
 * [[Media:Measuring-function-duration-with-ftrace.pdf|Measuring Function Duration with Ftrace (first version) (PDF)]]

Paper
Here is Tim's paper for the Canada Linux Symposium for this work:
 * [[Media:Bird-LS-2009-Measuring-function-duration-with-ftrace.pdf|Measuring Function Duration with Ftrace Paper (PDF)]]

Documentation
See the file Documentation/trace/func-duration.txt, after applying the patches.

(Or, if you applied the 2.6.31 patches, see the file Documentation/trace/func-graph.txt However, this version is deprecated.)

Patches
Below are patches for the function graph support and function duration tracer, for two kernel versions.

2.6.33 patches
Here are some patches to add support for the function_graph tracer to ARM, and to add support for 'tracing_thresh' to the function_graph tracer.


 * [[Media:Function-graph-ARM-w-thresh-2.6.33-mar-2010.tgz]]

To apply, extract the patches and the series file. If you have 'quilt', extract the file directly into the top level of the kernel source tree (the top directory is called 'patches'). Then do "quilt push -a".

If you don't have quilt, apply the patches manually, in the order specified in the 'series' file, with a command like: "patch -p1 <patches/foo.patch"

2.6.32-rc5 patches

 * [[Media:Ftrace-patches-oct-2009.tgz]]

To apply, extract the patches and the series file. If you have 'quilt', extract the file directly into the top level of the kernel source tree (the top directory is called 'patches'). Then do "quilt push -a".

If you don't have quilt, apply the patches manually, in the order specified in the 'series' file, with a command like: "patch -p1 <patches/foo.patch"

2.6.31-rc1 patches
The following patches were submitted to the kernel mailing list in early July 2009. There are patches against kernel version 2.6.31-rc1.


 * [[Media:Arm-sched_clock-notrace.patch]]
 * [[Media:Add-function-graph-tracer-support-for-ARM.patch]]
 * [[Media:Func-graph-duration-filter.patch]]
 * [[Media:Optimize-duration-filter-discard.patch]]

2.6.29 patches
The following patches were developed internally at Sony, but never submitted to mainline. They are posted here in the hopes that they will be useful to someone.


 * [[Media:Add-ARM-function-duration-tracer-2.6.29.tgz]]

This tar archive contains a patches directory, with a series file and several patch files. To use, extract at the source of your 2.6.29 kernel tree, and apply using quilt with 'quilt push -a'.

Alternatively, apply the patches individually using 'patch -p1 <patches/p1.patch', for each file listed in patches/series (in the order specified in the file).

This patch set was tested against a stock (mainline, from kernel.org) 2.6.29 kernel, on an OMAP OSK development board (ARM-based, TI OMAP chip).

patches for gcc 4.4.0
Note recent ARM toolchains instrument the code with calls to '__gnu_mcount_nc' instead of 'mcount'. If you get a compiler warning about missing the symbol '__gnu_mcount_nc', you should apply the patch mentioned in this e-mail also: (http://marc.info/?l=linux-arm-kernel&m=124946219616111&w=2) [Thanks to Jean Pihet of MontaVista for pointing this out]

Here is the above patch, and a patch which adds support for __gnu_mcount_nc to the function_graph tracer.


 * [[Media:Support-ftrace-with-newer-compilers.patch]] - this is the patch mentioned above
 * [[Media:Gnu_mcount_nc-func_graph.patch]]

FDD
The 'fdd' tool is now incorporated into the patch set, and is located in the kernel scripts directory after applying the patches. See the documentation in the kernel tree for instructions for use.

FTD
To install: * Download * rename to 'ftd': mv Ftd.txt ftd * make it executable: chmod a+x * Put it on your path somewhere: sudo mv ftd /usr/local/bin
 * [[Media:Ftd.txt]] - Function Trace Dump - post-trace analysis tool

History
Based on feeback from ftrace developers on the kernel mailing list, and from other developers at the tracing mini-summit in Montreal, I started working on an updated duration tracer, using a different filtering approach. This work was completed, and resulted in a new trace, the "function_duration" tracer, being completed in September of 2009.

This work was described at ELC Europe and the Japan Linux Symposium, in October, 2009. I was hoping to mainline the patches before the events, but ran out of time due to bugs on my main testing platform.

Further Work
I need to try to mainline this feature. I'd like to get it into Linux-tip or Linux-next sometime before the 2.6.33 merge window.

If you don't see it in mainline, just send me an e-mail asking about the status.