Kconfig.debug 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. # SPDX-License-Identifier: GPL-2.0
  2. menu "Kernel hacking"
  3. config TRACE_IRQFLAGS_SUPPORT
  4. def_bool y
  5. source "lib/Kconfig.debug"
  6. config EARLY_PRINTK_USB
  7. bool
  8. config X86_VERBOSE_BOOTUP
  9. bool "Enable verbose x86 bootup info messages"
  10. default y
  11. ---help---
  12. Enables the informational output from the decompression stage
  13. (e.g. bzImage) of the boot. If you disable this you will still
  14. see errors. Disable this if you want silent bootup.
  15. config EARLY_PRINTK
  16. bool "Early printk" if EXPERT
  17. default y
  18. ---help---
  19. Write kernel log output directly into the VGA buffer or to a serial
  20. port.
  21. This is useful for kernel debugging when your machine crashes very
  22. early before the console code is initialized. For normal operation
  23. it is not recommended because it looks ugly and doesn't cooperate
  24. with klogd/syslogd or the X server. You should normally say N here,
  25. unless you want to debug such a crash.
  26. config EARLY_PRINTK_DBGP
  27. bool "Early printk via EHCI debug port"
  28. depends on EARLY_PRINTK && PCI
  29. select EARLY_PRINTK_USB
  30. ---help---
  31. Write kernel log output directly into the EHCI debug port.
  32. This is useful for kernel debugging when your machine crashes very
  33. early before the console code is initialized. For normal operation
  34. it is not recommended because it looks ugly and doesn't cooperate
  35. with klogd/syslogd or the X server. You should normally say N here,
  36. unless you want to debug such a crash. You need usb debug device.
  37. config EARLY_PRINTK_EFI
  38. bool "Early printk via the EFI framebuffer"
  39. depends on EFI && EARLY_PRINTK
  40. select FONT_SUPPORT
  41. ---help---
  42. Write kernel log output directly into the EFI framebuffer.
  43. This is useful for kernel debugging when your machine crashes very
  44. early before the console code is initialized.
  45. config EARLY_PRINTK_USB_XDBC
  46. bool "Early printk via the xHCI debug port"
  47. depends on EARLY_PRINTK && PCI
  48. select EARLY_PRINTK_USB
  49. ---help---
  50. Write kernel log output directly into the xHCI debug port.
  51. One use for this feature is kernel debugging, for example when your
  52. machine crashes very early before the regular console code is
  53. initialized. Other uses include simpler, lockless logging instead of
  54. a full-blown printk console driver + klogd.
  55. For normal production environments this is normally not recommended,
  56. because it doesn't feed events into klogd/syslogd and doesn't try to
  57. print anything on the screen.
  58. You should normally say N here, unless you want to debug early
  59. crashes or need a very simple printk logging facility.
  60. config MCSAFE_TEST
  61. def_bool n
  62. config X86_PTDUMP_CORE
  63. def_bool n
  64. config X86_PTDUMP
  65. tristate "Export kernel pagetable layout to userspace via debugfs"
  66. depends on DEBUG_KERNEL
  67. select DEBUG_FS
  68. select X86_PTDUMP_CORE
  69. ---help---
  70. Say Y here if you want to show the kernel pagetable layout in a
  71. debugfs file. This information is only useful for kernel developers
  72. who are working in architecture specific areas of the kernel.
  73. It is probably not a good idea to enable this feature in a production
  74. kernel.
  75. If in doubt, say "N"
  76. config EFI_PGT_DUMP
  77. bool "Dump the EFI pagetable"
  78. depends on EFI
  79. select X86_PTDUMP_CORE
  80. ---help---
  81. Enable this if you want to dump the EFI page table before
  82. enabling virtual mode. This can be used to debug miscellaneous
  83. issues with the mapping of the EFI runtime regions into that
  84. table.
  85. config DEBUG_WX
  86. bool "Warn on W+X mappings at boot"
  87. select X86_PTDUMP_CORE
  88. ---help---
  89. Generate a warning if any W+X mappings are found at boot.
  90. This is useful for discovering cases where the kernel is leaving
  91. W+X mappings after applying NX, as such mappings are a security risk.
  92. Look for a message in dmesg output like this:
  93. x86/mm: Checked W+X mappings: passed, no W+X pages found.
  94. or like this, if the check failed:
  95. x86/mm: Checked W+X mappings: FAILED, <N> W+X pages found.
  96. Note that even if the check fails, your kernel is possibly
  97. still fine, as W+X mappings are not a security hole in
  98. themselves, what they do is that they make the exploitation
  99. of other unfixed kernel bugs easier.
  100. There is no runtime or memory usage effect of this option
  101. once the kernel has booted up - it's a one time check.
  102. If in doubt, say "Y".
  103. config DOUBLEFAULT
  104. default y
  105. bool "Enable doublefault exception handler" if EXPERT
  106. ---help---
  107. This option allows trapping of rare doublefault exceptions that
  108. would otherwise cause a system to silently reboot. Disabling this
  109. option saves about 4k and might cause you much additional grey
  110. hair.
  111. config DEBUG_TLBFLUSH
  112. bool "Set upper limit of TLB entries to flush one-by-one"
  113. depends on DEBUG_KERNEL
  114. ---help---
  115. X86-only for now.
  116. This option allows the user to tune the amount of TLB entries the
  117. kernel flushes one-by-one instead of doing a full TLB flush. In
  118. certain situations, the former is cheaper. This is controlled by the
  119. tlb_flushall_shift knob under /sys/kernel/debug/x86. If you set it
  120. to -1, the code flushes the whole TLB unconditionally. Otherwise,
  121. for positive values of it, the kernel will use single TLB entry
  122. invalidating instructions according to the following formula:
  123. flush_entries <= active_tlb_entries / 2^tlb_flushall_shift
  124. If in doubt, say "N".
  125. config IOMMU_DEBUG
  126. bool "Enable IOMMU debugging"
  127. depends on GART_IOMMU && DEBUG_KERNEL
  128. depends on X86_64
  129. ---help---
  130. Force the IOMMU to on even when you have less than 4GB of
  131. memory and add debugging code. On overflow always panic. And
  132. allow to enable IOMMU leak tracing. Can be disabled at boot
  133. time with iommu=noforce. This will also enable scatter gather
  134. list merging. Currently not recommended for production
  135. code. When you use it make sure you have a big enough
  136. IOMMU/AGP aperture. Most of the options enabled by this can
  137. be set more finegrained using the iommu= command line
  138. options. See Documentation/x86/x86_64/boot-options.txt for more
  139. details.
  140. config IOMMU_LEAK
  141. bool "IOMMU leak tracing"
  142. depends on IOMMU_DEBUG && DMA_API_DEBUG
  143. ---help---
  144. Add a simple leak tracer to the IOMMU code. This is useful when you
  145. are debugging a buggy device driver that leaks IOMMU mappings.
  146. config HAVE_MMIOTRACE_SUPPORT
  147. def_bool y
  148. config X86_DECODER_SELFTEST
  149. bool "x86 instruction decoder selftest"
  150. depends on DEBUG_KERNEL && KPROBES
  151. depends on !COMPILE_TEST
  152. ---help---
  153. Perform x86 instruction decoder selftests at build time.
  154. This option is useful for checking the sanity of x86 instruction
  155. decoder code.
  156. If unsure, say "N".
  157. #
  158. # IO delay types:
  159. #
  160. config IO_DELAY_TYPE_0X80
  161. int
  162. default "0"
  163. config IO_DELAY_TYPE_0XED
  164. int
  165. default "1"
  166. config IO_DELAY_TYPE_UDELAY
  167. int
  168. default "2"
  169. config IO_DELAY_TYPE_NONE
  170. int
  171. default "3"
  172. choice
  173. prompt "IO delay type"
  174. default IO_DELAY_0X80
  175. config IO_DELAY_0X80
  176. bool "port 0x80 based port-IO delay [recommended]"
  177. ---help---
  178. This is the traditional Linux IO delay used for in/out_p.
  179. It is the most tested hence safest selection here.
  180. config IO_DELAY_0XED
  181. bool "port 0xed based port-IO delay"
  182. ---help---
  183. Use port 0xed as the IO delay. This frees up port 0x80 which is
  184. often used as a hardware-debug port.
  185. config IO_DELAY_UDELAY
  186. bool "udelay based port-IO delay"
  187. ---help---
  188. Use udelay(2) as the IO delay method. This provides the delay
  189. while not having any side-effect on the IO port space.
  190. config IO_DELAY_NONE
  191. bool "no port-IO delay"
  192. ---help---
  193. No port-IO delay. Will break on old boxes that require port-IO
  194. delay for certain operations. Should work on most new machines.
  195. endchoice
  196. if IO_DELAY_0X80
  197. config DEFAULT_IO_DELAY_TYPE
  198. int
  199. default IO_DELAY_TYPE_0X80
  200. endif
  201. if IO_DELAY_0XED
  202. config DEFAULT_IO_DELAY_TYPE
  203. int
  204. default IO_DELAY_TYPE_0XED
  205. endif
  206. if IO_DELAY_UDELAY
  207. config DEFAULT_IO_DELAY_TYPE
  208. int
  209. default IO_DELAY_TYPE_UDELAY
  210. endif
  211. if IO_DELAY_NONE
  212. config DEFAULT_IO_DELAY_TYPE
  213. int
  214. default IO_DELAY_TYPE_NONE
  215. endif
  216. config DEBUG_BOOT_PARAMS
  217. bool "Debug boot parameters"
  218. depends on DEBUG_KERNEL
  219. depends on DEBUG_FS
  220. ---help---
  221. This option will cause struct boot_params to be exported via debugfs.
  222. config CPA_DEBUG
  223. bool "CPA self-test code"
  224. depends on DEBUG_KERNEL
  225. ---help---
  226. Do change_page_attr() self-tests every 30 seconds.
  227. config OPTIMIZE_INLINING
  228. bool "Allow gcc to uninline functions marked 'inline'"
  229. ---help---
  230. This option determines if the kernel forces gcc to inline the functions
  231. developers have marked 'inline'. Doing so takes away freedom from gcc to
  232. do what it thinks is best, which is desirable for the gcc 3.x series of
  233. compilers. The gcc 4.x series have a rewritten inlining algorithm and
  234. enabling this option will generate a smaller kernel there. Hopefully
  235. this algorithm is so good that allowing gcc 4.x and above to make the
  236. decision will become the default in the future. Until then this option
  237. is there to test gcc for this.
  238. If unsure, say N.
  239. config DEBUG_ENTRY
  240. bool "Debug low-level entry code"
  241. depends on DEBUG_KERNEL
  242. ---help---
  243. This option enables sanity checks in x86's low-level entry code.
  244. Some of these sanity checks may slow down kernel entries and
  245. exits or otherwise impact performance.
  246. If unsure, say N.
  247. config DEBUG_NMI_SELFTEST
  248. bool "NMI Selftest"
  249. depends on DEBUG_KERNEL && X86_LOCAL_APIC
  250. ---help---
  251. Enabling this option turns on a quick NMI selftest to verify
  252. that the NMI behaves correctly.
  253. This might help diagnose strange hangs that rely on NMI to
  254. function properly.
  255. If unsure, say N.
  256. config DEBUG_IMR_SELFTEST
  257. bool "Isolated Memory Region self test"
  258. default n
  259. depends on INTEL_IMR
  260. ---help---
  261. This option enables automated sanity testing of the IMR code.
  262. Some simple tests are run to verify IMR bounds checking, alignment
  263. and overlapping. This option is really only useful if you are
  264. debugging an IMR memory map or are modifying the IMR code and want to
  265. test your changes.
  266. If unsure say N here.
  267. config X86_DEBUG_FPU
  268. bool "Debug the x86 FPU code"
  269. depends on DEBUG_KERNEL
  270. default y
  271. ---help---
  272. If this option is enabled then there will be extra sanity
  273. checks and (boot time) debug printouts added to the kernel.
  274. This debugging adds some small amount of runtime overhead
  275. to the kernel.
  276. If unsure, say N.
  277. config PUNIT_ATOM_DEBUG
  278. tristate "ATOM Punit debug driver"
  279. depends on PCI
  280. select DEBUG_FS
  281. select IOSF_MBI
  282. ---help---
  283. This is a debug driver, which gets the power states
  284. of all Punit North Complex devices. The power states of
  285. each device is exposed as part of the debugfs interface.
  286. The current power state can be read from
  287. /sys/kernel/debug/punit_atom/dev_power_state
  288. choice
  289. prompt "Choose kernel unwinder"
  290. default UNWINDER_ORC if X86_64
  291. default UNWINDER_FRAME_POINTER if X86_32
  292. ---help---
  293. This determines which method will be used for unwinding kernel stack
  294. traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
  295. livepatch, lockdep, and more.
  296. config UNWINDER_ORC
  297. bool "ORC unwinder"
  298. depends on X86_64
  299. select STACK_VALIDATION
  300. ---help---
  301. This option enables the ORC (Oops Rewind Capability) unwinder for
  302. unwinding kernel stack traces. It uses a custom data format which is
  303. a simplified version of the DWARF Call Frame Information standard.
  304. This unwinder is more accurate across interrupt entry frames than the
  305. frame pointer unwinder. It also enables a 5-10% performance
  306. improvement across the entire kernel compared to frame pointers.
  307. Enabling this option will increase the kernel's runtime memory usage
  308. by roughly 2-4MB, depending on your kernel config.
  309. config UNWINDER_FRAME_POINTER
  310. bool "Frame pointer unwinder"
  311. select FRAME_POINTER
  312. ---help---
  313. This option enables the frame pointer unwinder for unwinding kernel
  314. stack traces.
  315. The unwinder itself is fast and it uses less RAM than the ORC
  316. unwinder, but the kernel text size will grow by ~3% and the kernel's
  317. overall performance will degrade by roughly 5-10%.
  318. This option is recommended if you want to use the livepatch
  319. consistency model, as this is currently the only way to get a
  320. reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
  321. config UNWINDER_GUESS
  322. bool "Guess unwinder"
  323. depends on EXPERT
  324. depends on !STACKDEPOT
  325. ---help---
  326. This option enables the "guess" unwinder for unwinding kernel stack
  327. traces. It scans the stack and reports every kernel text address it
  328. finds. Some of the addresses it reports may be incorrect.
  329. While this option often produces false positives, it can still be
  330. useful in many cases. Unlike the other unwinders, it has no runtime
  331. overhead.
  332. endchoice
  333. config FRAME_POINTER
  334. depends on !UNWINDER_ORC && !UNWINDER_GUESS
  335. bool
  336. endmenu