Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a linux kernel function available to ftrace function_graph tracer?

I want to trace a function during kernel boot process with ftrace function_graph to understand what it does, but it is not available in available_filter_functions.

I tried to export it with EXPORT_SYMBOL(), guessing that it will made it available but this is not the case.

Do you have a solution ?

For information, functions I want to trace are persistent_ram_init_ringbuffer and persistent_ram_early_init in Android kernel 3.4.

I read through the documentation but found nothing on this and grep did not helped more...

Thanks

like image 930
Jeremy Rocher Avatar asked Mar 07 '13 12:03

Jeremy Rocher


2 Answers

The problem is that those functions are annotated with __init and __devinit, which are black listed by ftrace function tracer.

Why? Because as module init functions (or kernel init functions) they are loaded during initialization and removed when the initialization is complete. Every function that ftrace traces is kept in a special compact table. Currently, there's no way to tell ftrace that those functions have been removed (freed) and that ftrace should remove them from its table. If we were to just ignore that, then when function tracing is enabled, ftrace will try to modify locations that no longer exist and can cause all sorts of issues (remember the e1000e bug?).

If you really want to trace them, then remove those annotations. Then they should appear in the list of functions to trace.

like image 79
rostedt Avatar answered Sep 28 '22 18:09

rostedt


http://lwn.net/Articles/370423/

http://www.mjmwired.net/kernel/Documentation/trace/ftrace.txt

these links might help. first is thing i found by googling. second is ftrace documentation

like image 45
sublime.Hat Avatar answered Sep 28 '22 16:09

sublime.Hat