Ftrace on android freeze when turn on function trace, somebody help me :(

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

I have installed Ftrace on android AVD and try to use Ftrace's functionality, but it does not work.

Below is a list of what I did:

  1. Install ubuntu 10.04 LTS
  2. Install essential tools such as android sdk, toolchain, libs, etc
  3. Download goldfish kernel refer - http://blog.markloiseau.com/2012/07/how-to-compile-the-android-goldfish-emulator-kernel/
  4. Modify kernel config file (turned on Tracer Options)
  5. Boot up goldfish with custom kernel which has compiled with tracer options
  6. Tried to use Ftrace functionality
  7. The kernel freezes

This is the log:

\# mount -t debugfs nodev /sys/kernel/debug \# ls /sys/kernel/debug sched_features mmc0 tracing bdi  \# cd /sys/kernel/debug/tracing \# ls events set_event available_events printk_formats per_cpu options saved_cmdlines trace_marker buffer_size_kb trace_pipe README tracing_thresh tracing_max_latency current_tracer available_tracers trace tracing_cpumask trace_options tracing_enabled tracing_on set_ftrace_pid  \# cat available_tracers function_graph function sched_switch nop  \# cat current_tracer  nop  \# echo sched_switch > current_tracer  \# cat current_tracer  sched_switch  \# cat trace | /data/busybox head -10 \# tracer: sched_switch \# \#           TASK-PID    CPU#    TIMESTAMP  FUNCTION \#              | |       |          |         |         bash-258   [000]   490.261240:    258:120:R   + [000]     4:115:S events/0         bash-258   [000]   490.262087:    258:120:S ==> [000]    45:120:R adbd         adbd-45    [000]   490.262318:     45:120:S ==> [000]     4:115:R events/0     events/0-4     [000]   490.262457:      4:115:R   + [000]    43:120:S qemud     events/0-4     [000]   490.262492:      4:115:S ==> [000]    43:120:R qemud        qemud-43    [000]   490.262643:     43:120:R   + [000]   109:112:S er$SensorThread  \# echo function > current_tracer  *<--- this command occur freeze* 

As shown above, some of the features work well. But at the time I turn on the tracking function, a key feature, the system is down.

What should i do ?

回答1:

There's several reasons that the function tracer may freeze. It's a very invasive tracer (traces almost all functions of the kernel). One issue is if it traces an internal function like disabling interrupts. This would cause it to go into an infinite loop. Now I assume you have an ARM device if you are running Android. Depending on the configuration some of the low level functions for ARM may need to be marked notrace to prevent them to be traced. If you have dynamic tracing enabled, try just tracing a single function and if that works you know the issue is with something that's being traced that shouldn't be. To trace a single function, just:

echo schedule > set_ftrace_filter; echo function > current_tracer

Good luck.



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