android_kernel_xiaomi_sm8350/kernel/trace
Steven Rostedt ad90c0e3ce ftrace: user update and disable dynamic ftrace daemon
In dynamic ftrace, the mcount function starts off pointing to a stub
function that just returns.

On start up, the call to the stub is modified to point to a "record_ip"
function. The job of the record_ip function is to add the function to
a pre-allocated hash list. If the function is already there, it simply is
ignored, otherwise it is added to the list.

Later, a ftraced daemon wakes up and calls kstop_machine if any functions
have been recorded, and changes the calls to the recorded functions to
a simple nop.  If no functions were recorded, the daemon goes back to sleep.

The daemon wakes up once a second to see if it needs to update any newly
recorded functions into nops.  Usually it does not, but if a lot of code
has been executed for the first time in the kernel, the ftraced daemon
will call kstop_machine to update those into nops.

The problem currently is that there's no way to stop the daemon from doing
this, and it can cause unneeded latencies (800us which for some is bothersome).

This patch adds a new file /debugfs/tracing/ftraced_enabled. If the daemon
is active, reading this will return "enabled\n" and "disabled\n" when the
daemon is not running. To disable the daemon, the user can echo "0" or
"disable" into this file, and "1" or "enable" to re-enable the daemon.

Since the daemon is used to convert the functions into nops to increase
the performance of the system, I also added that anytime something is
written into the ftraced_enabled file, kstop_machine will run if there
are new functions that have been detected that need to be converted.

This way the user can disable the daemon but still be able to control the
conversion of the mcount calls to nops by simply,

  "echo 0 > /debugfs/tracing/ftraced_enabled"

when they need to do more conversions.

To see the number of converted functions:

  "cat /debugfs/tracing/dyn_ftrace_total_info"

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-06-02 12:50:04 +02:00
..
ftrace.c ftrace: user update and disable dynamic ftrace daemon 2008-06-02 12:50:04 +02:00
Kconfig ftrace: add have dynamic ftrace config for archs 2008-05-23 22:49:18 +02:00
Makefile ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_functions.c ftrace: fix up cmdline recording 2008-05-26 22:51:49 +02:00
trace_irqsoff.c ftrace: remove printks from irqsoff trace 2008-05-26 22:51:27 +02:00
trace_sched_switch.c ftrace: fix up cmdline recording 2008-05-26 22:51:49 +02:00
trace_sched_wakeup.c ftrace: add function tracing to wake up tracing 2008-05-26 22:51:22 +02:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_selftest.c ftrace: limit use of check pages 2008-05-26 22:39:45 +02:00
trace.c ftrace: distinguish kretprobe'd functions in trace logs 2008-06-02 12:41:19 +02:00
trace.h ftrace: fix up cmdline recording 2008-05-26 22:51:49 +02:00