xref: /linux/kernel/trace/Kconfig (revision 30c937043b2db09ae3408f5534824f9ececdb581)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
216444a8aSArnaldo Carvalho de Melo#
3606576ceSSteven Rostedt# Architectures that offer an FUNCTION_TRACER implementation should
4606576ceSSteven Rostedt#  select HAVE_FUNCTION_TRACER:
516444a8aSArnaldo Carvalho de Melo#
62a3a4f66SFrédéric Weisbecker
78d26487fSTörök Edwinconfig USER_STACKTRACE_SUPPORT
88d26487fSTörök Edwin	bool
98d26487fSTörök Edwin
102a3a4f66SFrédéric Weisbeckerconfig NOP_TRACER
112a3a4f66SFrédéric Weisbecker	bool
122a3a4f66SFrédéric Weisbecker
1378d904b4SSteven Rostedtconfig HAVE_FTRACE_NMI_ENTER
1478d904b4SSteven Rostedt	bool
15555f386cSMike Frysinger	help
165fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/ftrace-design.rst
1778d904b4SSteven Rostedt
18606576ceSSteven Rostedtconfig HAVE_FUNCTION_TRACER
1916444a8aSArnaldo Carvalho de Melo	bool
20555f386cSMike Frysinger	help
215fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/ftrace-design.rst
22bc0c38d1SSteven Rostedt
23fb52607aSFrederic Weisbeckerconfig HAVE_FUNCTION_GRAPH_TRACER
2415e6cb36SFrederic Weisbecker	bool
25555f386cSMike Frysinger	help
265fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/ftrace-design.rst
2715e6cb36SFrederic Weisbecker
28677aa9f7SSteven Rostedtconfig HAVE_DYNAMIC_FTRACE
29677aa9f7SSteven Rostedt	bool
30555f386cSMike Frysinger	help
315fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/ftrace-design.rst
32677aa9f7SSteven Rostedt
3306aeaaeaSMasami Hiramatsuconfig HAVE_DYNAMIC_FTRACE_WITH_REGS
3406aeaaeaSMasami Hiramatsu	bool
3506aeaaeaSMasami Hiramatsu
368da3821bSSteven Rostedtconfig HAVE_FTRACE_MCOUNT_RECORD
378da3821bSSteven Rostedt	bool
38555f386cSMike Frysinger	help
395fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/ftrace-design.rst
408da3821bSSteven Rostedt
4166700001SJosh Stoneconfig HAVE_SYSCALL_TRACEPOINTS
42ee08c6ecSFrederic Weisbecker	bool
43555f386cSMike Frysinger	help
445fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/ftrace-design.rst
45ee08c6ecSFrederic Weisbecker
46a2546faeSSteven Rostedtconfig HAVE_FENTRY
47a2546faeSSteven Rostedt	bool
48a2546faeSSteven Rostedt	help
49a2546faeSSteven Rostedt	  Arch supports the gcc options -pg with -mfentry
50a2546faeSSteven Rostedt
512f4df001SVasily Gorbikconfig HAVE_NOP_MCOUNT
522f4df001SVasily Gorbik	bool
532f4df001SVasily Gorbik	help
542f4df001SVasily Gorbik	  Arch supports the gcc options -pg with -mrecord-mcount and -nop-mcount
552f4df001SVasily Gorbik
56cf4db259SSteven Rostedtconfig HAVE_C_RECORDMCOUNT
5772441cb1SSteven Rostedt	bool
5872441cb1SSteven Rostedt	help
5972441cb1SSteven Rostedt	  C version of recordmcount available?
6072441cb1SSteven Rostedt
61352ad25aSSteven Rostedtconfig TRACER_MAX_TRACE
62352ad25aSSteven Rostedt	bool
63352ad25aSSteven Rostedt
64ea632e9fSJosh Triplettconfig TRACE_CLOCK
65ea632e9fSJosh Triplett	bool
66ea632e9fSJosh Triplett
677a8e76a3SSteven Rostedtconfig RING_BUFFER
687a8e76a3SSteven Rostedt	bool
69ea632e9fSJosh Triplett	select TRACE_CLOCK
7022287688SSteven Rostedt (Red Hat)	select IRQ_WORK
717a8e76a3SSteven Rostedt
7278d904b4SSteven Rostedtconfig FTRACE_NMI_ENTER
7378d904b4SSteven Rostedt       bool
7478d904b4SSteven Rostedt       depends on HAVE_FTRACE_NMI_ENTER
7578d904b4SSteven Rostedt       default y
7678d904b4SSteven Rostedt
775f77a88bSTom Zanussiconfig EVENT_TRACING
78b11c53e1SZhaolei	select CONTEXT_SWITCH_TRACER
7960f1d5e3SMasami Hiramatsu        select GLOB
80b11c53e1SZhaolei	bool
81b11c53e1SZhaolei
82b11c53e1SZhaoleiconfig CONTEXT_SWITCH_TRACER
835f77a88bSTom Zanussi	bool
845f77a88bSTom Zanussi
8585bac32cSSteven Rostedtconfig RING_BUFFER_ALLOW_SWAP
8685bac32cSSteven Rostedt	bool
8785bac32cSSteven Rostedt	help
8885bac32cSSteven Rostedt	 Allow the use of ring_buffer_swap_cpu.
8985bac32cSSteven Rostedt	 Adds a very slight overhead to tracing when enabled.
9085bac32cSSteven Rostedt
91c3bc8fd6SJoel Fernandes (Google)config PREEMPTIRQ_TRACEPOINTS
92c3bc8fd6SJoel Fernandes (Google)	bool
93c3bc8fd6SJoel Fernandes (Google)	depends on TRACE_PREEMPT_TOGGLE || TRACE_IRQFLAGS
94c3bc8fd6SJoel Fernandes (Google)	select TRACING
95c3bc8fd6SJoel Fernandes (Google)	default y
96c3bc8fd6SJoel Fernandes (Google)	help
97c3bc8fd6SJoel Fernandes (Google)	  Create preempt/irq toggle tracepoints if needed, so that other parts
98c3bc8fd6SJoel Fernandes (Google)	  of the kernel can use them to generate or add hooks to them.
99c3bc8fd6SJoel Fernandes (Google)
1005e0a0939SSteven Rostedt# All tracer options should select GENERIC_TRACER. For those options that are
1015e0a0939SSteven Rostedt# enabled by all tracers (context switch and event tracer) they select TRACING.
1025e0a0939SSteven Rostedt# This allows those options to appear when no other tracer is selected. But the
1035e0a0939SSteven Rostedt# options do not appear when something else selects it. We need the two options
1045e0a0939SSteven Rostedt# GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the
10540892367SRandy Dunlap# hiding of the automatic options.
1065e0a0939SSteven Rostedt
107bc0c38d1SSteven Rostedtconfig TRACING
108bc0c38d1SSteven Rostedt	bool
109bc0c38d1SSteven Rostedt	select DEBUG_FS
1107a8e76a3SSteven Rostedt	select RING_BUFFER
111c2c80529SAl Viro	select STACKTRACE if STACKTRACE_SUPPORT
1125f87f112SIngo Molnar	select TRACEPOINTS
113f3384b28SSteven Rostedt	select NOP_TRACER
114769b0441SFrederic Weisbecker	select BINARY_PRINTF
1155f77a88bSTom Zanussi	select EVENT_TRACING
116ea632e9fSJosh Triplett	select TRACE_CLOCK
117bc0c38d1SSteven Rostedt
1185e0a0939SSteven Rostedtconfig GENERIC_TRACER
1195e0a0939SSteven Rostedt	bool
1205e0a0939SSteven Rostedt	select TRACING
1215e0a0939SSteven Rostedt
12240ada30fSIngo Molnar#
12340ada30fSIngo Molnar# Minimum requirements an architecture has to meet for us to
12440ada30fSIngo Molnar# be able to offer generic tracing facilities:
12540ada30fSIngo Molnar#
12640ada30fSIngo Molnarconfig TRACING_SUPPORT
12740ada30fSIngo Molnar	bool
1280ea5ee03SMichael Ellerman	depends on TRACE_IRQFLAGS_SUPPORT
12940ada30fSIngo Molnar	depends on STACKTRACE_SUPPORT
130422d3c7aSKOSAKI Motohiro	default y
13140ada30fSIngo Molnar
13240ada30fSIngo Molnarif TRACING_SUPPORT
13340ada30fSIngo Molnar
1344ed9f071SSteven Rostedtmenuconfig FTRACE
1354ed9f071SSteven Rostedt	bool "Tracers"
13665b77242SSteven Rostedt	default y if DEBUG_KERNEL
1374ed9f071SSteven Rostedt	help
1384ed9f071SSteven Rostedt	  Enable the kernel tracing infrastructure.
1394ed9f071SSteven Rostedt
1404ed9f071SSteven Rostedtif FTRACE
14117d80fd0SPeter Zijlstra
142606576ceSSteven Rostedtconfig FUNCTION_TRACER
1431b29b018SSteven Rostedt	bool "Kernel Function Tracer"
144606576ceSSteven Rostedt	depends on HAVE_FUNCTION_TRACER
1454d7a077cSSteven Rostedt	select KALLSYMS
1465e0a0939SSteven Rostedt	select GENERIC_TRACER
14735e8e302SSteven Rostedt	select CONTEXT_SWITCH_TRACER
14860f1d5e3SMasami Hiramatsu	select GLOB
14901b1d88bSThomas Gleixner	select TASKS_RCU if PREEMPTION
1501b29b018SSteven Rostedt	help
1511b29b018SSteven Rostedt	  Enable the kernel to trace every kernel function. This is done
1521b29b018SSteven Rostedt	  by using a compiler feature to insert a small, 5-byte No-Operation
15340892367SRandy Dunlap	  instruction at the beginning of every kernel function, which NOP
1541b29b018SSteven Rostedt	  sequence is then dynamically patched into a tracer call when
1551b29b018SSteven Rostedt	  tracing is enabled by the administrator. If it's runtime disabled
1561b29b018SSteven Rostedt	  (the bootup default), then the overhead of the instructions is very
1571b29b018SSteven Rostedt	  small and not measurable even in micro-benchmarks.
15835e8e302SSteven Rostedt
159fb52607aSFrederic Weisbeckerconfig FUNCTION_GRAPH_TRACER
160fb52607aSFrederic Weisbecker	bool "Kernel Function Graph Tracer"
161fb52607aSFrederic Weisbecker	depends on HAVE_FUNCTION_GRAPH_TRACER
16215e6cb36SFrederic Weisbecker	depends on FUNCTION_TRACER
163eb4a0378SSteven Rostedt	depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE
164764f3b95SIngo Molnar	default y
16515e6cb36SFrederic Weisbecker	help
166fb52607aSFrederic Weisbecker	  Enable the kernel to trace a function at both its return
167fb52607aSFrederic Weisbecker	  and its entry.
168692105b8SMatt LaPlante	  Its first purpose is to trace the duration of functions and
169692105b8SMatt LaPlante	  draw a call graph for each thread with some information like
170692105b8SMatt LaPlante	  the return value. This is done by setting the current return
171692105b8SMatt LaPlante	  address on the current task structure into a stack of calls.
17215e6cb36SFrederic Weisbecker
173c3bc8fd6SJoel Fernandes (Google)config TRACE_PREEMPT_TOGGLE
174c3bc8fd6SJoel Fernandes (Google)	bool
175c3bc8fd6SJoel Fernandes (Google)	help
176c3bc8fd6SJoel Fernandes (Google)	  Enables hooks which will be called when preemption is first disabled,
177c3bc8fd6SJoel Fernandes (Google)	  and last enabled.
178bac429f0SSteven Rostedt
179d5915816SJoel Fernandesconfig PREEMPTIRQ_EVENTS
180d5915816SJoel Fernandes	bool "Enable trace events for preempt and irq disable/enable"
181d5915816SJoel Fernandes	select TRACE_IRQFLAGS
182*30c93704SThomas Gleixner	select TRACE_PREEMPT_TOGGLE if PREEMPTION
183c3bc8fd6SJoel Fernandes (Google)	select GENERIC_TRACER
184d5915816SJoel Fernandes	default n
185d5915816SJoel Fernandes	help
186d5915816SJoel Fernandes	  Enable tracing of disable and enable events for preemption and irqs.
187d5915816SJoel Fernandes
18881d68a96SSteven Rostedtconfig IRQSOFF_TRACER
18981d68a96SSteven Rostedt	bool "Interrupts-off Latency Tracer"
19081d68a96SSteven Rostedt	default n
19181d68a96SSteven Rostedt	depends on TRACE_IRQFLAGS_SUPPORT
192592913ecSJohn Stultz	depends on !ARCH_USES_GETTIMEOFFSET
19381d68a96SSteven Rostedt	select TRACE_IRQFLAGS
1945e0a0939SSteven Rostedt	select GENERIC_TRACER
19581d68a96SSteven Rostedt	select TRACER_MAX_TRACE
19685bac32cSSteven Rostedt	select RING_BUFFER_ALLOW_SWAP
19722cffc2bSSteven Rostedt (Red Hat)	select TRACER_SNAPSHOT
1980b85ffc2SSteven Rostedt (Red Hat)	select TRACER_SNAPSHOT_PER_CPU_SWAP
19981d68a96SSteven Rostedt	help
20081d68a96SSteven Rostedt	  This option measures the time spent in irqs-off critical
20181d68a96SSteven Rostedt	  sections, with microsecond accuracy.
20281d68a96SSteven Rostedt
20381d68a96SSteven Rostedt	  The default measurement method is a maximum search, which is
20481d68a96SSteven Rostedt	  disabled by default and can be runtime (re-)started
20581d68a96SSteven Rostedt	  via:
20681d68a96SSteven Rostedt
207156f5a78SGeunSik Lim	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
20881d68a96SSteven Rostedt
20940892367SRandy Dunlap	  (Note that kernel size and overhead increase with this option
2106cd8a4bbSSteven Rostedt	  enabled. This option and the preempt-off timing option can be
2116cd8a4bbSSteven Rostedt	  used together or separately.)
2126cd8a4bbSSteven Rostedt
2136cd8a4bbSSteven Rostedtconfig PREEMPT_TRACER
2146cd8a4bbSSteven Rostedt	bool "Preemption-off Latency Tracer"
2156cd8a4bbSSteven Rostedt	default n
216592913ecSJohn Stultz	depends on !ARCH_USES_GETTIMEOFFSET
217*30c93704SThomas Gleixner	depends on PREEMPTION
2185e0a0939SSteven Rostedt	select GENERIC_TRACER
2196cd8a4bbSSteven Rostedt	select TRACER_MAX_TRACE
22085bac32cSSteven Rostedt	select RING_BUFFER_ALLOW_SWAP
22122cffc2bSSteven Rostedt (Red Hat)	select TRACER_SNAPSHOT
2220b85ffc2SSteven Rostedt (Red Hat)	select TRACER_SNAPSHOT_PER_CPU_SWAP
223c3bc8fd6SJoel Fernandes (Google)	select TRACE_PREEMPT_TOGGLE
2246cd8a4bbSSteven Rostedt	help
22540892367SRandy Dunlap	  This option measures the time spent in preemption-off critical
2266cd8a4bbSSteven Rostedt	  sections, with microsecond accuracy.
2276cd8a4bbSSteven Rostedt
2286cd8a4bbSSteven Rostedt	  The default measurement method is a maximum search, which is
2296cd8a4bbSSteven Rostedt	  disabled by default and can be runtime (re-)started
2306cd8a4bbSSteven Rostedt	  via:
2316cd8a4bbSSteven Rostedt
232156f5a78SGeunSik Lim	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
2336cd8a4bbSSteven Rostedt
23440892367SRandy Dunlap	  (Note that kernel size and overhead increase with this option
2356cd8a4bbSSteven Rostedt	  enabled. This option and the irqs-off timing option can be
2366cd8a4bbSSteven Rostedt	  used together or separately.)
2376cd8a4bbSSteven Rostedt
238352ad25aSSteven Rostedtconfig SCHED_TRACER
239352ad25aSSteven Rostedt	bool "Scheduling Latency Tracer"
2405e0a0939SSteven Rostedt	select GENERIC_TRACER
241352ad25aSSteven Rostedt	select CONTEXT_SWITCH_TRACER
242352ad25aSSteven Rostedt	select TRACER_MAX_TRACE
24322cffc2bSSteven Rostedt (Red Hat)	select TRACER_SNAPSHOT
244352ad25aSSteven Rostedt	help
245352ad25aSSteven Rostedt	  This tracer tracks the latency of the highest priority task
246352ad25aSSteven Rostedt	  to be scheduled in, starting from the point it has woken up.
247352ad25aSSteven Rostedt
248e7c15cd8SSteven Rostedt (Red Hat)config HWLAT_TRACER
249e7c15cd8SSteven Rostedt (Red Hat)	bool "Tracer to detect hardware latencies (like SMIs)"
250e7c15cd8SSteven Rostedt (Red Hat)	select GENERIC_TRACER
251e7c15cd8SSteven Rostedt (Red Hat)	help
252e7c15cd8SSteven Rostedt (Red Hat)	 This tracer, when enabled will create one or more kernel threads,
253c5c1ea75SJesper Dangaard Brouer	 depending on what the cpumask file is set to, which each thread
254e7c15cd8SSteven Rostedt (Red Hat)	 spinning in a loop looking for interruptions caused by
255e7c15cd8SSteven Rostedt (Red Hat)	 something other than the kernel. For example, if a
256e7c15cd8SSteven Rostedt (Red Hat)	 System Management Interrupt (SMI) takes a noticeable amount of
257e7c15cd8SSteven Rostedt (Red Hat)	 time, this tracer will detect it. This is useful for testing
258e7c15cd8SSteven Rostedt (Red Hat)	 if a system is reliable for Real Time tasks.
259e7c15cd8SSteven Rostedt (Red Hat)
260e7c15cd8SSteven Rostedt (Red Hat)	 Some files are created in the tracing directory when this
261e7c15cd8SSteven Rostedt (Red Hat)	 is enabled:
262e7c15cd8SSteven Rostedt (Red Hat)
263e7c15cd8SSteven Rostedt (Red Hat)	   hwlat_detector/width   - time in usecs for how long to spin for
264e7c15cd8SSteven Rostedt (Red Hat)	   hwlat_detector/window  - time in usecs between the start of each
265e7c15cd8SSteven Rostedt (Red Hat)				     iteration
266e7c15cd8SSteven Rostedt (Red Hat)
267e7c15cd8SSteven Rostedt (Red Hat)	 A kernel thread is created that will spin with interrupts disabled
268c5c1ea75SJesper Dangaard Brouer	 for "width" microseconds in every "window" cycle. It will not spin
269e7c15cd8SSteven Rostedt (Red Hat)	 for "window - width" microseconds, where the system can
270e7c15cd8SSteven Rostedt (Red Hat)	 continue to operate.
271e7c15cd8SSteven Rostedt (Red Hat)
272e7c15cd8SSteven Rostedt (Red Hat)	 The output will appear in the trace and trace_pipe files.
273e7c15cd8SSteven Rostedt (Red Hat)
274e7c15cd8SSteven Rostedt (Red Hat)	 When the tracer is not running, it has no affect on the system,
275e7c15cd8SSteven Rostedt (Red Hat)	 but when it is running, it can cause the system to be
276e7c15cd8SSteven Rostedt (Red Hat)	 periodically non responsive. Do not run this tracer on a
277e7c15cd8SSteven Rostedt (Red Hat)	 production system.
278e7c15cd8SSteven Rostedt (Red Hat)
279e7c15cd8SSteven Rostedt (Red Hat)	 To enable this tracer, echo in "hwlat" into the current_tracer
280e7c15cd8SSteven Rostedt (Red Hat)	 file. Every time a latency is greater than tracing_thresh, it will
281e7c15cd8SSteven Rostedt (Red Hat)	 be recorded into the ring buffer.
282e7c15cd8SSteven Rostedt (Red Hat)
283897f17a6SSteven Rostedtconfig ENABLE_DEFAULT_TRACERS
284897f17a6SSteven Rostedt	bool "Trace process context switches and events"
2855e0a0939SSteven Rostedt	depends on !GENERIC_TRACER
286b77e38aaSSteven Rostedt	select TRACING
287b77e38aaSSteven Rostedt	help
28840892367SRandy Dunlap	  This tracer hooks to various trace points in the kernel,
289b77e38aaSSteven Rostedt	  allowing the user to pick and choose which trace point they
290897f17a6SSteven Rostedt	  want to trace. It also includes the sched_switch tracer plugin.
291a7abe97fSSteven Rostedt
292ee08c6ecSFrederic Weisbeckerconfig FTRACE_SYSCALLS
293ee08c6ecSFrederic Weisbecker	bool "Trace syscalls"
29466700001SJosh Stone	depends on HAVE_SYSCALL_TRACEPOINTS
2955e0a0939SSteven Rostedt	select GENERIC_TRACER
2960ea1c415SFrederic Weisbecker	select KALLSYMS
297ee08c6ecSFrederic Weisbecker	help
298ee08c6ecSFrederic Weisbecker	  Basic tracer to catch the syscall entry and exit events.
299ee08c6ecSFrederic Weisbecker
300debdd57fSHiraku Toyookaconfig TRACER_SNAPSHOT
301debdd57fSHiraku Toyooka	bool "Create a snapshot trace buffer"
302debdd57fSHiraku Toyooka	select TRACER_MAX_TRACE
303debdd57fSHiraku Toyooka	help
304debdd57fSHiraku Toyooka	  Allow tracing users to take snapshot of the current buffer using the
305debdd57fSHiraku Toyooka	  ftrace interface, e.g.:
306debdd57fSHiraku Toyooka
307debdd57fSHiraku Toyooka	      echo 1 > /sys/kernel/debug/tracing/snapshot
308debdd57fSHiraku Toyooka	      cat snapshot
309debdd57fSHiraku Toyooka
3100b85ffc2SSteven Rostedt (Red Hat)config TRACER_SNAPSHOT_PER_CPU_SWAP
3110b85ffc2SSteven Rostedt (Red Hat)        bool "Allow snapshot to swap per CPU"
3120b85ffc2SSteven Rostedt (Red Hat)	depends on TRACER_SNAPSHOT
3130b85ffc2SSteven Rostedt (Red Hat)	select RING_BUFFER_ALLOW_SWAP
3140b85ffc2SSteven Rostedt (Red Hat)	help
3150b85ffc2SSteven Rostedt (Red Hat)	  Allow doing a snapshot of a single CPU buffer instead of a
3160b85ffc2SSteven Rostedt (Red Hat)	  full swap (all buffers). If this is set, then the following is
3170b85ffc2SSteven Rostedt (Red Hat)	  allowed:
3180b85ffc2SSteven Rostedt (Red Hat)
3190b85ffc2SSteven Rostedt (Red Hat)	      echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot
3200b85ffc2SSteven Rostedt (Red Hat)
3210b85ffc2SSteven Rostedt (Red Hat)	  After which, only the tracing buffer for CPU 2 was swapped with
3220b85ffc2SSteven Rostedt (Red Hat)	  the main tracing buffer, and the other CPU buffers remain the same.
3230b85ffc2SSteven Rostedt (Red Hat)
3240b85ffc2SSteven Rostedt (Red Hat)	  When this is enabled, this adds a little more overhead to the
3250b85ffc2SSteven Rostedt (Red Hat)	  trace recording, as it needs to add some checks to synchronize
3260b85ffc2SSteven Rostedt (Red Hat)	  recording with swaps. But this does not affect the performance
3270b85ffc2SSteven Rostedt (Red Hat)	  of the overall system. This is enabled by default when the preempt
3280b85ffc2SSteven Rostedt (Red Hat)	  or irq latency tracers are enabled, as those need to swap as well
3290b85ffc2SSteven Rostedt (Red Hat)	  and already adds the overhead (plus a lot more).
3300b85ffc2SSteven Rostedt (Red Hat)
3312ed84eebSSteven Rostedtconfig TRACE_BRANCH_PROFILING
3329ae5b879SSteven Rostedt	bool
3335e0a0939SSteven Rostedt	select GENERIC_TRACER
3349ae5b879SSteven Rostedt
3359ae5b879SSteven Rostedtchoice
3369ae5b879SSteven Rostedt	prompt "Branch Profiling"
3379ae5b879SSteven Rostedt	default BRANCH_PROFILE_NONE
3389ae5b879SSteven Rostedt	help
3399ae5b879SSteven Rostedt	 The branch profiling is a software profiler. It will add hooks
3409ae5b879SSteven Rostedt	 into the C conditionals to test which path a branch takes.
3419ae5b879SSteven Rostedt
3429ae5b879SSteven Rostedt	 The likely/unlikely profiler only looks at the conditions that
3439ae5b879SSteven Rostedt	 are annotated with a likely or unlikely macro.
3449ae5b879SSteven Rostedt
34540892367SRandy Dunlap	 The "all branch" profiler will profile every if-statement in the
3469ae5b879SSteven Rostedt	 kernel. This profiler will also enable the likely/unlikely
34740892367SRandy Dunlap	 profiler.
3489ae5b879SSteven Rostedt
34940892367SRandy Dunlap	 Either of the above profilers adds a bit of overhead to the system.
35040892367SRandy Dunlap	 If unsure, choose "No branch profiling".
3519ae5b879SSteven Rostedt
3529ae5b879SSteven Rostedtconfig BRANCH_PROFILE_NONE
3539ae5b879SSteven Rostedt	bool "No branch profiling"
3549ae5b879SSteven Rostedt	help
3559ae5b879SSteven Rostedt	  No branch profiling. Branch profiling adds a bit of overhead.
3569ae5b879SSteven Rostedt	  Only enable it if you want to analyse the branching behavior.
3579ae5b879SSteven Rostedt	  Otherwise keep it disabled.
3589ae5b879SSteven Rostedt
3599ae5b879SSteven Rostedtconfig PROFILE_ANNOTATED_BRANCHES
3609ae5b879SSteven Rostedt	bool "Trace likely/unlikely profiler"
3619ae5b879SSteven Rostedt	select TRACE_BRANCH_PROFILING
3621f0d69a9SSteven Rostedt	help
36359bf8964SMasanari Iida	  This tracer profiles all likely and unlikely macros
3641f0d69a9SSteven Rostedt	  in the kernel. It will display the results in:
3651f0d69a9SSteven Rostedt
36613e5befaSDavid Rientjes	  /sys/kernel/debug/tracing/trace_stat/branch_annotated
3671f0d69a9SSteven Rostedt
36840892367SRandy Dunlap	  Note: this will add a significant overhead; only turn this
3691f0d69a9SSteven Rostedt	  on if you need to profile the system's use of these macros.
3701f0d69a9SSteven Rostedt
3712bcd521aSSteven Rostedtconfig PROFILE_ALL_BRANCHES
37268e76e03SRandy Dunlap	bool "Profile all if conditionals" if !FORTIFY_SOURCE
3739ae5b879SSteven Rostedt	select TRACE_BRANCH_PROFILING
374b303c6dfSMasahiro Yamada	imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED  # avoid false positives
3752bcd521aSSteven Rostedt	help
3762bcd521aSSteven Rostedt	  This tracer profiles all branch conditions. Every if ()
3772bcd521aSSteven Rostedt	  taken in the kernel is recorded whether it hit or miss.
3782bcd521aSSteven Rostedt	  The results will be displayed in:
3792bcd521aSSteven Rostedt
38013e5befaSDavid Rientjes	  /sys/kernel/debug/tracing/trace_stat/branch_all
3812bcd521aSSteven Rostedt
3829ae5b879SSteven Rostedt	  This option also enables the likely/unlikely profiler.
3839ae5b879SSteven Rostedt
3842bcd521aSSteven Rostedt	  This configuration, when enabled, will impose a great overhead
3852bcd521aSSteven Rostedt	  on the system. This should only be enabled when the system
38640892367SRandy Dunlap	  is to be analyzed in much detail.
3879ae5b879SSteven Rostedtendchoice
3882bcd521aSSteven Rostedt
3892ed84eebSSteven Rostedtconfig TRACING_BRANCHES
39052f232cbSSteven Rostedt	bool
39152f232cbSSteven Rostedt	help
39252f232cbSSteven Rostedt	  Selected by tracers that will trace the likely and unlikely
39352f232cbSSteven Rostedt	  conditions. This prevents the tracers themselves from being
39452f232cbSSteven Rostedt	  profiled. Profiling the tracing infrastructure can only happen
39552f232cbSSteven Rostedt	  when the likelys and unlikelys are not being traced.
39652f232cbSSteven Rostedt
3972ed84eebSSteven Rostedtconfig BRANCH_TRACER
39852f232cbSSteven Rostedt	bool "Trace likely/unlikely instances"
3992ed84eebSSteven Rostedt	depends on TRACE_BRANCH_PROFILING
4002ed84eebSSteven Rostedt	select TRACING_BRANCHES
40152f232cbSSteven Rostedt	help
40252f232cbSSteven Rostedt	  This traces the events of likely and unlikely condition
40352f232cbSSteven Rostedt	  calls in the kernel.  The difference between this and the
40452f232cbSSteven Rostedt	  "Trace likely/unlikely profiler" is that this is not a
40552f232cbSSteven Rostedt	  histogram of the callers, but actually places the calling
40652f232cbSSteven Rostedt	  events into a running trace buffer to see when and where the
40752f232cbSSteven Rostedt	  events happened, as well as their results.
40852f232cbSSteven Rostedt
40952f232cbSSteven Rostedt	  Say N if unsure.
41052f232cbSSteven Rostedt
411e5a81b62SSteven Rostedtconfig STACK_TRACER
412e5a81b62SSteven Rostedt	bool "Trace max stack"
413606576ceSSteven Rostedt	depends on HAVE_FUNCTION_TRACER
414606576ceSSteven Rostedt	select FUNCTION_TRACER
415e5a81b62SSteven Rostedt	select STACKTRACE
4164d7a077cSSteven Rostedt	select KALLSYMS
417e5a81b62SSteven Rostedt	help
4184519d9e5SIngo Molnar	  This special tracer records the maximum stack footprint of the
419156f5a78SGeunSik Lim	  kernel and displays it in /sys/kernel/debug/tracing/stack_trace.
4204519d9e5SIngo Molnar
4214519d9e5SIngo Molnar	  This tracer works by hooking into every function call that the
4224519d9e5SIngo Molnar	  kernel executes, and keeping a maximum stack depth value and
423f38f1d2aSSteven Rostedt	  stack-trace saved.  If this is configured with DYNAMIC_FTRACE
424f38f1d2aSSteven Rostedt	  then it will not have any overhead while the stack tracer
425f38f1d2aSSteven Rostedt	  is disabled.
426f38f1d2aSSteven Rostedt
427f38f1d2aSSteven Rostedt	  To enable the stack tracer on bootup, pass in 'stacktrace'
428f38f1d2aSSteven Rostedt	  on the kernel command line.
429f38f1d2aSSteven Rostedt
430f38f1d2aSSteven Rostedt	  The stack tracer can also be enabled or disabled via the
431f38f1d2aSSteven Rostedt	  sysctl kernel.stack_tracer_enabled
4324519d9e5SIngo Molnar
4334519d9e5SIngo Molnar	  Say N if unsure.
434e5a81b62SSteven Rostedt
4352db270a8SFrederic Weisbeckerconfig BLK_DEV_IO_TRACE
43640892367SRandy Dunlap	bool "Support for tracing block IO actions"
4372db270a8SFrederic Weisbecker	depends on SYSFS
4381dfba05dSIngo Molnar	depends on BLOCK
4392db270a8SFrederic Weisbecker	select RELAY
4402db270a8SFrederic Weisbecker	select DEBUG_FS
4412db270a8SFrederic Weisbecker	select TRACEPOINTS
4425e0a0939SSteven Rostedt	select GENERIC_TRACER
4432db270a8SFrederic Weisbecker	select STACKTRACE
4442db270a8SFrederic Weisbecker	help
4452db270a8SFrederic Weisbecker	  Say Y here if you want to be able to trace the block layer actions
4462db270a8SFrederic Weisbecker	  on a given queue. Tracing allows you to see any traffic happening
4472db270a8SFrederic Weisbecker	  on a block device queue. For more information (and the userspace
4482db270a8SFrederic Weisbecker	  support tools needed), fetch the blktrace tools from:
4492db270a8SFrederic Weisbecker
4502db270a8SFrederic Weisbecker	  git://git.kernel.dk/blktrace.git
4512db270a8SFrederic Weisbecker
4522db270a8SFrederic Weisbecker	  Tracing also is possible using the ftrace interface, e.g.:
4532db270a8SFrederic Weisbecker
4542db270a8SFrederic Weisbecker	    echo 1 > /sys/block/sda/sda1/trace/enable
4552db270a8SFrederic Weisbecker	    echo blk > /sys/kernel/debug/tracing/current_tracer
4562db270a8SFrederic Weisbecker	    cat /sys/kernel/debug/tracing/trace_pipe
4572db270a8SFrederic Weisbecker
4582db270a8SFrederic Weisbecker	  If unsure, say N.
45936994e58SFrederic Weisbecker
4606b0b7551SAnton Blanchardconfig KPROBE_EVENTS
461413d37d1SMasami Hiramatsu	depends on KPROBES
462f850c30cSHeiko Carstens	depends on HAVE_REGS_AND_STACK_ACCESS_API
46377b44d1bSMasami Hiramatsu	bool "Enable kprobes-based dynamic events"
464413d37d1SMasami Hiramatsu	select TRACING
4658ab83f56SSrikar Dronamraju	select PROBE_EVENTS
4666212dd29SMasami Hiramatsu	select DYNAMIC_EVENTS
46777b44d1bSMasami Hiramatsu	default y
468413d37d1SMasami Hiramatsu	help
46940892367SRandy Dunlap	  This allows the user to add tracing events (similar to tracepoints)
47040892367SRandy Dunlap	  on the fly via the ftrace interface. See
4715fb94e9cSMauro Carvalho Chehab	  Documentation/trace/kprobetrace.rst for more details.
47277b44d1bSMasami Hiramatsu
47377b44d1bSMasami Hiramatsu	  Those events can be inserted wherever kprobes can probe, and record
47477b44d1bSMasami Hiramatsu	  various register and memory values.
47577b44d1bSMasami Hiramatsu
47640892367SRandy Dunlap	  This option is also required by perf-probe subcommand of perf tools.
47740892367SRandy Dunlap	  If you want to use perf tools, this option is strongly recommended.
478413d37d1SMasami Hiramatsu
47945408c4fSMasami Hiramatsuconfig KPROBE_EVENTS_ON_NOTRACE
48045408c4fSMasami Hiramatsu	bool "Do NOT protect notrace function from kprobe events"
48145408c4fSMasami Hiramatsu	depends on KPROBE_EVENTS
48245408c4fSMasami Hiramatsu	depends on KPROBES_ON_FTRACE
48345408c4fSMasami Hiramatsu	default n
48445408c4fSMasami Hiramatsu	help
48545408c4fSMasami Hiramatsu	  This is only for the developers who want to debug ftrace itself
48645408c4fSMasami Hiramatsu	  using kprobe events.
48745408c4fSMasami Hiramatsu
48845408c4fSMasami Hiramatsu	  If kprobes can use ftrace instead of breakpoint, ftrace related
48945408c4fSMasami Hiramatsu	  functions are protected from kprobe-events to prevent an infinit
49045408c4fSMasami Hiramatsu	  recursion or any unexpected execution path which leads to a kernel
49145408c4fSMasami Hiramatsu	  crash.
49245408c4fSMasami Hiramatsu
49345408c4fSMasami Hiramatsu	  This option disables such protection and allows you to put kprobe
49445408c4fSMasami Hiramatsu	  events on ftrace functions for debugging ftrace by itself.
49545408c4fSMasami Hiramatsu	  Note that this might let you shoot yourself in the foot.
49645408c4fSMasami Hiramatsu
49745408c4fSMasami Hiramatsu	  If unsure, say N.
49845408c4fSMasami Hiramatsu
4996b0b7551SAnton Blanchardconfig UPROBE_EVENTS
500f3f096cfSSrikar Dronamraju	bool "Enable uprobes-based dynamic events"
501f3f096cfSSrikar Dronamraju	depends on ARCH_SUPPORTS_UPROBES
502f3f096cfSSrikar Dronamraju	depends on MMU
50309294e31SDavid A. Long	depends on PERF_EVENTS
504f3f096cfSSrikar Dronamraju	select UPROBES
505f3f096cfSSrikar Dronamraju	select PROBE_EVENTS
5060597c49cSMasami Hiramatsu	select DYNAMIC_EVENTS
507f3f096cfSSrikar Dronamraju	select TRACING
50861f35d75SArnaldo Carvalho de Melo	default y
509f3f096cfSSrikar Dronamraju	help
510f3f096cfSSrikar Dronamraju	  This allows the user to add tracing events on top of userspace
511f3f096cfSSrikar Dronamraju	  dynamic events (similar to tracepoints) on the fly via the trace
512f3f096cfSSrikar Dronamraju	  events interface. Those events can be inserted wherever uprobes
513f3f096cfSSrikar Dronamraju	  can probe, and record various registers.
514f3f096cfSSrikar Dronamraju	  This option is required if you plan to use perf-probe subcommand
515f3f096cfSSrikar Dronamraju	  of perf tools on user space applications.
516f3f096cfSSrikar Dronamraju
517e1abf2ccSIngo Molnarconfig BPF_EVENTS
518e1abf2ccSIngo Molnar	depends on BPF_SYSCALL
5196b0b7551SAnton Blanchard	depends on (KPROBE_EVENTS || UPROBE_EVENTS) && PERF_EVENTS
520e1abf2ccSIngo Molnar	bool
521e1abf2ccSIngo Molnar	default y
522e1abf2ccSIngo Molnar	help
523e1abf2ccSIngo Molnar	  This allows the user to attach BPF programs to kprobe events.
524e1abf2ccSIngo Molnar
5255448d44cSMasami Hiramatsuconfig DYNAMIC_EVENTS
5265448d44cSMasami Hiramatsu	def_bool n
5275448d44cSMasami Hiramatsu
5288ab83f56SSrikar Dronamrajuconfig PROBE_EVENTS
5298ab83f56SSrikar Dronamraju	def_bool n
5308ab83f56SSrikar Dronamraju
5313d083395SSteven Rostedtconfig DYNAMIC_FTRACE
532db05021dSSteven Rostedt	bool "enable/disable function tracing dynamically"
533606576ceSSteven Rostedt	depends on FUNCTION_TRACER
534677aa9f7SSteven Rostedt	depends on HAVE_DYNAMIC_FTRACE
5353d083395SSteven Rostedt	default y
5363d083395SSteven Rostedt	help
537db05021dSSteven Rostedt	  This option will modify all the calls to function tracing
538db05021dSSteven Rostedt	  dynamically (will patch them out of the binary image and
539db05021dSSteven Rostedt	  replace them with a No-Op instruction) on boot up. During
540db05021dSSteven Rostedt	  compile time, a table is made of all the locations that ftrace
541db05021dSSteven Rostedt	  can function trace, and this table is linked into the kernel
542db05021dSSteven Rostedt	  image. When this is enabled, functions can be individually
543db05021dSSteven Rostedt	  enabled, and the functions not enabled will not affect
544db05021dSSteven Rostedt	  performance of the system.
545db05021dSSteven Rostedt
546db05021dSSteven Rostedt	  See the files in /sys/kernel/debug/tracing:
547db05021dSSteven Rostedt	    available_filter_functions
548db05021dSSteven Rostedt	    set_ftrace_filter
549db05021dSSteven Rostedt	    set_ftrace_notrace
5503d083395SSteven Rostedt
55140892367SRandy Dunlap	  This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
55240892367SRandy Dunlap	  otherwise has native performance as long as no tracing is active.
5533d083395SSteven Rostedt
55406aeaaeaSMasami Hiramatsuconfig DYNAMIC_FTRACE_WITH_REGS
55506aeaaeaSMasami Hiramatsu	def_bool y
55606aeaaeaSMasami Hiramatsu	depends on DYNAMIC_FTRACE
55706aeaaeaSMasami Hiramatsu	depends on HAVE_DYNAMIC_FTRACE_WITH_REGS
55806aeaaeaSMasami Hiramatsu
559bac429f0SSteven Rostedtconfig FUNCTION_PROFILER
560bac429f0SSteven Rostedt	bool "Kernel function profiler"
561493762fcSSteven Rostedt	depends on FUNCTION_TRACER
562bac429f0SSteven Rostedt	default n
563bac429f0SSteven Rostedt	help
564493762fcSSteven Rostedt	  This option enables the kernel function profiler. A file is created
565493762fcSSteven Rostedt	  in debugfs called function_profile_enabled which defaults to zero.
566bac429f0SSteven Rostedt	  When a 1 is echoed into this file profiling begins, and when a
56740892367SRandy Dunlap	  zero is entered, profiling stops. A "functions" file is created in
5681fee4f77SMasami Hiramatsu	  the trace_stat directory; this file shows the list of functions that
569bac429f0SSteven Rostedt	  have been hit and their counters.
570bac429f0SSteven Rostedt
57140892367SRandy Dunlap	  If in doubt, say N.
572bac429f0SSteven Rostedt
5739802d865SJosef Bacikconfig BPF_KPROBE_OVERRIDE
5749802d865SJosef Bacik	bool "Enable BPF programs to override a kprobed function"
5759802d865SJosef Bacik	depends on BPF_EVENTS
576540adea3SMasami Hiramatsu	depends on FUNCTION_ERROR_INJECTION
5779802d865SJosef Bacik	default n
5789802d865SJosef Bacik	help
5799802d865SJosef Bacik	 Allows BPF to override the execution of a probed function and
5809802d865SJosef Bacik	 set a different return value.  This is used for error injection.
5819802d865SJosef Bacik
5828da3821bSSteven Rostedtconfig FTRACE_MCOUNT_RECORD
5838da3821bSSteven Rostedt	def_bool y
5848da3821bSSteven Rostedt	depends on DYNAMIC_FTRACE
5858da3821bSSteven Rostedt	depends on HAVE_FTRACE_MCOUNT_RECORD
5868da3821bSSteven Rostedt
58760a11774SSteven Rostedtconfig FTRACE_SELFTEST
58860a11774SSteven Rostedt	bool
58960a11774SSteven Rostedt
59060a11774SSteven Rostedtconfig FTRACE_STARTUP_TEST
59160a11774SSteven Rostedt	bool "Perform a startup test on ftrace"
5925e0a0939SSteven Rostedt	depends on GENERIC_TRACER
59360a11774SSteven Rostedt	select FTRACE_SELFTEST
59460a11774SSteven Rostedt	help
59560a11774SSteven Rostedt	  This option performs a series of startup tests on ftrace. On bootup
59660a11774SSteven Rostedt	  a series of tests are made to verify that the tracer is
59760a11774SSteven Rostedt	  functioning properly. It will do tests on all the configured
59860a11774SSteven Rostedt	  tracers of ftrace.
59917d80fd0SPeter Zijlstra
600b3015fe4SSteven Rostedt (VMware)config EVENT_TRACE_STARTUP_TEST
601b3015fe4SSteven Rostedt (VMware)	bool "Run selftest on trace events"
602b3015fe4SSteven Rostedt (VMware)	depends on FTRACE_STARTUP_TEST
603b3015fe4SSteven Rostedt (VMware)	default y
604b3015fe4SSteven Rostedt (VMware)	help
605b3015fe4SSteven Rostedt (VMware)	  This option performs a test on all trace events in the system.
606b3015fe4SSteven Rostedt (VMware)	  It basically just enables each event and runs some code that
607b3015fe4SSteven Rostedt (VMware)	  will trigger events (not necessarily the event it enables)
608b3015fe4SSteven Rostedt (VMware)	  This may take some time run as there are a lot of events.
609b3015fe4SSteven Rostedt (VMware)
6101f5a6b45SSteven Rostedtconfig EVENT_TRACE_TEST_SYSCALLS
6111f5a6b45SSteven Rostedt	bool "Run selftest on syscall events"
612b3015fe4SSteven Rostedt (VMware)	depends on EVENT_TRACE_STARTUP_TEST
6131f5a6b45SSteven Rostedt	help
6141f5a6b45SSteven Rostedt	 This option will also enable testing every syscall event.
6151f5a6b45SSteven Rostedt	 It only enables the event and disables it and runs various loads
6161f5a6b45SSteven Rostedt	 with the event enabled. This adds a bit more time for kernel boot
6171f5a6b45SSteven Rostedt	 up since it runs this on every system call defined.
6181f5a6b45SSteven Rostedt
6191f5a6b45SSteven Rostedt	 TBD - enable a way to actually call the syscalls as we test their
6201f5a6b45SSteven Rostedt	       events
6211f5a6b45SSteven Rostedt
622fe6f90e5SPekka Paalanenconfig MMIOTRACE
623fe6f90e5SPekka Paalanen	bool "Memory mapped IO tracing"
62440ada30fSIngo Molnar	depends on HAVE_MMIOTRACE_SUPPORT && PCI
6255e0a0939SSteven Rostedt	select GENERIC_TRACER
626fe6f90e5SPekka Paalanen	help
627fe6f90e5SPekka Paalanen	  Mmiotrace traces Memory Mapped I/O access and is meant for
628fe6f90e5SPekka Paalanen	  debugging and reverse engineering. It is called from the ioremap
629fe6f90e5SPekka Paalanen	  implementation and works via page faults. Tracing is disabled by
630fe6f90e5SPekka Paalanen	  default and can be enabled at run-time.
631fe6f90e5SPekka Paalanen
6325fb94e9cSMauro Carvalho Chehab	  See Documentation/trace/mmiotrace.rst.
633fe6f90e5SPekka Paalanen	  If you are not helping to develop drivers, say N.
634fe6f90e5SPekka Paalanen
63508d43a5fSTom Zanussiconfig TRACING_MAP
63608d43a5fSTom Zanussi	bool
63708d43a5fSTom Zanussi	depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
63808d43a5fSTom Zanussi	help
63908d43a5fSTom Zanussi	  tracing_map is a special-purpose lock-free map for tracing,
64008d43a5fSTom Zanussi	  separated out as a stand-alone facility in order to allow it
64108d43a5fSTom Zanussi	  to be shared between multiple tracers.  It isn't meant to be
64208d43a5fSTom Zanussi	  generally used outside of that context, and is normally
64308d43a5fSTom Zanussi	  selected by tracers that use it.
64408d43a5fSTom Zanussi
6457ef224d1STom Zanussiconfig HIST_TRIGGERS
6467ef224d1STom Zanussi	bool "Histogram triggers"
6477ef224d1STom Zanussi	depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
6487ef224d1STom Zanussi	select TRACING_MAP
6497ad8fb61STom Zanussi	select TRACING
6507bbab38dSMasami Hiramatsu	select DYNAMIC_EVENTS
6517ef224d1STom Zanussi	default n
6527ef224d1STom Zanussi	help
6537ef224d1STom Zanussi	  Hist triggers allow one or more arbitrary trace event fields
6547ef224d1STom Zanussi	  to be aggregated into hash tables and dumped to stdout by
6557ef224d1STom Zanussi	  reading a debugfs/tracefs file.  They're useful for
6567ef224d1STom Zanussi	  gathering quick and dirty (though precise) summaries of
6577ef224d1STom Zanussi	  event activity as an initial guide for further investigation
6587ef224d1STom Zanussi	  using more advanced tools.
6597ef224d1STom Zanussi
66089e270c1STom Zanussi	  Inter-event tracing of quantities such as latencies is also
66189e270c1STom Zanussi	  supported using hist triggers under this option.
66289e270c1STom Zanussi
663ea272257SMauro Carvalho Chehab	  See Documentation/trace/histogram.rst.
6647ef224d1STom Zanussi	  If in doubt, say N.
6657ef224d1STom Zanussi
666fe6f90e5SPekka Paalanenconfig MMIOTRACE_TEST
667fe6f90e5SPekka Paalanen	tristate "Test module for mmiotrace"
668fe6f90e5SPekka Paalanen	depends on MMIOTRACE && m
669fe6f90e5SPekka Paalanen	help
670fe6f90e5SPekka Paalanen	  This is a dumb module for testing mmiotrace. It is very dangerous
671fe6f90e5SPekka Paalanen	  as it will write garbage to IO memory starting at a given address.
672fe6f90e5SPekka Paalanen	  However, it should be safe to use on e.g. unused portion of VRAM.
673fe6f90e5SPekka Paalanen
674fe6f90e5SPekka Paalanen	  Say N, unless you absolutely know what you are doing.
675fe6f90e5SPekka Paalanen
67681dc9f0eSSteven Rostedt (Red Hat)config TRACEPOINT_BENCHMARK
67781dc9f0eSSteven Rostedt (Red Hat)        bool "Add tracepoint that benchmarks tracepoints"
67881dc9f0eSSteven Rostedt (Red Hat)	help
67981dc9f0eSSteven Rostedt (Red Hat)	 This option creates the tracepoint "benchmark:benchmark_event".
68081dc9f0eSSteven Rostedt (Red Hat)	 When the tracepoint is enabled, it kicks off a kernel thread that
68181dc9f0eSSteven Rostedt (Red Hat)	 goes into an infinite loop (calling cond_sched() to let other tasks
68281dc9f0eSSteven Rostedt (Red Hat)	 run), and calls the tracepoint. Each iteration will record the time
68381dc9f0eSSteven Rostedt (Red Hat)	 it took to write to the tracepoint and the next iteration that
68481dc9f0eSSteven Rostedt (Red Hat)	 data will be passed to the tracepoint itself. That is, the tracepoint
68581dc9f0eSSteven Rostedt (Red Hat)	 will report the time it took to do the previous tracepoint.
68681dc9f0eSSteven Rostedt (Red Hat)	 The string written to the tracepoint is a static string of 128 bytes
68781dc9f0eSSteven Rostedt (Red Hat)	 to keep the time the same. The initial string is simply a write of
68881dc9f0eSSteven Rostedt (Red Hat)	 "START". The second string records the cold cache time of the first
68981dc9f0eSSteven Rostedt (Red Hat)	 write which is not added to the rest of the calculations.
69081dc9f0eSSteven Rostedt (Red Hat)
69181dc9f0eSSteven Rostedt (Red Hat)	 As it is a tight loop, it benchmarks as hot cache. That's fine because
69281dc9f0eSSteven Rostedt (Red Hat)	 we care most about hot paths that are probably in cache already.
69381dc9f0eSSteven Rostedt (Red Hat)
69481dc9f0eSSteven Rostedt (Red Hat)	 An example of the output:
69581dc9f0eSSteven Rostedt (Red Hat)
69681dc9f0eSSteven Rostedt (Red Hat)	      START
69781dc9f0eSSteven Rostedt (Red Hat)	      first=3672 [COLD CACHED]
69881dc9f0eSSteven Rostedt (Red Hat)	      last=632 first=3672 max=632 min=632 avg=316 std=446 std^2=199712
69981dc9f0eSSteven Rostedt (Red Hat)	      last=278 first=3672 max=632 min=278 avg=303 std=316 std^2=100337
70081dc9f0eSSteven Rostedt (Red Hat)	      last=277 first=3672 max=632 min=277 avg=296 std=258 std^2=67064
70181dc9f0eSSteven Rostedt (Red Hat)	      last=273 first=3672 max=632 min=273 avg=292 std=224 std^2=50411
70281dc9f0eSSteven Rostedt (Red Hat)	      last=273 first=3672 max=632 min=273 avg=288 std=200 std^2=40389
70381dc9f0eSSteven Rostedt (Red Hat)	      last=281 first=3672 max=632 min=273 avg=287 std=183 std^2=33666
70481dc9f0eSSteven Rostedt (Red Hat)
70581dc9f0eSSteven Rostedt (Red Hat)
7065092dbc9SSteven Rostedtconfig RING_BUFFER_BENCHMARK
7075092dbc9SSteven Rostedt	tristate "Ring buffer benchmark stress tester"
7085092dbc9SSteven Rostedt	depends on RING_BUFFER
7095092dbc9SSteven Rostedt	help
7105092dbc9SSteven Rostedt	  This option creates a test to stress the ring buffer and benchmark it.
71140892367SRandy Dunlap	  It creates its own ring buffer such that it will not interfere with
7125092dbc9SSteven Rostedt	  any other users of the ring buffer (such as ftrace). It then creates
7135092dbc9SSteven Rostedt	  a producer and consumer that will run for 10 seconds and sleep for
7145092dbc9SSteven Rostedt	  10 seconds. Each interval it will print out the number of events
7155092dbc9SSteven Rostedt	  it recorded and give a rough estimate of how long each iteration took.
7165092dbc9SSteven Rostedt
7175092dbc9SSteven Rostedt	  It does not disable interrupts or raise its priority, so it may be
7185092dbc9SSteven Rostedt	  affected by processes that are running.
7195092dbc9SSteven Rostedt
72040892367SRandy Dunlap	  If unsure, say N.
7215092dbc9SSteven Rostedt
7226c43e554SSteven Rostedt (Red Hat)config RING_BUFFER_STARTUP_TEST
7236c43e554SSteven Rostedt (Red Hat)       bool "Ring buffer startup self test"
7246c43e554SSteven Rostedt (Red Hat)       depends on RING_BUFFER
7256c43e554SSteven Rostedt (Red Hat)       help
7266c43e554SSteven Rostedt (Red Hat)         Run a simple self test on the ring buffer on boot up. Late in the
7276c43e554SSteven Rostedt (Red Hat)	 kernel boot sequence, the test will start that kicks off
7286c43e554SSteven Rostedt (Red Hat)	 a thread per cpu. Each thread will write various size events
7296c43e554SSteven Rostedt (Red Hat)	 into the ring buffer. Another thread is created to send IPIs
7306c43e554SSteven Rostedt (Red Hat)	 to each of the threads, where the IPI handler will also write
7316c43e554SSteven Rostedt (Red Hat)	 to the ring buffer, to test/stress the nesting ability.
7326c43e554SSteven Rostedt (Red Hat)	 If any anomalies are discovered, a warning will be displayed
7336c43e554SSteven Rostedt (Red Hat)	 and all ring buffers will be disabled.
7346c43e554SSteven Rostedt (Red Hat)
7356c43e554SSteven Rostedt (Red Hat)	 The test runs for 10 seconds. This will slow your boot time
7366c43e554SSteven Rostedt (Red Hat)	 by at least 10 more seconds.
7376c43e554SSteven Rostedt (Red Hat)
7386c43e554SSteven Rostedt (Red Hat)	 At the end of the test, statics and more checks are done.
7396c43e554SSteven Rostedt (Red Hat)	 It will output the stats of each per cpu buffer. What
7406c43e554SSteven Rostedt (Red Hat)	 was written, the sizes, what was read, what was lost, and
7416c43e554SSteven Rostedt (Red Hat)	 other similar details.
7426c43e554SSteven Rostedt (Red Hat)
7436c43e554SSteven Rostedt (Red Hat)	 If unsure, say N
7446c43e554SSteven Rostedt (Red Hat)
745f96e8577SJoel Fernandes (Google)config PREEMPTIRQ_DELAY_TEST
746f96e8577SJoel Fernandes (Google)	tristate "Preempt / IRQ disable delay thread to test latency tracers"
747f96e8577SJoel Fernandes (Google)	depends on m
748f96e8577SJoel Fernandes (Google)	help
749f96e8577SJoel Fernandes (Google)	  Select this option to build a test module that can help test latency
750f96e8577SJoel Fernandes (Google)	  tracers by executing a preempt or irq disable section with a user
751f96e8577SJoel Fernandes (Google)	  configurable delay. The module busy waits for the duration of the
752f96e8577SJoel Fernandes (Google)	  critical section.
753f96e8577SJoel Fernandes (Google)
754f96e8577SJoel Fernandes (Google)	  For example, the following invocation forces a one-time irq-disabled
755f96e8577SJoel Fernandes (Google)	  critical section for 500us:
756f96e8577SJoel Fernandes (Google)	  modprobe preemptirq_delay_test test_mode=irq delay=500000
757f96e8577SJoel Fernandes (Google)
758f96e8577SJoel Fernandes (Google)	  If unsure, say N
759f96e8577SJoel Fernandes (Google)
760681bec03SJeremy Lintonconfig TRACE_EVAL_MAP_FILE
761681bec03SJeremy Linton       bool "Show eval mappings for trace events"
7629828413dSSteven Rostedt (Red Hat)       depends on TRACING
7639828413dSSteven Rostedt (Red Hat)       help
764681bec03SJeremy Linton	The "print fmt" of the trace events will show the enum/sizeof names
765681bec03SJeremy Linton	instead	of their values. This can cause problems for user space tools
766681bec03SJeremy Linton	that use this string to parse the raw data as user space does not know
7679828413dSSteven Rostedt (Red Hat)	how to convert the string to its value.
7689828413dSSteven Rostedt (Red Hat)
7699828413dSSteven Rostedt (Red Hat)	To fix this, there's a special macro in the kernel that can be used
770681bec03SJeremy Linton	to convert an enum/sizeof into its value. If this macro is used, then
771681bec03SJeremy Linton	the print fmt strings will be converted to their values.
7729828413dSSteven Rostedt (Red Hat)
7739828413dSSteven Rostedt (Red Hat)	If something does not get converted properly, this option can be
774681bec03SJeremy Linton	used to show what enums/sizeof the kernel tried to convert.
7759828413dSSteven Rostedt (Red Hat)
776681bec03SJeremy Linton	This option is for debugging the conversions. A file is created
777681bec03SJeremy Linton	in the tracing directory called "eval_map" that will show the
7789828413dSSteven Rostedt (Red Hat)	names matched with their values and what trace event system they
7799828413dSSteven Rostedt (Red Hat)	belong too.
7809828413dSSteven Rostedt (Red Hat)
7819828413dSSteven Rostedt (Red Hat)	Normally, the mapping of the strings to values will be freed after
7829828413dSSteven Rostedt (Red Hat)	boot up or module load. With this option, they will not be freed, as
783681bec03SJeremy Linton	they are needed for the "eval_map" file. Enabling this option will
7849828413dSSteven Rostedt (Red Hat)	increase the memory footprint of the running kernel.
7859828413dSSteven Rostedt (Red Hat)
7869828413dSSteven Rostedt (Red Hat)	If unsure, say N
7879828413dSSteven Rostedt (Red Hat)
7886b7dca40SMasami Hiramatsuconfig GCOV_PROFILE_FTRACE
7896b7dca40SMasami Hiramatsu	bool "Enable GCOV profiling on ftrace subsystem"
7906b7dca40SMasami Hiramatsu	depends on GCOV_KERNEL
7916b7dca40SMasami Hiramatsu	help
7926b7dca40SMasami Hiramatsu	  Enable GCOV profiling on ftrace subsystem for checking
7936b7dca40SMasami Hiramatsu	  which functions/lines are tested.
7946b7dca40SMasami Hiramatsu
7956b7dca40SMasami Hiramatsu	  If unsure, say N.
7966b7dca40SMasami Hiramatsu
7976b7dca40SMasami Hiramatsu	  Note that on a kernel compiled with this config, ftrace will
7986b7dca40SMasami Hiramatsu	  run significantly slower.
7996b7dca40SMasami Hiramatsu
8004ed9f071SSteven Rostedtendif # FTRACE
80140ada30fSIngo Molnar
80240ada30fSIngo Molnarendif # TRACING_SUPPORT
80340ada30fSIngo Molnar
804