Debug

Debugging latenciesPREEMPT_RT

ftrace - Kernel function tracer

Infrastructure that can be used for debugging or analyzing latencies and performance issues in the kernel.

  • Very well documented in Documentation/trace/ftrace.txt
  • Negligible overhead when tracing is not enabled at run-time.
  • Can be used to trace any kernel function!

Using ftrace

  • Tracing information available through the debugfs virtual fs (CONFIG_DEBUG_FS in the Kernel Hacking section)
  • Mount this filesystem as follows: mount -t debugfs nodev /sys/kernel/debug
  • When tracing is enabled (see the next slides), tracing information is available in /sys/kernel/debug/tracing.
  • Check available tracers in /sys/kernel/debug/tracing/available_tracers

Scheduling latency tracer

CONFIG_SCHED_TRACER (Kernel Hacking section)

  • Maximum recorded time between waking up a top priority task and its scheduling on a CPU, expressed in us.
  • Check that wakeup is listed in /sys/kernel/debug/tracing/available_tracers
  • To select, reset and enable this tracer:

echo wakeup > /sys/kernel/debug/tracing/current_tracer echo 0 > /sys/kernel/debug/tracing/tracing_max_latency echo 1 > /sys/kernel/debug/tracing/tracing_enabled

  • Let your system run, in particular real-time tasks. Dummy example: chrt -f 5 sleep 1
  • Disable tracing:

echo 0 > /sys/kernel/debug/tracing/tracing_enabled

  • Read the maximum recorded latency and the corresponding trace:

    cat /sys/kernel/debug/tracing/tracing_max_latency

Exemple of worst-case latencies

Tests done with cyclictest

About real-time support in the standard Linux kernel

results matching ""

    No results matching ""