Kconfig 37 KB

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