Kconfig 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187
  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_FUNCTION_GRAPH_RETVAL
  28. bool
  29. config HAVE_DYNAMIC_FTRACE
  30. bool
  31. help
  32. See Documentation/trace/ftrace-design.rst
  33. config HAVE_DYNAMIC_FTRACE_WITH_REGS
  34. bool
  35. config HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
  36. bool
  37. config HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
  38. bool
  39. config HAVE_DYNAMIC_FTRACE_WITH_ARGS
  40. bool
  41. help
  42. If this is set, then arguments and stack can be found from
  43. the ftrace_regs passed into the function callback regs parameter
  44. by default, even without setting the REGS flag in the ftrace_ops.
  45. This allows for use of ftrace_regs_get_argument() and
  46. ftrace_regs_get_stack_pointer().
  47. config HAVE_DYNAMIC_FTRACE_NO_PATCHABLE
  48. bool
  49. help
  50. If the architecture generates __patchable_function_entries sections
  51. but does not want them included in the ftrace locations.
  52. config HAVE_FTRACE_MCOUNT_RECORD
  53. bool
  54. help
  55. See Documentation/trace/ftrace-design.rst
  56. config HAVE_SYSCALL_TRACEPOINTS
  57. bool
  58. help
  59. See Documentation/trace/ftrace-design.rst
  60. config HAVE_FENTRY
  61. bool
  62. help
  63. Arch supports the gcc options -pg with -mfentry
  64. config HAVE_NOP_MCOUNT
  65. bool
  66. help
  67. Arch supports the gcc options -pg with -mrecord-mcount and -nop-mcount
  68. config HAVE_OBJTOOL_MCOUNT
  69. bool
  70. help
  71. Arch supports objtool --mcount
  72. config HAVE_OBJTOOL_NOP_MCOUNT
  73. bool
  74. help
  75. Arch supports the objtool options --mcount with --mnop.
  76. An architecture can select this if it wants to enable nop'ing
  77. of ftrace locations.
  78. config HAVE_C_RECORDMCOUNT
  79. bool
  80. help
  81. C version of recordmcount available?
  82. config HAVE_BUILDTIME_MCOUNT_SORT
  83. bool
  84. help
  85. An architecture selects this if it sorts the mcount_loc section
  86. at build time.
  87. config BUILDTIME_MCOUNT_SORT
  88. bool
  89. default y
  90. depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE
  91. help
  92. Sort the mcount_loc section at build time.
  93. config TRACER_MAX_TRACE
  94. bool
  95. config TRACE_CLOCK
  96. bool
  97. config RING_BUFFER
  98. bool
  99. select TRACE_CLOCK
  100. select IRQ_WORK
  101. config EVENT_TRACING
  102. select CONTEXT_SWITCH_TRACER
  103. select GLOB
  104. bool
  105. config CONTEXT_SWITCH_TRACER
  106. bool
  107. config RING_BUFFER_ALLOW_SWAP
  108. bool
  109. help
  110. Allow the use of ring_buffer_swap_cpu.
  111. Adds a very slight overhead to tracing when enabled.
  112. config PREEMPTIRQ_TRACEPOINTS
  113. bool
  114. depends on TRACE_PREEMPT_TOGGLE || TRACE_IRQFLAGS
  115. select TRACING
  116. default y
  117. help
  118. Create preempt/irq toggle tracepoints if needed, so that other parts
  119. of the kernel can use them to generate or add hooks to them.
  120. # All tracer options should select GENERIC_TRACER. For those options that are
  121. # enabled by all tracers (context switch and event tracer) they select TRACING.
  122. # This allows those options to appear when no other tracer is selected. But the
  123. # options do not appear when something else selects it. We need the two options
  124. # GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the
  125. # hiding of the automatic options.
  126. config TRACING
  127. bool
  128. select RING_BUFFER
  129. select STACKTRACE if STACKTRACE_SUPPORT
  130. select TRACEPOINTS
  131. select NOP_TRACER
  132. select BINARY_PRINTF
  133. select EVENT_TRACING
  134. select TRACE_CLOCK
  135. select NEED_TASKS_RCU
  136. config GENERIC_TRACER
  137. bool
  138. select TRACING
  139. #
  140. # Minimum requirements an architecture has to meet for us to
  141. # be able to offer generic tracing facilities:
  142. #
  143. config TRACING_SUPPORT
  144. bool
  145. depends on TRACE_IRQFLAGS_SUPPORT
  146. depends on STACKTRACE_SUPPORT
  147. default y
  148. menuconfig FTRACE
  149. bool "Tracers"
  150. depends on TRACING_SUPPORT
  151. default y if DEBUG_KERNEL
  152. help
  153. Enable the kernel tracing infrastructure.
  154. if FTRACE
  155. config BOOTTIME_TRACING
  156. bool "Boot-time Tracing support"
  157. depends on TRACING
  158. select BOOT_CONFIG
  159. help
  160. Enable developer to setup ftrace subsystem via supplemental
  161. kernel cmdline at boot time for debugging (tracing) driver
  162. initialization and boot process.
  163. config FUNCTION_TRACER
  164. bool "Kernel Function Tracer"
  165. depends on HAVE_FUNCTION_TRACER
  166. select KALLSYMS
  167. select GENERIC_TRACER
  168. select CONTEXT_SWITCH_TRACER
  169. select GLOB
  170. select NEED_TASKS_RCU
  171. select TASKS_RUDE_RCU
  172. help
  173. Enable the kernel to trace every kernel function. This is done
  174. by using a compiler feature to insert a small, 5-byte No-Operation
  175. instruction at the beginning of every kernel function, which NOP
  176. sequence is then dynamically patched into a tracer call when
  177. tracing is enabled by the administrator. If it's runtime disabled
  178. (the bootup default), then the overhead of the instructions is very
  179. small and not measurable even in micro-benchmarks (at least on
  180. x86, but may have impact on other architectures).
  181. config FUNCTION_GRAPH_TRACER
  182. bool "Kernel Function Graph Tracer"
  183. depends on HAVE_FUNCTION_GRAPH_TRACER
  184. depends on FUNCTION_TRACER
  185. depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE
  186. default y
  187. help
  188. Enable the kernel to trace a function at both its return
  189. and its entry.
  190. Its first purpose is to trace the duration of functions and
  191. draw a call graph for each thread with some information like
  192. the return value. This is done by setting the current return
  193. address on the current task structure into a stack of calls.
  194. config FUNCTION_GRAPH_RETVAL
  195. bool "Kernel Function Graph Return Value"
  196. depends on HAVE_FUNCTION_GRAPH_RETVAL
  197. depends on FUNCTION_GRAPH_TRACER
  198. default n
  199. help
  200. Support recording and printing the function return value when
  201. using function graph tracer. It can be helpful to locate functions
  202. that return errors. This feature is off by default, and you can
  203. enable it via the trace option funcgraph-retval.
  204. See Documentation/trace/ftrace.rst
  205. config DYNAMIC_FTRACE
  206. bool "enable/disable function tracing dynamically"
  207. depends on FUNCTION_TRACER
  208. depends on HAVE_DYNAMIC_FTRACE
  209. default y
  210. help
  211. This option will modify all the calls to function tracing
  212. dynamically (will patch them out of the binary image and
  213. replace them with a No-Op instruction) on boot up. During
  214. compile time, a table is made of all the locations that ftrace
  215. can function trace, and this table is linked into the kernel
  216. image. When this is enabled, functions can be individually
  217. enabled, and the functions not enabled will not affect
  218. performance of the system.
  219. See the files in /sys/kernel/tracing:
  220. available_filter_functions
  221. set_ftrace_filter
  222. set_ftrace_notrace
  223. This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
  224. otherwise has native performance as long as no tracing is active.
  225. config DYNAMIC_FTRACE_WITH_REGS
  226. def_bool y
  227. depends on DYNAMIC_FTRACE
  228. depends on HAVE_DYNAMIC_FTRACE_WITH_REGS
  229. config DYNAMIC_FTRACE_WITH_DIRECT_CALLS
  230. def_bool y
  231. depends on DYNAMIC_FTRACE_WITH_REGS || DYNAMIC_FTRACE_WITH_ARGS
  232. depends on HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
  233. config DYNAMIC_FTRACE_WITH_CALL_OPS
  234. def_bool y
  235. depends on HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
  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/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/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/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/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/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/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/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/tracing/current_tracer
  553. cat /sys/kernel/tracing/trace_pipe
  554. If unsure, say N.
  555. config FPROBE_EVENTS
  556. depends on FPROBE
  557. depends on HAVE_REGS_AND_STACK_ACCESS_API
  558. bool "Enable fprobe-based dynamic events"
  559. select TRACING
  560. select PROBE_EVENTS
  561. select DYNAMIC_EVENTS
  562. default y
  563. help
  564. This allows user to add tracing events on the function entry and
  565. exit via ftrace interface. The syntax is same as the kprobe events
  566. and the kprobe events on function entry and exit will be
  567. transparently converted to this fprobe events.
  568. config PROBE_EVENTS_BTF_ARGS
  569. depends on HAVE_FUNCTION_ARG_ACCESS_API
  570. depends on FPROBE_EVENTS || KPROBE_EVENTS
  571. depends on DEBUG_INFO_BTF && BPF_SYSCALL
  572. bool "Support BTF function arguments for probe events"
  573. default y
  574. help
  575. The user can specify the arguments of the probe event using the names
  576. of the arguments of the probed function, when the probe location is a
  577. kernel function entry or a tracepoint.
  578. This is available only if BTF (BPF Type Format) support is enabled.
  579. config KPROBE_EVENTS
  580. depends on KPROBES
  581. depends on HAVE_REGS_AND_STACK_ACCESS_API
  582. bool "Enable kprobes-based dynamic events"
  583. select TRACING
  584. select PROBE_EVENTS
  585. select DYNAMIC_EVENTS
  586. default y
  587. help
  588. This allows the user to add tracing events (similar to tracepoints)
  589. on the fly via the ftrace interface. See
  590. Documentation/trace/kprobetrace.rst for more details.
  591. Those events can be inserted wherever kprobes can probe, and record
  592. various register and memory values.
  593. This option is also required by perf-probe subcommand of perf tools.
  594. If you want to use perf tools, this option is strongly recommended.
  595. config KPROBE_EVENTS_ON_NOTRACE
  596. bool "Do NOT protect notrace function from kprobe events"
  597. depends on KPROBE_EVENTS
  598. depends on DYNAMIC_FTRACE
  599. default n
  600. help
  601. This is only for the developers who want to debug ftrace itself
  602. using kprobe events.
  603. If kprobes can use ftrace instead of breakpoint, ftrace related
  604. functions are protected from kprobe-events to prevent an infinite
  605. recursion or any unexpected execution path which leads to a kernel
  606. crash.
  607. This option disables such protection and allows you to put kprobe
  608. events on ftrace functions for debugging ftrace by itself.
  609. Note that this might let you shoot yourself in the foot.
  610. If unsure, say N.
  611. config UPROBE_EVENTS
  612. bool "Enable uprobes-based dynamic events"
  613. depends on ARCH_SUPPORTS_UPROBES
  614. depends on MMU
  615. depends on PERF_EVENTS
  616. select UPROBES
  617. select PROBE_EVENTS
  618. select DYNAMIC_EVENTS
  619. select TRACING
  620. default y
  621. help
  622. This allows the user to add tracing events on top of userspace
  623. dynamic events (similar to tracepoints) on the fly via the trace
  624. events interface. Those events can be inserted wherever uprobes
  625. can probe, and record various registers.
  626. This option is required if you plan to use perf-probe subcommand
  627. of perf tools on user space applications.
  628. config BPF_EVENTS
  629. depends on BPF_SYSCALL
  630. depends on (KPROBE_EVENTS || UPROBE_EVENTS) && PERF_EVENTS
  631. bool
  632. default y
  633. help
  634. This allows the user to attach BPF programs to kprobe, uprobe, and
  635. tracepoint events.
  636. config DYNAMIC_EVENTS
  637. def_bool n
  638. config PROBE_EVENTS
  639. def_bool n
  640. config BPF_KPROBE_OVERRIDE
  641. bool "Enable BPF programs to override a kprobed function"
  642. depends on BPF_EVENTS
  643. depends on FUNCTION_ERROR_INJECTION
  644. default n
  645. help
  646. Allows BPF to override the execution of a probed function and
  647. set a different return value. This is used for error injection.
  648. config FTRACE_MCOUNT_RECORD
  649. def_bool y
  650. depends on DYNAMIC_FTRACE
  651. depends on HAVE_FTRACE_MCOUNT_RECORD
  652. config FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
  653. bool
  654. depends on FTRACE_MCOUNT_RECORD
  655. config FTRACE_MCOUNT_USE_CC
  656. def_bool y
  657. depends on $(cc-option,-mrecord-mcount)
  658. depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
  659. depends on FTRACE_MCOUNT_RECORD
  660. config FTRACE_MCOUNT_USE_OBJTOOL
  661. def_bool y
  662. depends on HAVE_OBJTOOL_MCOUNT
  663. depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
  664. depends on !FTRACE_MCOUNT_USE_CC
  665. depends on FTRACE_MCOUNT_RECORD
  666. select OBJTOOL
  667. config FTRACE_MCOUNT_USE_RECORDMCOUNT
  668. def_bool y
  669. depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
  670. depends on !FTRACE_MCOUNT_USE_CC
  671. depends on !FTRACE_MCOUNT_USE_OBJTOOL
  672. depends on FTRACE_MCOUNT_RECORD
  673. config TRACING_MAP
  674. bool
  675. depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
  676. help
  677. tracing_map is a special-purpose lock-free map for tracing,
  678. separated out as a stand-alone facility in order to allow it
  679. to be shared between multiple tracers. It isn't meant to be
  680. generally used outside of that context, and is normally
  681. selected by tracers that use it.
  682. config SYNTH_EVENTS
  683. bool "Synthetic trace events"
  684. select TRACING
  685. select DYNAMIC_EVENTS
  686. default n
  687. help
  688. Synthetic events are user-defined trace events that can be
  689. used to combine data from other trace events or in fact any
  690. data source. Synthetic events can be generated indirectly
  691. via the trace() action of histogram triggers or directly
  692. by way of an in-kernel API.
  693. See Documentation/trace/events.rst or
  694. Documentation/trace/histogram.rst for details and examples.
  695. If in doubt, say N.
  696. config USER_EVENTS
  697. bool "User trace events"
  698. select TRACING
  699. select DYNAMIC_EVENTS
  700. help
  701. User trace events are user-defined trace events that
  702. can be used like an existing kernel trace event. User trace
  703. events are generated by writing to a tracefs file. User
  704. processes can determine if their tracing events should be
  705. generated by registering a value and bit with the kernel
  706. that reflects when it is enabled or not.
  707. See Documentation/trace/user_events.rst.
  708. If in doubt, say N.
  709. config HIST_TRIGGERS
  710. bool "Histogram triggers"
  711. depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
  712. select TRACING_MAP
  713. select TRACING
  714. select DYNAMIC_EVENTS
  715. select SYNTH_EVENTS
  716. default n
  717. help
  718. Hist triggers allow one or more arbitrary trace event fields
  719. to be aggregated into hash tables and dumped to stdout by
  720. reading a debugfs/tracefs file. They're useful for
  721. gathering quick and dirty (though precise) summaries of
  722. event activity as an initial guide for further investigation
  723. using more advanced tools.
  724. Inter-event tracing of quantities such as latencies is also
  725. supported using hist triggers under this option.
  726. See Documentation/trace/histogram.rst.
  727. If in doubt, say N.
  728. config TRACE_EVENT_INJECT
  729. bool "Trace event injection"
  730. depends on TRACING
  731. help
  732. Allow user-space to inject a specific trace event into the ring
  733. buffer. This is mainly used for testing purpose.
  734. If unsure, say N.
  735. config TRACEPOINT_BENCHMARK
  736. bool "Add tracepoint that benchmarks tracepoints"
  737. help
  738. This option creates the tracepoint "benchmark:benchmark_event".
  739. When the tracepoint is enabled, it kicks off a kernel thread that
  740. goes into an infinite loop (calling cond_resched() to let other tasks
  741. run), and calls the tracepoint. Each iteration will record the time
  742. it took to write to the tracepoint and the next iteration that
  743. data will be passed to the tracepoint itself. That is, the tracepoint
  744. will report the time it took to do the previous tracepoint.
  745. The string written to the tracepoint is a static string of 128 bytes
  746. to keep the time the same. The initial string is simply a write of
  747. "START". The second string records the cold cache time of the first
  748. write which is not added to the rest of the calculations.
  749. As it is a tight loop, it benchmarks as hot cache. That's fine because
  750. we care most about hot paths that are probably in cache already.
  751. An example of the output:
  752. START
  753. first=3672 [COLD CACHED]
  754. last=632 first=3672 max=632 min=632 avg=316 std=446 std^2=199712
  755. last=278 first=3672 max=632 min=278 avg=303 std=316 std^2=100337
  756. last=277 first=3672 max=632 min=277 avg=296 std=258 std^2=67064
  757. last=273 first=3672 max=632 min=273 avg=292 std=224 std^2=50411
  758. last=273 first=3672 max=632 min=273 avg=288 std=200 std^2=40389
  759. last=281 first=3672 max=632 min=273 avg=287 std=183 std^2=33666
  760. config RING_BUFFER_BENCHMARK
  761. tristate "Ring buffer benchmark stress tester"
  762. depends on RING_BUFFER
  763. help
  764. This option creates a test to stress the ring buffer and benchmark it.
  765. It creates its own ring buffer such that it will not interfere with
  766. any other users of the ring buffer (such as ftrace). It then creates
  767. a producer and consumer that will run for 10 seconds and sleep for
  768. 10 seconds. Each interval it will print out the number of events
  769. it recorded and give a rough estimate of how long each iteration took.
  770. It does not disable interrupts or raise its priority, so it may be
  771. affected by processes that are running.
  772. If unsure, say N.
  773. config TRACE_EVAL_MAP_FILE
  774. bool "Show eval mappings for trace events"
  775. depends on TRACING
  776. help
  777. The "print fmt" of the trace events will show the enum/sizeof names
  778. instead of their values. This can cause problems for user space tools
  779. that use this string to parse the raw data as user space does not know
  780. how to convert the string to its value.
  781. To fix this, there's a special macro in the kernel that can be used
  782. to convert an enum/sizeof into its value. If this macro is used, then
  783. the print fmt strings will be converted to their values.
  784. If something does not get converted properly, this option can be
  785. used to show what enums/sizeof the kernel tried to convert.
  786. This option is for debugging the conversions. A file is created
  787. in the tracing directory called "eval_map" that will show the
  788. names matched with their values and what trace event system they
  789. belong too.
  790. Normally, the mapping of the strings to values will be freed after
  791. boot up or module load. With this option, they will not be freed, as
  792. they are needed for the "eval_map" file. Enabling this option will
  793. increase the memory footprint of the running kernel.
  794. If unsure, say N.
  795. config FTRACE_RECORD_RECURSION
  796. bool "Record functions that recurse in function tracing"
  797. depends on FUNCTION_TRACER
  798. help
  799. All callbacks that attach to the function tracing have some sort
  800. of protection against recursion. Even though the protection exists,
  801. it adds overhead. This option will create a file in the tracefs
  802. file system called "recursed_functions" that will list the functions
  803. that triggered a recursion.
  804. This will add more overhead to cases that have recursion.
  805. If unsure, say N
  806. config FTRACE_RECORD_RECURSION_SIZE
  807. int "Max number of recursed functions to record"
  808. default 128
  809. depends on FTRACE_RECORD_RECURSION
  810. help
  811. This defines the limit of number of functions that can be
  812. listed in the "recursed_functions" file, that lists all
  813. the functions that caused a recursion to happen.
  814. This file can be reset, but the limit can not change in
  815. size at runtime.
  816. config FTRACE_VALIDATE_RCU_IS_WATCHING
  817. bool "Validate RCU is on during ftrace execution"
  818. depends on FUNCTION_TRACER
  819. depends on ARCH_WANTS_NO_INSTR
  820. help
  821. All callbacks that attach to the function tracing have some sort of
  822. protection against recursion. This option is only to verify that
  823. ftrace (and other users of ftrace_test_recursion_trylock()) are not
  824. called outside of RCU, as if they are, it can cause a race. But it
  825. also has a noticeable overhead when enabled.
  826. If unsure, say N
  827. config RING_BUFFER_RECORD_RECURSION
  828. bool "Record functions that recurse in the ring buffer"
  829. depends on FTRACE_RECORD_RECURSION
  830. # default y, because it is coupled with FTRACE_RECORD_RECURSION
  831. default y
  832. help
  833. The ring buffer has its own internal recursion. Although when
  834. recursion happens it won't cause harm because of the protection,
  835. but it does cause unwanted overhead. Enabling this option will
  836. place where recursion was detected into the ftrace "recursed_functions"
  837. file.
  838. This will add more overhead to cases that have recursion.
  839. config GCOV_PROFILE_FTRACE
  840. bool "Enable GCOV profiling on ftrace subsystem"
  841. depends on GCOV_KERNEL
  842. help
  843. Enable GCOV profiling on ftrace subsystem for checking
  844. which functions/lines are tested.
  845. If unsure, say N.
  846. Note that on a kernel compiled with this config, ftrace will
  847. run significantly slower.
  848. config FTRACE_SELFTEST
  849. bool
  850. config FTRACE_STARTUP_TEST
  851. bool "Perform a startup test on ftrace"
  852. depends on GENERIC_TRACER
  853. select FTRACE_SELFTEST
  854. help
  855. This option performs a series of startup tests on ftrace. On bootup
  856. a series of tests are made to verify that the tracer is
  857. functioning properly. It will do tests on all the configured
  858. tracers of ftrace.
  859. config EVENT_TRACE_STARTUP_TEST
  860. bool "Run selftest on trace events"
  861. depends on FTRACE_STARTUP_TEST
  862. default y
  863. help
  864. This option performs a test on all trace events in the system.
  865. It basically just enables each event and runs some code that
  866. will trigger events (not necessarily the event it enables)
  867. This may take some time run as there are a lot of events.
  868. config EVENT_TRACE_TEST_SYSCALLS
  869. bool "Run selftest on syscall events"
  870. depends on EVENT_TRACE_STARTUP_TEST
  871. help
  872. This option will also enable testing every syscall event.
  873. It only enables the event and disables it and runs various loads
  874. with the event enabled. This adds a bit more time for kernel boot
  875. up since it runs this on every system call defined.
  876. TBD - enable a way to actually call the syscalls as we test their
  877. events
  878. config FTRACE_SORT_STARTUP_TEST
  879. bool "Verify compile time sorting of ftrace functions"
  880. depends on DYNAMIC_FTRACE
  881. depends on BUILDTIME_MCOUNT_SORT
  882. help
  883. Sorting of the mcount_loc sections that is used to find the
  884. where the ftrace knows where to patch functions for tracing
  885. and other callbacks is done at compile time. But if the sort
  886. is not done correctly, it will cause non-deterministic failures.
  887. When this is set, the sorted sections will be verified that they
  888. are in deed sorted and will warn if they are not.
  889. If unsure, say N
  890. config RING_BUFFER_STARTUP_TEST
  891. bool "Ring buffer startup self test"
  892. depends on RING_BUFFER
  893. help
  894. Run a simple self test on the ring buffer on boot up. Late in the
  895. kernel boot sequence, the test will start that kicks off
  896. a thread per cpu. Each thread will write various size events
  897. into the ring buffer. Another thread is created to send IPIs
  898. to each of the threads, where the IPI handler will also write
  899. to the ring buffer, to test/stress the nesting ability.
  900. If any anomalies are discovered, a warning will be displayed
  901. and all ring buffers will be disabled.
  902. The test runs for 10 seconds. This will slow your boot time
  903. by at least 10 more seconds.
  904. At the end of the test, statistics and more checks are done.
  905. It will output the stats of each per cpu buffer: What
  906. was written, the sizes, what was read, what was lost, and
  907. other similar details.
  908. If unsure, say N
  909. config RING_BUFFER_VALIDATE_TIME_DELTAS
  910. bool "Verify ring buffer time stamp deltas"
  911. depends on RING_BUFFER
  912. help
  913. This will audit the time stamps on the ring buffer sub
  914. buffer to make sure that all the time deltas for the
  915. events on a sub buffer matches the current time stamp.
  916. This audit is performed for every event that is not
  917. interrupted, or interrupting another event. A check
  918. is also made when traversing sub buffers to make sure
  919. that all the deltas on the previous sub buffer do not
  920. add up to be greater than the current time stamp.
  921. NOTE: This adds significant overhead to recording of events,
  922. and should only be used to test the logic of the ring buffer.
  923. Do not use it on production systems.
  924. Only say Y if you understand what this does, and you
  925. still want it enabled. Otherwise say N
  926. config MMIOTRACE_TEST
  927. tristate "Test module for mmiotrace"
  928. depends on MMIOTRACE && m
  929. help
  930. This is a dumb module for testing mmiotrace. It is very dangerous
  931. as it will write garbage to IO memory starting at a given address.
  932. However, it should be safe to use on e.g. unused portion of VRAM.
  933. Say N, unless you absolutely know what you are doing.
  934. config PREEMPTIRQ_DELAY_TEST
  935. tristate "Test module to create a preempt / IRQ disable delay thread to test latency tracers"
  936. depends on m
  937. help
  938. Select this option to build a test module that can help test latency
  939. tracers by executing a preempt or irq disable section with a user
  940. configurable delay. The module busy waits for the duration of the
  941. critical section.
  942. For example, the following invocation generates a burst of three
  943. irq-disabled critical sections for 500us:
  944. modprobe preemptirq_delay_test test_mode=irq delay=500 burst_size=3
  945. What's more, if you want to attach the test on the cpu which the latency
  946. tracer is running on, specify cpu_affinity=cpu_num at the end of the
  947. command.
  948. If unsure, say N
  949. config SYNTH_EVENT_GEN_TEST
  950. tristate "Test module for in-kernel synthetic event generation"
  951. depends on SYNTH_EVENTS && m
  952. help
  953. This option creates a test module to check the base
  954. functionality of in-kernel synthetic event definition and
  955. generation.
  956. To test, insert the module, and then check the trace buffer
  957. for the generated sample events.
  958. If unsure, say N.
  959. config KPROBE_EVENT_GEN_TEST
  960. tristate "Test module for in-kernel kprobe event generation"
  961. depends on KPROBE_EVENTS && m
  962. help
  963. This option creates a test module to check the base
  964. functionality of in-kernel kprobe event definition.
  965. To test, insert the module, and then check the trace buffer
  966. for the generated kprobe events.
  967. If unsure, say N.
  968. config HIST_TRIGGERS_DEBUG
  969. bool "Hist trigger debug support"
  970. depends on HIST_TRIGGERS
  971. help
  972. Add "hist_debug" file for each event, which when read will
  973. dump out a bunch of internal details about the hist triggers
  974. defined on that event.
  975. The hist_debug file serves a couple of purposes:
  976. - Helps developers verify that nothing is broken.
  977. - Provides educational information to support the details
  978. of the hist trigger internals as described by
  979. Documentation/trace/histogram-design.rst.
  980. The hist_debug output only covers the data structures
  981. related to the histogram definitions themselves and doesn't
  982. display the internals of map buckets or variable values of
  983. running histograms.
  984. If unsure, say N.
  985. source "kernel/trace/rv/Kconfig"
  986. endif # FTRACE