Kconfig.debug 13 KB

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