1# SPDX-License-Identifier: GPL-2.0-only 2# 3# Architectures that offer an FUNCTION_TRACER implementation should 4# select HAVE_FUNCTION_TRACER: 5# 6 7config USER_STACKTRACE_SUPPORT 8 bool 9 10config NOP_TRACER 11 bool 12 13config HAVE_FUNCTION_TRACER 14 bool 15 help 16 See Documentation/trace/ftrace-design.rst 17 18config HAVE_FUNCTION_GRAPH_TRACER 19 bool 20 help 21 See Documentation/trace/ftrace-design.rst 22 23config HAVE_DYNAMIC_FTRACE 24 bool 25 help 26 See Documentation/trace/ftrace-design.rst 27 28config HAVE_DYNAMIC_FTRACE_WITH_REGS 29 bool 30 31config HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS 32 bool 33 34config HAVE_DYNAMIC_FTRACE_WITH_ARGS 35 bool 36 help 37 If this is set, then arguments and stack can be found from 38 the pt_regs passed into the function callback regs parameter 39 by default, even without setting the REGS flag in the ftrace_ops. 40 This allows for use of regs_get_kernel_argument() and 41 kernel_stack_pointer(). 42 43config HAVE_FTRACE_MCOUNT_RECORD 44 bool 45 help 46 See Documentation/trace/ftrace-design.rst 47 48config HAVE_SYSCALL_TRACEPOINTS 49 bool 50 help 51 See Documentation/trace/ftrace-design.rst 52 53config HAVE_FENTRY 54 bool 55 help 56 Arch supports the gcc options -pg with -mfentry 57 58config HAVE_NOP_MCOUNT 59 bool 60 help 61 Arch supports the gcc options -pg with -mrecord-mcount and -nop-mcount 62 63config HAVE_OBJTOOL_MCOUNT 64 bool 65 help 66 Arch supports objtool --mcount 67 68config HAVE_C_RECORDMCOUNT 69 bool 70 help 71 C version of recordmcount available? 72 73config HAVE_BUILDTIME_MCOUNT_SORT 74 bool 75 help 76 An architecture selects this if it sorts the mcount_loc section 77 at build time. 78 79config BUILDTIME_MCOUNT_SORT 80 bool 81 default y 82 depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE 83 help 84 Sort the mcount_loc section at build time. 85 86config TRACER_MAX_TRACE 87 bool 88 89config TRACE_CLOCK 90 bool 91 92config RING_BUFFER 93 bool 94 select TRACE_CLOCK 95 select IRQ_WORK 96 97config EVENT_TRACING 98 select CONTEXT_SWITCH_TRACER 99 select GLOB 100 bool 101 102config CONTEXT_SWITCH_TRACER 103 bool 104 105config RING_BUFFER_ALLOW_SWAP 106 bool 107 help 108 Allow the use of ring_buffer_swap_cpu. 109 Adds a very slight overhead to tracing when enabled. 110 111config PREEMPTIRQ_TRACEPOINTS 112 bool 113 depends on TRACE_PREEMPT_TOGGLE || TRACE_IRQFLAGS 114 select TRACING 115 default y 116 help 117 Create preempt/irq toggle tracepoints if needed, so that other parts 118 of the kernel can use them to generate or add hooks to them. 119 120# All tracer options should select GENERIC_TRACER. For those options that are 121# enabled by all tracers (context switch and event tracer) they select TRACING. 122# This allows those options to appear when no other tracer is selected. But the 123# options do not appear when something else selects it. We need the two options 124# GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the 125# hiding of the automatic options. 126 127config TRACING 128 bool 129 select RING_BUFFER 130 select STACKTRACE if STACKTRACE_SUPPORT 131 select TRACEPOINTS 132 select NOP_TRACER 133 select BINARY_PRINTF 134 select EVENT_TRACING 135 select TRACE_CLOCK 136 137config GENERIC_TRACER 138 bool 139 select TRACING 140 141# 142# Minimum requirements an architecture has to meet for us to 143# be able to offer generic tracing facilities: 144# 145config TRACING_SUPPORT 146 bool 147 depends on TRACE_IRQFLAGS_SUPPORT 148 depends on STACKTRACE_SUPPORT 149 default y 150 151menuconfig FTRACE 152 bool "Tracers" 153 depends on TRACING_SUPPORT 154 default y if DEBUG_KERNEL 155 help 156 Enable the kernel tracing infrastructure. 157 158if FTRACE 159 160config BOOTTIME_TRACING 161 bool "Boot-time Tracing support" 162 depends on TRACING 163 select BOOT_CONFIG 164 help 165 Enable developer to setup ftrace subsystem via supplemental 166 kernel cmdline at boot time for debugging (tracing) driver 167 initialization and boot process. 168 169config FUNCTION_TRACER 170 bool "Kernel Function Tracer" 171 depends on HAVE_FUNCTION_TRACER 172 select KALLSYMS 173 select GENERIC_TRACER 174 select CONTEXT_SWITCH_TRACER 175 select GLOB 176 select TASKS_RCU if PREEMPTION 177 select TASKS_RUDE_RCU 178 help 179 Enable the kernel to trace every kernel function. This is done 180 by using a compiler feature to insert a small, 5-byte No-Operation 181 instruction at the beginning of every kernel function, which NOP 182 sequence is then dynamically patched into a tracer call when 183 tracing is enabled by the administrator. If it's runtime disabled 184 (the bootup default), then the overhead of the instructions is very 185 small and not measurable even in micro-benchmarks. 186 187config FUNCTION_GRAPH_TRACER 188 bool "Kernel Function Graph Tracer" 189 depends on HAVE_FUNCTION_GRAPH_TRACER 190 depends on FUNCTION_TRACER 191 depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE 192 default y 193 help 194 Enable the kernel to trace a function at both its return 195 and its entry. 196 Its first purpose is to trace the duration of functions and 197 draw a call graph for each thread with some information like 198 the return value. This is done by setting the current return 199 address on the current task structure into a stack of calls. 200 201config DYNAMIC_FTRACE 202 bool "enable/disable function tracing dynamically" 203 depends on FUNCTION_TRACER 204 depends on HAVE_DYNAMIC_FTRACE 205 default y 206 help 207 This option will modify all the calls to function tracing 208 dynamically (will patch them out of the binary image and 209 replace them with a No-Op instruction) on boot up. During 210 compile time, a table is made of all the locations that ftrace 211 can function trace, and this table is linked into the kernel 212 image. When this is enabled, functions can be individually 213 enabled, and the functions not enabled will not affect 214 performance of the system. 215 216 See the files in /sys/kernel/debug/tracing: 217 available_filter_functions 218 set_ftrace_filter 219 set_ftrace_notrace 220 221 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but 222 otherwise has native performance as long as no tracing is active. 223 224config DYNAMIC_FTRACE_WITH_REGS 225 def_bool y 226 depends on DYNAMIC_FTRACE 227 depends on HAVE_DYNAMIC_FTRACE_WITH_REGS 228 229config DYNAMIC_FTRACE_WITH_DIRECT_CALLS 230 def_bool y 231 depends on DYNAMIC_FTRACE_WITH_REGS 232 depends on HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS 233 234config DYNAMIC_FTRACE_WITH_ARGS 235 def_bool y 236 depends on DYNAMIC_FTRACE 237 depends on HAVE_DYNAMIC_FTRACE_WITH_ARGS 238 239config FPROBE 240 bool "Kernel Function Probe (fprobe)" 241 depends on FUNCTION_TRACER 242 depends on DYNAMIC_FTRACE_WITH_REGS 243 default n 244 help 245 This option enables kernel function probe (fprobe) based on ftrace, 246 which is similar to kprobes, but probes only for kernel function 247 entries and it can probe multiple functions by one fprobe. 248 249 If unsure, say N. 250 251config FUNCTION_PROFILER 252 bool "Kernel function profiler" 253 depends on FUNCTION_TRACER 254 default n 255 help 256 This option enables the kernel function profiler. A file is created 257 in debugfs called function_profile_enabled which defaults to zero. 258 When a 1 is echoed into this file profiling begins, and when a 259 zero is entered, profiling stops. A "functions" file is created in 260 the trace_stat directory; this file shows the list of functions that 261 have been hit and their counters. 262 263 If in doubt, say N. 264 265config STACK_TRACER 266 bool "Trace max stack" 267 depends on HAVE_FUNCTION_TRACER 268 select FUNCTION_TRACER 269 select STACKTRACE 270 select KALLSYMS 271 help 272 This special tracer records the maximum stack footprint of the 273 kernel and displays it in /sys/kernel/debug/tracing/stack_trace. 274 275 This tracer works by hooking into every function call that the 276 kernel executes, and keeping a maximum stack depth value and 277 stack-trace saved. If this is configured with DYNAMIC_FTRACE 278 then it will not have any overhead while the stack tracer 279 is disabled. 280 281 To enable the stack tracer on bootup, pass in 'stacktrace' 282 on the kernel command line. 283 284 The stack tracer can also be enabled or disabled via the 285 sysctl kernel.stack_tracer_enabled 286 287 Say N if unsure. 288 289config TRACE_PREEMPT_TOGGLE 290 bool 291 help 292 Enables hooks which will be called when preemption is first disabled, 293 and last enabled. 294 295config IRQSOFF_TRACER 296 bool "Interrupts-off Latency Tracer" 297 default n 298 depends on TRACE_IRQFLAGS_SUPPORT 299 select TRACE_IRQFLAGS 300 select GENERIC_TRACER 301 select TRACER_MAX_TRACE 302 select RING_BUFFER_ALLOW_SWAP 303 select TRACER_SNAPSHOT 304 select TRACER_SNAPSHOT_PER_CPU_SWAP 305 help 306 This option measures the time spent in irqs-off critical 307 sections, with microsecond accuracy. 308 309 The default measurement method is a maximum search, which is 310 disabled by default and can be runtime (re-)started 311 via: 312 313 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency 314 315 (Note that kernel size and overhead increase with this option 316 enabled. This option and the preempt-off timing option can be 317 used together or separately.) 318 319config PREEMPT_TRACER 320 bool "Preemption-off Latency Tracer" 321 default n 322 depends on PREEMPTION 323 select GENERIC_TRACER 324 select TRACER_MAX_TRACE 325 select RING_BUFFER_ALLOW_SWAP 326 select TRACER_SNAPSHOT 327 select TRACER_SNAPSHOT_PER_CPU_SWAP 328 select TRACE_PREEMPT_TOGGLE 329 help 330 This option measures the time spent in preemption-off critical 331 sections, with microsecond accuracy. 332 333 The default measurement method is a maximum search, which is 334 disabled by default and can be runtime (re-)started 335 via: 336 337 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency 338 339 (Note that kernel size and overhead increase with this option 340 enabled. This option and the irqs-off timing option can be 341 used together or separately.) 342 343config SCHED_TRACER 344 bool "Scheduling Latency Tracer" 345 select GENERIC_TRACER 346 select CONTEXT_SWITCH_TRACER 347 select TRACER_MAX_TRACE 348 select TRACER_SNAPSHOT 349 help 350 This tracer tracks the latency of the highest priority task 351 to be scheduled in, starting from the point it has woken up. 352 353config HWLAT_TRACER 354 bool "Tracer to detect hardware latencies (like SMIs)" 355 select GENERIC_TRACER 356 help 357 This tracer, when enabled will create one or more kernel threads, 358 depending on what the cpumask file is set to, which each thread 359 spinning in a loop looking for interruptions caused by 360 something other than the kernel. For example, if a 361 System Management Interrupt (SMI) takes a noticeable amount of 362 time, this tracer will detect it. This is useful for testing 363 if a system is reliable for Real Time tasks. 364 365 Some files are created in the tracing directory when this 366 is enabled: 367 368 hwlat_detector/width - time in usecs for how long to spin for 369 hwlat_detector/window - time in usecs between the start of each 370 iteration 371 372 A kernel thread is created that will spin with interrupts disabled 373 for "width" microseconds in every "window" cycle. It will not spin 374 for "window - width" microseconds, where the system can 375 continue to operate. 376 377 The output will appear in the trace and trace_pipe files. 378 379 When the tracer is not running, it has no affect on the system, 380 but when it is running, it can cause the system to be 381 periodically non responsive. Do not run this tracer on a 382 production system. 383 384 To enable this tracer, echo in "hwlat" into the current_tracer 385 file. Every time a latency is greater than tracing_thresh, it will 386 be recorded into the ring buffer. 387 388config OSNOISE_TRACER 389 bool "OS Noise tracer" 390 select GENERIC_TRACER 391 help 392 In the context of high-performance computing (HPC), the Operating 393 System Noise (osnoise) refers to the interference experienced by an 394 application due to activities inside the operating system. In the 395 context of Linux, NMIs, IRQs, SoftIRQs, and any other system thread 396 can cause noise to the system. Moreover, hardware-related jobs can 397 also cause noise, for example, via SMIs. 398 399 The osnoise tracer leverages the hwlat_detector by running a similar 400 loop with preemption, SoftIRQs and IRQs enabled, thus allowing all 401 the sources of osnoise during its execution. The osnoise tracer takes 402 note of the entry and exit point of any source of interferences, 403 increasing a per-cpu interference counter. It saves an interference 404 counter for each source of interference. The interference counter for 405 NMI, IRQs, SoftIRQs, and threads is increased anytime the tool 406 observes these interferences' entry events. When a noise happens 407 without any interference from the operating system level, the 408 hardware noise counter increases, pointing to a hardware-related 409 noise. In this way, osnoise can account for any source of 410 interference. At the end of the period, the osnoise tracer prints 411 the sum of all noise, the max single noise, the percentage of CPU 412 available for the thread, and the counters for the noise sources. 413 414 In addition to the tracer, a set of tracepoints were added to 415 facilitate the identification of the osnoise source. 416 417 The output will appear in the trace and trace_pipe files. 418 419 To enable this tracer, echo in "osnoise" into the current_tracer 420 file. 421 422config TIMERLAT_TRACER 423 bool "Timerlat tracer" 424 select OSNOISE_TRACER 425 select GENERIC_TRACER 426 help 427 The timerlat tracer aims to help the preemptive kernel developers 428 to find sources of wakeup latencies of real-time threads. 429 430 The tracer creates a per-cpu kernel thread with real-time priority. 431 The tracer thread sets a periodic timer to wakeup itself, and goes 432 to sleep waiting for the timer to fire. At the wakeup, the thread 433 then computes a wakeup latency value as the difference between 434 the current time and the absolute time that the timer was set 435 to expire. 436 437 The tracer prints two lines at every activation. The first is the 438 timer latency observed at the hardirq context before the 439 activation of the thread. The second is the timer latency observed 440 by the thread, which is the same level that cyclictest reports. The 441 ACTIVATION ID field serves to relate the irq execution to its 442 respective thread execution. 443 444 The tracer is build on top of osnoise tracer, and the osnoise: 445 events can be used to trace the source of interference from NMI, 446 IRQs and other threads. It also enables the capture of the 447 stacktrace at the IRQ context, which helps to identify the code 448 path that can cause thread delay. 449 450config MMIOTRACE 451 bool "Memory mapped IO tracing" 452 depends on HAVE_MMIOTRACE_SUPPORT && PCI 453 select GENERIC_TRACER 454 help 455 Mmiotrace traces Memory Mapped I/O access and is meant for 456 debugging and reverse engineering. It is called from the ioremap 457 implementation and works via page faults. Tracing is disabled by 458 default and can be enabled at run-time. 459 460 See Documentation/trace/mmiotrace.rst. 461 If you are not helping to develop drivers, say N. 462 463config ENABLE_DEFAULT_TRACERS 464 bool "Trace process context switches and events" 465 depends on !GENERIC_TRACER 466 select TRACING 467 help 468 This tracer hooks to various trace points in the kernel, 469 allowing the user to pick and choose which trace point they 470 want to trace. It also includes the sched_switch tracer plugin. 471 472config FTRACE_SYSCALLS 473 bool "Trace syscalls" 474 depends on HAVE_SYSCALL_TRACEPOINTS 475 select GENERIC_TRACER 476 select KALLSYMS 477 help 478 Basic tracer to catch the syscall entry and exit events. 479 480config TRACER_SNAPSHOT 481 bool "Create a snapshot trace buffer" 482 select TRACER_MAX_TRACE 483 help 484 Allow tracing users to take snapshot of the current buffer using the 485 ftrace interface, e.g.: 486 487 echo 1 > /sys/kernel/debug/tracing/snapshot 488 cat snapshot 489 490config TRACER_SNAPSHOT_PER_CPU_SWAP 491 bool "Allow snapshot to swap per CPU" 492 depends on TRACER_SNAPSHOT 493 select RING_BUFFER_ALLOW_SWAP 494 help 495 Allow doing a snapshot of a single CPU buffer instead of a 496 full swap (all buffers). If this is set, then the following is 497 allowed: 498 499 echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot 500 501 After which, only the tracing buffer for CPU 2 was swapped with 502 the main tracing buffer, and the other CPU buffers remain the same. 503 504 When this is enabled, this adds a little more overhead to the 505 trace recording, as it needs to add some checks to synchronize 506 recording with swaps. But this does not affect the performance 507 of the overall system. This is enabled by default when the preempt 508 or irq latency tracers are enabled, as those need to swap as well 509 and already adds the overhead (plus a lot more). 510 511config TRACE_BRANCH_PROFILING 512 bool 513 select GENERIC_TRACER 514 515choice 516 prompt "Branch Profiling" 517 default BRANCH_PROFILE_NONE 518 help 519 The branch profiling is a software profiler. It will add hooks 520 into the C conditionals to test which path a branch takes. 521 522 The likely/unlikely profiler only looks at the conditions that 523 are annotated with a likely or unlikely macro. 524 525 The "all branch" profiler will profile every if-statement in the 526 kernel. This profiler will also enable the likely/unlikely 527 profiler. 528 529 Either of the above profilers adds a bit of overhead to the system. 530 If unsure, choose "No branch profiling". 531 532config BRANCH_PROFILE_NONE 533 bool "No branch profiling" 534 help 535 No branch profiling. Branch profiling adds a bit of overhead. 536 Only enable it if you want to analyse the branching behavior. 537 Otherwise keep it disabled. 538 539config PROFILE_ANNOTATED_BRANCHES 540 bool "Trace likely/unlikely profiler" 541 select TRACE_BRANCH_PROFILING 542 help 543 This tracer profiles all likely and unlikely macros 544 in the kernel. It will display the results in: 545 546 /sys/kernel/debug/tracing/trace_stat/branch_annotated 547 548 Note: this will add a significant overhead; only turn this 549 on if you need to profile the system's use of these macros. 550 551config PROFILE_ALL_BRANCHES 552 bool "Profile all if conditionals" if !FORTIFY_SOURCE 553 select TRACE_BRANCH_PROFILING 554 help 555 This tracer profiles all branch conditions. Every if () 556 taken in the kernel is recorded whether it hit or miss. 557 The results will be displayed in: 558 559 /sys/kernel/debug/tracing/trace_stat/branch_all 560 561 This option also enables the likely/unlikely profiler. 562 563 This configuration, when enabled, will impose a great overhead 564 on the system. This should only be enabled when the system 565 is to be analyzed in much detail. 566endchoice 567 568config TRACING_BRANCHES 569 bool 570 help 571 Selected by tracers that will trace the likely and unlikely 572 conditions. This prevents the tracers themselves from being 573 profiled. Profiling the tracing infrastructure can only happen 574 when the likelys and unlikelys are not being traced. 575 576config BRANCH_TRACER 577 bool "Trace likely/unlikely instances" 578 depends on TRACE_BRANCH_PROFILING 579 select TRACING_BRANCHES 580 help 581 This traces the events of likely and unlikely condition 582 calls in the kernel. The difference between this and the 583 "Trace likely/unlikely profiler" is that this is not a 584 histogram of the callers, but actually places the calling 585 events into a running trace buffer to see when and where the 586 events happened, as well as their results. 587 588 Say N if unsure. 589 590config BLK_DEV_IO_TRACE 591 bool "Support for tracing block IO actions" 592 depends on SYSFS 593 depends on BLOCK 594 select RELAY 595 select DEBUG_FS 596 select TRACEPOINTS 597 select GENERIC_TRACER 598 select STACKTRACE 599 help 600 Say Y here if you want to be able to trace the block layer actions 601 on a given queue. Tracing allows you to see any traffic happening 602 on a block device queue. For more information (and the userspace 603 support tools needed), fetch the blktrace tools from: 604 605 git://git.kernel.dk/blktrace.git 606 607 Tracing also is possible using the ftrace interface, e.g.: 608 609 echo 1 > /sys/block/sda/sda1/trace/enable 610 echo blk > /sys/kernel/debug/tracing/current_tracer 611 cat /sys/kernel/debug/tracing/trace_pipe 612 613 If unsure, say N. 614 615config KPROBE_EVENTS 616 depends on KPROBES 617 depends on HAVE_REGS_AND_STACK_ACCESS_API 618 bool "Enable kprobes-based dynamic events" 619 select TRACING 620 select PROBE_EVENTS 621 select DYNAMIC_EVENTS 622 default y 623 help 624 This allows the user to add tracing events (similar to tracepoints) 625 on the fly via the ftrace interface. See 626 Documentation/trace/kprobetrace.rst for more details. 627 628 Those events can be inserted wherever kprobes can probe, and record 629 various register and memory values. 630 631 This option is also required by perf-probe subcommand of perf tools. 632 If you want to use perf tools, this option is strongly recommended. 633 634config KPROBE_EVENTS_ON_NOTRACE 635 bool "Do NOT protect notrace function from kprobe events" 636 depends on KPROBE_EVENTS 637 depends on DYNAMIC_FTRACE 638 default n 639 help 640 This is only for the developers who want to debug ftrace itself 641 using kprobe events. 642 643 If kprobes can use ftrace instead of breakpoint, ftrace related 644 functions are protected from kprobe-events to prevent an infinite 645 recursion or any unexpected execution path which leads to a kernel 646 crash. 647 648 This option disables such protection and allows you to put kprobe 649 events on ftrace functions for debugging ftrace by itself. 650 Note that this might let you shoot yourself in the foot. 651 652 If unsure, say N. 653 654config UPROBE_EVENTS 655 bool "Enable uprobes-based dynamic events" 656 depends on ARCH_SUPPORTS_UPROBES 657 depends on MMU 658 depends on PERF_EVENTS 659 select UPROBES 660 select PROBE_EVENTS 661 select DYNAMIC_EVENTS 662 select TRACING 663 default y 664 help 665 This allows the user to add tracing events on top of userspace 666 dynamic events (similar to tracepoints) on the fly via the trace 667 events interface. Those events can be inserted wherever uprobes 668 can probe, and record various registers. 669 This option is required if you plan to use perf-probe subcommand 670 of perf tools on user space applications. 671 672config BPF_EVENTS 673 depends on BPF_SYSCALL 674 depends on (KPROBE_EVENTS || UPROBE_EVENTS) && PERF_EVENTS 675 bool 676 default y 677 help 678 This allows the user to attach BPF programs to kprobe, uprobe, and 679 tracepoint events. 680 681config DYNAMIC_EVENTS 682 def_bool n 683 684config PROBE_EVENTS 685 def_bool n 686 687config BPF_KPROBE_OVERRIDE 688 bool "Enable BPF programs to override a kprobed function" 689 depends on BPF_EVENTS 690 depends on FUNCTION_ERROR_INJECTION 691 default n 692 help 693 Allows BPF to override the execution of a probed function and 694 set a different return value. This is used for error injection. 695 696config FTRACE_MCOUNT_RECORD 697 def_bool y 698 depends on DYNAMIC_FTRACE 699 depends on HAVE_FTRACE_MCOUNT_RECORD 700 701config FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY 702 bool 703 depends on FTRACE_MCOUNT_RECORD 704 705config FTRACE_MCOUNT_USE_CC 706 def_bool y 707 depends on $(cc-option,-mrecord-mcount) 708 depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY 709 depends on FTRACE_MCOUNT_RECORD 710 711config FTRACE_MCOUNT_USE_OBJTOOL 712 def_bool y 713 depends on HAVE_OBJTOOL_MCOUNT 714 depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY 715 depends on !FTRACE_MCOUNT_USE_CC 716 depends on FTRACE_MCOUNT_RECORD 717 718config FTRACE_MCOUNT_USE_RECORDMCOUNT 719 def_bool y 720 depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY 721 depends on !FTRACE_MCOUNT_USE_CC 722 depends on !FTRACE_MCOUNT_USE_OBJTOOL 723 depends on FTRACE_MCOUNT_RECORD 724 725config TRACING_MAP 726 bool 727 depends on ARCH_HAVE_NMI_SAFE_CMPXCHG 728 help 729 tracing_map is a special-purpose lock-free map for tracing, 730 separated out as a stand-alone facility in order to allow it 731 to be shared between multiple tracers. It isn't meant to be 732 generally used outside of that context, and is normally 733 selected by tracers that use it. 734 735config SYNTH_EVENTS 736 bool "Synthetic trace events" 737 select TRACING 738 select DYNAMIC_EVENTS 739 default n 740 help 741 Synthetic events are user-defined trace events that can be 742 used to combine data from other trace events or in fact any 743 data source. Synthetic events can be generated indirectly 744 via the trace() action of histogram triggers or directly 745 by way of an in-kernel API. 746 747 See Documentation/trace/events.rst or 748 Documentation/trace/histogram.rst for details and examples. 749 750 If in doubt, say N. 751 752config HIST_TRIGGERS 753 bool "Histogram triggers" 754 depends on ARCH_HAVE_NMI_SAFE_CMPXCHG 755 select TRACING_MAP 756 select TRACING 757 select DYNAMIC_EVENTS 758 select SYNTH_EVENTS 759 default n 760 help 761 Hist triggers allow one or more arbitrary trace event fields 762 to be aggregated into hash tables and dumped to stdout by 763 reading a debugfs/tracefs file. They're useful for 764 gathering quick and dirty (though precise) summaries of 765 event activity as an initial guide for further investigation 766 using more advanced tools. 767 768 Inter-event tracing of quantities such as latencies is also 769 supported using hist triggers under this option. 770 771 See Documentation/trace/histogram.rst. 772 If in doubt, say N. 773 774config TRACE_EVENT_INJECT 775 bool "Trace event injection" 776 depends on TRACING 777 help 778 Allow user-space to inject a specific trace event into the ring 779 buffer. This is mainly used for testing purpose. 780 781 If unsure, say N. 782 783config TRACEPOINT_BENCHMARK 784 bool "Add tracepoint that benchmarks tracepoints" 785 help 786 This option creates the tracepoint "benchmark:benchmark_event". 787 When the tracepoint is enabled, it kicks off a kernel thread that 788 goes into an infinite loop (calling cond_resched() to let other tasks 789 run), and calls the tracepoint. Each iteration will record the time 790 it took to write to the tracepoint and the next iteration that 791 data will be passed to the tracepoint itself. That is, the tracepoint 792 will report the time it took to do the previous tracepoint. 793 The string written to the tracepoint is a static string of 128 bytes 794 to keep the time the same. The initial string is simply a write of 795 "START". The second string records the cold cache time of the first 796 write which is not added to the rest of the calculations. 797 798 As it is a tight loop, it benchmarks as hot cache. That's fine because 799 we care most about hot paths that are probably in cache already. 800 801 An example of the output: 802 803 START 804 first=3672 [COLD CACHED] 805 last=632 first=3672 max=632 min=632 avg=316 std=446 std^2=199712 806 last=278 first=3672 max=632 min=278 avg=303 std=316 std^2=100337 807 last=277 first=3672 max=632 min=277 avg=296 std=258 std^2=67064 808 last=273 first=3672 max=632 min=273 avg=292 std=224 std^2=50411 809 last=273 first=3672 max=632 min=273 avg=288 std=200 std^2=40389 810 last=281 first=3672 max=632 min=273 avg=287 std=183 std^2=33666 811 812 813config RING_BUFFER_BENCHMARK 814 tristate "Ring buffer benchmark stress tester" 815 depends on RING_BUFFER 816 help 817 This option creates a test to stress the ring buffer and benchmark it. 818 It creates its own ring buffer such that it will not interfere with 819 any other users of the ring buffer (such as ftrace). It then creates 820 a producer and consumer that will run for 10 seconds and sleep for 821 10 seconds. Each interval it will print out the number of events 822 it recorded and give a rough estimate of how long each iteration took. 823 824 It does not disable interrupts or raise its priority, so it may be 825 affected by processes that are running. 826 827 If unsure, say N. 828 829config TRACE_EVAL_MAP_FILE 830 bool "Show eval mappings for trace events" 831 depends on TRACING 832 help 833 The "print fmt" of the trace events will show the enum/sizeof names 834 instead of their values. This can cause problems for user space tools 835 that use this string to parse the raw data as user space does not know 836 how to convert the string to its value. 837 838 To fix this, there's a special macro in the kernel that can be used 839 to convert an enum/sizeof into its value. If this macro is used, then 840 the print fmt strings will be converted to their values. 841 842 If something does not get converted properly, this option can be 843 used to show what enums/sizeof the kernel tried to convert. 844 845 This option is for debugging the conversions. A file is created 846 in the tracing directory called "eval_map" that will show the 847 names matched with their values and what trace event system they 848 belong too. 849 850 Normally, the mapping of the strings to values will be freed after 851 boot up or module load. With this option, they will not be freed, as 852 they are needed for the "eval_map" file. Enabling this option will 853 increase the memory footprint of the running kernel. 854 855 If unsure, say N. 856 857config FTRACE_RECORD_RECURSION 858 bool "Record functions that recurse in function tracing" 859 depends on FUNCTION_TRACER 860 help 861 All callbacks that attach to the function tracing have some sort 862 of protection against recursion. Even though the protection exists, 863 it adds overhead. This option will create a file in the tracefs 864 file system called "recursed_functions" that will list the functions 865 that triggered a recursion. 866 867 This will add more overhead to cases that have recursion. 868 869 If unsure, say N 870 871config FTRACE_RECORD_RECURSION_SIZE 872 int "Max number of recursed functions to record" 873 default 128 874 depends on FTRACE_RECORD_RECURSION 875 help 876 This defines the limit of number of functions that can be 877 listed in the "recursed_functions" file, that lists all 878 the functions that caused a recursion to happen. 879 This file can be reset, but the limit can not change in 880 size at runtime. 881 882config RING_BUFFER_RECORD_RECURSION 883 bool "Record functions that recurse in the ring buffer" 884 depends on FTRACE_RECORD_RECURSION 885 # default y, because it is coupled with FTRACE_RECORD_RECURSION 886 default y 887 help 888 The ring buffer has its own internal recursion. Although when 889 recursion happens it wont cause harm because of the protection, 890 but it does cause an unwanted overhead. Enabling this option will 891 place where recursion was detected into the ftrace "recursed_functions" 892 file. 893 894 This will add more overhead to cases that have recursion. 895 896config GCOV_PROFILE_FTRACE 897 bool "Enable GCOV profiling on ftrace subsystem" 898 depends on GCOV_KERNEL 899 help 900 Enable GCOV profiling on ftrace subsystem for checking 901 which functions/lines are tested. 902 903 If unsure, say N. 904 905 Note that on a kernel compiled with this config, ftrace will 906 run significantly slower. 907 908config FTRACE_SELFTEST 909 bool 910 911config FTRACE_STARTUP_TEST 912 bool "Perform a startup test on ftrace" 913 depends on GENERIC_TRACER 914 select FTRACE_SELFTEST 915 help 916 This option performs a series of startup tests on ftrace. On bootup 917 a series of tests are made to verify that the tracer is 918 functioning properly. It will do tests on all the configured 919 tracers of ftrace. 920 921config EVENT_TRACE_STARTUP_TEST 922 bool "Run selftest on trace events" 923 depends on FTRACE_STARTUP_TEST 924 default y 925 help 926 This option performs a test on all trace events in the system. 927 It basically just enables each event and runs some code that 928 will trigger events (not necessarily the event it enables) 929 This may take some time run as there are a lot of events. 930 931config EVENT_TRACE_TEST_SYSCALLS 932 bool "Run selftest on syscall events" 933 depends on EVENT_TRACE_STARTUP_TEST 934 help 935 This option will also enable testing every syscall event. 936 It only enables the event and disables it and runs various loads 937 with the event enabled. This adds a bit more time for kernel boot 938 up since it runs this on every system call defined. 939 940 TBD - enable a way to actually call the syscalls as we test their 941 events 942 943config FTRACE_SORT_STARTUP_TEST 944 bool "Verify compile time sorting of ftrace functions" 945 depends on DYNAMIC_FTRACE 946 depends on BUILDTIME_MCOUNT_SORT 947 help 948 Sorting of the mcount_loc sections that is used to find the 949 where the ftrace knows where to patch functions for tracing 950 and other callbacks is done at compile time. But if the sort 951 is not done correctly, it will cause non-deterministic failures. 952 When this is set, the sorted sections will be verified that they 953 are in deed sorted and will warn if they are not. 954 955 If unsure, say N 956 957config RING_BUFFER_STARTUP_TEST 958 bool "Ring buffer startup self test" 959 depends on RING_BUFFER 960 help 961 Run a simple self test on the ring buffer on boot up. Late in the 962 kernel boot sequence, the test will start that kicks off 963 a thread per cpu. Each thread will write various size events 964 into the ring buffer. Another thread is created to send IPIs 965 to each of the threads, where the IPI handler will also write 966 to the ring buffer, to test/stress the nesting ability. 967 If any anomalies are discovered, a warning will be displayed 968 and all ring buffers will be disabled. 969 970 The test runs for 10 seconds. This will slow your boot time 971 by at least 10 more seconds. 972 973 At the end of the test, statics and more checks are done. 974 It will output the stats of each per cpu buffer. What 975 was written, the sizes, what was read, what was lost, and 976 other similar details. 977 978 If unsure, say N 979 980config RING_BUFFER_VALIDATE_TIME_DELTAS 981 bool "Verify ring buffer time stamp deltas" 982 depends on RING_BUFFER 983 help 984 This will audit the time stamps on the ring buffer sub 985 buffer to make sure that all the time deltas for the 986 events on a sub buffer matches the current time stamp. 987 This audit is performed for every event that is not 988 interrupted, or interrupting another event. A check 989 is also made when traversing sub buffers to make sure 990 that all the deltas on the previous sub buffer do not 991 add up to be greater than the current time stamp. 992 993 NOTE: This adds significant overhead to recording of events, 994 and should only be used to test the logic of the ring buffer. 995 Do not use it on production systems. 996 997 Only say Y if you understand what this does, and you 998 still want it enabled. Otherwise say N 999 1000config MMIOTRACE_TEST 1001 tristate "Test module for mmiotrace" 1002 depends on MMIOTRACE && m 1003 help 1004 This is a dumb module for testing mmiotrace. It is very dangerous 1005 as it will write garbage to IO memory starting at a given address. 1006 However, it should be safe to use on e.g. unused portion of VRAM. 1007 1008 Say N, unless you absolutely know what you are doing. 1009 1010config PREEMPTIRQ_DELAY_TEST 1011 tristate "Test module to create a preempt / IRQ disable delay thread to test latency tracers" 1012 depends on m 1013 help 1014 Select this option to build a test module that can help test latency 1015 tracers by executing a preempt or irq disable section with a user 1016 configurable delay. The module busy waits for the duration of the 1017 critical section. 1018 1019 For example, the following invocation generates a burst of three 1020 irq-disabled critical sections for 500us: 1021 modprobe preemptirq_delay_test test_mode=irq delay=500 burst_size=3 1022 1023 What's more, if you want to attach the test on the cpu which the latency 1024 tracer is running on, specify cpu_affinity=cpu_num at the end of the 1025 command. 1026 1027 If unsure, say N 1028 1029config SYNTH_EVENT_GEN_TEST 1030 tristate "Test module for in-kernel synthetic event generation" 1031 depends on SYNTH_EVENTS 1032 help 1033 This option creates a test module to check the base 1034 functionality of in-kernel synthetic event definition and 1035 generation. 1036 1037 To test, insert the module, and then check the trace buffer 1038 for the generated sample events. 1039 1040 If unsure, say N. 1041 1042config KPROBE_EVENT_GEN_TEST 1043 tristate "Test module for in-kernel kprobe event generation" 1044 depends on KPROBE_EVENTS 1045 help 1046 This option creates a test module to check the base 1047 functionality of in-kernel kprobe event definition. 1048 1049 To test, insert the module, and then check the trace buffer 1050 for the generated kprobe events. 1051 1052 If unsure, say N. 1053 1054config HIST_TRIGGERS_DEBUG 1055 bool "Hist trigger debug support" 1056 depends on HIST_TRIGGERS 1057 help 1058 Add "hist_debug" file for each event, which when read will 1059 dump out a bunch of internal details about the hist triggers 1060 defined on that event. 1061 1062 The hist_debug file serves a couple of purposes: 1063 1064 - Helps developers verify that nothing is broken. 1065 1066 - Provides educational information to support the details 1067 of the hist trigger internals as described by 1068 Documentation/trace/histogram-design.rst. 1069 1070 The hist_debug output only covers the data structures 1071 related to the histogram definitions themselves and doesn't 1072 display the internals of map buckets or variable values of 1073 running histograms. 1074 1075 If unsure, say N. 1076 1077endif # FTRACE 1078