Kconfig 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. #
  2. # Architectures that offer an FUNCTION_TRACER implementation should
  3. # select HAVE_FUNCTION_TRACER:
  4. #
  5. config USER_STACKTRACE_SUPPORT
  6. bool
  7. config NOP_TRACER
  8. bool
  9. config HAVE_FTRACE_NMI_ENTER
  10. bool
  11. help
  12. See Documentation/trace/ftrace-design.txt
  13. config HAVE_FUNCTION_TRACER
  14. bool
  15. help
  16. See Documentation/trace/ftrace-design.txt
  17. config HAVE_FUNCTION_GRAPH_TRACER
  18. bool
  19. help
  20. See Documentation/trace/ftrace-design.txt
  21. config HAVE_FUNCTION_GRAPH_FP_TEST
  22. bool
  23. help
  24. See Documentation/trace/ftrace-design.txt
  25. config HAVE_DYNAMIC_FTRACE
  26. bool
  27. help
  28. See Documentation/trace/ftrace-design.txt
  29. config HAVE_DYNAMIC_FTRACE_WITH_REGS
  30. bool
  31. config HAVE_FTRACE_MCOUNT_RECORD
  32. bool
  33. help
  34. See Documentation/trace/ftrace-design.txt
  35. config HAVE_SYSCALL_TRACEPOINTS
  36. bool
  37. help
  38. See Documentation/trace/ftrace-design.txt
  39. config HAVE_FENTRY
  40. bool
  41. help
  42. Arch supports the gcc options -pg with -mfentry
  43. config HAVE_C_RECORDMCOUNT
  44. bool
  45. help
  46. C version of recordmcount available?
  47. config TRACER_MAX_TRACE
  48. bool
  49. config TRACE_CLOCK
  50. bool
  51. config RING_BUFFER
  52. bool
  53. select TRACE_CLOCK
  54. select IRQ_WORK
  55. config FTRACE_NMI_ENTER
  56. bool
  57. depends on HAVE_FTRACE_NMI_ENTER
  58. default y
  59. config EVENT_TRACING
  60. select CONTEXT_SWITCH_TRACER
  61. bool
  62. config CONTEXT_SWITCH_TRACER
  63. bool
  64. config RING_BUFFER_ALLOW_SWAP
  65. bool
  66. help
  67. Allow the use of ring_buffer_swap_cpu.
  68. Adds a very slight overhead to tracing when enabled.
  69. # All tracer options should select GENERIC_TRACER. For those options that are
  70. # enabled by all tracers (context switch and event tracer) they select TRACING.
  71. # This allows those options to appear when no other tracer is selected. But the
  72. # options do not appear when something else selects it. We need the two options
  73. # GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the
  74. # hiding of the automatic options.
  75. config TRACING
  76. bool
  77. select DEBUG_FS
  78. select RING_BUFFER
  79. select STACKTRACE if STACKTRACE_SUPPORT
  80. select TRACEPOINTS
  81. select NOP_TRACER
  82. select BINARY_PRINTF
  83. select EVENT_TRACING
  84. select TRACE_CLOCK
  85. config GENERIC_TRACER
  86. bool
  87. select TRACING
  88. #
  89. # Minimum requirements an architecture has to meet for us to
  90. # be able to offer generic tracing facilities:
  91. #
  92. config TRACING_SUPPORT
  93. bool
  94. # PPC32 has no irqflags tracing support, but it can use most of the
  95. # tracers anyway, they were tested to build and work. Note that new
  96. # exceptions to this list aren't welcomed, better implement the
  97. # irqflags tracing for your architecture.
  98. depends on TRACE_IRQFLAGS_SUPPORT || PPC32
  99. depends on STACKTRACE_SUPPORT
  100. default y
  101. if TRACING_SUPPORT
  102. menuconfig FTRACE
  103. bool "Tracers"
  104. default y if DEBUG_KERNEL
  105. help
  106. Enable the kernel tracing infrastructure.
  107. if FTRACE
  108. config FUNCTION_TRACER
  109. bool "Kernel Function Tracer"
  110. depends on HAVE_FUNCTION_TRACER
  111. select KALLSYMS
  112. select GENERIC_TRACER
  113. select CONTEXT_SWITCH_TRACER
  114. help
  115. Enable the kernel to trace every kernel function. This is done
  116. by using a compiler feature to insert a small, 5-byte No-Operation
  117. instruction at the beginning of every kernel function, which NOP
  118. sequence is then dynamically patched into a tracer call when
  119. tracing is enabled by the administrator. If it's runtime disabled
  120. (the bootup default), then the overhead of the instructions is very
  121. small and not measurable even in micro-benchmarks.
  122. config FUNCTION_GRAPH_TRACER
  123. bool "Kernel Function Graph Tracer"
  124. depends on HAVE_FUNCTION_GRAPH_TRACER
  125. depends on FUNCTION_TRACER
  126. depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE
  127. default y
  128. help
  129. Enable the kernel to trace a function at both its return
  130. and its entry.
  131. Its first purpose is to trace the duration of functions and
  132. draw a call graph for each thread with some information like
  133. the return value. This is done by setting the current return
  134. address on the current task structure into a stack of calls.
  135. config IRQSOFF_TRACER
  136. bool "Interrupts-off Latency Tracer"
  137. default n
  138. depends on TRACE_IRQFLAGS_SUPPORT
  139. depends on !ARCH_USES_GETTIMEOFFSET
  140. select TRACE_IRQFLAGS
  141. select GENERIC_TRACER
  142. select TRACER_MAX_TRACE
  143. select RING_BUFFER_ALLOW_SWAP
  144. select TRACER_SNAPSHOT
  145. select TRACER_SNAPSHOT_PER_CPU_SWAP
  146. help
  147. This option measures the time spent in irqs-off critical
  148. sections, with microsecond accuracy.
  149. The default measurement method is a maximum search, which is
  150. disabled by default and can be runtime (re-)started
  151. via:
  152. echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
  153. (Note that kernel size and overhead increase with this option
  154. enabled. This option and the preempt-off timing option can be
  155. used together or separately.)
  156. config PREEMPT_TRACER
  157. bool "Preemption-off Latency Tracer"
  158. default n
  159. depends on !ARCH_USES_GETTIMEOFFSET
  160. depends on PREEMPT
  161. select GENERIC_TRACER
  162. select TRACER_MAX_TRACE
  163. select RING_BUFFER_ALLOW_SWAP
  164. select TRACER_SNAPSHOT
  165. select TRACER_SNAPSHOT_PER_CPU_SWAP
  166. help
  167. This option measures the time spent in preemption-off critical
  168. sections, with microsecond accuracy.
  169. The default measurement method is a maximum search, which is
  170. disabled by default and can be runtime (re-)started
  171. via:
  172. echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
  173. (Note that kernel size and overhead increase with this option
  174. enabled. This option and the irqs-off timing option can be
  175. used together or separately.)
  176. config SCHED_TRACER
  177. bool "Scheduling Latency Tracer"
  178. select GENERIC_TRACER
  179. select CONTEXT_SWITCH_TRACER
  180. select TRACER_MAX_TRACE
  181. select TRACER_SNAPSHOT
  182. help
  183. This tracer tracks the latency of the highest priority task
  184. to be scheduled in, starting from the point it has woken up.
  185. config ENABLE_DEFAULT_TRACERS
  186. bool "Trace process context switches and events"
  187. depends on !GENERIC_TRACER
  188. select TRACING
  189. help
  190. This tracer hooks to various trace points in the kernel,
  191. allowing the user to pick and choose which trace point they
  192. want to trace. It also includes the sched_switch tracer plugin.
  193. config FTRACE_SYSCALLS
  194. bool "Trace syscalls"
  195. depends on HAVE_SYSCALL_TRACEPOINTS
  196. select GENERIC_TRACER
  197. select KALLSYMS
  198. help
  199. Basic tracer to catch the syscall entry and exit events.
  200. config TRACER_SNAPSHOT
  201. bool "Create a snapshot trace buffer"
  202. select TRACER_MAX_TRACE
  203. help
  204. Allow tracing users to take snapshot of the current buffer using the
  205. ftrace interface, e.g.:
  206. echo 1 > /sys/kernel/debug/tracing/snapshot
  207. cat snapshot
  208. config TRACER_SNAPSHOT_PER_CPU_SWAP
  209. bool "Allow snapshot to swap per CPU"
  210. depends on TRACER_SNAPSHOT
  211. select RING_BUFFER_ALLOW_SWAP
  212. help
  213. Allow doing a snapshot of a single CPU buffer instead of a
  214. full swap (all buffers). If this is set, then the following is
  215. allowed:
  216. echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot
  217. After which, only the tracing buffer for CPU 2 was swapped with
  218. the main tracing buffer, and the other CPU buffers remain the same.
  219. When this is enabled, this adds a little more overhead to the
  220. trace recording, as it needs to add some checks to synchronize
  221. recording with swaps. But this does not affect the performance
  222. of the overall system. This is enabled by default when the preempt
  223. or irq latency tracers are enabled, as those need to swap as well
  224. and already adds the overhead (plus a lot more).
  225. config TRACE_BRANCH_PROFILING
  226. bool
  227. select GENERIC_TRACER
  228. choice
  229. prompt "Branch Profiling"
  230. default BRANCH_PROFILE_NONE
  231. help
  232. The branch profiling is a software profiler. It will add hooks
  233. into the C conditionals to test which path a branch takes.
  234. The likely/unlikely profiler only looks at the conditions that
  235. are annotated with a likely or unlikely macro.
  236. The "all branch" profiler will profile every if-statement in the
  237. kernel. This profiler will also enable the likely/unlikely
  238. profiler.
  239. Either of the above profilers adds a bit of overhead to the system.
  240. If unsure, choose "No branch profiling".
  241. config BRANCH_PROFILE_NONE
  242. bool "No branch profiling"
  243. help
  244. No branch profiling. Branch profiling adds a bit of overhead.
  245. Only enable it if you want to analyse the branching behavior.
  246. Otherwise keep it disabled.
  247. config PROFILE_ANNOTATED_BRANCHES
  248. bool "Trace likely/unlikely profiler"
  249. select TRACE_BRANCH_PROFILING
  250. help
  251. This tracer profiles all likely and unlikely macros
  252. in the kernel. It will display the results in:
  253. /sys/kernel/debug/tracing/trace_stat/branch_annotated
  254. Note: this will add a significant overhead; only turn this
  255. on if you need to profile the system's use of these macros.
  256. config PROFILE_ALL_BRANCHES
  257. bool "Profile all if conditionals"
  258. select TRACE_BRANCH_PROFILING
  259. help
  260. This tracer profiles all branch conditions. Every if ()
  261. taken in the kernel is recorded whether it hit or miss.
  262. The results will be displayed in:
  263. /sys/kernel/debug/tracing/trace_stat/branch_all
  264. This option also enables the likely/unlikely profiler.
  265. This configuration, when enabled, will impose a great overhead
  266. on the system. This should only be enabled when the system
  267. is to be analyzed in much detail.
  268. endchoice
  269. config TRACING_BRANCHES
  270. bool
  271. help
  272. Selected by tracers that will trace the likely and unlikely
  273. conditions. This prevents the tracers themselves from being
  274. profiled. Profiling the tracing infrastructure can only happen
  275. when the likelys and unlikelys are not being traced.
  276. config BRANCH_TRACER
  277. bool "Trace likely/unlikely instances"
  278. depends on TRACE_BRANCH_PROFILING
  279. select TRACING_BRANCHES
  280. help
  281. This traces the events of likely and unlikely condition
  282. calls in the kernel. The difference between this and the
  283. "Trace likely/unlikely profiler" is that this is not a
  284. histogram of the callers, but actually places the calling
  285. events into a running trace buffer to see when and where the
  286. events happened, as well as their results.
  287. Say N if unsure.
  288. config STACK_TRACER
  289. bool "Trace max stack"
  290. depends on HAVE_FUNCTION_TRACER
  291. select FUNCTION_TRACER
  292. select STACKTRACE
  293. select KALLSYMS
  294. help
  295. This special tracer records the maximum stack footprint of the
  296. kernel and displays it in /sys/kernel/debug/tracing/stack_trace.
  297. This tracer works by hooking into every function call that the
  298. kernel executes, and keeping a maximum stack depth value and
  299. stack-trace saved. If this is configured with DYNAMIC_FTRACE
  300. then it will not have any overhead while the stack tracer
  301. is disabled.
  302. To enable the stack tracer on bootup, pass in 'stacktrace'
  303. on the kernel command line.
  304. The stack tracer can also be enabled or disabled via the
  305. sysctl kernel.stack_tracer_enabled
  306. Say N if unsure.
  307. config BLK_DEV_IO_TRACE
  308. bool "Support for tracing block IO actions"
  309. depends on SYSFS
  310. depends on BLOCK
  311. select RELAY
  312. select DEBUG_FS
  313. select TRACEPOINTS
  314. select GENERIC_TRACER
  315. select STACKTRACE
  316. help
  317. Say Y here if you want to be able to trace the block layer actions
  318. on a given queue. Tracing allows you to see any traffic happening
  319. on a block device queue. For more information (and the userspace
  320. support tools needed), fetch the blktrace tools from:
  321. git://git.kernel.dk/blktrace.git
  322. Tracing also is possible using the ftrace interface, e.g.:
  323. echo 1 > /sys/block/sda/sda1/trace/enable
  324. echo blk > /sys/kernel/debug/tracing/current_tracer
  325. cat /sys/kernel/debug/tracing/trace_pipe
  326. If unsure, say N.
  327. config KPROBE_EVENT
  328. depends on KPROBES
  329. depends on HAVE_REGS_AND_STACK_ACCESS_API
  330. bool "Enable kprobes-based dynamic events"
  331. select TRACING
  332. select PROBE_EVENTS
  333. default y
  334. help
  335. This allows the user to add tracing events (similar to tracepoints)
  336. on the fly via the ftrace interface. See
  337. Documentation/trace/kprobetrace.txt for more details.
  338. Those events can be inserted wherever kprobes can probe, and record
  339. various register and memory values.
  340. This option is also required by perf-probe subcommand of perf tools.
  341. If you want to use perf tools, this option is strongly recommended.
  342. config UPROBE_EVENT
  343. bool "Enable uprobes-based dynamic events"
  344. depends on ARCH_SUPPORTS_UPROBES
  345. depends on MMU
  346. depends on PERF_EVENTS
  347. select UPROBES
  348. select PROBE_EVENTS
  349. select TRACING
  350. default n
  351. help
  352. This allows the user to add tracing events on top of userspace
  353. dynamic events (similar to tracepoints) on the fly via the trace
  354. events interface. Those events can be inserted wherever uprobes
  355. can probe, and record various registers.
  356. This option is required if you plan to use perf-probe subcommand
  357. of perf tools on user space applications.
  358. config BPF_EVENTS
  359. depends on BPF_SYSCALL
  360. depends on (KPROBE_EVENT || UPROBE_EVENT) && PERF_EVENTS
  361. bool
  362. default y
  363. help
  364. This allows the user to attach BPF programs to kprobe events.
  365. config PROBE_EVENTS
  366. def_bool n
  367. config DYNAMIC_FTRACE
  368. bool "enable/disable function tracing dynamically"
  369. depends on FUNCTION_TRACER
  370. depends on HAVE_DYNAMIC_FTRACE
  371. default y
  372. help
  373. This option will modify all the calls to function tracing
  374. dynamically (will patch them out of the binary image and
  375. replace them with a No-Op instruction) on boot up. During
  376. compile time, a table is made of all the locations that ftrace
  377. can function trace, and this table is linked into the kernel
  378. image. When this is enabled, functions can be individually
  379. enabled, and the functions not enabled will not affect
  380. performance of the system.
  381. See the files in /sys/kernel/debug/tracing:
  382. available_filter_functions
  383. set_ftrace_filter
  384. set_ftrace_notrace
  385. This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
  386. otherwise has native performance as long as no tracing is active.
  387. config DYNAMIC_FTRACE_WITH_REGS
  388. def_bool y
  389. depends on DYNAMIC_FTRACE
  390. depends on HAVE_DYNAMIC_FTRACE_WITH_REGS
  391. config FUNCTION_PROFILER
  392. bool "Kernel function profiler"
  393. depends on FUNCTION_TRACER
  394. default n
  395. help
  396. This option enables the kernel function profiler. A file is created
  397. in debugfs called function_profile_enabled which defaults to zero.
  398. When a 1 is echoed into this file profiling begins, and when a
  399. zero is entered, profiling stops. A "functions" file is created in
  400. the trace_stats directory; this file shows the list of functions that
  401. have been hit and their counters.
  402. If in doubt, say N.
  403. config FTRACE_MCOUNT_RECORD
  404. def_bool y
  405. depends on DYNAMIC_FTRACE
  406. depends on HAVE_FTRACE_MCOUNT_RECORD
  407. config FTRACE_SELFTEST
  408. bool
  409. config FTRACE_STARTUP_TEST
  410. bool "Perform a startup test on ftrace"
  411. depends on GENERIC_TRACER
  412. select FTRACE_SELFTEST
  413. help
  414. This option performs a series of startup tests on ftrace. On bootup
  415. a series of tests are made to verify that the tracer is
  416. functioning properly. It will do tests on all the configured
  417. tracers of ftrace.
  418. config EVENT_TRACE_TEST_SYSCALLS
  419. bool "Run selftest on syscall events"
  420. depends on FTRACE_STARTUP_TEST
  421. help
  422. This option will also enable testing every syscall event.
  423. It only enables the event and disables it and runs various loads
  424. with the event enabled. This adds a bit more time for kernel boot
  425. up since it runs this on every system call defined.
  426. TBD - enable a way to actually call the syscalls as we test their
  427. events
  428. config MMIOTRACE
  429. bool "Memory mapped IO tracing"
  430. depends on HAVE_MMIOTRACE_SUPPORT && PCI
  431. select GENERIC_TRACER
  432. help
  433. Mmiotrace traces Memory Mapped I/O access and is meant for
  434. debugging and reverse engineering. It is called from the ioremap
  435. implementation and works via page faults. Tracing is disabled by
  436. default and can be enabled at run-time.
  437. See Documentation/trace/mmiotrace.txt.
  438. If you are not helping to develop drivers, say N.
  439. config MMIOTRACE_TEST
  440. tristate "Test module for mmiotrace"
  441. depends on MMIOTRACE && m
  442. help
  443. This is a dumb module for testing mmiotrace. It is very dangerous
  444. as it will write garbage to IO memory starting at a given address.
  445. However, it should be safe to use on e.g. unused portion of VRAM.
  446. Say N, unless you absolutely know what you are doing.
  447. config TRACEPOINT_BENCHMARK
  448. bool "Add tracepoint that benchmarks tracepoints"
  449. help
  450. This option creates the tracepoint "benchmark:benchmark_event".
  451. When the tracepoint is enabled, it kicks off a kernel thread that
  452. goes into an infinite loop (calling cond_sched() to let other tasks
  453. run), and calls the tracepoint. Each iteration will record the time
  454. it took to write to the tracepoint and the next iteration that
  455. data will be passed to the tracepoint itself. That is, the tracepoint
  456. will report the time it took to do the previous tracepoint.
  457. The string written to the tracepoint is a static string of 128 bytes
  458. to keep the time the same. The initial string is simply a write of
  459. "START". The second string records the cold cache time of the first
  460. write which is not added to the rest of the calculations.
  461. As it is a tight loop, it benchmarks as hot cache. That's fine because
  462. we care most about hot paths that are probably in cache already.
  463. An example of the output:
  464. START
  465. first=3672 [COLD CACHED]
  466. last=632 first=3672 max=632 min=632 avg=316 std=446 std^2=199712
  467. last=278 first=3672 max=632 min=278 avg=303 std=316 std^2=100337
  468. last=277 first=3672 max=632 min=277 avg=296 std=258 std^2=67064
  469. last=273 first=3672 max=632 min=273 avg=292 std=224 std^2=50411
  470. last=273 first=3672 max=632 min=273 avg=288 std=200 std^2=40389
  471. last=281 first=3672 max=632 min=273 avg=287 std=183 std^2=33666
  472. config RING_BUFFER_BENCHMARK
  473. tristate "Ring buffer benchmark stress tester"
  474. depends on RING_BUFFER
  475. help
  476. This option creates a test to stress the ring buffer and benchmark it.
  477. It creates its own ring buffer such that it will not interfere with
  478. any other users of the ring buffer (such as ftrace). It then creates
  479. a producer and consumer that will run for 10 seconds and sleep for
  480. 10 seconds. Each interval it will print out the number of events
  481. it recorded and give a rough estimate of how long each iteration took.
  482. It does not disable interrupts or raise its priority, so it may be
  483. affected by processes that are running.
  484. If unsure, say N.
  485. config RING_BUFFER_STARTUP_TEST
  486. bool "Ring buffer startup self test"
  487. depends on RING_BUFFER
  488. help
  489. Run a simple self test on the ring buffer on boot up. Late in the
  490. kernel boot sequence, the test will start that kicks off
  491. a thread per cpu. Each thread will write various size events
  492. into the ring buffer. Another thread is created to send IPIs
  493. to each of the threads, where the IPI handler will also write
  494. to the ring buffer, to test/stress the nesting ability.
  495. If any anomalies are discovered, a warning will be displayed
  496. and all ring buffers will be disabled.
  497. The test runs for 10 seconds. This will slow your boot time
  498. by at least 10 more seconds.
  499. At the end of the test, statics and more checks are done.
  500. It will output the stats of each per cpu buffer. What
  501. was written, the sizes, what was read, what was lost, and
  502. other similar details.
  503. If unsure, say N
  504. config TRACE_ENUM_MAP_FILE
  505. bool "Show enum mappings for trace events"
  506. depends on TRACING
  507. help
  508. The "print fmt" of the trace events will show the enum names instead
  509. of their values. This can cause problems for user space tools that
  510. use this string to parse the raw data as user space does not know
  511. how to convert the string to its value.
  512. To fix this, there's a special macro in the kernel that can be used
  513. to convert the enum into its value. If this macro is used, then the
  514. print fmt strings will have the enums converted to their values.
  515. If something does not get converted properly, this option can be
  516. used to show what enums the kernel tried to convert.
  517. This option is for debugging the enum conversions. A file is created
  518. in the tracing directory called "enum_map" that will show the enum
  519. names matched with their values and what trace event system they
  520. belong too.
  521. Normally, the mapping of the strings to values will be freed after
  522. boot up or module load. With this option, they will not be freed, as
  523. they are needed for the "enum_map" file. Enabling this option will
  524. increase the memory footprint of the running kernel.
  525. If unsure, say N
  526. config TRACING_EVENTS_GPIO
  527. bool "Trace gpio events"
  528. depends on GPIOLIB
  529. default y
  530. help
  531. Enable tracing events for gpio subsystem
  532. endif # FTRACE
  533. endif # TRACING_SUPPORT