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