xref: /linux-6.15/kernel/trace/Kconfig (revision 606576ce)
116444a8aSArnaldo Carvalho de Melo#
2*606576ceSSteven Rostedt# Architectures that offer an FUNCTION_TRACER implementation should
3*606576ceSSteven Rostedt#  select HAVE_FUNCTION_TRACER:
416444a8aSArnaldo Carvalho de Melo#
52a3a4f66SFrédéric Weisbecker
62a3a4f66SFrédéric Weisbeckerconfig NOP_TRACER
72a3a4f66SFrédéric Weisbecker	bool
82a3a4f66SFrédéric Weisbecker
9*606576ceSSteven Rostedtconfig HAVE_FUNCTION_TRACER
1016444a8aSArnaldo Carvalho de Melo	bool
112a3a4f66SFrédéric Weisbecker	select NOP_TRACER
12bc0c38d1SSteven Rostedt
13677aa9f7SSteven Rostedtconfig HAVE_DYNAMIC_FTRACE
14677aa9f7SSteven Rostedt	bool
15677aa9f7SSteven Rostedt
168da3821bSSteven Rostedtconfig HAVE_FTRACE_MCOUNT_RECORD
178da3821bSSteven Rostedt	bool
188da3821bSSteven Rostedt
19352ad25aSSteven Rostedtconfig TRACER_MAX_TRACE
20352ad25aSSteven Rostedt	bool
21352ad25aSSteven Rostedt
227a8e76a3SSteven Rostedtconfig RING_BUFFER
237a8e76a3SSteven Rostedt	bool
247a8e76a3SSteven Rostedt
25bc0c38d1SSteven Rostedtconfig TRACING
26bc0c38d1SSteven Rostedt	bool
27bc0c38d1SSteven Rostedt	select DEBUG_FS
287a8e76a3SSteven Rostedt	select RING_BUFFER
2986387f7eSIngo Molnar	select STACKTRACE
305f87f112SIngo Molnar	select TRACEPOINTS
31bc0c38d1SSteven Rostedt
32*606576ceSSteven Rostedtconfig FUNCTION_TRACER
331b29b018SSteven Rostedt	bool "Kernel Function Tracer"
34*606576ceSSteven Rostedt	depends on HAVE_FUNCTION_TRACER
35d3ee6d99SIngo Molnar	depends on DEBUG_KERNEL
361b29b018SSteven Rostedt	select FRAME_POINTER
371b29b018SSteven Rostedt	select TRACING
3835e8e302SSteven Rostedt	select CONTEXT_SWITCH_TRACER
391b29b018SSteven Rostedt	help
401b29b018SSteven Rostedt	  Enable the kernel to trace every kernel function. This is done
411b29b018SSteven Rostedt	  by using a compiler feature to insert a small, 5-byte No-Operation
421b29b018SSteven Rostedt	  instruction to the beginning of every kernel function, which NOP
431b29b018SSteven Rostedt	  sequence is then dynamically patched into a tracer call when
441b29b018SSteven Rostedt	  tracing is enabled by the administrator. If it's runtime disabled
451b29b018SSteven Rostedt	  (the bootup default), then the overhead of the instructions is very
461b29b018SSteven Rostedt	  small and not measurable even in micro-benchmarks.
4735e8e302SSteven Rostedt
4881d68a96SSteven Rostedtconfig IRQSOFF_TRACER
4981d68a96SSteven Rostedt	bool "Interrupts-off Latency Tracer"
5081d68a96SSteven Rostedt	default n
5181d68a96SSteven Rostedt	depends on TRACE_IRQFLAGS_SUPPORT
5281d68a96SSteven Rostedt	depends on GENERIC_TIME
53d3ee6d99SIngo Molnar	depends on DEBUG_KERNEL
5481d68a96SSteven Rostedt	select TRACE_IRQFLAGS
5581d68a96SSteven Rostedt	select TRACING
5681d68a96SSteven Rostedt	select TRACER_MAX_TRACE
5781d68a96SSteven Rostedt	help
5881d68a96SSteven Rostedt	  This option measures the time spent in irqs-off critical
5981d68a96SSteven Rostedt	  sections, with microsecond accuracy.
6081d68a96SSteven Rostedt
6181d68a96SSteven Rostedt	  The default measurement method is a maximum search, which is
6281d68a96SSteven Rostedt	  disabled by default and can be runtime (re-)started
6381d68a96SSteven Rostedt	  via:
6481d68a96SSteven Rostedt
6581d68a96SSteven Rostedt	      echo 0 > /debugfs/tracing/tracing_max_latency
6681d68a96SSteven Rostedt
676cd8a4bbSSteven Rostedt	  (Note that kernel size and overhead increases with this option
686cd8a4bbSSteven Rostedt	  enabled. This option and the preempt-off timing option can be
696cd8a4bbSSteven Rostedt	  used together or separately.)
706cd8a4bbSSteven Rostedt
716cd8a4bbSSteven Rostedtconfig PREEMPT_TRACER
726cd8a4bbSSteven Rostedt	bool "Preemption-off Latency Tracer"
736cd8a4bbSSteven Rostedt	default n
746cd8a4bbSSteven Rostedt	depends on GENERIC_TIME
756cd8a4bbSSteven Rostedt	depends on PREEMPT
76d3ee6d99SIngo Molnar	depends on DEBUG_KERNEL
776cd8a4bbSSteven Rostedt	select TRACING
786cd8a4bbSSteven Rostedt	select TRACER_MAX_TRACE
796cd8a4bbSSteven Rostedt	help
806cd8a4bbSSteven Rostedt	  This option measures the time spent in preemption off critical
816cd8a4bbSSteven Rostedt	  sections, with microsecond accuracy.
826cd8a4bbSSteven Rostedt
836cd8a4bbSSteven Rostedt	  The default measurement method is a maximum search, which is
846cd8a4bbSSteven Rostedt	  disabled by default and can be runtime (re-)started
856cd8a4bbSSteven Rostedt	  via:
866cd8a4bbSSteven Rostedt
876cd8a4bbSSteven Rostedt	      echo 0 > /debugfs/tracing/tracing_max_latency
886cd8a4bbSSteven Rostedt
896cd8a4bbSSteven Rostedt	  (Note that kernel size and overhead increases with this option
906cd8a4bbSSteven Rostedt	  enabled. This option and the irqs-off timing option can be
916cd8a4bbSSteven Rostedt	  used together or separately.)
926cd8a4bbSSteven Rostedt
93f06c3810SIngo Molnarconfig SYSPROF_TRACER
94f06c3810SIngo Molnar	bool "Sysprof Tracer"
954d2df795SThomas Gleixner	depends on X86
96f06c3810SIngo Molnar	select TRACING
97f06c3810SIngo Molnar	help
98f06c3810SIngo Molnar	  This tracer provides the trace needed by the 'Sysprof' userspace
99f06c3810SIngo Molnar	  tool.
100f06c3810SIngo Molnar
101352ad25aSSteven Rostedtconfig SCHED_TRACER
102352ad25aSSteven Rostedt	bool "Scheduling Latency Tracer"
103d3ee6d99SIngo Molnar	depends on DEBUG_KERNEL
104352ad25aSSteven Rostedt	select TRACING
105352ad25aSSteven Rostedt	select CONTEXT_SWITCH_TRACER
106352ad25aSSteven Rostedt	select TRACER_MAX_TRACE
107352ad25aSSteven Rostedt	help
108352ad25aSSteven Rostedt	  This tracer tracks the latency of the highest priority task
109352ad25aSSteven Rostedt	  to be scheduled in, starting from the point it has woken up.
110352ad25aSSteven Rostedt
11135e8e302SSteven Rostedtconfig CONTEXT_SWITCH_TRACER
11235e8e302SSteven Rostedt	bool "Trace process context switches"
113d3ee6d99SIngo Molnar	depends on DEBUG_KERNEL
11435e8e302SSteven Rostedt	select TRACING
11535e8e302SSteven Rostedt	select MARKERS
11635e8e302SSteven Rostedt	help
11735e8e302SSteven Rostedt	  This tracer gets called from the context switch and records
11835e8e302SSteven Rostedt	  all switching of tasks.
11935e8e302SSteven Rostedt
1201f5c2abbSFrédéric Weisbeckerconfig BOOT_TRACER
1211f5c2abbSFrédéric Weisbecker	bool "Trace boot initcalls"
1221f5c2abbSFrédéric Weisbecker	depends on DEBUG_KERNEL
1231f5c2abbSFrédéric Weisbecker	select TRACING
1241f5c2abbSFrédéric Weisbecker	help
1251f5c2abbSFrédéric Weisbecker	  This tracer helps developers to optimize boot times: it records
12698d9c66aSIngo Molnar	  the timings of the initcalls and traces key events and the identity
12798d9c66aSIngo Molnar	  of tasks that can cause boot delays, such as context-switches.
12898d9c66aSIngo Molnar
12998d9c66aSIngo Molnar	  Its aim is to be parsed by the /scripts/bootgraph.pl tool to
13098d9c66aSIngo Molnar	  produce pretty graphics about boot inefficiencies, giving a visual
13198d9c66aSIngo Molnar	  representation of the delays during initcalls - but the raw
13298d9c66aSIngo Molnar	  /debug/tracing/trace text output is readable too.
13398d9c66aSIngo Molnar
13498d9c66aSIngo Molnar	  ( Note that tracing self tests can't be enabled if this tracer is
13598d9c66aSIngo Molnar	    selected, because the self-tests are an initcall as well and that
13698d9c66aSIngo Molnar	    would invalidate the boot trace. )
1371f5c2abbSFrédéric Weisbecker
138e5a81b62SSteven Rostedtconfig STACK_TRACER
139e5a81b62SSteven Rostedt	bool "Trace max stack"
140*606576ceSSteven Rostedt	depends on HAVE_FUNCTION_TRACER
1412ff01c6aSIngo Molnar	depends on DEBUG_KERNEL
142*606576ceSSteven Rostedt	select FUNCTION_TRACER
143e5a81b62SSteven Rostedt	select STACKTRACE
144e5a81b62SSteven Rostedt	help
1454519d9e5SIngo Molnar	  This special tracer records the maximum stack footprint of the
1464519d9e5SIngo Molnar	  kernel and displays it in debugfs/tracing/stack_trace.
1474519d9e5SIngo Molnar
1484519d9e5SIngo Molnar	  This tracer works by hooking into every function call that the
1494519d9e5SIngo Molnar	  kernel executes, and keeping a maximum stack depth value and
1504519d9e5SIngo Molnar	  stack-trace saved. Because this logic has to execute in every
1514519d9e5SIngo Molnar	  kernel function, all the time, this option can slow down the
1524519d9e5SIngo Molnar	  kernel measurably and is generally intended for kernel
1534519d9e5SIngo Molnar	  developers only.
1544519d9e5SIngo Molnar
1554519d9e5SIngo Molnar	  Say N if unsure.
156e5a81b62SSteven Rostedt
1573d083395SSteven Rostedtconfig DYNAMIC_FTRACE
1583d083395SSteven Rostedt	bool "enable/disable ftrace tracepoints dynamically"
159*606576ceSSteven Rostedt	depends on FUNCTION_TRACER
160677aa9f7SSteven Rostedt	depends on HAVE_DYNAMIC_FTRACE
161d3ee6d99SIngo Molnar	depends on DEBUG_KERNEL
1623d083395SSteven Rostedt	default y
1633d083395SSteven Rostedt	help
1643d083395SSteven Rostedt         This option will modify all the calls to ftrace dynamically
1653d083395SSteven Rostedt	 (will patch them out of the binary image and replaces them
1663d083395SSteven Rostedt	 with a No-Op instruction) as they are called. A table is
1673d083395SSteven Rostedt	 created to dynamically enable them again.
1683d083395SSteven Rostedt
169*606576ceSSteven Rostedt	 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but otherwise
1703d083395SSteven Rostedt	 has native performance as long as no tracing is active.
1713d083395SSteven Rostedt
1723d083395SSteven Rostedt	 The changes to the code are done by a kernel thread that
1733d083395SSteven Rostedt	 wakes up once a second and checks to see if any ftrace calls
1743d083395SSteven Rostedt	 were made. If so, it runs stop_machine (stops all CPUS)
1753d083395SSteven Rostedt	 and modifies the code to jump over the call to ftrace.
17660a11774SSteven Rostedt
1778da3821bSSteven Rostedtconfig FTRACE_MCOUNT_RECORD
1788da3821bSSteven Rostedt	def_bool y
1798da3821bSSteven Rostedt	depends on DYNAMIC_FTRACE
1808da3821bSSteven Rostedt	depends on HAVE_FTRACE_MCOUNT_RECORD
1818da3821bSSteven Rostedt
18260a11774SSteven Rostedtconfig FTRACE_SELFTEST
18360a11774SSteven Rostedt	bool
18460a11774SSteven Rostedt
18560a11774SSteven Rostedtconfig FTRACE_STARTUP_TEST
18660a11774SSteven Rostedt	bool "Perform a startup test on ftrace"
1873ce2b920SFrédéric Weisbecker	depends on TRACING && DEBUG_KERNEL && !BOOT_TRACER
18860a11774SSteven Rostedt	select FTRACE_SELFTEST
18960a11774SSteven Rostedt	help
19060a11774SSteven Rostedt	  This option performs a series of startup tests on ftrace. On bootup
19160a11774SSteven Rostedt	  a series of tests are made to verify that the tracer is
19260a11774SSteven Rostedt	  functioning properly. It will do tests on all the configured
19360a11774SSteven Rostedt	  tracers of ftrace.
194