blob: b2e6fb5b6cb8680df99966cb3632bb7643e58f92 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#
2# Architectures that offer an FUNCTION_TRACER implementation should
3# select HAVE_FUNCTION_TRACER:
4#
5
6config USER_STACKTRACE_SUPPORT
7 bool
8
9config NOP_TRACER
10 bool
11
12config HAVE_FTRACE_NMI_ENTER
13 bool
14 help
15 See Documentation/trace/ftrace-design.txt
16
17config HAVE_FUNCTION_TRACER
18 bool
19 help
20 See Documentation/trace/ftrace-design.txt
21
22config HAVE_FUNCTION_GRAPH_TRACER
23 bool
24 help
25 See Documentation/trace/ftrace-design.txt
26
27config HAVE_FUNCTION_GRAPH_FP_TEST
28 bool
29 help
30 See Documentation/trace/ftrace-design.txt
31
32config HAVE_FUNCTION_TRACE_MCOUNT_TEST
33 bool
34 help
35 See Documentation/trace/ftrace-design.txt
36
37config HAVE_DYNAMIC_FTRACE
38 bool
39 help
40 See Documentation/trace/ftrace-design.txt
41
42config HAVE_FTRACE_MCOUNT_RECORD
43 bool
44 help
45 See Documentation/trace/ftrace-design.txt
46
47config HAVE_SYSCALL_TRACEPOINTS
48 bool
49 help
50 See Documentation/trace/ftrace-design.txt
51
52config HAVE_C_RECORDMCOUNT
53 bool
54 help
55 C version of recordmcount available?
56
57config TRACER_MAX_TRACE
58 bool
59
60config RING_BUFFER
61 bool
62
63config FTRACE_NMI_ENTER
64 bool
65 depends on HAVE_FTRACE_NMI_ENTER
66 default y
67
68config EVENT_TRACING
69 select CONTEXT_SWITCH_TRACER
70 bool
71
72config EVENT_POWER_TRACING_DEPRECATED
73 depends on EVENT_TRACING
74 bool "Deprecated power event trace API, to be removed"
75 default y
76 help
77 Provides old power event types:
78 C-state/idle accounting events:
79 power:power_start
80 power:power_end
81 and old cpufreq accounting event:
82 power:power_frequency
83 This is for userspace compatibility
84 and will vanish after 5 kernel iterations,
85 namely 3.1.
86
87config CONTEXT_SWITCH_TRACER
88 bool
89
90config RING_BUFFER_ALLOW_SWAP
91 bool
92 help
93 Allow the use of ring_buffer_swap_cpu.
94 Adds a very slight overhead to tracing when enabled.
95
96# All tracer options should select GENERIC_TRACER. For those options that are
97# enabled by all tracers (context switch and event tracer) they select TRACING.
98# This allows those options to appear when no other tracer is selected. But the
99# options do not appear when something else selects it. We need the two options
100# GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the
101# hiding of the automatic options.
102
103config TRACING
104 bool
105 select DEBUG_FS
106 select RING_BUFFER
107 select STACKTRACE if STACKTRACE_SUPPORT
108 select TRACEPOINTS
109 select NOP_TRACER
110 select BINARY_PRINTF
111 select EVENT_TRACING
112
113config GENERIC_TRACER
114 bool
115 select TRACING
116
117#
118# Minimum requirements an architecture has to meet for us to
119# be able to offer generic tracing facilities:
120#
121config TRACING_SUPPORT
122 bool
123 # PPC32 has no irqflags tracing support, but it can use most of the
124 # tracers anyway, they were tested to build and work. Note that new
125 # exceptions to this list aren't welcomed, better implement the
126 # irqflags tracing for your architecture.
127 depends on TRACE_IRQFLAGS_SUPPORT || PPC32
128 depends on STACKTRACE_SUPPORT
129 default y
130
131if TRACING_SUPPORT
132
133menuconfig FTRACE
134 bool "Tracers"
135 default y if DEBUG_KERNEL
136 help
137 Enable the kernel tracing infrastructure.
138
139if FTRACE
140
141config FUNCTION_TRACER
142 bool "Kernel Function Tracer"
143 depends on HAVE_FUNCTION_TRACER
144 select FRAME_POINTER if !ARM_UNWIND && !PPC && !S390 && !MICROBLAZE
145 select KALLSYMS
146 select GENERIC_TRACER
147 select CONTEXT_SWITCH_TRACER
148 help
149 Enable the kernel to trace every kernel function. This is done
150 by using a compiler feature to insert a small, 5-byte No-Operation
151 instruction at the beginning of every kernel function, which NOP
152 sequence is then dynamically patched into a tracer call when
153 tracing is enabled by the administrator. If it's runtime disabled
154 (the bootup default), then the overhead of the instructions is very
155 small and not measurable even in micro-benchmarks.
156
157config FUNCTION_GRAPH_TRACER
158 bool "Kernel Function Graph Tracer"
159 depends on HAVE_FUNCTION_GRAPH_TRACER
160 depends on FUNCTION_TRACER
161 depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE
162 default y
163 help
164 Enable the kernel to trace a function at both its return
165 and its entry.
166 Its first purpose is to trace the duration of functions and
167 draw a call graph for each thread with some information like
168 the return value. This is done by setting the current return
169 address on the current task structure into a stack of calls.
170
171
172config IRQSOFF_TRACER
173 bool "Interrupts-off Latency Tracer"
174 default n
175 depends on TRACE_IRQFLAGS_SUPPORT
176 depends on !ARCH_USES_GETTIMEOFFSET
177 select TRACE_IRQFLAGS
178 select GENERIC_TRACER
179 select TRACER_MAX_TRACE
180 select RING_BUFFER_ALLOW_SWAP
181 help
182 This option measures the time spent in irqs-off critical
183 sections, with microsecond accuracy.
184
185 The default measurement method is a maximum search, which is
186 disabled by default and can be runtime (re-)started
187 via:
188
189 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
190
191 (Note that kernel size and overhead increase with this option
192 enabled. This option and the preempt-off timing option can be
193 used together or separately.)
194
195config INTERRUPT_OFF_HIST
196 bool "Interrupts-off Latency Histogram"
197 depends on IRQSOFF_TRACER
198 help
199 This option generates continuously updated histograms (one per cpu)
200 of the duration of time periods with interrupts disabled. The
201 histograms are disabled by default. To enable them, write a non-zero
202 number to
203
204 /sys/kernel/debug/tracing/latency_hist/enable/preemptirqsoff
205
206 If PREEMPT_OFF_HIST is also selected, additional histograms (one
207 per cpu) are generated that accumulate the duration of time periods
208 when both interrupts and preemption are disabled. The histogram data
209 will be located in the debug file system at
210
211 /sys/kernel/debug/tracing/latency_hist/irqsoff
212
213config PREEMPT_TRACER
214 bool "Preemption-off Latency Tracer"
215 default n
216 depends on !ARCH_USES_GETTIMEOFFSET
217 depends on PREEMPT
218 select GENERIC_TRACER
219 select TRACER_MAX_TRACE
220 select RING_BUFFER_ALLOW_SWAP
221 help
222 This option measures the time spent in preemption-off critical
223 sections, with microsecond accuracy.
224
225 The default measurement method is a maximum search, which is
226 disabled by default and can be runtime (re-)started
227 via:
228
229 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
230
231 (Note that kernel size and overhead increase with this option
232 enabled. This option and the irqs-off timing option can be
233 used together or separately.)
234
235config PREEMPT_OFF_HIST
236 bool "Preemption-off Latency Histogram"
237 depends on PREEMPT_TRACER
238 help
239 This option generates continuously updated histograms (one per cpu)
240 of the duration of time periods with preemption disabled. The
241 histograms are disabled by default. To enable them, write a non-zero
242 number to
243
244 /sys/kernel/debug/tracing/latency_hist/enable/preemptirqsoff
245
246 If INTERRUPT_OFF_HIST is also selected, additional histograms (one
247 per cpu) are generated that accumulate the duration of time periods
248 when both interrupts and preemption are disabled. The histogram data
249 will be located in the debug file system at
250
251 /sys/kernel/debug/tracing/latency_hist/preemptoff
252
253config SCHED_TRACER
254 bool "Scheduling Latency Tracer"
255 select GENERIC_TRACER
256 select CONTEXT_SWITCH_TRACER
257 select TRACER_MAX_TRACE
258 help
259 This tracer tracks the latency of the highest priority task
260 to be scheduled in, starting from the point it has woken up.
261
262config WAKEUP_LATENCY_HIST
263 bool "Scheduling Latency Histogram"
264 depends on SCHED_TRACER
265 help
266 This option generates continuously updated histograms (one per cpu)
267 of the scheduling latency of the highest priority task.
268 The histograms are disabled by default. To enable them, write a
269 non-zero number to
270
271 /sys/kernel/debug/tracing/latency_hist/enable/wakeup
272
273 Two different algorithms are used, one to determine the latency of
274 processes that exclusively use the highest priority of the system and
275 another one to determine the latency of processes that share the
276 highest system priority with other processes. The former is used to
277 improve hardware and system software, the latter to optimize the
278 priority design of a given system. The histogram data will be
279 located in the debug file system at
280
281 /sys/kernel/debug/tracing/latency_hist/wakeup
282
283 and
284
285 /sys/kernel/debug/tracing/latency_hist/wakeup/sharedprio
286
287 If both Scheduling Latency Histogram and Missed Timer Offsets
288 Histogram are selected, additional histogram data will be collected
289 that contain, in addition to the wakeup latency, the timer latency, in
290 case the wakeup was triggered by an expired timer. These histograms
291 are available in the
292
293 /sys/kernel/debug/tracing/latency_hist/timerandwakeup
294
295 directory. They reflect the apparent interrupt and scheduling latency
296 and are best suitable to determine the worst-case latency of a given
297 system. To enable these histograms, write a non-zero number to
298
299 /sys/kernel/debug/tracing/latency_hist/enable/timerandwakeup
300
301config MISSED_TIMER_OFFSETS_HIST
302 depends on HIGH_RES_TIMERS
303 select GENERIC_TRACER
304 bool "Missed Timer Offsets Histogram"
305 help
306 Generate a histogram of missed timer offsets in microseconds. The
307 histograms are disabled by default. To enable them, write a non-zero
308 number to
309
310 /sys/kernel/debug/tracing/latency_hist/enable/missed_timer_offsets
311
312 The histogram data will be located in the debug file system at
313
314 /sys/kernel/debug/tracing/latency_hist/missed_timer_offsets
315
316 If both Scheduling Latency Histogram and Missed Timer Offsets
317 Histogram are selected, additional histogram data will be collected
318 that contain, in addition to the wakeup latency, the timer latency, in
319 case the wakeup was triggered by an expired timer. These histograms
320 are available in the
321
322 /sys/kernel/debug/tracing/latency_hist/timerandwakeup
323
324 directory. They reflect the apparent interrupt and scheduling latency
325 and are best suitable to determine the worst-case latency of a given
326 system. To enable these histograms, write a non-zero number to
327
328 /sys/kernel/debug/tracing/latency_hist/enable/timerandwakeup
329
330config ENABLE_DEFAULT_TRACERS
331 bool "Trace process context switches and events"
332 depends on !GENERIC_TRACER
333 select TRACING
334 help
335 This tracer hooks to various trace points in the kernel,
336 allowing the user to pick and choose which trace point they
337 want to trace. It also includes the sched_switch tracer plugin.
338
339config FTRACE_SYSCALLS
340 bool "Trace syscalls"
341 depends on HAVE_SYSCALL_TRACEPOINTS
342 select GENERIC_TRACER
343 select KALLSYMS
344 help
345 Basic tracer to catch the syscall entry and exit events.
346
347config TRACE_BRANCH_PROFILING
348 bool
349 select GENERIC_TRACER
350
351choice
352 prompt "Branch Profiling"
353 default BRANCH_PROFILE_NONE
354 help
355 The branch profiling is a software profiler. It will add hooks
356 into the C conditionals to test which path a branch takes.
357
358 The likely/unlikely profiler only looks at the conditions that
359 are annotated with a likely or unlikely macro.
360
361 The "all branch" profiler will profile every if-statement in the
362 kernel. This profiler will also enable the likely/unlikely
363 profiler.
364
365 Either of the above profilers adds a bit of overhead to the system.
366 If unsure, choose "No branch profiling".
367
368config BRANCH_PROFILE_NONE
369 bool "No branch profiling"
370 help
371 No branch profiling. Branch profiling adds a bit of overhead.
372 Only enable it if you want to analyse the branching behavior.
373 Otherwise keep it disabled.
374
375config PROFILE_ANNOTATED_BRANCHES
376 bool "Trace likely/unlikely profiler"
377 select TRACE_BRANCH_PROFILING
378 help
379 This tracer profiles all the the likely and unlikely macros
380 in the kernel. It will display the results in:
381
382 /sys/kernel/debug/tracing/trace_stat/branch_annotated
383
384 Note: this will add a significant overhead; only turn this
385 on if you need to profile the system's use of these macros.
386
387config PROFILE_ALL_BRANCHES
388 bool "Profile all if conditionals"
389 select TRACE_BRANCH_PROFILING
390 help
391 This tracer profiles all branch conditions. Every if ()
392 taken in the kernel is recorded whether it hit or miss.
393 The results will be displayed in:
394
395 /sys/kernel/debug/tracing/trace_stat/branch_all
396
397 This option also enables the likely/unlikely profiler.
398
399 This configuration, when enabled, will impose a great overhead
400 on the system. This should only be enabled when the system
401 is to be analyzed in much detail.
402endchoice
403
404config TRACING_BRANCHES
405 bool
406 help
407 Selected by tracers that will trace the likely and unlikely
408 conditions. This prevents the tracers themselves from being
409 profiled. Profiling the tracing infrastructure can only happen
410 when the likelys and unlikelys are not being traced.
411
412config BRANCH_TRACER
413 bool "Trace likely/unlikely instances"
414 depends on TRACE_BRANCH_PROFILING
415 select TRACING_BRANCHES
416 help
417 This traces the events of likely and unlikely condition
418 calls in the kernel. The difference between this and the
419 "Trace likely/unlikely profiler" is that this is not a
420 histogram of the callers, but actually places the calling
421 events into a running trace buffer to see when and where the
422 events happened, as well as their results.
423
424 Say N if unsure.
425
426config STACK_TRACER
427 bool "Trace max stack"
428 depends on HAVE_FUNCTION_TRACER
429 select FUNCTION_TRACER
430 select STACKTRACE
431 select KALLSYMS
432 help
433 This special tracer records the maximum stack footprint of the
434 kernel and displays it in /sys/kernel/debug/tracing/stack_trace.
435
436 This tracer works by hooking into every function call that the
437 kernel executes, and keeping a maximum stack depth value and
438 stack-trace saved. If this is configured with DYNAMIC_FTRACE
439 then it will not have any overhead while the stack tracer
440 is disabled.
441
442 To enable the stack tracer on bootup, pass in 'stacktrace'
443 on the kernel command line.
444
445 The stack tracer can also be enabled or disabled via the
446 sysctl kernel.stack_tracer_enabled
447
448 Say N if unsure.
449
450config BLK_DEV_IO_TRACE
451 bool "Support for tracing block IO actions"
452 depends on SYSFS
453 depends on BLOCK
454 select RELAY
455 select DEBUG_FS
456 select TRACEPOINTS
457 select GENERIC_TRACER
458 select STACKTRACE
459 help
460 Say Y here if you want to be able to trace the block layer actions
461 on a given queue. Tracing allows you to see any traffic happening
462 on a block device queue. For more information (and the userspace
463 support tools needed), fetch the blktrace tools from:
464
465 git://git.kernel.dk/blktrace.git
466
467 Tracing also is possible using the ftrace interface, e.g.:
468
469 echo 1 > /sys/block/sda/sda1/trace/enable
470 echo blk > /sys/kernel/debug/tracing/current_tracer
471 cat /sys/kernel/debug/tracing/trace_pipe
472
473 If unsure, say N.
474
475config KPROBE_EVENT
476 depends on KPROBES
477 depends on HAVE_REGS_AND_STACK_ACCESS_API
478 bool "Enable kprobes-based dynamic events"
479 select TRACING
480 default y
481 help
482 This allows the user to add tracing events (similar to tracepoints)
483 on the fly via the ftrace interface. See
484 Documentation/trace/kprobetrace.txt for more details.
485
486 Those events can be inserted wherever kprobes can probe, and record
487 various register and memory values.
488
489 This option is also required by perf-probe subcommand of perf tools.
490 If you want to use perf tools, this option is strongly recommended.
491
492config DYNAMIC_FTRACE
493 bool "enable/disable function tracing dynamically"
494 depends on FUNCTION_TRACER
495 depends on HAVE_DYNAMIC_FTRACE
496 default y
497 help
498 This option will modify all the calls to function tracing
499 dynamically (will patch them out of the binary image and
500 replace them with a No-Op instruction) on boot up. During
501 compile time, a table is made of all the locations that ftrace
502 can function trace, and this table is linked into the kernel
503 image. When this is enabled, functions can be individually
504 enabled, and the functions not enabled will not affect
505 performance of the system.
506
507 See the files in /sys/kernel/debug/tracing:
508 available_filter_functions
509 set_ftrace_filter
510 set_ftrace_notrace
511
512 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
513 otherwise has native performance as long as no tracing is active.
514
515config FUNCTION_PROFILER
516 bool "Kernel function profiler"
517 depends on FUNCTION_TRACER
518 default n
519 help
520 This option enables the kernel function profiler. A file is created
521 in debugfs called function_profile_enabled which defaults to zero.
522 When a 1 is echoed into this file profiling begins, and when a
523 zero is entered, profiling stops. A "functions" file is created in
524 the trace_stats directory; this file shows the list of functions that
525 have been hit and their counters.
526
527 If in doubt, say N.
528
529config FTRACE_MCOUNT_RECORD
530 def_bool y
531 depends on DYNAMIC_FTRACE
532 depends on HAVE_FTRACE_MCOUNT_RECORD
533
534config FTRACE_SELFTEST
535 bool
536
537config FTRACE_STARTUP_TEST
538 bool "Perform a startup test on ftrace"
539 depends on GENERIC_TRACER
540 select FTRACE_SELFTEST
541 help
542 This option performs a series of startup tests on ftrace. On bootup
543 a series of tests are made to verify that the tracer is
544 functioning properly. It will do tests on all the configured
545 tracers of ftrace.
546
547config EVENT_TRACE_TEST_SYSCALLS
548 bool "Run selftest on syscall events"
549 depends on FTRACE_STARTUP_TEST
550 help
551 This option will also enable testing every syscall event.
552 It only enables the event and disables it and runs various loads
553 with the event enabled. This adds a bit more time for kernel boot
554 up since it runs this on every system call defined.
555
556 TBD - enable a way to actually call the syscalls as we test their
557 events
558
559config MMIOTRACE
560 bool "Memory mapped IO tracing"
561 depends on HAVE_MMIOTRACE_SUPPORT && PCI
562 select GENERIC_TRACER
563 help
564 Mmiotrace traces Memory Mapped I/O access and is meant for
565 debugging and reverse engineering. It is called from the ioremap
566 implementation and works via page faults. Tracing is disabled by
567 default and can be enabled at run-time.
568
569 See Documentation/trace/mmiotrace.txt.
570 If you are not helping to develop drivers, say N.
571
572config MMIOTRACE_TEST
573 tristate "Test module for mmiotrace"
574 depends on MMIOTRACE && m
575 help
576 This is a dumb module for testing mmiotrace. It is very dangerous
577 as it will write garbage to IO memory starting at a given address.
578 However, it should be safe to use on e.g. unused portion of VRAM.
579
580 Say N, unless you absolutely know what you are doing.
581
582config RING_BUFFER_BENCHMARK
583 tristate "Ring buffer benchmark stress tester"
584 depends on RING_BUFFER
585 help
586 This option creates a test to stress the ring buffer and benchmark it.
587 It creates its own ring buffer such that it will not interfere with
588 any other users of the ring buffer (such as ftrace). It then creates
589 a producer and consumer that will run for 10 seconds and sleep for
590 10 seconds. Each interval it will print out the number of events
591 it recorded and give a rough estimate of how long each iteration took.
592
593 It does not disable interrupts or raise its priority, so it may be
594 affected by processes that are running.
595
596 If unsure, say N.
597
598endif # FTRACE
599
600endif # TRACING_SUPPORT
601