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

♀尐吖头ヾ 提交于 2019-11-27 16:12:32

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/15271551/how-to-make-a-linux-kernel-function-available-to-ftrace-function-graph-tracer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!