1# SPDX-License-Identifier: GPL-2.0-only 2menu "Kernel hacking" 3 4menu "printk and dmesg options" 5 6config PRINTK_TIME 7 bool "Show timing information on printks" 8 depends on PRINTK 9 help 10 Selecting this option causes time stamps of the printk() 11 messages to be added to the output of the syslog() system 12 call and at the console. 13 14 The timestamp is always recorded internally, and exported 15 to /dev/kmsg. This flag just specifies if the timestamp should 16 be included, not that the timestamp is recorded. 17 18 The behavior is also controlled by the kernel command line 19 parameter printk.time=1. See Documentation/admin-guide/kernel-parameters.rst 20 21config PRINTK_CALLER 22 bool "Show caller information on printks" 23 depends on PRINTK 24 help 25 Selecting this option causes printk() to add a caller "thread id" (if 26 in task context) or a caller "processor id" (if not in task context) 27 to every message. 28 29 This option is intended for environments where multiple threads 30 concurrently call printk() for many times, for it is difficult to 31 interpret without knowing where these lines (or sometimes individual 32 line which was divided into multiple lines due to race) came from. 33 34 Since toggling after boot makes the code racy, currently there is 35 no option to enable/disable at the kernel command line parameter or 36 sysfs interface. 37 38config PRINTK_EXECUTION_CTX 39 bool 40 depends on PRINTK 41 help 42 This option extends struct printk_info to include extra execution 43 context in printk, such as task name and CPU number from where the 44 message originated. This is useful for correlating printk messages 45 with specific execution contexts. 46 47 This is automatically enabled when a console driver that supports 48 execution context is selected. 49 50config STACKTRACE_BUILD_ID 51 bool "Show build ID information in stacktraces" 52 depends on PRINTK 53 help 54 Selecting this option adds build ID information for symbols in 55 stacktraces printed with the printk format '%p[SR]b'. 56 57 This option is intended for distros where debuginfo is not easily 58 accessible but can be downloaded given the build ID of the vmlinux or 59 kernel module where the function is located. 60 61config CONSOLE_LOGLEVEL_DEFAULT 62 int "Default console loglevel (1-15)" 63 range 1 15 64 default "7" 65 help 66 Default loglevel to determine what will be printed on the console. 67 68 Setting a default here is equivalent to passing in loglevel=<x> in 69 the kernel bootargs. loglevel=<x> continues to override whatever 70 value is specified here as well. 71 72 Note: This does not affect the log level of un-prefixed printk() 73 usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT 74 option. 75 76config CONSOLE_LOGLEVEL_QUIET 77 int "quiet console loglevel (1-15)" 78 range 1 15 79 default "4" 80 help 81 loglevel to use when "quiet" is passed on the kernel commandline. 82 83 When "quiet" is passed on the kernel commandline this loglevel 84 will be used as the loglevel. IOW passing "quiet" will be the 85 equivalent of passing "loglevel=<CONSOLE_LOGLEVEL_QUIET>" 86 87config MESSAGE_LOGLEVEL_DEFAULT 88 int "Default message log level (1-7)" 89 range 1 7 90 default "4" 91 help 92 Default log level for printk statements with no specified priority. 93 94 This was hard-coded to KERN_WARNING since at least 2.6.10 but folks 95 that are auditing their logs closely may want to set it to a lower 96 priority. 97 98 Note: This does not affect what message level gets printed on the console 99 by default. To change that, use loglevel=<x> in the kernel bootargs, 100 or pick a different CONSOLE_LOGLEVEL_DEFAULT configuration value. 101 102config BOOT_PRINTK_DELAY 103 bool "Delay each boot printk message by N milliseconds" 104 depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY 105 help 106 This build option allows you to read kernel boot messages 107 by inserting a short delay after each one. The delay is 108 specified in milliseconds on the kernel command line, 109 using "boot_delay=N". 110 111 It is likely that you would also need to use "lpj=M" to preset 112 the "loops per jiffy" value. 113 See a previous boot log for the "lpj" value to use for your 114 system, and then set "lpj=M" before setting "boot_delay=N". 115 NOTE: Using this option may adversely affect SMP systems. 116 I.e., processors other than the first one may not boot up. 117 BOOT_PRINTK_DELAY also may cause LOCKUP_DETECTOR to detect 118 what it believes to be lockup conditions. 119 120config DYNAMIC_DEBUG 121 bool "Enable dynamic printk() support" 122 default n 123 depends on PRINTK 124 depends on (DEBUG_FS || PROC_FS) 125 select DYNAMIC_DEBUG_CORE 126 help 127 128 Compiles debug level messages into the kernel, which would not 129 otherwise be available at runtime. These messages can then be 130 enabled/disabled based on various levels of scope - per source file, 131 function, module, format string, and line number. This mechanism 132 implicitly compiles in all pr_debug() and dev_dbg() calls, which 133 enlarges the kernel text size by about 2%. 134 135 If a source file is compiled with DEBUG flag set, any 136 pr_debug() calls in it are enabled by default, but can be 137 disabled at runtime as below. Note that DEBUG flag is 138 turned on by many CONFIG_*DEBUG* options. 139 140 Usage: 141 142 Dynamic debugging is controlled via the 'dynamic_debug/control' file, 143 which is contained in the 'debugfs' filesystem or procfs. 144 Thus, the debugfs or procfs filesystem must first be mounted before 145 making use of this feature. 146 We refer the control file as: <debugfs>/dynamic_debug/control. This 147 file contains a list of the debug statements that can be enabled. The 148 format for each line of the file is: 149 150 filename:lineno [module]function flags format 151 152 filename : source file of the debug statement 153 lineno : line number of the debug statement 154 module : module that contains the debug statement 155 function : function that contains the debug statement 156 flags : '=p' means the line is turned 'on' for printing 157 format : the format used for the debug statement 158 159 From a live system: 160 161 nullarbor:~ # cat <debugfs>/dynamic_debug/control 162 # filename:lineno [module]function flags format 163 fs/aio.c:222 [aio]__put_ioctx =_ "__put_ioctx:\040freeing\040%p\012" 164 fs/aio.c:248 [aio]ioctx_alloc =_ "ENOMEM:\040nr_events\040too\040high\012" 165 fs/aio.c:1770 [aio]sys_io_cancel =_ "calling\040cancel\012" 166 167 Example usage: 168 169 // enable the message at line 1603 of file svcsock.c 170 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > 171 <debugfs>/dynamic_debug/control 172 173 // enable all the messages in file svcsock.c 174 nullarbor:~ # echo -n 'file svcsock.c +p' > 175 <debugfs>/dynamic_debug/control 176 177 // enable all the messages in the NFS server module 178 nullarbor:~ # echo -n 'module nfsd +p' > 179 <debugfs>/dynamic_debug/control 180 181 // enable all 12 messages in the function svc_process() 182 nullarbor:~ # echo -n 'func svc_process +p' > 183 <debugfs>/dynamic_debug/control 184 185 // disable all 12 messages in the function svc_process() 186 nullarbor:~ # echo -n 'func svc_process -p' > 187 <debugfs>/dynamic_debug/control 188 189 See Documentation/admin-guide/dynamic-debug-howto.rst for additional 190 information. 191 192config DYNAMIC_DEBUG_CORE 193 bool "Enable core function of dynamic debug support" 194 depends on PRINTK 195 depends on (DEBUG_FS || PROC_FS) 196 help 197 Enable core functional support of dynamic debug. It is useful 198 when you want to tie dynamic debug to your kernel modules with 199 DYNAMIC_DEBUG_MODULE defined for each of them, especially for 200 the case of embedded system where the kernel image size is 201 sensitive for people. 202 203config SYMBOLIC_ERRNAME 204 bool "Support symbolic error names in printf" 205 default y if PRINTK 206 help 207 If you say Y here, the kernel's printf implementation will 208 be able to print symbolic error names such as ENOSPC instead 209 of the number 28. It makes the kernel image slightly larger 210 (about 3KB), but can make the kernel logs easier to read. 211 212config DEBUG_BUGVERBOSE 213 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT 214 depends on BUG && (GENERIC_BUG || HAVE_DEBUG_BUGVERBOSE) 215 default y 216 help 217 Say Y here to make BUG() panics output the file name and line number 218 of the BUG call as well as the EIP and oops trace. This aids 219 debugging but costs about 70-100K of memory. 220 221config DEBUG_BUGVERBOSE_DETAILED 222 bool "Verbose WARN_ON_ONCE() reporting (adds 100K)" if DEBUG_BUGVERBOSE 223 help 224 Say Y here to make WARN_ON_ONCE() output the condition string of the 225 warning, in addition to the file name and line number. 226 This helps debugging, but costs about 100K of memory. 227 228 Say N if unsure. 229 230 231endmenu # "printk and dmesg options" 232 233config DEBUG_KERNEL 234 bool "Kernel debugging" 235 help 236 Say Y here if you are developing drivers or trying to debug and 237 identify kernel problems. 238 239config DEBUG_MISC 240 bool "Miscellaneous debug code" 241 default DEBUG_KERNEL 242 depends on DEBUG_KERNEL 243 help 244 Say Y here if you need to enable miscellaneous debug code that should 245 be under a more specific debug option but isn't. 246 247menu "Compile-time checks and compiler options" 248 249config DEBUG_INFO 250 bool 251 help 252 A kernel debug info option other than "None" has been selected 253 in the "Debug information" choice below, indicating that debug 254 information will be generated for build targets. 255 256# Clang generates .uleb128 with label differences for DWARF v5, a feature that 257# older binutils ports do not support when utilizing RISC-V style linker 258# relaxation: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 259config AS_HAS_NON_CONST_ULEB128 260 def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) 261 262choice 263 prompt "Debug information" 264 depends on DEBUG_KERNEL 265 help 266 Selecting something other than "None" results in a kernel image 267 that will include debugging info resulting in a larger kernel image. 268 This adds debug symbols to the kernel and modules (gcc -g), and 269 is needed if you intend to use kernel crashdump or binary object 270 tools like crash, kgdb, LKCD, gdb, etc on the kernel. 271 272 Choose which version of DWARF debug info to emit. If unsure, 273 select "Toolchain default". 274 275config DEBUG_INFO_NONE 276 bool "Disable debug information" 277 help 278 Do not build the kernel with debugging information, which will 279 result in a faster and smaller build. 280 281config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 282 bool "Rely on the toolchain's implicit default DWARF version" 283 select DEBUG_INFO 284 depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_ULEB128) 285 help 286 The implicit default version of DWARF debug info produced by a 287 toolchain changes over time. 288 289 This can break consumers of the debug info that haven't upgraded to 290 support newer revisions, and prevent testing newer versions, but 291 those should be less common scenarios. 292 293config DEBUG_INFO_DWARF4 294 bool "Generate DWARF Version 4 debuginfo" 295 select DEBUG_INFO 296 depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) 297 help 298 Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 299 if using clang without clang's integrated assembler, and gdb 7.0+. 300 301 If you have consumers of DWARF debug info that are not ready for 302 newer revisions of DWARF, you may wish to choose this or have your 303 config select this. 304 305config DEBUG_INFO_DWARF5 306 bool "Generate DWARF Version 5 debuginfo" 307 select DEBUG_INFO 308 depends on !ARCH_HAS_BROKEN_DWARF5 309 depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_ULEB128) 310 help 311 Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 312 5.0+ accepts the -gdwarf-5 flag but only had partial support for some 313 draft features until 7.0), and gdb 8.0+. 314 315 Changes to the structure of debug info in Version 5 allow for around 316 15-18% savings in resulting image and debug info section sizes as 317 compared to DWARF Version 4. DWARF Version 5 standardizes previous 318 extensions such as accelerators for symbol indexing and the format 319 for fission (.dwo/.dwp) files. Users may not want to select this 320 config if they rely on tooling that has not yet been updated to 321 support DWARF Version 5. 322 323endchoice # "Debug information" 324 325if DEBUG_INFO 326 327config DEBUG_INFO_REDUCED 328 bool "Reduce debugging information" 329 help 330 If you say Y here gcc is instructed to generate less debugging 331 information for structure types. This means that tools that 332 need full debugging information (like kgdb or systemtap) won't 333 be happy. But if you merely need debugging information to 334 resolve line numbers there is no loss. Advantage is that 335 build directory object sizes shrink dramatically over a full 336 DEBUG_INFO build and compile times are reduced too. 337 Only works with newer gcc versions. 338 339choice 340 prompt "Compressed Debug information" 341 help 342 Compress the resulting debug info. Results in smaller debug info sections, 343 but requires that consumers are able to decompress the results. 344 345 If unsure, choose DEBUG_INFO_COMPRESSED_NONE. 346 347config DEBUG_INFO_COMPRESSED_NONE 348 bool "Don't compress debug information" 349 help 350 Don't compress debug info sections. 351 352config DEBUG_INFO_COMPRESSED_ZLIB 353 bool "Compress debugging information with zlib" 354 depends on $(cc-option,-gz=zlib) 355 depends on $(ld-option,--compress-debug-sections=zlib) 356 help 357 Compress the debug information using zlib. 358 359 Users of dpkg-deb via debian/rules may find an increase in 360 size of their debug .deb packages with this config set, due to the 361 debug info being compressed with zlib, then the object files being 362 recompressed with a different compression scheme. But this is still 363 preferable to setting KDEB_COMPRESS or DPKG_DEB_COMPRESSOR_TYPE to 364 "none" which would be even larger. 365 366config DEBUG_INFO_COMPRESSED_ZSTD 367 bool "Compress debugging information with zstd" 368 depends on $(cc-option,-gz=zstd) 369 depends on $(ld-option,--compress-debug-sections=zstd) 370 help 371 Compress the debug information using zstd. This may provide better 372 compression than zlib, for about the same time costs, but requires newer 373 toolchain support. Requires GCC 13.0+ or Clang 16.0+, binutils 2.40+, and 374 zstd. 375 376endchoice # "Compressed Debug information" 377 378config DEBUG_INFO_SPLIT 379 bool "Produce split debuginfo in .dwo files" 380 depends on $(cc-option,-gsplit-dwarf) 381 # RISC-V linker relaxation + -gsplit-dwarf has issues with LLVM and GCC 382 # prior to 12.x: 383 # https://github.com/llvm/llvm-project/issues/56642 384 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090 385 depends on !RISCV || GCC_VERSION >= 120000 386 help 387 Generate debug info into separate .dwo files. This significantly 388 reduces the build directory size for builds with DEBUG_INFO, 389 because it stores the information only once on disk in .dwo 390 files instead of multiple times in object files and executables. 391 In addition the debug information is also compressed. 392 393 Requires recent gcc (4.7+) and recent gdb/binutils. 394 Any tool that packages or reads debug information would need 395 to know about the .dwo files and include them. 396 Incompatible with older versions of ccache. 397 398config DEBUG_INFO_BTF 399 bool "Generate BTF type information" 400 depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED 401 depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST 402 depends on BPF_SYSCALL 403 depends on PAHOLE_VERSION >= 116 404 depends on DEBUG_INFO_DWARF4 || PAHOLE_VERSION >= 121 405 # pahole uses elfutils, which does not have support for Hexagon relocations 406 depends on !HEXAGON 407 help 408 Generate deduplicated BTF type information from DWARF debug info. 409 Turning this on requires pahole v1.16 or later (v1.21 or later to 410 support DWARF 5), which will convert DWARF type info into equivalent 411 deduplicated BTF type info. 412 413config PAHOLE_HAS_SPLIT_BTF 414 def_bool PAHOLE_VERSION >= 119 415 416config PAHOLE_HAS_BTF_TAG 417 def_bool PAHOLE_VERSION >= 123 418 depends on CC_IS_CLANG 419 help 420 Decide whether pahole emits btf_tag attributes (btf_type_tag and 421 btf_decl_tag) or not. Currently only clang compiler implements 422 these attributes, so make the config depend on CC_IS_CLANG. 423 424config PAHOLE_HAS_LANG_EXCLUDE 425 def_bool PAHOLE_VERSION >= 124 426 help 427 Support for the --lang_exclude flag which makes pahole exclude 428 compilation units from the supplied language. Used in Kbuild to 429 omit Rust CUs which are not supported in version 1.24 of pahole, 430 otherwise it would emit malformed kernel and module binaries when 431 using DEBUG_INFO_BTF_MODULES. 432 433config DEBUG_INFO_BTF_MODULES 434 bool "Generate BTF type information for kernel modules" 435 default y 436 depends on DEBUG_INFO_BTF && MODULES && PAHOLE_HAS_SPLIT_BTF 437 help 438 Generate compact split BTF type information for kernel modules. 439 440config MODULE_ALLOW_BTF_MISMATCH 441 bool "Allow loading modules with non-matching BTF type info" 442 depends on DEBUG_INFO_BTF_MODULES 443 help 444 For modules whose split BTF does not match vmlinux, load without 445 BTF rather than refusing to load. The default behavior with 446 module BTF enabled is to reject modules with such mismatches; 447 this option will still load module BTF where possible but ignore 448 it when a mismatch is found. 449 450config GDB_SCRIPTS 451 bool "Provide GDB scripts for kernel debugging" 452 help 453 This creates the required links to GDB helper scripts in the 454 build directory. If you load vmlinux into gdb, the helper 455 scripts will be automatically imported by gdb as well, and 456 additional functions are available to analyze a Linux kernel 457 instance. See Documentation/process/debugging/gdb-kernel-debugging.rst 458 for further details. 459 460endif # DEBUG_INFO 461 462config FRAME_WARN 463 int "Warn for stack frames larger than" 464 range 0 8192 465 default 0 if KMSAN 466 default 2048 if GCC_PLUGIN_LATENT_ENTROPY 467 default 2048 if PARISC 468 default 1536 if (!64BIT && XTENSA) 469 default 1280 if !64BIT 470 default 2048 if 64BIT 471 help 472 Tell the compiler to warn at build time for stack frames larger than this. 473 Setting this too low will cause a lot of warnings. 474 Setting it to 0 disables the warning. 475 476config STRIP_ASM_SYMS 477 bool "Strip assembler-generated symbols during link" 478 default n 479 help 480 Strip internal assembler-generated symbols during a link (symbols 481 that look like '.Lxxx') so they don't pollute the output of 482 get_wchan() and suchlike. 483 484config READABLE_ASM 485 bool "Generate readable assembler code" 486 depends on DEBUG_KERNEL 487 depends on CC_IS_GCC 488 help 489 Disable some compiler optimizations that tend to generate human unreadable 490 assembler output. This may make the kernel slightly slower, but it helps 491 to keep kernel developers who have to stare a lot at assembler listings 492 sane. 493 494config HEADERS_INSTALL 495 bool "Install uapi headers to usr/include" 496 help 497 This option will install uapi headers (headers exported to user-space) 498 into the usr/include directory for use during the kernel build. 499 This is unneeded for building the kernel itself, but needed for some 500 user-space program samples. It is also needed by some features such 501 as uapi header sanity checks. 502 503config DEBUG_SECTION_MISMATCH 504 bool "Enable full Section mismatch analysis" 505 depends on CC_IS_GCC 506 help 507 The section mismatch analysis checks if there are illegal references 508 from one section to another. During linktime or runtime, some 509 sections are dropped; any use of code/data previously in these 510 sections would most likely result in an oops. 511 512 In the code, functions and variables are annotated with __init, 513 __initdata, and so on (see the full list in include/linux/init.h). 514 This directs the toolchain to place code/data in specific sections. 515 516 The section mismatch analysis is always performed after a full 517 kernel build, and enabling this option causes the option 518 -fno-inline-functions-called-once to be added to gcc commands. 519 520 However, when inlining a function annotated with __init in 521 a non-init function, we would lose the section information and thus 522 the analysis would not catch the illegal reference. This option 523 tells gcc to inline less (but it does result in a larger kernel). 524 525config SECTION_MISMATCH_WARN_ONLY 526 bool "Make section mismatch errors non-fatal" 527 default y 528 help 529 If you say N here, the build process will fail if there are any 530 section mismatch, instead of just throwing warnings. 531 532 If unsure, say Y. 533 534config DEBUG_FORCE_FUNCTION_ALIGN_64B 535 bool "Force all function address 64B aligned" 536 depends on EXPERT && (X86_64 || ARM64 || PPC32 || PPC64 || ARC || RISCV || S390) 537 select FUNCTION_ALIGNMENT_64B 538 help 539 There are cases that a commit from one domain changes the function 540 address alignment of other domains, and cause magic performance 541 bump (regression or improvement). Enable this option will help to 542 verify if the bump is caused by function alignment changes, while 543 it will slightly increase the kernel size and affect icache usage. 544 545 It is mainly for debug and performance tuning use. 546 547# 548# Select this config option from the architecture Kconfig, if it 549# is preferred to always offer frame pointers as a config 550# option on the architecture (regardless of KERNEL_DEBUG): 551# 552config ARCH_WANT_FRAME_POINTERS 553 bool 554 555config FRAME_POINTER 556 bool "Compile the kernel with frame pointers" 557 depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS 558 default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS 559 help 560 If you say Y here the resulting kernel image will be slightly 561 larger and slower, but it gives very useful debugging information 562 in case of kernel bugs. (precise oopses/stacktraces/warnings) 563 564config OBJTOOL 565 bool 566 567config OBJTOOL_WERROR 568 bool "Upgrade objtool warnings to errors" 569 depends on OBJTOOL && !COMPILE_TEST 570 help 571 Fail the build on objtool warnings. 572 573 Objtool warnings can indicate kernel instability, including boot 574 failures. This option is highly recommended. 575 576 If unsure, say Y. 577 578config STACK_VALIDATION 579 bool "Compile-time stack metadata validation" 580 depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER 581 select OBJTOOL 582 default n 583 help 584 Validate frame pointer rules at compile-time. This helps ensure that 585 runtime stack traces are more reliable. 586 587 For more information, see 588 tools/objtool/Documentation/objtool.txt. 589 590config NOINSTR_VALIDATION 591 bool 592 depends on HAVE_NOINSTR_VALIDATION && DEBUG_ENTRY 593 select OBJTOOL 594 default y 595 596config VMLINUX_MAP 597 bool "Generate vmlinux.map file when linking" 598 depends on EXPERT 599 help 600 Selecting this option will pass "-Map=vmlinux.map" to ld 601 when linking vmlinux. That file can be useful for verifying 602 and debugging magic section games, and for seeing which 603 pieces of code get eliminated with 604 CONFIG_LD_DEAD_CODE_DATA_ELIMINATION. 605 606config BUILTIN_MODULE_RANGES 607 bool "Generate address range information for builtin modules" 608 depends on !LTO 609 depends on VMLINUX_MAP 610 help 611 When modules are built into the kernel, there will be no module name 612 associated with its symbols in /proc/kallsyms. Tracers may want to 613 identify symbols by module name and symbol name regardless of whether 614 the module is configured as loadable or not. 615 616 This option generates modules.builtin.ranges in the build tree with 617 offset ranges (per ELF section) for the module(s) they belong to. 618 It also records an anchor symbol to determine the load address of the 619 section. 620 621config DEBUG_FORCE_WEAK_PER_CPU 622 bool "Force weak per-cpu definitions" 623 depends on DEBUG_KERNEL 624 help 625 s390 and alpha require percpu variables in modules to be 626 defined weak to work around addressing range issue which 627 puts the following two restrictions on percpu variable 628 definitions. 629 630 1. percpu symbols must be unique whether static or not 631 2. percpu variables can't be defined inside a function 632 633 To ensure that generic code follows the above rules, this 634 option forces all percpu variables to be defined as weak. 635 636endmenu # "Compiler options" 637 638menu "Generic Kernel Debugging Instruments" 639 640config MAGIC_SYSRQ 641 bool "Magic SysRq key" 642 depends on !UML 643 help 644 If you say Y here, you will have some control over the system even 645 if the system crashes for example during kernel debugging (e.g., you 646 will be able to flush the buffer cache to disk, reboot the system 647 immediately or dump some status information). This is accomplished 648 by pressing various keys while holding SysRq (Alt+PrintScreen). It 649 also works on a serial console (on PC hardware at least), if you 650 send a BREAK and then within 5 seconds a command keypress. The 651 keys are documented in <file:Documentation/admin-guide/sysrq.rst>. 652 Don't say Y unless you really know what this hack does. 653 654config MAGIC_SYSRQ_DEFAULT_ENABLE 655 hex "Enable magic SysRq key functions by default" 656 depends on MAGIC_SYSRQ 657 default 0x1 658 help 659 Specifies which SysRq key functions are enabled by default. 660 This may be set to 1 or 0 to enable or disable them all, or 661 to a bitmask as described in Documentation/admin-guide/sysrq.rst. 662 663config MAGIC_SYSRQ_SERIAL 664 bool "Enable magic SysRq key over serial" 665 depends on MAGIC_SYSRQ 666 default y 667 help 668 Many embedded boards have a disconnected TTL level serial which can 669 generate some garbage that can lead to spurious false sysrq detects. 670 This option allows you to decide whether you want to enable the 671 magic SysRq key. 672 673config MAGIC_SYSRQ_SERIAL_SEQUENCE 674 string "Char sequence that enables magic SysRq over serial" 675 depends on MAGIC_SYSRQ_SERIAL 676 default "" 677 help 678 Specifies a sequence of characters that can follow BREAK to enable 679 SysRq on a serial console. 680 681 If unsure, leave an empty string and the option will not be enabled. 682 683config DEBUG_FS 684 bool "Debug Filesystem" 685 help 686 debugfs is a virtual file system that kernel developers use to put 687 debugging files into. Enable this option to be able to read and 688 write to these files. 689 690 For detailed documentation on the debugfs API, see 691 Documentation/filesystems/. 692 693 If unsure, say N. 694 695choice 696 prompt "Debugfs default access" 697 depends on DEBUG_FS 698 default DEBUG_FS_ALLOW_ALL 699 help 700 This selects the default access restrictions for debugfs. 701 It can be overridden with kernel command line option 702 debugfs=[on,off]. The restrictions apply for API access 703 and filesystem registration. 704 705config DEBUG_FS_ALLOW_ALL 706 bool "Access normal" 707 help 708 No restrictions apply. Both API and filesystem registration 709 is on. This is the normal default operation. 710 711config DEBUG_FS_ALLOW_NONE 712 bool "No access" 713 help 714 Access is off. Clients get -PERM when trying to create nodes in 715 debugfs tree and debugfs is not registered as a filesystem. 716 Client can then back-off or continue without debugfs access. 717 718endchoice 719 720source "lib/Kconfig.kgdb" 721source "lib/Kconfig.ubsan" 722source "lib/Kconfig.kcsan" 723 724endmenu 725 726menu "Networking Debugging" 727 728source "net/Kconfig.debug" 729 730endmenu # "Networking Debugging" 731 732menu "Memory Debugging" 733 734source "mm/Kconfig.debug" 735 736config DEBUG_OBJECTS 737 bool "Debug object operations" 738 depends on DEBUG_KERNEL 739 help 740 If you say Y here, additional code will be inserted into the 741 kernel to track the life time of various objects and validate 742 the operations on those objects. 743 744config DEBUG_OBJECTS_SELFTEST 745 bool "Debug objects selftest" 746 depends on DEBUG_OBJECTS 747 help 748 This enables the selftest of the object debug code. 749 750config DEBUG_OBJECTS_FREE 751 bool "Debug objects in freed memory" 752 depends on DEBUG_OBJECTS 753 help 754 This enables checks whether a k/v free operation frees an area 755 which contains an object which has not been deactivated 756 properly. This can make kmalloc/kfree-intensive workloads 757 much slower. 758 759config DEBUG_OBJECTS_TIMERS 760 bool "Debug timer objects" 761 depends on DEBUG_OBJECTS 762 help 763 If you say Y here, additional code will be inserted into the 764 timer routines to track the life time of timer objects and 765 validate the timer operations. 766 767config DEBUG_OBJECTS_WORK 768 bool "Debug work objects" 769 depends on DEBUG_OBJECTS 770 help 771 If you say Y here, additional code will be inserted into the 772 work queue routines to track the life time of work objects and 773 validate the work operations. 774 775config DEBUG_OBJECTS_RCU_HEAD 776 bool "Debug RCU callbacks objects" 777 depends on DEBUG_OBJECTS 778 help 779 Enable this to turn on debugging of RCU list heads (call_rcu() usage). 780 781config DEBUG_OBJECTS_PERCPU_COUNTER 782 bool "Debug percpu counter objects" 783 depends on DEBUG_OBJECTS 784 help 785 If you say Y here, additional code will be inserted into the 786 percpu counter routines to track the life time of percpu counter 787 objects and validate the percpu counter operations. 788 789config DEBUG_OBJECTS_ENABLE_DEFAULT 790 int "debug_objects bootup default value (0-1)" 791 range 0 1 792 default "1" 793 depends on DEBUG_OBJECTS 794 help 795 Debug objects boot parameter default value 796 797config SHRINKER_DEBUG 798 bool "Enable shrinker debugging support" 799 depends on DEBUG_FS 800 help 801 Say Y to enable the shrinker debugfs interface which provides 802 visibility into the kernel memory shrinkers subsystem. 803 Disable it to avoid an extra memory footprint. 804 805config DEBUG_STACK_USAGE 806 bool "Stack utilization instrumentation" 807 depends on DEBUG_KERNEL 808 help 809 Enables the display of the minimum amount of free stack which each 810 task has ever had available in the sysrq-T and sysrq-P debug output. 811 Also emits a message to dmesg when a process exits if that process 812 used more stack space than previously exiting processes. 813 814 This option will slow down process creation somewhat. 815 816config SCHED_STACK_END_CHECK 817 bool "Detect stack corruption on calls to schedule()" 818 depends on DEBUG_KERNEL 819 default n 820 help 821 This option checks for a stack overrun on calls to schedule(). 822 If the stack end location is found to be over written always panic as 823 the content of the corrupted region can no longer be trusted. 824 This is to ensure no erroneous behaviour occurs which could result in 825 data corruption or a sporadic crash at a later stage once the region 826 is examined. The runtime overhead introduced is minimal. 827 828config ARCH_HAS_DEBUG_VM_PGTABLE 829 bool 830 help 831 An architecture should select this when it can successfully 832 build and run DEBUG_VM_PGTABLE. 833 834config DEBUG_VFS 835 bool "Debug VFS" 836 depends on DEBUG_KERNEL 837 help 838 Enable this to turn on extended checks in the VFS layer that may impact 839 performance. 840 841 If unsure, say N. 842 843config DEBUG_VM_IRQSOFF 844 def_bool DEBUG_VM && !PREEMPT_RT 845 846config DEBUG_VM 847 bool "Debug VM" 848 depends on DEBUG_KERNEL 849 help 850 Enable this to turn on extended checks in the virtual-memory system 851 that may impact performance. 852 853 If unsure, say N. 854 855config DEBUG_VM_SHOOT_LAZIES 856 bool "Debug MMU_LAZY_TLB_SHOOTDOWN implementation" 857 depends on DEBUG_VM 858 depends on MMU_LAZY_TLB_SHOOTDOWN 859 help 860 Enable additional IPIs that ensure lazy tlb mm references are removed 861 before the mm is freed. 862 863 If unsure, say N. 864 865config DEBUG_VM_MAPLE_TREE 866 bool "Debug VM maple trees" 867 depends on DEBUG_VM 868 select DEBUG_MAPLE_TREE 869 help 870 Enable VM maple tree debugging information and extra validations. 871 872 If unsure, say N. 873 874config DEBUG_VM_RB 875 bool "Debug VM red-black trees" 876 depends on DEBUG_VM 877 help 878 Enable VM red-black tree debugging information and extra validations. 879 880 If unsure, say N. 881 882config DEBUG_VM_PGFLAGS 883 bool "Debug page-flags operations" 884 depends on DEBUG_VM 885 help 886 Enables extra validation on page flags operations. 887 888 If unsure, say N. 889 890config DEBUG_VM_PGTABLE 891 bool "Debug arch page table for semantics compliance" 892 depends on MMU 893 depends on ARCH_HAS_DEBUG_VM_PGTABLE 894 default y if DEBUG_VM 895 help 896 This option provides a debug method which can be used to test 897 architecture page table helper functions on various platforms in 898 verifying if they comply with expected generic MM semantics. This 899 will help architecture code in making sure that any changes or 900 new additions of these helpers still conform to expected 901 semantics of the generic MM. Platforms will have to opt in for 902 this through ARCH_HAS_DEBUG_VM_PGTABLE. 903 904 If unsure, say N. 905 906config ARCH_HAS_DEBUG_VIRTUAL 907 bool 908 909config DEBUG_VIRTUAL 910 bool "Debug VM translations" 911 depends on DEBUG_KERNEL && ARCH_HAS_DEBUG_VIRTUAL 912 help 913 Enable some costly sanity checks in virtual to page code. This can 914 catch mistakes with virt_to_page() and friends. 915 916 If unsure, say N. 917 918config DEBUG_NOMMU_REGIONS 919 bool "Debug the global anon/private NOMMU mapping region tree" 920 depends on DEBUG_KERNEL && !MMU 921 help 922 This option causes the global tree of anonymous and private mapping 923 regions to be regularly checked for invalid topology. 924 925config DEBUG_MEMORY_INIT 926 bool "Debug memory initialisation" if EXPERT 927 default !EXPERT 928 help 929 Enable this for additional checks during memory initialisation. 930 The sanity checks verify aspects of the VM such as the memory model 931 and other information provided by the architecture. Verbose 932 information will be printed at KERN_DEBUG loglevel depending 933 on the mminit_loglevel= command-line option. 934 935 If unsure, say Y 936 937config MEMORY_NOTIFIER_ERROR_INJECT 938 tristate "Memory hotplug notifier error injection module" 939 depends on MEMORY_HOTPLUG && NOTIFIER_ERROR_INJECTION 940 help 941 This option provides the ability to inject artificial errors to 942 memory hotplug notifier chain callbacks. It is controlled through 943 debugfs interface under /sys/kernel/debug/notifier-error-inject/memory 944 945 If the notifier call chain should be failed with some events 946 notified, write the error code to "actions/<notifier event>/error". 947 948 Example: Inject memory hotplug offline error (-12 == -ENOMEM) 949 950 # cd /sys/kernel/debug/notifier-error-inject/memory 951 # echo -12 > actions/MEM_GOING_OFFLINE/error 952 # echo offline > /sys/devices/system/memory/memoryXXX/state 953 bash: echo: write error: Cannot allocate memory 954 955 To compile this code as a module, choose M here: the module will 956 be called memory-notifier-error-inject. 957 958 If unsure, say N. 959 960config DEBUG_PER_CPU_MAPS 961 bool "Debug access to per_cpu maps" 962 depends on DEBUG_KERNEL 963 depends on SMP 964 help 965 Say Y to verify that the per_cpu map being accessed has 966 been set up. This adds a fair amount of code to kernel memory 967 and decreases performance. 968 969 Say N if unsure. 970 971config DEBUG_KMAP_LOCAL 972 bool "Debug kmap_local temporary mappings" 973 depends on DEBUG_KERNEL && KMAP_LOCAL 974 help 975 This option enables additional error checking for the kmap_local 976 infrastructure. Disable for production use. 977 978config ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP 979 bool 980 981config DEBUG_KMAP_LOCAL_FORCE_MAP 982 bool "Enforce kmap_local temporary mappings" 983 depends on DEBUG_KERNEL && ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP 984 select KMAP_LOCAL 985 select DEBUG_KMAP_LOCAL 986 help 987 This option enforces temporary mappings through the kmap_local 988 mechanism for non-highmem pages and on non-highmem systems. 989 Disable this for production systems! 990 991config DEBUG_HIGHMEM 992 bool "Highmem debugging" 993 depends on DEBUG_KERNEL && HIGHMEM 994 select DEBUG_KMAP_LOCAL_FORCE_MAP if ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP 995 select DEBUG_KMAP_LOCAL 996 help 997 This option enables additional error checking for high memory 998 systems. Disable for production systems. 999 1000config HAVE_DEBUG_STACKOVERFLOW 1001 bool 1002 1003config DEBUG_STACKOVERFLOW 1004 bool "Check for stack overflows" 1005 depends on DEBUG_KERNEL && HAVE_DEBUG_STACKOVERFLOW 1006 help 1007 Say Y here if you want to check for overflows of kernel, IRQ 1008 and exception stacks (if your architecture uses them). This 1009 option will show detailed messages if free stack space drops 1010 below a certain limit. 1011 1012 These kinds of bugs usually occur when call-chains in the 1013 kernel get too deep, especially when interrupts are 1014 involved. 1015 1016 Use this in cases where you see apparently random memory 1017 corruption, especially if it appears in 'struct thread_info' 1018 1019 If in doubt, say "N". 1020 1021config CODE_TAGGING 1022 bool 1023 select KALLSYMS 1024 1025config MEM_ALLOC_PROFILING 1026 bool "Enable memory allocation profiling" 1027 default n 1028 depends on MMU 1029 depends on PROC_FS 1030 depends on !DEBUG_FORCE_WEAK_PER_CPU 1031 select CODE_TAGGING 1032 select PAGE_EXTENSION 1033 select SLAB_OBJ_EXT 1034 help 1035 Track allocation source code and record total allocation size 1036 initiated at that code location. The mechanism can be used to track 1037 memory leaks with a low performance and memory impact. 1038 1039config MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT 1040 bool "Enable memory allocation profiling by default" 1041 default y 1042 depends on MEM_ALLOC_PROFILING 1043 1044config MEM_ALLOC_PROFILING_DEBUG 1045 bool "Memory allocation profiler debugging" 1046 default n 1047 depends on MEM_ALLOC_PROFILING 1048 select MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT 1049 help 1050 Adds warnings with helpful error messages for memory allocation 1051 profiling. 1052 1053source "lib/Kconfig.kasan" 1054source "lib/Kconfig.kfence" 1055source "lib/Kconfig.kmsan" 1056 1057endmenu # "Memory Debugging" 1058 1059config DEBUG_SHIRQ 1060 bool "Debug shared IRQ handlers" 1061 depends on DEBUG_KERNEL 1062 help 1063 Enable this to generate a spurious interrupt just before a shared 1064 interrupt handler is deregistered (generating one when registering 1065 is currently disabled). Drivers need to handle this correctly. Some 1066 don't and need to be caught. 1067 1068menu "Debug Oops, Lockups and Hangs" 1069 1070config PANIC_ON_OOPS 1071 bool "Panic on Oops" 1072 help 1073 Say Y here to enable the kernel to panic when it oopses. This 1074 has the same effect as setting oops=panic on the kernel command 1075 line. 1076 1077 This feature is useful to ensure that the kernel does not do 1078 anything erroneous after an oops which could result in data 1079 corruption or other issues. 1080 1081 Say N if unsure. 1082 1083config PANIC_TIMEOUT 1084 int "panic timeout" 1085 default 0 1086 help 1087 Set the timeout value (in seconds) until a reboot occurs when 1088 the kernel panics. If n = 0, then we wait forever. A timeout 1089 value n > 0 will wait n seconds before rebooting, while a timeout 1090 value n < 0 will reboot immediately. This setting can be overridden 1091 with the kernel command line option panic=, and from userspace via 1092 /proc/sys/kernel/panic. 1093 1094config LOCKUP_DETECTOR 1095 bool 1096 1097config SOFTLOCKUP_DETECTOR 1098 bool "Detect Soft Lockups" 1099 depends on DEBUG_KERNEL && !S390 1100 select LOCKUP_DETECTOR 1101 help 1102 Say Y here to enable the kernel to act as a watchdog to detect 1103 soft lockups. 1104 1105 Softlockups are bugs that cause the kernel to loop in kernel 1106 mode for more than 20 seconds, without giving other tasks a 1107 chance to run. The current stack trace is displayed upon 1108 detection and the system will stay locked up. 1109 1110config SOFTLOCKUP_DETECTOR_INTR_STORM 1111 bool "Detect Interrupt Storm in Soft Lockups" 1112 depends on SOFTLOCKUP_DETECTOR && IRQ_TIME_ACCOUNTING 1113 select GENERIC_IRQ_STAT_SNAPSHOT 1114 default y if NR_CPUS <= 128 1115 help 1116 Say Y here to enable the kernel to detect interrupt storm 1117 during "soft lockups". 1118 1119 "soft lockups" can be caused by a variety of reasons. If one is 1120 caused by an interrupt storm, then the storming interrupts will not 1121 be on the callstack. To detect this case, it is necessary to report 1122 the CPU stats and the interrupt counts during the "soft lockups". 1123 1124config BOOTPARAM_SOFTLOCKUP_PANIC 1125 bool "Panic (Reboot) On Soft Lockups" 1126 depends on SOFTLOCKUP_DETECTOR 1127 help 1128 Say Y here to enable the kernel to panic on "soft lockups", 1129 which are bugs that cause the kernel to loop in kernel 1130 mode for more than 20 seconds (configurable using the watchdog_thresh 1131 sysctl), without giving other tasks a chance to run. 1132 1133 The panic can be used in combination with panic_timeout, 1134 to cause the system to reboot automatically after a 1135 lockup has been detected. This feature is useful for 1136 high-availability systems that have uptime guarantees and 1137 where a lockup must be resolved ASAP. 1138 1139 Say N if unsure. 1140 1141config HAVE_HARDLOCKUP_DETECTOR_BUDDY 1142 bool 1143 depends on SMP 1144 default y 1145 1146# 1147# Global switch whether to build a hardlockup detector at all. It is available 1148# only when the architecture supports at least one implementation. There are 1149# two exceptions. The hardlockup detector is never enabled on: 1150# 1151# s390: it reported many false positives there 1152# 1153# sparc64: has a custom implementation which is not using the common 1154# hardlockup command line options and sysctl interface. 1155# 1156config HARDLOCKUP_DETECTOR 1157 bool "Detect Hard Lockups" 1158 depends on DEBUG_KERNEL && !S390 && !HARDLOCKUP_DETECTOR_SPARC64 1159 depends on HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_BUDDY || HAVE_HARDLOCKUP_DETECTOR_ARCH 1160 imply HARDLOCKUP_DETECTOR_PERF 1161 imply HARDLOCKUP_DETECTOR_BUDDY 1162 imply HARDLOCKUP_DETECTOR_ARCH 1163 select LOCKUP_DETECTOR 1164 1165 help 1166 Say Y here to enable the kernel to act as a watchdog to detect 1167 hard lockups. 1168 1169 Hardlockups are bugs that cause the CPU to loop in kernel mode 1170 for more than 10 seconds, without letting other interrupts have a 1171 chance to run. The current stack trace is displayed upon detection 1172 and the system will stay locked up. 1173 1174# 1175# Note that arch-specific variants are always preferred. 1176# 1177config HARDLOCKUP_DETECTOR_PREFER_BUDDY 1178 bool "Prefer the buddy CPU hardlockup detector" 1179 depends on HARDLOCKUP_DETECTOR 1180 depends on HAVE_HARDLOCKUP_DETECTOR_PERF && HAVE_HARDLOCKUP_DETECTOR_BUDDY 1181 depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH 1182 help 1183 Say Y here to prefer the buddy hardlockup detector over the perf one. 1184 1185 With the buddy detector, each CPU uses its softlockup hrtimer 1186 to check that the next CPU is processing hrtimer interrupts by 1187 verifying that a counter is increasing. 1188 1189 This hardlockup detector is useful on systems that don't have 1190 an arch-specific hardlockup detector or if resources needed 1191 for the hardlockup detector are better used for other things. 1192 1193config HARDLOCKUP_DETECTOR_PERF 1194 bool 1195 depends on HARDLOCKUP_DETECTOR 1196 depends on HAVE_HARDLOCKUP_DETECTOR_PERF && !HARDLOCKUP_DETECTOR_PREFER_BUDDY 1197 depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH 1198 select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER 1199 1200config HARDLOCKUP_DETECTOR_BUDDY 1201 bool 1202 depends on HARDLOCKUP_DETECTOR 1203 depends on HAVE_HARDLOCKUP_DETECTOR_BUDDY 1204 depends on !HAVE_HARDLOCKUP_DETECTOR_PERF || HARDLOCKUP_DETECTOR_PREFER_BUDDY 1205 depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH 1206 select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER 1207 1208config HARDLOCKUP_DETECTOR_ARCH 1209 bool 1210 depends on HARDLOCKUP_DETECTOR 1211 depends on HAVE_HARDLOCKUP_DETECTOR_ARCH 1212 help 1213 The arch-specific implementation of the hardlockup detector will 1214 be used. 1215 1216# 1217# Both the "perf" and "buddy" hardlockup detectors count hrtimer 1218# interrupts. This config enables functions managing this common code. 1219# 1220config HARDLOCKUP_DETECTOR_COUNTS_HRTIMER 1221 bool 1222 select SOFTLOCKUP_DETECTOR 1223 1224# 1225# Enables a timestamp based low pass filter to compensate for perf based 1226# hard lockup detection which runs too fast due to turbo modes. 1227# 1228config HARDLOCKUP_CHECK_TIMESTAMP 1229 bool 1230 1231config BOOTPARAM_HARDLOCKUP_PANIC 1232 bool "Panic (Reboot) On Hard Lockups" 1233 depends on HARDLOCKUP_DETECTOR 1234 help 1235 Say Y here to enable the kernel to panic on "hard lockups", 1236 which are bugs that cause the kernel to loop in kernel 1237 mode with interrupts disabled for more than 10 seconds (configurable 1238 using the watchdog_thresh sysctl). 1239 1240 Say N if unsure. 1241 1242config DETECT_HUNG_TASK 1243 bool "Detect Hung Tasks" 1244 depends on DEBUG_KERNEL 1245 default SOFTLOCKUP_DETECTOR 1246 help 1247 Say Y here to enable the kernel to detect "hung tasks", 1248 which are bugs that cause the task to be stuck in 1249 uninterruptible "D" state indefinitely. 1250 1251 When a hung task is detected, the kernel will print the 1252 current stack trace (which you should report), but the 1253 task will stay in uninterruptible state. If lockdep is 1254 enabled then all held locks will also be reported. This 1255 feature has negligible overhead. 1256 1257config DEFAULT_HUNG_TASK_TIMEOUT 1258 int "Default timeout for hung task detection (in seconds)" 1259 depends on DETECT_HUNG_TASK 1260 default 120 1261 help 1262 This option controls the default timeout (in seconds) used 1263 to determine when a task has become non-responsive and should 1264 be considered hung. 1265 1266 It can be adjusted at runtime via the kernel.hung_task_timeout_secs 1267 sysctl or by writing a value to 1268 /proc/sys/kernel/hung_task_timeout_secs. 1269 1270 A timeout of 0 disables the check. The default is two minutes. 1271 Keeping the default should be fine in most cases. 1272 1273config BOOTPARAM_HUNG_TASK_PANIC 1274 int "Number of hung tasks to trigger kernel panic" 1275 depends on DETECT_HUNG_TASK 1276 default 0 1277 help 1278 When set to a non-zero value, a kernel panic will be triggered 1279 if the number of hung tasks found during a single scan reaches 1280 this value. 1281 1282 The panic can be used in combination with panic_timeout, 1283 to cause the system to reboot automatically after a 1284 hung task has been detected. This feature is useful for 1285 high-availability systems that have uptime guarantees and 1286 where a hung tasks must be resolved ASAP. 1287 1288 Say N if unsure. 1289 1290config DETECT_HUNG_TASK_BLOCKER 1291 bool "Dump Hung Tasks Blocker" 1292 depends on DETECT_HUNG_TASK 1293 depends on !PREEMPT_RT 1294 default y 1295 help 1296 Say Y here to show the blocker task's stacktrace who acquires 1297 the mutex lock which "hung tasks" are waiting. 1298 This will add overhead a bit but shows suspicious tasks and 1299 call trace if it comes from waiting a mutex. 1300 1301config WQ_WATCHDOG 1302 bool "Detect Workqueue Stalls" 1303 depends on DEBUG_KERNEL 1304 help 1305 Say Y here to enable stall detection on workqueues. If a 1306 worker pool doesn't make forward progress on a pending work 1307 item for over a given amount of time, 30s by default, a 1308 warning message is printed along with dump of workqueue 1309 state. This can be configured through kernel parameter 1310 "workqueue.watchdog_thresh" and its sysfs counterpart. 1311 1312config WQ_CPU_INTENSIVE_REPORT 1313 bool "Report per-cpu work items which hog CPU for too long" 1314 depends on DEBUG_KERNEL 1315 help 1316 Say Y here to enable reporting of concurrency-managed per-cpu work 1317 items that hog CPUs for longer than 1318 workqueue.cpu_intensive_thresh_us. Workqueue automatically 1319 detects and excludes them from concurrency management to prevent 1320 them from stalling other per-cpu work items. Occassional 1321 triggering may not necessarily indicate a problem. Repeated 1322 triggering likely indicates that the work item should be switched 1323 to use an unbound workqueue. 1324 1325config TEST_LOCKUP 1326 tristate "Test module to generate lockups" 1327 depends on m 1328 help 1329 This builds the "test_lockup" module that helps to make sure 1330 that watchdogs and lockup detectors are working properly. 1331 1332 Depending on module parameters it could emulate soft or hard 1333 lockup, "hung task", or locking arbitrary lock for a long time. 1334 Also it could generate series of lockups with cooling-down periods. 1335 1336 If unsure, say N. 1337 1338endmenu # "Debug lockups and hangs" 1339 1340menu "Scheduler Debugging" 1341 1342config SCHED_INFO 1343 bool 1344 default n 1345 1346config SCHEDSTATS 1347 bool "Collect scheduler statistics" 1348 depends on PROC_FS 1349 select SCHED_INFO 1350 help 1351 If you say Y here, additional code will be inserted into the 1352 scheduler and related routines to collect statistics about 1353 scheduler behavior and provide them in /proc/schedstat. These 1354 stats may be useful for both tuning and debugging the scheduler 1355 If you aren't debugging the scheduler or trying to tune a specific 1356 application, you can say N to avoid the very slight overhead 1357 this adds. 1358 1359endmenu 1360 1361config DEBUG_PREEMPT 1362 bool "Debug preemptible kernel" 1363 depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT 1364 help 1365 If you say Y here then the kernel will use a debug variant of the 1366 commonly used smp_processor_id() function and will print warnings 1367 if kernel code uses it in a preemption-unsafe way. Also, the kernel 1368 will detect preemption count underflows. 1369 1370 This option has potential to introduce high runtime overhead, 1371 depending on workload as it triggers debugging routines for each 1372 this_cpu operation. It should only be used for debugging purposes. 1373 1374menu "Lock Debugging (spinlocks, mutexes, etc...)" 1375 1376config LOCK_DEBUGGING_SUPPORT 1377 bool 1378 depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 1379 default y 1380 1381config PROVE_LOCKING 1382 bool "Lock debugging: prove locking correctness" 1383 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1384 select LOCKDEP 1385 select DEBUG_SPINLOCK 1386 select DEBUG_MUTEXES if !PREEMPT_RT 1387 select DEBUG_RT_MUTEXES if RT_MUTEXES 1388 select DEBUG_RWSEMS if !PREEMPT_RT 1389 select DEBUG_WW_MUTEX_SLOWPATH 1390 select DEBUG_LOCK_ALLOC 1391 select PREEMPT_COUNT if !ARCH_NO_PREEMPT 1392 select TRACE_IRQFLAGS 1393 default n 1394 help 1395 This feature enables the kernel to prove that all locking 1396 that occurs in the kernel runtime is mathematically 1397 correct: that under no circumstance could an arbitrary (and 1398 not yet triggered) combination of observed locking 1399 sequences (on an arbitrary number of CPUs, running an 1400 arbitrary number of tasks and interrupt contexts) cause a 1401 deadlock. 1402 1403 In short, this feature enables the kernel to report locking 1404 related deadlocks before they actually occur. 1405 1406 The proof does not depend on how hard and complex a 1407 deadlock scenario would be to trigger: how many 1408 participant CPUs, tasks and irq-contexts would be needed 1409 for it to trigger. The proof also does not depend on 1410 timing: if a race and a resulting deadlock is possible 1411 theoretically (no matter how unlikely the race scenario 1412 is), it will be proven so and will immediately be 1413 reported by the kernel (once the event is observed that 1414 makes the deadlock theoretically possible). 1415 1416 If a deadlock is impossible (i.e. the locking rules, as 1417 observed by the kernel, are mathematically correct), the 1418 kernel reports nothing. 1419 1420 NOTE: this feature can also be enabled for rwlocks, mutexes 1421 and rwsems - in which case all dependencies between these 1422 different locking variants are observed and mapped too, and 1423 the proof of observed correctness is also maintained for an 1424 arbitrary combination of these separate locking variants. 1425 1426 For more details, see Documentation/locking/lockdep-design.rst. 1427 1428config PROVE_RAW_LOCK_NESTING 1429 bool "Enable raw_spinlock - spinlock nesting checks" if !ARCH_SUPPORTS_RT 1430 depends on PROVE_LOCKING 1431 default y if ARCH_SUPPORTS_RT 1432 help 1433 Enable the raw_spinlock vs. spinlock nesting checks which ensure 1434 that the lock nesting rules for PREEMPT_RT enabled kernels are 1435 not violated. 1436 1437config LOCK_STAT 1438 bool "Lock usage statistics" 1439 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1440 select LOCKDEP 1441 select DEBUG_SPINLOCK 1442 select DEBUG_MUTEXES if !PREEMPT_RT 1443 select DEBUG_RT_MUTEXES if RT_MUTEXES 1444 select DEBUG_LOCK_ALLOC 1445 default n 1446 help 1447 This feature enables tracking lock contention points 1448 1449 For more details, see Documentation/locking/lockstat.rst 1450 1451 This also enables lock events required by "perf lock", 1452 subcommand of perf. 1453 If you want to use "perf lock", you also need to turn on 1454 CONFIG_EVENT_TRACING. 1455 1456 CONFIG_LOCK_STAT defines "contended" and "acquired" lock events. 1457 (CONFIG_LOCKDEP defines "acquire" and "release" events.) 1458 1459config DEBUG_RT_MUTEXES 1460 bool "RT Mutex debugging, deadlock detection" 1461 depends on DEBUG_KERNEL && RT_MUTEXES 1462 help 1463 This allows rt mutex semantics violations and rt mutex related 1464 deadlocks (lockups) to be detected and reported automatically. 1465 1466config DEBUG_SPINLOCK 1467 bool "Spinlock and rw-lock debugging: basic checks" 1468 depends on DEBUG_KERNEL 1469 select UNINLINE_SPIN_UNLOCK 1470 help 1471 Say Y here and build SMP to catch missing spinlock initialization 1472 and certain other kinds of spinlock errors commonly made. This is 1473 best used in conjunction with the NMI watchdog so that spinlock 1474 deadlocks are also debuggable. 1475 1476config DEBUG_MUTEXES 1477 bool "Mutex debugging: basic checks" 1478 depends on DEBUG_KERNEL && !PREEMPT_RT 1479 help 1480 This feature allows mutex semantics violations to be detected and 1481 reported. 1482 1483config DEBUG_WW_MUTEX_SLOWPATH 1484 bool "Wait/wound mutex debugging: Slowpath testing" 1485 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1486 select DEBUG_LOCK_ALLOC 1487 select DEBUG_SPINLOCK 1488 select DEBUG_MUTEXES if !PREEMPT_RT 1489 select DEBUG_RT_MUTEXES if PREEMPT_RT 1490 help 1491 This feature enables slowpath testing for w/w mutex users by 1492 injecting additional -EDEADLK wound/backoff cases. Together with 1493 the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this 1494 will test all possible w/w mutex interface abuse with the 1495 exception of simply not acquiring all the required locks. 1496 Note that this feature can introduce significant overhead, so 1497 it really should not be enabled in a production or distro kernel, 1498 even a debug kernel. If you are a driver writer, enable it. If 1499 you are a distro, do not. 1500 1501config DEBUG_RWSEMS 1502 bool "RW Semaphore debugging: basic checks" 1503 depends on DEBUG_KERNEL && !PREEMPT_RT 1504 help 1505 This debugging feature allows mismatched rw semaphore locks 1506 and unlocks to be detected and reported. 1507 1508config DEBUG_LOCK_ALLOC 1509 bool "Lock debugging: detect incorrect freeing of live locks" 1510 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1511 select DEBUG_SPINLOCK 1512 select DEBUG_MUTEXES if !PREEMPT_RT 1513 select DEBUG_RT_MUTEXES if RT_MUTEXES 1514 select LOCKDEP 1515 help 1516 This feature will check whether any held lock (spinlock, rwlock, 1517 mutex or rwsem) is incorrectly freed by the kernel, via any of the 1518 memory-freeing routines (kfree(), kmem_cache_free(), free_pages(), 1519 vfree(), etc.), whether a live lock is incorrectly reinitialized via 1520 spin_lock_init()/mutex_init()/etc., or whether there is any lock 1521 held during task exit. 1522 1523config LOCKDEP 1524 bool 1525 depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1526 select STACKTRACE 1527 select KALLSYMS 1528 select KALLSYMS_ALL 1529 1530config LOCKDEP_SMALL 1531 bool 1532 1533config LOCKDEP_BITS 1534 int "Size for MAX_LOCKDEP_ENTRIES (as Nth power of 2)" 1535 depends on LOCKDEP && !LOCKDEP_SMALL 1536 range 10 24 1537 default 15 1538 help 1539 Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message. 1540 1541config LOCKDEP_CHAINS_BITS 1542 int "Size for MAX_LOCKDEP_CHAINS (as Nth power of 2)" 1543 depends on LOCKDEP && !LOCKDEP_SMALL 1544 range 10 21 1545 default 16 1546 help 1547 Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!" message. 1548 1549config LOCKDEP_STACK_TRACE_BITS 1550 int "Size for MAX_STACK_TRACE_ENTRIES (as Nth power of 2)" 1551 depends on LOCKDEP && !LOCKDEP_SMALL 1552 range 10 26 1553 default 19 1554 help 1555 Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message. 1556 1557config LOCKDEP_STACK_TRACE_HASH_BITS 1558 int "Size for STACK_TRACE_HASH_SIZE (as Nth power of 2)" 1559 depends on LOCKDEP && !LOCKDEP_SMALL 1560 range 10 26 1561 default 14 1562 help 1563 Try increasing this value if you need large STACK_TRACE_HASH_SIZE. 1564 1565config LOCKDEP_CIRCULAR_QUEUE_BITS 1566 int "Size for elements in circular_queue struct (as Nth power of 2)" 1567 depends on LOCKDEP 1568 range 10 26 1569 default 12 1570 help 1571 Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure. 1572 1573config DEBUG_LOCKDEP 1574 bool "Lock dependency engine debugging" 1575 depends on DEBUG_KERNEL && LOCKDEP 1576 select DEBUG_IRQFLAGS 1577 help 1578 If you say Y here, the lock dependency engine will do 1579 additional runtime checks to debug itself, at the price 1580 of more runtime overhead. 1581 1582config DEBUG_ATOMIC_SLEEP 1583 bool "Sleep inside atomic section checking" 1584 select PREEMPT_COUNT 1585 depends on DEBUG_KERNEL 1586 depends on !ARCH_NO_PREEMPT 1587 help 1588 If you say Y here, various routines which may sleep will become very 1589 noisy if they are called inside atomic sections: when a spinlock is 1590 held, inside an rcu read side critical section, inside preempt disabled 1591 sections, inside an interrupt, etc... 1592 1593config DEBUG_LOCKING_API_SELFTESTS 1594 bool "Locking API boot-time self-tests" 1595 depends on DEBUG_KERNEL 1596 help 1597 Say Y here if you want the kernel to run a short self-test during 1598 bootup. The self-test checks whether common types of locking bugs 1599 are detected by debugging mechanisms or not. (if you disable 1600 lock debugging then those bugs won't be detected of course.) 1601 The following locking APIs are covered: spinlocks, rwlocks, 1602 mutexes and rwsems. 1603 1604config LOCK_TORTURE_TEST 1605 tristate "torture tests for locking" 1606 depends on DEBUG_KERNEL 1607 select TORTURE_TEST 1608 help 1609 This option provides a kernel module that runs torture tests 1610 on kernel locking primitives. The kernel module may be built 1611 after the fact on the running kernel to be tested, if desired. 1612 1613 Say Y here if you want kernel locking-primitive torture tests 1614 to be built into the kernel. 1615 Say M if you want these torture tests to build as a module. 1616 Say N if you are unsure. 1617 1618config WW_MUTEX_SELFTEST 1619 tristate "Wait/wound mutex selftests" 1620 help 1621 This option provides a kernel module that runs tests on the 1622 on the struct ww_mutex locking API. 1623 1624 It is recommended to enable DEBUG_WW_MUTEX_SLOWPATH in conjunction 1625 with this test harness. 1626 1627 Say M if you want these self tests to build as a module. 1628 Say N if you are unsure. 1629 1630config SCF_TORTURE_TEST 1631 tristate "torture tests for smp_call_function*()" 1632 depends on DEBUG_KERNEL 1633 select TORTURE_TEST 1634 help 1635 This option provides a kernel module that runs torture tests 1636 on the smp_call_function() family of primitives. The kernel 1637 module may be built after the fact on the running kernel to 1638 be tested, if desired. 1639 1640config CSD_LOCK_WAIT_DEBUG 1641 bool "Debugging for csd_lock_wait(), called from smp_call_function*()" 1642 depends on DEBUG_KERNEL 1643 depends on SMP 1644 depends on 64BIT 1645 default n 1646 help 1647 This option enables debug prints when CPUs are slow to respond 1648 to the smp_call_function*() IPI wrappers. These debug prints 1649 include the IPI handler function currently executing (if any) 1650 and relevant stack traces. 1651 1652config CSD_LOCK_WAIT_DEBUG_DEFAULT 1653 bool "Default csd_lock_wait() debugging on at boot time" 1654 depends on CSD_LOCK_WAIT_DEBUG 1655 depends on 64BIT 1656 default n 1657 help 1658 This option causes the csdlock_debug= kernel boot parameter to 1659 default to 1 (basic debugging) instead of 0 (no debugging). 1660 1661endmenu # lock debugging 1662 1663config TRACE_IRQFLAGS 1664 depends on TRACE_IRQFLAGS_SUPPORT 1665 bool 1666 help 1667 Enables hooks to interrupt enabling and disabling for 1668 either tracing or lock debugging. 1669 1670config TRACE_IRQFLAGS_NMI 1671 def_bool y 1672 depends on TRACE_IRQFLAGS 1673 depends on TRACE_IRQFLAGS_NMI_SUPPORT 1674 1675config NMI_CHECK_CPU 1676 bool "Debugging for CPUs failing to respond to backtrace requests" 1677 depends on DEBUG_KERNEL 1678 depends on X86 1679 default n 1680 help 1681 Enables debug prints when a CPU fails to respond to a given 1682 backtrace NMI. These prints provide some reasons why a CPU 1683 might legitimately be failing to respond, for example, if it 1684 is offline of if ignore_nmis is set. 1685 1686config DEBUG_IRQFLAGS 1687 bool "Debug IRQ flag manipulation" 1688 help 1689 Enables checks for potentially unsafe enabling or disabling of 1690 interrupts, such as calling raw_local_irq_restore() when interrupts 1691 are enabled. 1692 1693config STACKTRACE 1694 bool "Stack backtrace support" 1695 depends on STACKTRACE_SUPPORT 1696 help 1697 This option causes the kernel to create a /proc/pid/stack for 1698 every process, showing its current stack trace. 1699 It is also used by various kernel debugging features that require 1700 stack trace generation. 1701 1702config WARN_ALL_UNSEEDED_RANDOM 1703 bool "Warn for all uses of unseeded randomness" 1704 default n 1705 help 1706 Some parts of the kernel contain bugs relating to their use of 1707 cryptographically secure random numbers before it's actually possible 1708 to generate those numbers securely. This setting ensures that these 1709 flaws don't go unnoticed, by enabling a message, should this ever 1710 occur. This will allow people with obscure setups to know when things 1711 are going wrong, so that they might contact developers about fixing 1712 it. 1713 1714 Unfortunately, on some models of some architectures getting 1715 a fully seeded CRNG is extremely difficult, and so this can 1716 result in dmesg getting spammed for a surprisingly long 1717 time. This is really bad from a security perspective, and 1718 so architecture maintainers really need to do what they can 1719 to get the CRNG seeded sooner after the system is booted. 1720 However, since users cannot do anything actionable to 1721 address this, by default this option is disabled. 1722 1723 Say Y here if you want to receive warnings for all uses of 1724 unseeded randomness. This will be of use primarily for 1725 those developers interested in improving the security of 1726 Linux kernels running on their architecture (or 1727 subarchitecture). 1728 1729config DEBUG_KOBJECT 1730 bool "kobject debugging" 1731 depends on DEBUG_KERNEL 1732 help 1733 If you say Y here, some extra kobject debugging messages will be sent 1734 to the syslog. 1735 1736config DEBUG_KOBJECT_RELEASE 1737 bool "kobject release debugging" 1738 depends on DEBUG_OBJECTS_TIMERS 1739 help 1740 kobjects are reference counted objects. This means that their 1741 last reference count put is not predictable, and the kobject can 1742 live on past the point at which a driver decides to drop its 1743 initial reference to the kobject gained on allocation. An 1744 example of this would be a struct device which has just been 1745 unregistered. 1746 1747 However, some buggy drivers assume that after such an operation, 1748 the memory backing the kobject can be immediately freed. This 1749 goes completely against the principles of a refcounted object. 1750 1751 If you say Y here, the kernel will delay the release of kobjects 1752 on the last reference count to improve the visibility of this 1753 kind of kobject release bug. 1754 1755config HAVE_DEBUG_BUGVERBOSE 1756 bool 1757 1758menu "Debug kernel data structures" 1759 1760config DEBUG_LIST 1761 bool "Debug linked list manipulation" 1762 depends on DEBUG_KERNEL 1763 select LIST_HARDENED 1764 help 1765 Enable this to turn on extended checks in the linked-list walking 1766 routines. 1767 1768 This option trades better quality error reports for performance, and 1769 is more suitable for kernel debugging. If you care about performance, 1770 you should only enable CONFIG_LIST_HARDENED instead. 1771 1772 If unsure, say N. 1773 1774config DEBUG_PLIST 1775 bool "Debug priority linked list manipulation" 1776 depends on DEBUG_KERNEL 1777 help 1778 Enable this to turn on extended checks in the priority-ordered 1779 linked-list (plist) walking routines. This checks the entire 1780 list multiple times during each manipulation. 1781 1782 If unsure, say N. 1783 1784config DEBUG_SG 1785 bool "Debug SG table operations" 1786 depends on DEBUG_KERNEL 1787 help 1788 Enable this to turn on checks on scatter-gather tables. This can 1789 help find problems with drivers that do not properly initialize 1790 their sg tables. 1791 1792 If unsure, say N. 1793 1794config DEBUG_NOTIFIERS 1795 bool "Debug notifier call chains" 1796 depends on DEBUG_KERNEL 1797 help 1798 Enable this to turn on sanity checking for notifier call chains. 1799 This is most useful for kernel developers to make sure that 1800 modules properly unregister themselves from notifier chains. 1801 This is a relatively cheap check but if you care about maximum 1802 performance, say N. 1803 1804config DEBUG_CLOSURES 1805 bool "Debug closures (bcache async widgits)" 1806 depends on CLOSURES 1807 select DEBUG_FS 1808 help 1809 Keeps all active closures in a linked list and provides a debugfs 1810 interface to list them, which makes it possible to see asynchronous 1811 operations that get stuck. 1812 1813config DEBUG_MAPLE_TREE 1814 bool "Debug maple trees" 1815 depends on DEBUG_KERNEL 1816 help 1817 Enable maple tree debugging information and extra validations. 1818 1819 If unsure, say N. 1820 1821endmenu 1822 1823source "kernel/rcu/Kconfig.debug" 1824 1825config DEBUG_WQ_FORCE_RR_CPU 1826 bool "Force round-robin CPU selection for unbound work items" 1827 depends on DEBUG_KERNEL 1828 default n 1829 help 1830 Workqueue used to implicitly guarantee that work items queued 1831 without explicit CPU specified are put on the local CPU. This 1832 guarantee is no longer true and while local CPU is still 1833 preferred work items may be put on foreign CPUs. Kernel 1834 parameter "workqueue.debug_force_rr_cpu" is added to force 1835 round-robin CPU selection to flush out usages which depend on the 1836 now broken guarantee. This config option enables the debug 1837 feature by default. When enabled, memory and cache locality will 1838 be impacted. 1839 1840config CPU_HOTPLUG_STATE_CONTROL 1841 bool "Enable CPU hotplug state control" 1842 depends on DEBUG_KERNEL 1843 depends on HOTPLUG_CPU 1844 default n 1845 help 1846 Allows to write steps between "offline" and "online" to the CPUs 1847 sysfs target file so states can be stepped granular. This is a debug 1848 option for now as the hotplug machinery cannot be stopped and 1849 restarted at arbitrary points yet. 1850 1851 Say N if your are unsure. 1852 1853config LATENCYTOP 1854 bool "Latency measuring infrastructure" 1855 depends on DEBUG_KERNEL 1856 depends on STACKTRACE_SUPPORT 1857 depends on PROC_FS 1858 depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 1859 select KALLSYMS 1860 select KALLSYMS_ALL 1861 select STACKTRACE 1862 select SCHEDSTATS 1863 help 1864 Enable this option if you want to use the LatencyTOP tool 1865 to find out which userspace is blocking on what kernel operations. 1866 1867config DEBUG_CGROUP_REF 1868 bool "Disable inlining of cgroup css reference count functions" 1869 depends on DEBUG_KERNEL 1870 depends on CGROUPS 1871 depends on KPROBES 1872 default n 1873 help 1874 Force cgroup css reference count functions to not be inlined so 1875 that they can be kprobed for debugging. 1876 1877source "kernel/trace/Kconfig" 1878 1879config PROVIDE_OHCI1394_DMA_INIT 1880 bool "Remote debugging over FireWire early on boot" 1881 depends on PCI && X86 1882 help 1883 If you want to debug problems which hang or crash the kernel early 1884 on boot and the crashing machine has a FireWire port, you can use 1885 this feature to remotely access the memory of the crashed machine 1886 over FireWire. This employs remote DMA as part of the OHCI1394 1887 specification which is now the standard for FireWire controllers. 1888 1889 With remote DMA, you can monitor the printk buffer remotely using 1890 firescope and access all memory below 4GB using fireproxy from gdb. 1891 Even controlling a kernel debugger is possible using remote DMA. 1892 1893 Usage: 1894 1895 If ohci1394_dma=early is used as boot parameter, it will initialize 1896 all OHCI1394 controllers which are found in the PCI config space. 1897 1898 As all changes to the FireWire bus such as enabling and disabling 1899 devices cause a bus reset and thereby disable remote DMA for all 1900 devices, be sure to have the cable plugged and FireWire enabled on 1901 the debugging host before booting the debug target for debugging. 1902 1903 This code (~1k) is freed after boot. By then, the firewire stack 1904 in charge of the OHCI-1394 controllers should be used instead. 1905 1906 See Documentation/core-api/debugging-via-ohci1394.rst for more information. 1907 1908source "samples/Kconfig" 1909 1910config ARCH_HAS_DEVMEM_IS_ALLOWED 1911 bool 1912 1913config STRICT_DEVMEM 1914 bool "Filter access to /dev/mem" 1915 depends on MMU && DEVMEM 1916 depends on ARCH_HAS_DEVMEM_IS_ALLOWED || GENERIC_LIB_DEVMEM_IS_ALLOWED 1917 default y if PPC || X86 || ARM64 || S390 1918 help 1919 If this option is disabled, you allow userspace (root) access to all 1920 of memory, including kernel and userspace memory. Accidental 1921 access to this is obviously disastrous, but specific access can 1922 be used by people debugging the kernel. Note that with PAT support 1923 enabled, even in this case there are restrictions on /dev/mem 1924 use due to the cache aliasing requirements. 1925 1926 If this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem 1927 file only allows userspace access to PCI space and the BIOS code and 1928 data regions. This is sufficient for dosemu and X and all common 1929 users of /dev/mem. 1930 1931 If in doubt, say Y. 1932 1933config IO_STRICT_DEVMEM 1934 bool "Filter I/O access to /dev/mem" 1935 depends on STRICT_DEVMEM 1936 help 1937 If this option is disabled, you allow userspace (root) access to all 1938 io-memory regardless of whether a driver is actively using that 1939 range. Accidental access to this is obviously disastrous, but 1940 specific access can be used by people debugging kernel drivers. 1941 1942 If this option is switched on, the /dev/mem file only allows 1943 userspace access to *idle* io-memory ranges (see /proc/iomem) This 1944 may break traditional users of /dev/mem (dosemu, legacy X, etc...) 1945 if the driver using a given range cannot be disabled. 1946 1947 If in doubt, say Y. 1948 1949menu "$(SRCARCH) Debugging" 1950 1951source "arch/$(SRCARCH)/Kconfig.debug" 1952 1953endmenu 1954 1955menu "Kernel Testing and Coverage" 1956 1957source "lib/kunit/Kconfig" 1958 1959config NOTIFIER_ERROR_INJECTION 1960 tristate "Notifier error injection" 1961 depends on DEBUG_KERNEL 1962 select DEBUG_FS 1963 help 1964 This option provides the ability to inject artificial errors to 1965 specified notifier chain callbacks. It is useful to test the error 1966 handling of notifier call chain failures. 1967 1968 Say N if unsure. 1969 1970config PM_NOTIFIER_ERROR_INJECT 1971 tristate "PM notifier error injection module" 1972 depends on PM && NOTIFIER_ERROR_INJECTION 1973 default m if PM_DEBUG 1974 help 1975 This option provides the ability to inject artificial errors to 1976 PM notifier chain callbacks. It is controlled through debugfs 1977 interface /sys/kernel/debug/notifier-error-inject/pm 1978 1979 If the notifier call chain should be failed with some events 1980 notified, write the error code to "actions/<notifier event>/error". 1981 1982 Example: Inject PM suspend error (-12 = -ENOMEM) 1983 1984 # cd /sys/kernel/debug/notifier-error-inject/pm/ 1985 # echo -12 > actions/PM_SUSPEND_PREPARE/error 1986 # echo mem > /sys/power/state 1987 bash: echo: write error: Cannot allocate memory 1988 1989 To compile this code as a module, choose M here: the module will 1990 be called pm-notifier-error-inject. 1991 1992 If unsure, say N. 1993 1994config OF_RECONFIG_NOTIFIER_ERROR_INJECT 1995 tristate "OF reconfig notifier error injection module" 1996 depends on OF_DYNAMIC && NOTIFIER_ERROR_INJECTION 1997 help 1998 This option provides the ability to inject artificial errors to 1999 OF reconfig notifier chain callbacks. It is controlled 2000 through debugfs interface under 2001 /sys/kernel/debug/notifier-error-inject/OF-reconfig/ 2002 2003 If the notifier call chain should be failed with some events 2004 notified, write the error code to "actions/<notifier event>/error". 2005 2006 To compile this code as a module, choose M here: the module will 2007 be called of-reconfig-notifier-error-inject. 2008 2009 If unsure, say N. 2010 2011config NETDEV_NOTIFIER_ERROR_INJECT 2012 tristate "Netdev notifier error injection module" 2013 depends on NET && NOTIFIER_ERROR_INJECTION 2014 help 2015 This option provides the ability to inject artificial errors to 2016 netdevice notifier chain callbacks. It is controlled through debugfs 2017 interface /sys/kernel/debug/notifier-error-inject/netdev 2018 2019 If the notifier call chain should be failed with some events 2020 notified, write the error code to "actions/<notifier event>/error". 2021 2022 Example: Inject netdevice mtu change error (-22 = -EINVAL) 2023 2024 # cd /sys/kernel/debug/notifier-error-inject/netdev 2025 # echo -22 > actions/NETDEV_CHANGEMTU/error 2026 # ip link set eth0 mtu 1024 2027 RTNETLINK answers: Invalid argument 2028 2029 To compile this code as a module, choose M here: the module will 2030 be called netdev-notifier-error-inject. 2031 2032 If unsure, say N. 2033 2034config FUNCTION_ERROR_INJECTION 2035 bool "Fault-injections of functions" 2036 depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES 2037 help 2038 Add fault injections into various functions that are annotated with 2039 ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return 2040 value of these functions. This is useful to test error paths of code. 2041 2042 If unsure, say N 2043 2044config FAULT_INJECTION 2045 bool "Fault-injection framework" 2046 depends on DEBUG_KERNEL 2047 help 2048 Provide fault-injection framework. 2049 For more details, see Documentation/fault-injection/. 2050 2051config FAILSLAB 2052 bool "Fault-injection capability for kmalloc" 2053 depends on FAULT_INJECTION 2054 help 2055 Provide fault-injection capability for kmalloc. 2056 2057config FAIL_PAGE_ALLOC 2058 bool "Fault-injection capability for alloc_pages()" 2059 depends on FAULT_INJECTION 2060 help 2061 Provide fault-injection capability for alloc_pages(). 2062 2063config FAULT_INJECTION_USERCOPY 2064 bool "Fault injection capability for usercopy functions" 2065 depends on FAULT_INJECTION 2066 help 2067 Provides fault-injection capability to inject failures 2068 in usercopy functions (copy_from_user(), get_user(), ...). 2069 2070config FAIL_MAKE_REQUEST 2071 bool "Fault-injection capability for disk IO" 2072 depends on FAULT_INJECTION && BLOCK 2073 help 2074 Provide fault-injection capability for disk IO. 2075 2076config FAIL_IO_TIMEOUT 2077 bool "Fault-injection capability for faking disk interrupts" 2078 depends on FAULT_INJECTION && BLOCK 2079 help 2080 Provide fault-injection capability on end IO handling. This 2081 will make the block layer "forget" an interrupt as configured, 2082 thus exercising the error handling. 2083 2084 Only works with drivers that use the generic timeout handling, 2085 for others it won't do anything. 2086 2087config FAIL_FUTEX 2088 bool "Fault-injection capability for futexes" 2089 select DEBUG_FS 2090 depends on FAULT_INJECTION && FUTEX 2091 help 2092 Provide fault-injection capability for futexes. 2093 2094config FAULT_INJECTION_DEBUG_FS 2095 bool "Debugfs entries for fault-injection capabilities" 2096 depends on FAULT_INJECTION && SYSFS && DEBUG_FS 2097 help 2098 Enable configuration of fault-injection capabilities via debugfs. 2099 2100config FAIL_FUNCTION 2101 bool "Fault-injection capability for functions" 2102 depends on FAULT_INJECTION_DEBUG_FS && FUNCTION_ERROR_INJECTION 2103 help 2104 Provide function-based fault-injection capability. 2105 This will allow you to override a specific function with a return 2106 with given return value. As a result, function caller will see 2107 an error value and have to handle it. This is useful to test the 2108 error handling in various subsystems. 2109 2110config FAIL_MMC_REQUEST 2111 bool "Fault-injection capability for MMC IO" 2112 depends on FAULT_INJECTION_DEBUG_FS && MMC 2113 help 2114 Provide fault-injection capability for MMC IO. 2115 This will make the mmc core return data errors. This is 2116 useful to test the error handling in the mmc block device 2117 and to test how the mmc host driver handles retries from 2118 the block device. 2119 2120config FAIL_SUNRPC 2121 bool "Fault-injection capability for SunRPC" 2122 depends on FAULT_INJECTION_DEBUG_FS && SUNRPC_DEBUG 2123 help 2124 Provide fault-injection capability for SunRPC and 2125 its consumers. 2126 2127config FAIL_SKB_REALLOC 2128 bool "Fault-injection capability forcing skb to reallocate" 2129 depends on FAULT_INJECTION_DEBUG_FS 2130 help 2131 Provide fault-injection capability that forces the skb to be 2132 reallocated, catching possible invalid pointers to the skb. 2133 2134 For more information, check 2135 Documentation/fault-injection/fault-injection.rst 2136 2137config FAULT_INJECTION_CONFIGFS 2138 bool "Configfs interface for fault-injection capabilities" 2139 depends on FAULT_INJECTION 2140 select CONFIGFS_FS 2141 help 2142 This option allows configfs-based drivers to dynamically configure 2143 fault-injection via configfs. Each parameter for driver-specific 2144 fault-injection can be made visible as a configfs attribute in a 2145 configfs group. 2146 2147 2148config FAULT_INJECTION_STACKTRACE_FILTER 2149 bool "stacktrace filter for fault-injection capabilities" 2150 depends on FAULT_INJECTION 2151 depends on (FAULT_INJECTION_DEBUG_FS || FAULT_INJECTION_CONFIGFS) && STACKTRACE_SUPPORT 2152 select STACKTRACE 2153 depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 2154 help 2155 Provide stacktrace filter for fault-injection capabilities 2156 2157config ARCH_HAS_KCOV 2158 bool 2159 help 2160 An architecture should select this when it can successfully 2161 build and run with CONFIG_KCOV. This typically requires 2162 disabling instrumentation for some early boot code. 2163 2164config KCOV 2165 bool "Code coverage for fuzzing" 2166 depends on ARCH_HAS_KCOV 2167 depends on !ARCH_WANTS_NO_INSTR || HAVE_NOINSTR_HACK || \ 2168 GCC_VERSION >= 120000 || CC_IS_CLANG 2169 select DEBUG_FS 2170 select OBJTOOL if HAVE_NOINSTR_HACK 2171 help 2172 KCOV exposes kernel code coverage information in a form suitable 2173 for coverage-guided fuzzing (randomized testing). 2174 2175 For more details, see Documentation/dev-tools/kcov.rst. 2176 2177config KCOV_ENABLE_COMPARISONS 2178 bool "Enable comparison operands collection by KCOV" 2179 depends on KCOV 2180 depends on $(cc-option,-fsanitize-coverage=trace-cmp) 2181 help 2182 KCOV also exposes operands of every comparison in the instrumented 2183 code along with operand sizes and PCs of the comparison instructions. 2184 These operands can be used by fuzzing engines to improve the quality 2185 of fuzzing coverage. 2186 2187config KCOV_INSTRUMENT_ALL 2188 bool "Instrument all code by default" 2189 depends on KCOV 2190 default y 2191 help 2192 If you are doing generic system call fuzzing (like e.g. syzkaller), 2193 then you will want to instrument the whole kernel and you should 2194 say y here. If you are doing more targeted fuzzing (like e.g. 2195 filesystem fuzzing with AFL) then you will want to enable coverage 2196 for more specific subsets of files, and should say n here. 2197 2198config KCOV_IRQ_AREA_SIZE 2199 hex "Size of interrupt coverage collection area in words" 2200 depends on KCOV 2201 default 0x40000 2202 help 2203 KCOV uses preallocated per-cpu areas to collect coverage from 2204 soft interrupts. This specifies the size of those areas in the 2205 number of unsigned long words. 2206 2207config KCOV_SELFTEST 2208 bool "Perform short selftests on boot" 2209 depends on KCOV 2210 help 2211 Run short KCOV coverage collection selftests on boot. 2212 On test failure, causes the kernel to panic. Recommended to be 2213 enabled, ensuring critical functionality works as intended. 2214 2215menuconfig RUNTIME_TESTING_MENU 2216 bool "Runtime Testing" 2217 default y 2218 2219if RUNTIME_TESTING_MENU 2220 2221config TEST_DHRY 2222 tristate "Dhrystone benchmark test" 2223 help 2224 Enable this to include the Dhrystone 2.1 benchmark. This test 2225 calculates the number of Dhrystones per second, and the number of 2226 DMIPS (Dhrystone MIPS) obtained when the Dhrystone score is divided 2227 by 1757 (the number of Dhrystones per second obtained on the VAX 2228 11/780, nominally a 1 MIPS machine). 2229 2230 To run the benchmark, it needs to be enabled explicitly, either from 2231 the kernel command line (when built-in), or from userspace (when 2232 built-in or modular). 2233 2234 Run once during kernel boot: 2235 2236 test_dhry.run 2237 2238 Set number of iterations from kernel command line: 2239 2240 test_dhry.iterations=<n> 2241 2242 Set number of iterations from userspace: 2243 2244 echo <n> > /sys/module/test_dhry/parameters/iterations 2245 2246 Trigger manual run from userspace: 2247 2248 echo y > /sys/module/test_dhry/parameters/run 2249 2250 If the number of iterations is <= 0, the test will devise a suitable 2251 number of iterations (test runs for at least 2s) automatically. 2252 This process takes ca. 4s. 2253 2254 If unsure, say N. 2255 2256config LKDTM 2257 tristate "Linux Kernel Dump Test Tool Module" 2258 depends on DEBUG_FS 2259 help 2260 This module enables testing of the different dumping mechanisms by 2261 inducing system failures at predefined crash points. 2262 If you don't need it: say N 2263 Choose M here to compile this code as a module. The module will be 2264 called lkdtm. 2265 2266 Documentation on how to use the module can be found in 2267 Documentation/fault-injection/provoke-crashes.rst 2268 2269config CPUMASK_KUNIT_TEST 2270 tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS 2271 depends on KUNIT 2272 default KUNIT_ALL_TESTS 2273 help 2274 Enable to turn on cpumask tests, running at boot or module load time. 2275 2276 For more information on KUnit and unit tests in general, please refer 2277 to the KUnit documentation in Documentation/dev-tools/kunit/. 2278 2279 If unsure, say N. 2280 2281config TEST_LIST_SORT 2282 tristate "Linked list sorting test" if !KUNIT_ALL_TESTS 2283 depends on KUNIT 2284 default KUNIT_ALL_TESTS 2285 help 2286 Enable this to turn on 'list_sort()' function test. This test is 2287 executed only once during system boot (so affects only boot time), 2288 or at module load time. 2289 2290 If unsure, say N. 2291 2292config TEST_MIN_HEAP 2293 tristate "Min heap test" 2294 depends on DEBUG_KERNEL || m 2295 help 2296 Enable this to turn on min heap function tests. This test is 2297 executed only once during system boot (so affects only boot time), 2298 or at module load time. 2299 2300 If unsure, say N. 2301 2302config TEST_SORT 2303 tristate "Array-based sort test" if !KUNIT_ALL_TESTS 2304 depends on KUNIT 2305 default KUNIT_ALL_TESTS 2306 help 2307 This option enables the self-test function of 'sort()' at boot, 2308 or at module load time. 2309 2310 If unsure, say N. 2311 2312config TEST_DIV64 2313 tristate "64bit/32bit division and modulo test" 2314 depends on DEBUG_KERNEL || m 2315 help 2316 Enable this to turn on 'do_div()' function test. This test is 2317 executed only once during system boot (so affects only boot time), 2318 or at module load time. 2319 2320 If unsure, say N. 2321 2322config TEST_MULDIV64 2323 tristate "mul_u64_u64_div_u64() test" 2324 depends on DEBUG_KERNEL || m 2325 help 2326 Enable this to turn on 'mul_u64_u64_div_u64()' function test. 2327 This test is executed only once during system boot (so affects 2328 only boot time), or at module load time. 2329 2330 If unsure, say N. 2331 2332config TEST_IOV_ITER 2333 tristate "Test iov_iter operation" if !KUNIT_ALL_TESTS 2334 depends on KUNIT 2335 depends on MMU 2336 default KUNIT_ALL_TESTS 2337 help 2338 Enable this to turn on testing of the operation of the I/O iterator 2339 (iov_iter). This test is executed only once during system boot (so 2340 affects only boot time), or at module load time. 2341 2342 If unsure, say N. 2343 2344config KPROBES_SANITY_TEST 2345 tristate "Kprobes sanity tests" if !KUNIT_ALL_TESTS 2346 depends on DEBUG_KERNEL 2347 depends on KPROBES 2348 depends on KUNIT 2349 select STACKTRACE if ARCH_CORRECT_STACKTRACE_ON_KRETPROBE 2350 default KUNIT_ALL_TESTS 2351 help 2352 This option provides for testing basic kprobes functionality on 2353 boot. Samples of kprobe and kretprobe are inserted and 2354 verified for functionality. 2355 2356 Say N if you are unsure. 2357 2358config FPROBE_SANITY_TEST 2359 bool "Self test for fprobe" 2360 depends on DEBUG_KERNEL 2361 depends on FPROBE 2362 depends on KUNIT=y 2363 help 2364 This option will enable testing the fprobe when the system boot. 2365 A series of tests are made to verify that the fprobe is functioning 2366 properly. 2367 2368 Say N if you are unsure. 2369 2370config BACKTRACE_SELF_TEST 2371 tristate "Self test for the backtrace code" 2372 depends on DEBUG_KERNEL 2373 help 2374 This option provides a kernel module that can be used to test 2375 the kernel stack backtrace code. This option is not useful 2376 for distributions or general kernels, but only for kernel 2377 developers working on architecture code. 2378 2379 Note that if you want to also test saved backtraces, you will 2380 have to enable STACKTRACE as well. 2381 2382 Say N if you are unsure. 2383 2384config TEST_REF_TRACKER 2385 tristate "Self test for reference tracker" 2386 depends on DEBUG_KERNEL && STACKTRACE_SUPPORT 2387 select REF_TRACKER 2388 help 2389 This option provides a kernel module performing tests 2390 using reference tracker infrastructure. 2391 2392 Say N if you are unsure. 2393 2394config RBTREE_TEST 2395 tristate "Red-Black tree test" 2396 depends on DEBUG_KERNEL 2397 help 2398 A benchmark measuring the performance of the rbtree library. 2399 Also includes rbtree invariant checks. 2400 2401config REED_SOLOMON_TEST 2402 tristate "Reed-Solomon library test" 2403 depends on DEBUG_KERNEL || m 2404 select REED_SOLOMON 2405 select REED_SOLOMON_ENC16 2406 select REED_SOLOMON_DEC16 2407 help 2408 This option enables the self-test function of rslib at boot, 2409 or at module load time. 2410 2411 If unsure, say N. 2412 2413config INTERVAL_TREE_TEST 2414 tristate "Interval tree test" 2415 depends on DEBUG_KERNEL 2416 select INTERVAL_TREE 2417 help 2418 A benchmark measuring the performance of the interval tree library 2419 2420config PERCPU_TEST 2421 tristate "Per cpu operations test" 2422 depends on m && DEBUG_KERNEL 2423 help 2424 Enable this option to build test module which validates per-cpu 2425 operations. 2426 2427 If unsure, say N. 2428 2429config ATOMIC64_SELFTEST 2430 tristate "Perform an atomic64_t self-test" 2431 help 2432 Enable this option to test the atomic64_t functions at boot or 2433 at module load time. 2434 2435 If unsure, say N. 2436 2437config ASYNC_RAID6_TEST 2438 tristate "Self test for hardware accelerated raid6 recovery" 2439 depends on ASYNC_RAID6_RECOV 2440 select ASYNC_MEMCPY 2441 help 2442 This is a one-shot self test that permutes through the 2443 recovery of all the possible two disk failure scenarios for a 2444 N-disk array. Recovery is performed with the asynchronous 2445 raid6 recovery routines, and will optionally use an offload 2446 engine if one is available. 2447 2448 If unsure, say N. 2449 2450config TEST_HEXDUMP 2451 tristate "Test functions located in the hexdump module at runtime" 2452 2453config PRINTF_KUNIT_TEST 2454 tristate "KUnit test printf() family of functions at runtime" if !KUNIT_ALL_TESTS 2455 depends on KUNIT 2456 default KUNIT_ALL_TESTS 2457 help 2458 Enable this option to test the printf functions at runtime. 2459 2460 If unsure, say N. 2461 2462config SCANF_KUNIT_TEST 2463 tristate "KUnit test scanf() family of functions at runtime" if !KUNIT_ALL_TESTS 2464 depends on KUNIT 2465 default KUNIT_ALL_TESTS 2466 help 2467 Enable this option to test the scanf functions at runtime. 2468 2469 If unsure, say N. 2470 2471config SEQ_BUF_KUNIT_TEST 2472 tristate "KUnit test for seq_buf" if !KUNIT_ALL_TESTS 2473 depends on KUNIT 2474 default KUNIT_ALL_TESTS 2475 help 2476 This builds unit tests for the seq_buf library. 2477 2478 If unsure, say N. 2479 2480config STRING_KUNIT_TEST 2481 tristate "KUnit test string functions at runtime" if !KUNIT_ALL_TESTS 2482 depends on KUNIT 2483 default KUNIT_ALL_TESTS 2484 2485config STRING_HELPERS_KUNIT_TEST 2486 tristate "KUnit test string helpers at runtime" if !KUNIT_ALL_TESTS 2487 depends on KUNIT 2488 default KUNIT_ALL_TESTS 2489 2490config FFS_KUNIT_TEST 2491 tristate "KUnit test ffs-family functions at runtime" if !KUNIT_ALL_TESTS 2492 depends on KUNIT 2493 default KUNIT_ALL_TESTS 2494 help 2495 This builds KUnit tests for ffs-family bit manipulation functions 2496 including ffs(), __ffs(), fls(), __fls(), fls64(), and __ffs64(). 2497 2498 These tests validate mathematical correctness, edge case handling, 2499 and cross-architecture consistency of bit scanning functions. 2500 2501 For more information on KUnit and unit tests in general, 2502 please refer to Documentation/dev-tools/kunit/. 2503 2504config TEST_KSTRTOX 2505 tristate "Test kstrto*() family of functions at runtime" 2506 2507config TEST_BITMAP 2508 tristate "Test bitmap_*() family of functions at runtime" 2509 help 2510 Enable this option to test the bitmap functions at boot. 2511 2512 If unsure, say N. 2513 2514config TEST_UUID 2515 tristate "Test functions located in the uuid module at runtime" 2516 2517config TEST_XARRAY 2518 tristate "Test the XArray code at runtime" 2519 2520config TEST_MAPLE_TREE 2521 tristate "Test the Maple Tree code at runtime or module load" 2522 help 2523 Enable this option to test the maple tree code functions at boot, or 2524 when the module is loaded. Enable "Debug Maple Trees" will enable 2525 more verbose output on failures. 2526 2527 If unsure, say N. 2528 2529config TEST_RHASHTABLE 2530 tristate "Perform selftest on resizable hash table" 2531 help 2532 Enable this option to test the rhashtable functions at boot. 2533 2534 If unsure, say N. 2535 2536config TEST_IDA 2537 tristate "Perform selftest on IDA functions" 2538 2539config TEST_MISC_MINOR 2540 bool "miscdevice KUnit test" if !KUNIT_ALL_TESTS 2541 depends on KUNIT=y 2542 default KUNIT_ALL_TESTS 2543 help 2544 Kunit test for miscdevice API, specially its behavior in respect to 2545 static and dynamic minor numbers. 2546 2547 KUnit tests run during boot and output the results to the debug log 2548 in TAP format (https://testanything.org/). Only useful for kernel devs 2549 running the KUnit test harness, and not intended for inclusion into a 2550 production build. 2551 2552 For more information on KUnit and unit tests in general please refer 2553 to the KUnit documentation in Documentation/dev-tools/kunit/. 2554 2555 If unsure, say N. 2556 2557config TEST_PARMAN 2558 tristate "Perform selftest on priority array manager" 2559 depends on PARMAN 2560 help 2561 Enable this option to test priority array manager on boot 2562 (or module load). 2563 2564 If unsure, say N. 2565 2566config TEST_IRQ_TIMINGS 2567 bool "IRQ timings selftest" 2568 depends on IRQ_TIMINGS 2569 help 2570 Enable this option to test the irq timings code on boot. 2571 2572 If unsure, say N. 2573 2574config TEST_LKM 2575 tristate "Test module loading with 'hello world' module" 2576 depends on m 2577 help 2578 This builds the "test_module" module that emits "Hello, world" 2579 on printk when loaded. It is designed to be used for basic 2580 evaluation of the module loading subsystem (for example when 2581 validating module verification). It lacks any extra dependencies, 2582 and will not normally be loaded by the system unless explicitly 2583 requested by name. 2584 2585 If unsure, say N. 2586 2587config TEST_BITOPS 2588 tristate "Test module for compilation of bitops operations" 2589 help 2590 This builds the "test_bitops" module that is much like the 2591 TEST_LKM module except that it does a basic exercise of the 2592 set/clear_bit macros and get_count_order/long to make sure there are 2593 no compiler warnings from C=1 sparse checker or -Wextra 2594 compilations. It has no dependencies and doesn't run or load unless 2595 explicitly requested by name. for example: modprobe test_bitops. 2596 2597 If unsure, say N. 2598 2599config TEST_VMALLOC 2600 tristate "Test module for stress/performance analysis of vmalloc allocator" 2601 default n 2602 depends on MMU 2603 help 2604 This builds the "test_vmalloc" module that should be used for 2605 stress and performance analysis. So, any new change for vmalloc 2606 subsystem can be evaluated from performance and stability point 2607 of view. 2608 2609 If unsure, say N. 2610 2611config TEST_BPF 2612 tristate "Test BPF filter functionality" 2613 depends on m && NET 2614 help 2615 This builds the "test_bpf" module that runs various test vectors 2616 against the BPF interpreter or BPF JIT compiler depending on the 2617 current setting. This is in particular useful for BPF JIT compiler 2618 development, but also to run regression tests against changes in 2619 the interpreter code. It also enables test stubs for eBPF maps and 2620 verifier used by user space verifier testsuite. 2621 2622 If unsure, say N. 2623 2624config FIND_BIT_BENCHMARK 2625 tristate "Test find_bit functions" 2626 help 2627 This builds the "test_find_bit" module that measure find_*_bit() 2628 functions performance. 2629 2630 If unsure, say N. 2631 2632config FIND_BIT_BENCHMARK_RUST 2633 tristate "Test find_bit functions in Rust" 2634 depends on RUST 2635 help 2636 This builds the "find_bit_benchmark_rust" module. It is a micro 2637 benchmark that measures the performance of Rust functions that 2638 correspond to the find_*_bit() operations in C. It follows the 2639 FIND_BIT_BENCHMARK closely but will in general not yield same 2640 numbers due to extra bounds checks and overhead of foreign 2641 function calls. 2642 2643 If unsure, say N. 2644 2645config TEST_FIRMWARE 2646 tristate "Test firmware loading via userspace interface" 2647 depends on FW_LOADER 2648 help 2649 This builds the "test_firmware" module that creates a userspace 2650 interface for testing firmware loading. This can be used to 2651 control the triggering of firmware loading without needing an 2652 actual firmware-using device. The contents can be rechecked by 2653 userspace. 2654 2655 If unsure, say N. 2656 2657config TEST_SYSCTL 2658 tristate "sysctl test driver" 2659 depends on PROC_SYSCTL 2660 help 2661 This builds the "test_sysctl" module. This driver enables to test the 2662 proc sysctl interfaces available to drivers safely without affecting 2663 production knobs which might alter system functionality. 2664 2665 If unsure, say N. 2666 2667config BITFIELD_KUNIT 2668 tristate "KUnit test bitfield functions at runtime" if !KUNIT_ALL_TESTS 2669 depends on KUNIT 2670 default KUNIT_ALL_TESTS 2671 help 2672 Enable this option to test the bitfield functions at boot. 2673 2674 KUnit tests run during boot and output the results to the debug log 2675 in TAP format (http://testanything.org/). Only useful for kernel devs 2676 running the KUnit test harness, and not intended for inclusion into a 2677 production build. 2678 2679 For more information on KUnit and unit tests in general please refer 2680 to the KUnit documentation in Documentation/dev-tools/kunit/. 2681 2682 If unsure, say N. 2683 2684config CHECKSUM_KUNIT 2685 tristate "KUnit test checksum functions at runtime" if !KUNIT_ALL_TESTS 2686 depends on KUNIT 2687 default KUNIT_ALL_TESTS 2688 help 2689 Enable this option to test the checksum functions at boot. 2690 2691 KUnit tests run during boot and output the results to the debug log 2692 in TAP format (http://testanything.org/). Only useful for kernel devs 2693 running the KUnit test harness, and not intended for inclusion into a 2694 production build. 2695 2696 For more information on KUnit and unit tests in general please refer 2697 to the KUnit documentation in Documentation/dev-tools/kunit/. 2698 2699 If unsure, say N. 2700 2701config UTIL_MACROS_KUNIT 2702 tristate "KUnit test util_macros.h functions at runtime" if !KUNIT_ALL_TESTS 2703 depends on KUNIT 2704 default KUNIT_ALL_TESTS 2705 help 2706 Enable this option to test the util_macros.h function at boot. 2707 2708 KUnit tests run during boot and output the results to the debug log 2709 in TAP format (http://testanything.org/). Only useful for kernel devs 2710 running the KUnit test harness, and not intended for inclusion into a 2711 production build. 2712 2713 For more information on KUnit and unit tests in general please refer 2714 to the KUnit documentation in Documentation/dev-tools/kunit/. 2715 2716 If unsure, say N. 2717 2718config HASH_KUNIT_TEST 2719 tristate "KUnit Test for integer hash functions" if !KUNIT_ALL_TESTS 2720 depends on KUNIT 2721 default KUNIT_ALL_TESTS 2722 help 2723 Enable this option to test the kernel's string (<linux/stringhash.h>), and 2724 integer (<linux/hash.h>) hash functions on boot. 2725 2726 KUnit tests run during boot and output the results to the debug log 2727 in TAP format (https://testanything.org/). Only useful for kernel devs 2728 running the KUnit test harness, and not intended for inclusion into a 2729 production build. 2730 2731 For more information on KUnit and unit tests in general please refer 2732 to the KUnit documentation in Documentation/dev-tools/kunit/. 2733 2734 This is intended to help people writing architecture-specific 2735 optimized versions. If unsure, say N. 2736 2737config RESOURCE_KUNIT_TEST 2738 tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS 2739 depends on KUNIT 2740 default KUNIT_ALL_TESTS 2741 select GET_FREE_REGION 2742 help 2743 This builds the resource API unit test. 2744 Tests the logic of API provided by resource.c and ioport.h. 2745 For more information on KUnit and unit tests in general please refer 2746 to the KUnit documentation in Documentation/dev-tools/kunit/. 2747 2748 If unsure, say N. 2749 2750config SYSCTL_KUNIT_TEST 2751 tristate "KUnit test for sysctl" if !KUNIT_ALL_TESTS 2752 depends on KUNIT 2753 default KUNIT_ALL_TESTS 2754 help 2755 This builds the proc sysctl unit test, which runs on boot. 2756 Tests the API contract and implementation correctness of sysctl. 2757 For more information on KUnit and unit tests in general please refer 2758 to the KUnit documentation in Documentation/dev-tools/kunit/. 2759 2760 If unsure, say N. 2761 2762config KFIFO_KUNIT_TEST 2763 tristate "KUnit Test for the generic kernel FIFO implementation" if !KUNIT_ALL_TESTS 2764 depends on KUNIT 2765 default KUNIT_ALL_TESTS 2766 help 2767 This builds the generic FIFO implementation KUnit test suite. 2768 It tests that the API and basic functionality of the kfifo type 2769 and associated macros. 2770 2771 For more information on KUnit and unit tests in general please refer 2772 to the KUnit documentation in Documentation/dev-tools/kunit/. 2773 2774 If unsure, say N. 2775 2776config LIST_KUNIT_TEST 2777 tristate "KUnit Test for Kernel Linked-list structures" if !KUNIT_ALL_TESTS 2778 depends on KUNIT 2779 default KUNIT_ALL_TESTS 2780 help 2781 This builds the linked list KUnit test suite. 2782 It tests that the API and basic functionality of the list_head type 2783 and associated macros. 2784 2785 KUnit tests run during boot and output the results to the debug log 2786 in TAP format (https://testanything.org/). Only useful for kernel devs 2787 running the KUnit test harness, and not intended for inclusion into a 2788 production build. 2789 2790 For more information on KUnit and unit tests in general please refer 2791 to the KUnit documentation in Documentation/dev-tools/kunit/. 2792 2793 If unsure, say N. 2794 2795config HASHTABLE_KUNIT_TEST 2796 tristate "KUnit Test for Kernel Hashtable structures" if !KUNIT_ALL_TESTS 2797 depends on KUNIT 2798 default KUNIT_ALL_TESTS 2799 help 2800 This builds the hashtable KUnit test suite. 2801 It tests the basic functionality of the API defined in 2802 include/linux/hashtable.h. For more information on KUnit and 2803 unit tests in general please refer to the KUnit documentation 2804 in Documentation/dev-tools/kunit/. 2805 2806 If unsure, say N. 2807 2808config LINEAR_RANGES_TEST 2809 tristate "KUnit test for linear_ranges" 2810 depends on KUNIT 2811 select LINEAR_RANGES 2812 help 2813 This builds the linear_ranges unit test, which runs on boot. 2814 Tests the linear_ranges logic correctness. 2815 For more information on KUnit and unit tests in general please refer 2816 to the KUnit documentation in Documentation/dev-tools/kunit/. 2817 2818 If unsure, say N. 2819 2820config CMDLINE_KUNIT_TEST 2821 tristate "KUnit test for cmdline API" if !KUNIT_ALL_TESTS 2822 depends on KUNIT 2823 default KUNIT_ALL_TESTS 2824 help 2825 This builds the cmdline API unit test. 2826 Tests the logic of API provided by cmdline.c. 2827 For more information on KUnit and unit tests in general please refer 2828 to the KUnit documentation in Documentation/dev-tools/kunit/. 2829 2830 If unsure, say N. 2831 2832config BASE64_KUNIT 2833 tristate "KUnit test for base64 decoding and encoding" if !KUNIT_ALL_TESTS 2834 depends on KUNIT 2835 default KUNIT_ALL_TESTS 2836 help 2837 This builds the base64 unit tests. 2838 2839 The tests cover the encoding and decoding logic of Base64 functions 2840 in the kernel. 2841 In addition to correctness checks, simple performance benchmarks 2842 for both encoding and decoding are also included. 2843 2844 For more information on KUnit and unit tests in general please refer 2845 to the KUnit documentation in Documentation/dev-tools/kunit/. 2846 2847 If unsure, say N. 2848 2849config BITS_TEST 2850 tristate "KUnit test for bit functions and macros" if !KUNIT_ALL_TESTS 2851 depends on KUNIT 2852 default KUNIT_ALL_TESTS 2853 help 2854 This builds the bits unit test. 2855 Tests the logic of macros defined in bits.h. 2856 For more information on KUnit and unit tests in general please refer 2857 to the KUnit documentation in Documentation/dev-tools/kunit/. 2858 2859 If unsure, say N. 2860 2861config SLUB_KUNIT_TEST 2862 tristate "KUnit test for SLUB cache error detection" if !KUNIT_ALL_TESTS 2863 depends on SLUB_DEBUG && KUNIT 2864 default KUNIT_ALL_TESTS 2865 help 2866 This builds SLUB allocator unit test. 2867 Tests SLUB cache debugging functionality. 2868 For more information on KUnit and unit tests in general please refer 2869 to the KUnit documentation in Documentation/dev-tools/kunit/. 2870 2871 If unsure, say N. 2872 2873config RATIONAL_KUNIT_TEST 2874 tristate "KUnit test for rational.c" if !KUNIT_ALL_TESTS 2875 depends on KUNIT && RATIONAL 2876 default KUNIT_ALL_TESTS 2877 help 2878 This builds the rational math unit test. 2879 For more information on KUnit and unit tests in general please refer 2880 to the KUnit documentation in Documentation/dev-tools/kunit/. 2881 2882 If unsure, say N. 2883 2884config MEMCPY_KUNIT_TEST 2885 tristate "Test memcpy(), memmove(), and memset() functions at runtime" if !KUNIT_ALL_TESTS 2886 depends on KUNIT 2887 default KUNIT_ALL_TESTS 2888 help 2889 Builds unit tests for memcpy(), memmove(), and memset() functions. 2890 For more information on KUnit and unit tests in general please refer 2891 to the KUnit documentation in Documentation/dev-tools/kunit/. 2892 2893 If unsure, say N. 2894 2895config IS_SIGNED_TYPE_KUNIT_TEST 2896 tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS 2897 depends on KUNIT 2898 default KUNIT_ALL_TESTS 2899 help 2900 Builds unit tests for the is_signed_type() macro. 2901 2902 For more information on KUnit and unit tests in general please refer 2903 to the KUnit documentation in Documentation/dev-tools/kunit/. 2904 2905 If unsure, say N. 2906 2907config OVERFLOW_KUNIT_TEST 2908 tristate "Test check_*_overflow() functions at runtime" if !KUNIT_ALL_TESTS 2909 depends on KUNIT 2910 default KUNIT_ALL_TESTS 2911 help 2912 Builds unit tests for the check_*_overflow(), size_*(), allocation, and 2913 related functions. 2914 2915 For more information on KUnit and unit tests in general please refer 2916 to the KUnit documentation in Documentation/dev-tools/kunit/. 2917 2918 If unsure, say N. 2919 2920config RANDSTRUCT_KUNIT_TEST 2921 tristate "Test randstruct structure layout randomization at runtime" if !KUNIT_ALL_TESTS 2922 depends on KUNIT 2923 default KUNIT_ALL_TESTS 2924 help 2925 Builds unit tests for the checking CONFIG_RANDSTRUCT=y, which 2926 randomizes structure layouts. 2927 2928config STACKINIT_KUNIT_TEST 2929 tristate "Test level of stack variable initialization" if !KUNIT_ALL_TESTS 2930 depends on KUNIT 2931 default KUNIT_ALL_TESTS 2932 help 2933 Test if the kernel is zero-initializing stack variables and 2934 padding. Coverage is controlled by compiler flags, 2935 CONFIG_INIT_STACK_ALL_PATTERN or CONFIG_INIT_STACK_ALL_ZERO. 2936 2937config FORTIFY_KUNIT_TEST 2938 tristate "Test fortified str*() and mem*() function internals at runtime" if !KUNIT_ALL_TESTS 2939 depends on KUNIT 2940 default KUNIT_ALL_TESTS 2941 help 2942 Builds unit tests for checking internals of FORTIFY_SOURCE as used 2943 by the str*() and mem*() family of functions. For testing runtime 2944 traps of FORTIFY_SOURCE, see LKDTM's "FORTIFY_*" tests. 2945 2946config LONGEST_SYM_KUNIT_TEST 2947 tristate "Test the longest symbol possible" if !KUNIT_ALL_TESTS 2948 depends on KUNIT && KPROBES 2949 depends on !PREFIX_SYMBOLS && !CFI && !GCOV_KERNEL 2950 default KUNIT_ALL_TESTS 2951 help 2952 Tests the longest symbol possible 2953 2954 If unsure, say N. 2955 2956config HW_BREAKPOINT_KUNIT_TEST 2957 bool "Test hw_breakpoint constraints accounting" if !KUNIT_ALL_TESTS 2958 depends on HAVE_HW_BREAKPOINT 2959 depends on KUNIT=y 2960 default KUNIT_ALL_TESTS 2961 help 2962 Tests for hw_breakpoint constraints accounting. 2963 2964 If unsure, say N. 2965 2966config SIPHASH_KUNIT_TEST 2967 tristate "Perform selftest on siphash functions" if !KUNIT_ALL_TESTS 2968 depends on KUNIT 2969 default KUNIT_ALL_TESTS 2970 help 2971 Enable this option to test the kernel's siphash (<linux/siphash.h>) hash 2972 functions on boot (or module load). 2973 2974 This is intended to help people writing architecture-specific 2975 optimized versions. If unsure, say N. 2976 2977config USERCOPY_KUNIT_TEST 2978 tristate "KUnit Test for user/kernel boundary protections" 2979 depends on KUNIT 2980 default KUNIT_ALL_TESTS 2981 help 2982 This builds the "usercopy_kunit" module that runs sanity checks 2983 on the copy_to/from_user infrastructure, making sure basic 2984 user/kernel boundary testing is working. 2985 2986config BLACKHOLE_DEV_KUNIT_TEST 2987 tristate "Test blackhole netdev functionality" if !KUNIT_ALL_TESTS 2988 depends on NET 2989 depends on KUNIT 2990 default KUNIT_ALL_TESTS 2991 help 2992 This builds the "blackhole_dev_kunit" module that validates the 2993 data path through this blackhole netdev. 2994 2995 If unsure, say N. 2996 2997config TEST_UDELAY 2998 tristate "udelay test driver" 2999 help 3000 This builds the "udelay_test" module that helps to make sure 3001 that udelay() is working properly. 3002 3003 If unsure, say N. 3004 3005config TEST_STATIC_KEYS 3006 tristate "Test static keys" 3007 depends on m 3008 help 3009 Test the static key interfaces. 3010 3011 If unsure, say N. 3012 3013config TEST_DYNAMIC_DEBUG 3014 tristate "Test DYNAMIC_DEBUG" 3015 depends on DYNAMIC_DEBUG 3016 help 3017 This module registers a tracer callback to count enabled 3018 pr_debugs in a 'do_debugging' function, then alters their 3019 enablements, calls the function, and compares counts. 3020 3021 If unsure, say N. 3022 3023config TEST_KMOD 3024 tristate "kmod stress tester" 3025 depends on m 3026 select TEST_LKM 3027 help 3028 Test the kernel's module loading mechanism: kmod. kmod implements 3029 support to load modules using the Linux kernel's usermode helper. 3030 This test provides a series of tests against kmod. 3031 3032 Although technically you can either build test_kmod as a module or 3033 into the kernel we disallow building it into the kernel since 3034 it stress tests request_module() and this will very likely cause 3035 some issues by taking over precious threads available from other 3036 module load requests, ultimately this could be fatal. 3037 3038 To run tests run: 3039 3040 tools/testing/selftests/kmod/kmod.sh --help 3041 3042 If unsure, say N. 3043 3044config TEST_RUNTIME 3045 bool 3046 3047config TEST_RUNTIME_MODULE 3048 bool 3049 3050config TEST_KALLSYMS 3051 tristate "module kallsyms find_symbol() test" 3052 depends on m 3053 select TEST_RUNTIME 3054 select TEST_RUNTIME_MODULE 3055 select TEST_KALLSYMS_A 3056 select TEST_KALLSYMS_B 3057 select TEST_KALLSYMS_C 3058 select TEST_KALLSYMS_D 3059 help 3060 This allows us to stress test find_symbol() through the kallsyms 3061 used to place symbols on the kernel ELF kallsyms and modules kallsyms 3062 where we place kernel symbols such as exported symbols. 3063 3064 We have four test modules: 3065 3066 A: has KALLSYSMS_NUMSYMS exported symbols 3067 B: uses one of A's symbols 3068 C: adds KALLSYMS_SCALE_FACTOR * KALLSYSMS_NUMSYMS exported 3069 D: adds 2 * the symbols than C 3070 3071 We stress test find_symbol() through two means: 3072 3073 1) Upon load of B it will trigger simplify_symbols() to look for the 3074 one symbol it uses from the module A with tons of symbols. This is an 3075 indirect way for us to have B call resolve_symbol_wait() upon module 3076 load. This will eventually call find_symbol() which will eventually 3077 try to find the symbols used with find_exported_symbol_in_section(). 3078 find_exported_symbol_in_section() uses bsearch() so a binary search 3079 for each symbol. Binary search will at worst be O(log(n)) so the 3080 larger TEST_MODULE_KALLSYSMS the worse the search. 3081 3082 2) The selftests should load C first, before B. Upon B's load towards 3083 the end right before we call module B's init routine we get 3084 complete_formation() called on the module. That will first check 3085 for duplicate symbols with the call to verify_exported_symbols(). 3086 That is when we'll force iteration on module C's insane symbol list. 3087 Since it has 10 * KALLSYMS_NUMSYMS it means we can first test 3088 just loading B without C. The amount of time it takes to load C Vs 3089 B can give us an idea of the impact growth of the symbol space and 3090 give us projection. Module A only uses one symbol from B so to allow 3091 this scaling in module C to be proportional, if it used more symbols 3092 then the first test would be doing more and increasing just the 3093 search space would be slightly different. The last module, module D 3094 will just increase the search space by twice the number of symbols in 3095 C so to allow for full projects. 3096 3097 tools/testing/selftests/module/find_symbol.sh 3098 3099 The current defaults will incur a build delay of about 7 minutes 3100 on an x86_64 with only 8 cores. Enable this only if you want to 3101 stress test find_symbol() with thousands of symbols. At the same 3102 time this is also useful to test building modules with thousands of 3103 symbols, and if BTF is enabled this also stress tests adding BTF 3104 information for each module. Currently enabling many more symbols 3105 will segfault the build system. 3106 3107 If unsure, say N. 3108 3109if TEST_KALLSYMS 3110 3111config TEST_KALLSYMS_A 3112 tristate 3113 depends on m 3114 3115config TEST_KALLSYMS_B 3116 tristate 3117 depends on m 3118 3119config TEST_KALLSYMS_C 3120 tristate 3121 depends on m 3122 3123config TEST_KALLSYMS_D 3124 tristate 3125 depends on m 3126 3127choice 3128 prompt "Kallsym test range" 3129 default TEST_KALLSYMS_LARGE 3130 help 3131 Selecting something other than "Fast" will enable tests which slow 3132 down the build and may crash your build. 3133 3134config TEST_KALLSYMS_FAST 3135 bool "Fast builds" 3136 help 3137 You won't really be testing kallsysms, so this just helps fast builds 3138 when allmodconfig is used.. 3139 3140config TEST_KALLSYMS_LARGE 3141 bool "Enable testing kallsyms with large exports" 3142 help 3143 This will enable larger number of symbols. This will slow down 3144 your build considerably. 3145 3146config TEST_KALLSYMS_MAX 3147 bool "Known kallsysms limits" 3148 help 3149 This will enable exports to the point we know we'll start crashing 3150 builds. 3151 3152endchoice 3153 3154config TEST_KALLSYMS_NUMSYMS 3155 int "test kallsyms number of symbols" 3156 range 2 10000 3157 default 2 if TEST_KALLSYMS_FAST 3158 default 100 if TEST_KALLSYMS_LARGE 3159 default 10000 if TEST_KALLSYMS_MAX 3160 help 3161 The number of symbols to create on TEST_KALLSYMS_A, only one of which 3162 module TEST_KALLSYMS_B will use. This also will be used 3163 for how many symbols TEST_KALLSYMS_C will have, scaled up by 3164 TEST_KALLSYMS_SCALE_FACTOR. Note that setting this to 10,000 will 3165 trigger a segfault today, don't use anything close to it unless 3166 you are aware that this should not be used for automated build tests. 3167 3168config TEST_KALLSYMS_SCALE_FACTOR 3169 int "test kallsyms scale factor" 3170 default 8 3171 help 3172 How many more unusued symbols will TEST_KALLSYSMS_C have than 3173 TEST_KALLSYMS_A. If 8, then module C will have 8 * syms 3174 than module A. Then TEST_KALLSYMS_D will have double the amount 3175 of symbols than C so to allow projections. 3176 3177endif # TEST_KALLSYMS 3178 3179config TEST_DEBUG_VIRTUAL 3180 tristate "Test CONFIG_DEBUG_VIRTUAL feature" 3181 depends on DEBUG_VIRTUAL 3182 help 3183 Test the kernel's ability to detect incorrect calls to 3184 virt_to_phys() done against the non-linear part of the 3185 kernel's virtual address map. 3186 3187 If unsure, say N. 3188 3189config TEST_MEMCAT_P 3190 tristate "Test memcat_p() helper function" 3191 help 3192 Test the memcat_p() helper for correctly merging two 3193 pointer arrays together. 3194 3195 If unsure, say N. 3196 3197config TEST_OBJAGG 3198 tristate "Perform selftest on object aggreration manager" 3199 default n 3200 depends on OBJAGG 3201 help 3202 Enable this option to test object aggregation manager on boot 3203 (or module load). 3204 3205config TEST_MEMINIT 3206 tristate "Test heap/page initialization" 3207 help 3208 Test if the kernel is zero-initializing heap and page allocations. 3209 This can be useful to test init_on_alloc and init_on_free features. 3210 3211 If unsure, say N. 3212 3213config TEST_HMM 3214 tristate "Test HMM (Heterogeneous Memory Management)" 3215 depends on TRANSPARENT_HUGEPAGE 3216 depends on DEVICE_PRIVATE 3217 select HMM_MIRROR 3218 select MMU_NOTIFIER 3219 help 3220 This is a pseudo device driver solely for testing HMM. 3221 Say M here if you want to build the HMM test module. 3222 Doing so will allow you to run tools/testing/selftest/vm/hmm-tests. 3223 3224 If unsure, say N. 3225 3226config TEST_FREE_PAGES 3227 tristate "Test freeing pages" 3228 help 3229 Test that a memory leak does not occur due to a race between 3230 freeing a block of pages and a speculative page reference. 3231 Loading this module is safe if your kernel has the bug fixed. 3232 If the bug is not fixed, it will leak gigabytes of memory and 3233 probably OOM your system. 3234 3235config TEST_FPU 3236 tristate "Test floating point operations in kernel space" 3237 depends on ARCH_HAS_KERNEL_FPU_SUPPORT && !KCOV_INSTRUMENT_ALL 3238 help 3239 Enable this option to add /sys/kernel/debug/selftest_helpers/test_fpu 3240 which will trigger a sequence of floating point operations. This is used 3241 for self-testing floating point control register setting in 3242 kernel_fpu_begin(). 3243 3244 If unsure, say N. 3245 3246config TEST_CLOCKSOURCE_WATCHDOG 3247 tristate "Test clocksource watchdog in kernel space" 3248 depends on CLOCKSOURCE_WATCHDOG 3249 help 3250 Enable this option to create a kernel module that will trigger 3251 a test of the clocksource watchdog. This module may be loaded 3252 via modprobe or insmod in which case it will run upon being 3253 loaded, or it may be built in, in which case it will run 3254 shortly after boot. 3255 3256 If unsure, say N. 3257 3258config TEST_OBJPOOL 3259 tristate "Test module for correctness and stress of objpool" 3260 default n 3261 depends on m && DEBUG_KERNEL 3262 help 3263 This builds the "test_objpool" module that should be used for 3264 correctness verification and concurrent testings of objects 3265 allocation and reclamation. 3266 3267 If unsure, say N. 3268 3269config TEST_KEXEC_HANDOVER 3270 bool "Test for Kexec HandOver" 3271 default n 3272 depends on KEXEC_HANDOVER 3273 help 3274 This option enables test for Kexec HandOver (KHO). 3275 The test consists of two parts: saving kernel data before kexec and 3276 restoring the data after kexec and verifying that it was properly 3277 handed over. This test module creates and saves data on the boot of 3278 the first kernel and restores and verifies the data on the boot of 3279 kexec'ed kernel. 3280 3281 For detailed documentation about KHO, see Documentation/core-api/kho. 3282 3283 To run the test run: 3284 3285 tools/testing/selftests/kho/vmtest.sh -h 3286 3287 If unsure, say N. 3288 3289config RATELIMIT_KUNIT_TEST 3290 tristate "KUnit Test for correctness and stress of ratelimit" if !KUNIT_ALL_TESTS 3291 depends on KUNIT 3292 default KUNIT_ALL_TESTS 3293 help 3294 This builds the "test_ratelimit" module that should be used 3295 for correctness verification and concurrent testings of rate 3296 limiting. 3297 3298 If unsure, say N. 3299 3300config INT_POW_KUNIT_TEST 3301 tristate "Integer exponentiation (int_pow) test" if !KUNIT_ALL_TESTS 3302 depends on KUNIT 3303 default KUNIT_ALL_TESTS 3304 help 3305 This option enables the KUnit test suite for the int_pow function, 3306 which performs integer exponentiation. The test suite is designed to 3307 verify that the implementation of int_pow correctly computes the power 3308 of a given base raised to a given exponent. 3309 3310 Enabling this option will include tests that check various scenarios 3311 and edge cases to ensure the accuracy and reliability of the exponentiation 3312 function. 3313 3314 If unsure, say N 3315 3316config INT_SQRT_KUNIT_TEST 3317 tristate "Integer square root test" if !KUNIT_ALL_TESTS 3318 depends on KUNIT 3319 default KUNIT_ALL_TESTS 3320 help 3321 This option enables the KUnit test suite for the int_sqrt() function, 3322 which performs square root calculation. The test suite checks 3323 various scenarios, including edge cases, to ensure correctness. 3324 3325 Enabling this option will include tests that check various scenarios 3326 and edge cases to ensure the accuracy and reliability of the square root 3327 function. 3328 3329 If unsure, say N 3330 3331config INT_LOG_KUNIT_TEST 3332 tristate "Integer log (int_log) test" if !KUNIT_ALL_TESTS 3333 depends on KUNIT 3334 default KUNIT_ALL_TESTS 3335 help 3336 This option enables the KUnit test suite for the int_log library, which 3337 provides two functions to compute the integer logarithm in base 2 and 3338 base 10, called respectively as intlog2 and intlog10. 3339 3340 If unsure, say N 3341 3342config GCD_KUNIT_TEST 3343 tristate "Greatest common divisor test" if !KUNIT_ALL_TESTS 3344 depends on KUNIT 3345 default KUNIT_ALL_TESTS 3346 help 3347 This option enables the KUnit test suite for the gcd() function, 3348 which computes the greatest common divisor of two numbers. 3349 3350 This test suite verifies the correctness of gcd() across various 3351 scenarios, including edge cases. 3352 3353 If unsure, say N 3354 3355config PRIME_NUMBERS_KUNIT_TEST 3356 tristate "Prime number generator test" if !KUNIT_ALL_TESTS 3357 depends on KUNIT 3358 depends on PRIME_NUMBERS 3359 default KUNIT_ALL_TESTS 3360 help 3361 This option enables the KUnit test suite for the {is,next}_prime_number 3362 functions. 3363 3364 Enabling this option will include tests that compare the prime number 3365 generator functions against a brute force implementation. 3366 3367 If unsure, say N 3368 3369endif # RUNTIME_TESTING_MENU 3370 3371config ARCH_USE_MEMTEST 3372 bool 3373 help 3374 An architecture should select this when it uses early_memtest() 3375 during boot process. 3376 3377config MEMTEST 3378 bool "Memtest" 3379 depends on ARCH_USE_MEMTEST 3380 help 3381 This option adds a kernel parameter 'memtest', which allows memtest 3382 to be set and executed. 3383 memtest=0, mean disabled; -- default 3384 memtest=1, mean do 1 test pattern; 3385 ... 3386 memtest=17, mean do 17 test patterns. 3387 If you are unsure how to answer this question, answer N. 3388 3389 3390 3391config HYPERV_TESTING 3392 bool "Microsoft Hyper-V driver testing" 3393 default n 3394 depends on HYPERV && DEBUG_FS 3395 help 3396 Select this option to enable Hyper-V vmbus testing. 3397 3398endmenu # "Kernel Testing and Coverage" 3399 3400menu "Rust hacking" 3401 3402config RUST_DEBUG_ASSERTIONS 3403 bool "Debug assertions" 3404 depends on RUST 3405 help 3406 Enables rustc's `-Cdebug-assertions` codegen option. 3407 3408 This flag lets you turn `cfg(debug_assertions)` conditional 3409 compilation on or off. This can be used to enable extra debugging 3410 code in development but not in production. For example, it controls 3411 the behavior of the standard library's `debug_assert!` macro. 3412 3413 Note that this will apply to all Rust code, including `core`. 3414 3415 If unsure, say N. 3416 3417config RUST_OVERFLOW_CHECKS 3418 bool "Overflow checks" 3419 default y 3420 depends on RUST 3421 help 3422 Enables rustc's `-Coverflow-checks` codegen option. 3423 3424 This flag allows you to control the behavior of runtime integer 3425 overflow. When overflow-checks are enabled, a Rust panic will occur 3426 on overflow. 3427 3428 Note that this will apply to all Rust code, including `core`. 3429 3430 If unsure, say Y. 3431 3432config RUST_BUILD_ASSERT_ALLOW 3433 bool "Allow unoptimized build-time assertions" 3434 depends on RUST 3435 help 3436 Controls how `build_error!` and `build_assert!` are handled during the build. 3437 3438 If calls to them exist in the binary, it may indicate a violated invariant 3439 or that the optimizer failed to verify the invariant during compilation. 3440 3441 This should not happen, thus by default the build is aborted. However, 3442 as an escape hatch, you can choose Y here to ignore them during build 3443 and let the check be carried at runtime (with `panic!` being called if 3444 the check fails). 3445 3446 If unsure, say N. 3447 3448config RUST_KERNEL_DOCTESTS 3449 bool "Doctests for the `kernel` crate" if !KUNIT_ALL_TESTS 3450 depends on RUST && KUNIT=y 3451 default KUNIT_ALL_TESTS 3452 help 3453 This builds the documentation tests of the `kernel` crate 3454 as KUnit tests. 3455 3456 For more information on KUnit and unit tests in general, 3457 please refer to the KUnit documentation in Documentation/dev-tools/kunit/. 3458 3459 If unsure, say N. 3460 3461endmenu # "Rust" 3462 3463endmenu # Kernel hacking 3464