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