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