1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only 2*4882a593Smuzhiyunmenu "Kernel hacking" 3*4882a593Smuzhiyun 4*4882a593Smuzhiyunmenu "printk and dmesg options" 5*4882a593Smuzhiyun 6*4882a593Smuzhiyunconfig PRINTK_TIME 7*4882a593Smuzhiyun bool "Show timing information on printks" 8*4882a593Smuzhiyun depends on PRINTK 9*4882a593Smuzhiyun help 10*4882a593Smuzhiyun Selecting this option causes time stamps of the printk() 11*4882a593Smuzhiyun messages to be added to the output of the syslog() system 12*4882a593Smuzhiyun call and at the console. 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun The timestamp is always recorded internally, and exported 15*4882a593Smuzhiyun to /dev/kmsg. This flag just specifies if the timestamp should 16*4882a593Smuzhiyun be included, not that the timestamp is recorded. 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun The behavior is also controlled by the kernel command line 19*4882a593Smuzhiyun parameter printk.time=1. See Documentation/admin-guide/kernel-parameters.rst 20*4882a593Smuzhiyun 21*4882a593Smuzhiyunconfig PRINTK_TIME_FROM_ARM_ARCH_TIMER 22*4882a593Smuzhiyun bool "Timing from ARM architected timer" 23*4882a593Smuzhiyun depends on PRINTK_TIME && ARM_ARCH_TIMER && NO_GKI 24*4882a593Smuzhiyun 25*4882a593Smuzhiyunconfig PRINTK_CALLER 26*4882a593Smuzhiyun bool "Show caller information on printks" 27*4882a593Smuzhiyun depends on PRINTK 28*4882a593Smuzhiyun help 29*4882a593Smuzhiyun Selecting this option causes printk() to add a caller "thread id" (if 30*4882a593Smuzhiyun in task context) or a caller "processor id" (if not in task context) 31*4882a593Smuzhiyun to every message. 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun This option is intended for environments where multiple threads 34*4882a593Smuzhiyun concurrently call printk() for many times, for it is difficult to 35*4882a593Smuzhiyun interpret without knowing where these lines (or sometimes individual 36*4882a593Smuzhiyun line which was divided into multiple lines due to race) came from. 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun Since toggling after boot makes the code racy, currently there is 39*4882a593Smuzhiyun no option to enable/disable at the kernel command line parameter or 40*4882a593Smuzhiyun sysfs interface. 41*4882a593Smuzhiyun 42*4882a593Smuzhiyunconfig CONSOLE_LOGLEVEL_DEFAULT 43*4882a593Smuzhiyun int "Default console loglevel (1-15)" 44*4882a593Smuzhiyun range 1 15 45*4882a593Smuzhiyun default "7" 46*4882a593Smuzhiyun help 47*4882a593Smuzhiyun Default loglevel to determine what will be printed on the console. 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun Setting a default here is equivalent to passing in loglevel=<x> in 50*4882a593Smuzhiyun the kernel bootargs. loglevel=<x> continues to override whatever 51*4882a593Smuzhiyun value is specified here as well. 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun Note: This does not affect the log level of un-prefixed printk() 54*4882a593Smuzhiyun usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT 55*4882a593Smuzhiyun option. 56*4882a593Smuzhiyun 57*4882a593Smuzhiyunconfig CONSOLE_LOGLEVEL_QUIET 58*4882a593Smuzhiyun int "quiet console loglevel (1-15)" 59*4882a593Smuzhiyun range 1 15 60*4882a593Smuzhiyun default "4" 61*4882a593Smuzhiyun help 62*4882a593Smuzhiyun loglevel to use when "quiet" is passed on the kernel commandline. 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun When "quiet" is passed on the kernel commandline this loglevel 65*4882a593Smuzhiyun will be used as the loglevel. IOW passing "quiet" will be the 66*4882a593Smuzhiyun equivalent of passing "loglevel=<CONSOLE_LOGLEVEL_QUIET>" 67*4882a593Smuzhiyun 68*4882a593Smuzhiyunconfig MESSAGE_LOGLEVEL_DEFAULT 69*4882a593Smuzhiyun int "Default message log level (1-7)" 70*4882a593Smuzhiyun range 1 7 71*4882a593Smuzhiyun default "4" 72*4882a593Smuzhiyun help 73*4882a593Smuzhiyun Default log level for printk statements with no specified priority. 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun This was hard-coded to KERN_WARNING since at least 2.6.10 but folks 76*4882a593Smuzhiyun that are auditing their logs closely may want to set it to a lower 77*4882a593Smuzhiyun priority. 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun Note: This does not affect what message level gets printed on the console 80*4882a593Smuzhiyun by default. To change that, use loglevel=<x> in the kernel bootargs, 81*4882a593Smuzhiyun or pick a different CONSOLE_LOGLEVEL_DEFAULT configuration value. 82*4882a593Smuzhiyun 83*4882a593Smuzhiyunconfig BOOT_PRINTK_DELAY 84*4882a593Smuzhiyun bool "Delay each boot printk message by N milliseconds" 85*4882a593Smuzhiyun depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY 86*4882a593Smuzhiyun help 87*4882a593Smuzhiyun This build option allows you to read kernel boot messages 88*4882a593Smuzhiyun by inserting a short delay after each one. The delay is 89*4882a593Smuzhiyun specified in milliseconds on the kernel command line, 90*4882a593Smuzhiyun using "boot_delay=N". 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun It is likely that you would also need to use "lpj=M" to preset 93*4882a593Smuzhiyun the "loops per jiffie" value. 94*4882a593Smuzhiyun See a previous boot log for the "lpj" value to use for your 95*4882a593Smuzhiyun system, and then set "lpj=M" before setting "boot_delay=N". 96*4882a593Smuzhiyun NOTE: Using this option may adversely affect SMP systems. 97*4882a593Smuzhiyun I.e., processors other than the first one may not boot up. 98*4882a593Smuzhiyun BOOT_PRINTK_DELAY also may cause LOCKUP_DETECTOR to detect 99*4882a593Smuzhiyun what it believes to be lockup conditions. 100*4882a593Smuzhiyun 101*4882a593Smuzhiyunconfig DYNAMIC_DEBUG 102*4882a593Smuzhiyun bool "Enable dynamic printk() support" 103*4882a593Smuzhiyun default n 104*4882a593Smuzhiyun depends on PRINTK 105*4882a593Smuzhiyun depends on (DEBUG_FS || PROC_FS) 106*4882a593Smuzhiyun select DYNAMIC_DEBUG_CORE 107*4882a593Smuzhiyun help 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun Compiles debug level messages into the kernel, which would not 110*4882a593Smuzhiyun otherwise be available at runtime. These messages can then be 111*4882a593Smuzhiyun enabled/disabled based on various levels of scope - per source file, 112*4882a593Smuzhiyun function, module, format string, and line number. This mechanism 113*4882a593Smuzhiyun implicitly compiles in all pr_debug() and dev_dbg() calls, which 114*4882a593Smuzhiyun enlarges the kernel text size by about 2%. 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun If a source file is compiled with DEBUG flag set, any 117*4882a593Smuzhiyun pr_debug() calls in it are enabled by default, but can be 118*4882a593Smuzhiyun disabled at runtime as below. Note that DEBUG flag is 119*4882a593Smuzhiyun turned on by many CONFIG_*DEBUG* options. 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun Usage: 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun Dynamic debugging is controlled via the 'dynamic_debug/control' file, 124*4882a593Smuzhiyun which is contained in the 'debugfs' filesystem or procfs. 125*4882a593Smuzhiyun Thus, the debugfs or procfs filesystem must first be mounted before 126*4882a593Smuzhiyun making use of this feature. 127*4882a593Smuzhiyun We refer the control file as: <debugfs>/dynamic_debug/control. This 128*4882a593Smuzhiyun file contains a list of the debug statements that can be enabled. The 129*4882a593Smuzhiyun format for each line of the file is: 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun filename:lineno [module]function flags format 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun filename : source file of the debug statement 134*4882a593Smuzhiyun lineno : line number of the debug statement 135*4882a593Smuzhiyun module : module that contains the debug statement 136*4882a593Smuzhiyun function : function that contains the debug statement 137*4882a593Smuzhiyun flags : '=p' means the line is turned 'on' for printing 138*4882a593Smuzhiyun format : the format used for the debug statement 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun From a live system: 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun nullarbor:~ # cat <debugfs>/dynamic_debug/control 143*4882a593Smuzhiyun # filename:lineno [module]function flags format 144*4882a593Smuzhiyun fs/aio.c:222 [aio]__put_ioctx =_ "__put_ioctx:\040freeing\040%p\012" 145*4882a593Smuzhiyun fs/aio.c:248 [aio]ioctx_alloc =_ "ENOMEM:\040nr_events\040too\040high\012" 146*4882a593Smuzhiyun fs/aio.c:1770 [aio]sys_io_cancel =_ "calling\040cancel\012" 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun Example usage: 149*4882a593Smuzhiyun 150*4882a593Smuzhiyun // enable the message at line 1603 of file svcsock.c 151*4882a593Smuzhiyun nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > 152*4882a593Smuzhiyun <debugfs>/dynamic_debug/control 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun // enable all the messages in file svcsock.c 155*4882a593Smuzhiyun nullarbor:~ # echo -n 'file svcsock.c +p' > 156*4882a593Smuzhiyun <debugfs>/dynamic_debug/control 157*4882a593Smuzhiyun 158*4882a593Smuzhiyun // enable all the messages in the NFS server module 159*4882a593Smuzhiyun nullarbor:~ # echo -n 'module nfsd +p' > 160*4882a593Smuzhiyun <debugfs>/dynamic_debug/control 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun // enable all 12 messages in the function svc_process() 163*4882a593Smuzhiyun nullarbor:~ # echo -n 'func svc_process +p' > 164*4882a593Smuzhiyun <debugfs>/dynamic_debug/control 165*4882a593Smuzhiyun 166*4882a593Smuzhiyun // disable all 12 messages in the function svc_process() 167*4882a593Smuzhiyun nullarbor:~ # echo -n 'func svc_process -p' > 168*4882a593Smuzhiyun <debugfs>/dynamic_debug/control 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun See Documentation/admin-guide/dynamic-debug-howto.rst for additional 171*4882a593Smuzhiyun information. 172*4882a593Smuzhiyun 173*4882a593Smuzhiyunconfig DYNAMIC_DEBUG_CORE 174*4882a593Smuzhiyun bool "Enable core function of dynamic debug support" 175*4882a593Smuzhiyun depends on PRINTK 176*4882a593Smuzhiyun depends on (DEBUG_FS || PROC_FS) 177*4882a593Smuzhiyun help 178*4882a593Smuzhiyun Enable core functional support of dynamic debug. It is useful 179*4882a593Smuzhiyun when you want to tie dynamic debug to your kernel modules with 180*4882a593Smuzhiyun DYNAMIC_DEBUG_MODULE defined for each of them, especially for 181*4882a593Smuzhiyun the case of embedded system where the kernel image size is 182*4882a593Smuzhiyun sensitive for people. 183*4882a593Smuzhiyun 184*4882a593Smuzhiyunconfig SYMBOLIC_ERRNAME 185*4882a593Smuzhiyun bool "Support symbolic error names in printf" 186*4882a593Smuzhiyun default y if PRINTK 187*4882a593Smuzhiyun help 188*4882a593Smuzhiyun If you say Y here, the kernel's printf implementation will 189*4882a593Smuzhiyun be able to print symbolic error names such as ENOSPC instead 190*4882a593Smuzhiyun of the number 28. It makes the kernel image slightly larger 191*4882a593Smuzhiyun (about 3KB), but can make the kernel logs easier to read. 192*4882a593Smuzhiyun 193*4882a593Smuzhiyunconfig DEBUG_BUGVERBOSE 194*4882a593Smuzhiyun bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT 195*4882a593Smuzhiyun depends on BUG && (GENERIC_BUG || HAVE_DEBUG_BUGVERBOSE) 196*4882a593Smuzhiyun default y 197*4882a593Smuzhiyun help 198*4882a593Smuzhiyun Say Y here to make BUG() panics output the file name and line number 199*4882a593Smuzhiyun of the BUG call as well as the EIP and oops trace. This aids 200*4882a593Smuzhiyun debugging but costs about 70-100K of memory. 201*4882a593Smuzhiyun 202*4882a593Smuzhiyunendmenu # "printk and dmesg options" 203*4882a593Smuzhiyun 204*4882a593Smuzhiyunmenu "Compile-time checks and compiler options" 205*4882a593Smuzhiyun 206*4882a593Smuzhiyunconfig DEBUG_INFO 207*4882a593Smuzhiyun bool "Compile the kernel with debug info" 208*4882a593Smuzhiyun depends on DEBUG_KERNEL && !COMPILE_TEST 209*4882a593Smuzhiyun help 210*4882a593Smuzhiyun If you say Y here the resulting kernel image will include 211*4882a593Smuzhiyun debugging info resulting in a larger kernel image. 212*4882a593Smuzhiyun This adds debug symbols to the kernel and modules (gcc -g), and 213*4882a593Smuzhiyun is needed if you intend to use kernel crashdump or binary object 214*4882a593Smuzhiyun tools like crash, kgdb, LKCD, gdb, etc on the kernel. 215*4882a593Smuzhiyun Say Y here only if you plan to debug the kernel. 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun If unsure, say N. 218*4882a593Smuzhiyun 219*4882a593Smuzhiyunif DEBUG_INFO 220*4882a593Smuzhiyun 221*4882a593Smuzhiyunconfig DEBUG_INFO_REDUCED 222*4882a593Smuzhiyun bool "Reduce debugging information" 223*4882a593Smuzhiyun help 224*4882a593Smuzhiyun If you say Y here gcc is instructed to generate less debugging 225*4882a593Smuzhiyun information for structure types. This means that tools that 226*4882a593Smuzhiyun need full debugging information (like kgdb or systemtap) won't 227*4882a593Smuzhiyun be happy. But if you merely need debugging information to 228*4882a593Smuzhiyun resolve line numbers there is no loss. Advantage is that 229*4882a593Smuzhiyun build directory object sizes shrink dramatically over a full 230*4882a593Smuzhiyun DEBUG_INFO build and compile times are reduced too. 231*4882a593Smuzhiyun Only works with newer gcc versions. 232*4882a593Smuzhiyun 233*4882a593Smuzhiyunconfig DEBUG_INFO_COMPRESSED 234*4882a593Smuzhiyun bool "Compressed debugging information" 235*4882a593Smuzhiyun depends on $(cc-option,-gz=zlib) 236*4882a593Smuzhiyun depends on $(ld-option,--compress-debug-sections=zlib) 237*4882a593Smuzhiyun help 238*4882a593Smuzhiyun Compress the debug information using zlib. Requires GCC 5.0+ or Clang 239*4882a593Smuzhiyun 5.0+, binutils 2.26+, and zlib. 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun Users of dpkg-deb via scripts/package/builddeb may find an increase in 242*4882a593Smuzhiyun size of their debug .deb packages with this config set, due to the 243*4882a593Smuzhiyun debug info being compressed with zlib, then the object files being 244*4882a593Smuzhiyun recompressed with a different compression scheme. But this is still 245*4882a593Smuzhiyun preferable to setting $KDEB_COMPRESS to "none" which would be even 246*4882a593Smuzhiyun larger. 247*4882a593Smuzhiyun 248*4882a593Smuzhiyunconfig DEBUG_INFO_SPLIT 249*4882a593Smuzhiyun bool "Produce split debuginfo in .dwo files" 250*4882a593Smuzhiyun depends on $(cc-option,-gsplit-dwarf) 251*4882a593Smuzhiyun help 252*4882a593Smuzhiyun Generate debug info into separate .dwo files. This significantly 253*4882a593Smuzhiyun reduces the build directory size for builds with DEBUG_INFO, 254*4882a593Smuzhiyun because it stores the information only once on disk in .dwo 255*4882a593Smuzhiyun files instead of multiple times in object files and executables. 256*4882a593Smuzhiyun In addition the debug information is also compressed. 257*4882a593Smuzhiyun 258*4882a593Smuzhiyun Requires recent gcc (4.7+) and recent gdb/binutils. 259*4882a593Smuzhiyun Any tool that packages or reads debug information would need 260*4882a593Smuzhiyun to know about the .dwo files and include them. 261*4882a593Smuzhiyun Incompatible with older versions of ccache. 262*4882a593Smuzhiyun 263*4882a593Smuzhiyunconfig DEBUG_INFO_DWARF4 264*4882a593Smuzhiyun bool "Generate dwarf4 debuginfo" 265*4882a593Smuzhiyun depends on $(cc-option,-gdwarf-4) 266*4882a593Smuzhiyun help 267*4882a593Smuzhiyun Generate dwarf4 debug info. This requires recent versions 268*4882a593Smuzhiyun of gcc and gdb. It makes the debug information larger. 269*4882a593Smuzhiyun But it significantly improves the success of resolving 270*4882a593Smuzhiyun variables in gdb on optimized code. 271*4882a593Smuzhiyun 272*4882a593Smuzhiyunconfig DEBUG_INFO_BTF 273*4882a593Smuzhiyun bool "Generate BTF typeinfo" 274*4882a593Smuzhiyun depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED 275*4882a593Smuzhiyun depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST 276*4882a593Smuzhiyun help 277*4882a593Smuzhiyun Generate deduplicated BTF type information from DWARF debug info. 278*4882a593Smuzhiyun Turning this on expects presence of pahole tool, which will convert 279*4882a593Smuzhiyun DWARF type info into equivalent deduplicated BTF type info. 280*4882a593Smuzhiyun 281*4882a593Smuzhiyunconfig GDB_SCRIPTS 282*4882a593Smuzhiyun bool "Provide GDB scripts for kernel debugging" 283*4882a593Smuzhiyun help 284*4882a593Smuzhiyun This creates the required links to GDB helper scripts in the 285*4882a593Smuzhiyun build directory. If you load vmlinux into gdb, the helper 286*4882a593Smuzhiyun scripts will be automatically imported by gdb as well, and 287*4882a593Smuzhiyun additional functions are available to analyze a Linux kernel 288*4882a593Smuzhiyun instance. See Documentation/dev-tools/gdb-kernel-debugging.rst 289*4882a593Smuzhiyun for further details. 290*4882a593Smuzhiyun 291*4882a593Smuzhiyunendif # DEBUG_INFO 292*4882a593Smuzhiyun 293*4882a593Smuzhiyunconfig ENABLE_MUST_CHECK 294*4882a593Smuzhiyun bool "Enable __must_check logic" 295*4882a593Smuzhiyun default y 296*4882a593Smuzhiyun help 297*4882a593Smuzhiyun Enable the __must_check logic in the kernel build. Disable this to 298*4882a593Smuzhiyun suppress the "warning: ignoring return value of 'foo', declared with 299*4882a593Smuzhiyun attribute warn_unused_result" messages. 300*4882a593Smuzhiyun 301*4882a593Smuzhiyunconfig FRAME_WARN 302*4882a593Smuzhiyun int "Warn for stack frames larger than" 303*4882a593Smuzhiyun range 0 8192 304*4882a593Smuzhiyun default 2048 if GCC_PLUGIN_LATENT_ENTROPY 305*4882a593Smuzhiyun default 2048 if PARISC 306*4882a593Smuzhiyun default 1536 if (!64BIT && XTENSA) 307*4882a593Smuzhiyun default 1280 if KASAN && !64BIT 308*4882a593Smuzhiyun default 1024 if !64BIT 309*4882a593Smuzhiyun default 2048 if 64BIT 310*4882a593Smuzhiyun help 311*4882a593Smuzhiyun Tell gcc to warn at build time for stack frames larger than this. 312*4882a593Smuzhiyun Setting this too low will cause a lot of warnings. 313*4882a593Smuzhiyun Setting it to 0 disables the warning. 314*4882a593Smuzhiyun 315*4882a593Smuzhiyunconfig STRIP_ASM_SYMS 316*4882a593Smuzhiyun bool "Strip assembler-generated symbols during link" 317*4882a593Smuzhiyun default n 318*4882a593Smuzhiyun help 319*4882a593Smuzhiyun Strip internal assembler-generated symbols during a link (symbols 320*4882a593Smuzhiyun that look like '.Lxxx') so they don't pollute the output of 321*4882a593Smuzhiyun get_wchan() and suchlike. 322*4882a593Smuzhiyun 323*4882a593Smuzhiyunconfig READABLE_ASM 324*4882a593Smuzhiyun bool "Generate readable assembler code" 325*4882a593Smuzhiyun depends on DEBUG_KERNEL 326*4882a593Smuzhiyun help 327*4882a593Smuzhiyun Disable some compiler optimizations that tend to generate human unreadable 328*4882a593Smuzhiyun assembler output. This may make the kernel slightly slower, but it helps 329*4882a593Smuzhiyun to keep kernel developers who have to stare a lot at assembler listings 330*4882a593Smuzhiyun sane. 331*4882a593Smuzhiyun 332*4882a593Smuzhiyunconfig HEADERS_INSTALL 333*4882a593Smuzhiyun bool "Install uapi headers to usr/include" 334*4882a593Smuzhiyun depends on !UML 335*4882a593Smuzhiyun help 336*4882a593Smuzhiyun This option will install uapi headers (headers exported to user-space) 337*4882a593Smuzhiyun into the usr/include directory for use during the kernel build. 338*4882a593Smuzhiyun This is unneeded for building the kernel itself, but needed for some 339*4882a593Smuzhiyun user-space program samples. It is also needed by some features such 340*4882a593Smuzhiyun as uapi header sanity checks. 341*4882a593Smuzhiyun 342*4882a593Smuzhiyunconfig DEBUG_SECTION_MISMATCH 343*4882a593Smuzhiyun bool "Enable full Section mismatch analysis" 344*4882a593Smuzhiyun help 345*4882a593Smuzhiyun The section mismatch analysis checks if there are illegal 346*4882a593Smuzhiyun references from one section to another section. 347*4882a593Smuzhiyun During linktime or runtime, some sections are dropped; 348*4882a593Smuzhiyun any use of code/data previously in these sections would 349*4882a593Smuzhiyun most likely result in an oops. 350*4882a593Smuzhiyun In the code, functions and variables are annotated with 351*4882a593Smuzhiyun __init,, etc. (see the full list in include/linux/init.h), 352*4882a593Smuzhiyun which results in the code/data being placed in specific sections. 353*4882a593Smuzhiyun The section mismatch analysis is always performed after a full 354*4882a593Smuzhiyun kernel build, and enabling this option causes the following 355*4882a593Smuzhiyun additional step to occur: 356*4882a593Smuzhiyun - Add the option -fno-inline-functions-called-once to gcc commands. 357*4882a593Smuzhiyun When inlining a function annotated with __init in a non-init 358*4882a593Smuzhiyun function, we would lose the section information and thus 359*4882a593Smuzhiyun the analysis would not catch the illegal reference. 360*4882a593Smuzhiyun This option tells gcc to inline less (but it does result in 361*4882a593Smuzhiyun a larger kernel). 362*4882a593Smuzhiyun 363*4882a593Smuzhiyunconfig SECTION_MISMATCH_WARN_ONLY 364*4882a593Smuzhiyun bool "Make section mismatch errors non-fatal" 365*4882a593Smuzhiyun default y 366*4882a593Smuzhiyun help 367*4882a593Smuzhiyun If you say N here, the build process will fail if there are any 368*4882a593Smuzhiyun section mismatch, instead of just throwing warnings. 369*4882a593Smuzhiyun 370*4882a593Smuzhiyun If unsure, say Y. 371*4882a593Smuzhiyun 372*4882a593Smuzhiyunconfig DEBUG_FORCE_FUNCTION_ALIGN_32B 373*4882a593Smuzhiyun bool "Force all function address 32B aligned" if EXPERT 374*4882a593Smuzhiyun help 375*4882a593Smuzhiyun There are cases that a commit from one domain changes the function 376*4882a593Smuzhiyun address alignment of other domains, and cause magic performance 377*4882a593Smuzhiyun bump (regression or improvement). Enable this option will help to 378*4882a593Smuzhiyun verify if the bump is caused by function alignment changes, while 379*4882a593Smuzhiyun it will slightly increase the kernel size and affect icache usage. 380*4882a593Smuzhiyun 381*4882a593Smuzhiyun It is mainly for debug and performance tuning use. 382*4882a593Smuzhiyun 383*4882a593Smuzhiyun# 384*4882a593Smuzhiyun# Select this config option from the architecture Kconfig, if it 385*4882a593Smuzhiyun# is preferred to always offer frame pointers as a config 386*4882a593Smuzhiyun# option on the architecture (regardless of KERNEL_DEBUG): 387*4882a593Smuzhiyun# 388*4882a593Smuzhiyunconfig ARCH_WANT_FRAME_POINTERS 389*4882a593Smuzhiyun bool 390*4882a593Smuzhiyun 391*4882a593Smuzhiyunconfig FRAME_POINTER 392*4882a593Smuzhiyun bool "Compile the kernel with frame pointers" 393*4882a593Smuzhiyun depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS 394*4882a593Smuzhiyun default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS 395*4882a593Smuzhiyun help 396*4882a593Smuzhiyun If you say Y here the resulting kernel image will be slightly 397*4882a593Smuzhiyun larger and slower, but it gives very useful debugging information 398*4882a593Smuzhiyun in case of kernel bugs. (precise oopses/stacktraces/warnings) 399*4882a593Smuzhiyun 400*4882a593Smuzhiyunconfig STACK_VALIDATION 401*4882a593Smuzhiyun bool "Compile-time stack metadata validation" 402*4882a593Smuzhiyun depends on HAVE_STACK_VALIDATION 403*4882a593Smuzhiyun default n 404*4882a593Smuzhiyun help 405*4882a593Smuzhiyun Add compile-time checks to validate stack metadata, including frame 406*4882a593Smuzhiyun pointers (if CONFIG_FRAME_POINTER is enabled). This helps ensure 407*4882a593Smuzhiyun that runtime stack traces are more reliable. 408*4882a593Smuzhiyun 409*4882a593Smuzhiyun This is also a prerequisite for generation of ORC unwind data, which 410*4882a593Smuzhiyun is needed for CONFIG_UNWINDER_ORC. 411*4882a593Smuzhiyun 412*4882a593Smuzhiyun For more information, see 413*4882a593Smuzhiyun tools/objtool/Documentation/stack-validation.txt. 414*4882a593Smuzhiyun 415*4882a593Smuzhiyunconfig VMLINUX_VALIDATION 416*4882a593Smuzhiyun bool 417*4882a593Smuzhiyun depends on STACK_VALIDATION && DEBUG_ENTRY && !PARAVIRT 418*4882a593Smuzhiyun default y 419*4882a593Smuzhiyun 420*4882a593Smuzhiyunconfig DEBUG_FORCE_WEAK_PER_CPU 421*4882a593Smuzhiyun bool "Force weak per-cpu definitions" 422*4882a593Smuzhiyun depends on DEBUG_KERNEL 423*4882a593Smuzhiyun help 424*4882a593Smuzhiyun s390 and alpha require percpu variables in modules to be 425*4882a593Smuzhiyun defined weak to work around addressing range issue which 426*4882a593Smuzhiyun puts the following two restrictions on percpu variable 427*4882a593Smuzhiyun definitions. 428*4882a593Smuzhiyun 429*4882a593Smuzhiyun 1. percpu symbols must be unique whether static or not 430*4882a593Smuzhiyun 2. percpu variables can't be defined inside a function 431*4882a593Smuzhiyun 432*4882a593Smuzhiyun To ensure that generic code follows the above rules, this 433*4882a593Smuzhiyun option forces all percpu variables to be defined as weak. 434*4882a593Smuzhiyun 435*4882a593Smuzhiyunendmenu # "Compiler options" 436*4882a593Smuzhiyun 437*4882a593Smuzhiyunmenu "Generic Kernel Debugging Instruments" 438*4882a593Smuzhiyun 439*4882a593Smuzhiyunconfig MAGIC_SYSRQ 440*4882a593Smuzhiyun bool "Magic SysRq key" 441*4882a593Smuzhiyun depends on !UML 442*4882a593Smuzhiyun help 443*4882a593Smuzhiyun If you say Y here, you will have some control over the system even 444*4882a593Smuzhiyun if the system crashes for example during kernel debugging (e.g., you 445*4882a593Smuzhiyun will be able to flush the buffer cache to disk, reboot the system 446*4882a593Smuzhiyun immediately or dump some status information). This is accomplished 447*4882a593Smuzhiyun by pressing various keys while holding SysRq (Alt+PrintScreen). It 448*4882a593Smuzhiyun also works on a serial console (on PC hardware at least), if you 449*4882a593Smuzhiyun send a BREAK and then within 5 seconds a command keypress. The 450*4882a593Smuzhiyun keys are documented in <file:Documentation/admin-guide/sysrq.rst>. 451*4882a593Smuzhiyun Don't say Y unless you really know what this hack does. 452*4882a593Smuzhiyun 453*4882a593Smuzhiyunconfig MAGIC_SYSRQ_DEFAULT_ENABLE 454*4882a593Smuzhiyun hex "Enable magic SysRq key functions by default" 455*4882a593Smuzhiyun depends on MAGIC_SYSRQ 456*4882a593Smuzhiyun default 0x1 457*4882a593Smuzhiyun help 458*4882a593Smuzhiyun Specifies which SysRq key functions are enabled by default. 459*4882a593Smuzhiyun This may be set to 1 or 0 to enable or disable them all, or 460*4882a593Smuzhiyun to a bitmask as described in Documentation/admin-guide/sysrq.rst. 461*4882a593Smuzhiyun 462*4882a593Smuzhiyunconfig MAGIC_SYSRQ_SERIAL 463*4882a593Smuzhiyun bool "Enable magic SysRq key over serial" 464*4882a593Smuzhiyun depends on MAGIC_SYSRQ 465*4882a593Smuzhiyun default y 466*4882a593Smuzhiyun help 467*4882a593Smuzhiyun Many embedded boards have a disconnected TTL level serial which can 468*4882a593Smuzhiyun generate some garbage that can lead to spurious false sysrq detects. 469*4882a593Smuzhiyun This option allows you to decide whether you want to enable the 470*4882a593Smuzhiyun magic SysRq key. 471*4882a593Smuzhiyun 472*4882a593Smuzhiyunconfig MAGIC_SYSRQ_SERIAL_SEQUENCE 473*4882a593Smuzhiyun string "Char sequence that enables magic SysRq over serial" 474*4882a593Smuzhiyun depends on MAGIC_SYSRQ_SERIAL 475*4882a593Smuzhiyun default "" 476*4882a593Smuzhiyun help 477*4882a593Smuzhiyun Specifies a sequence of characters that can follow BREAK to enable 478*4882a593Smuzhiyun SysRq on a serial console. 479*4882a593Smuzhiyun 480*4882a593Smuzhiyun If unsure, leave an empty string and the option will not be enabled. 481*4882a593Smuzhiyun 482*4882a593Smuzhiyunconfig DEBUG_FS 483*4882a593Smuzhiyun bool "Debug Filesystem" 484*4882a593Smuzhiyun help 485*4882a593Smuzhiyun debugfs is a virtual file system that kernel developers use to put 486*4882a593Smuzhiyun debugging files into. Enable this option to be able to read and 487*4882a593Smuzhiyun write to these files. 488*4882a593Smuzhiyun 489*4882a593Smuzhiyun For detailed documentation on the debugfs API, see 490*4882a593Smuzhiyun Documentation/filesystems/. 491*4882a593Smuzhiyun 492*4882a593Smuzhiyun If unsure, say N. 493*4882a593Smuzhiyun 494*4882a593Smuzhiyunchoice 495*4882a593Smuzhiyun prompt "Debugfs default access" 496*4882a593Smuzhiyun depends on DEBUG_FS 497*4882a593Smuzhiyun default DEBUG_FS_ALLOW_ALL 498*4882a593Smuzhiyun help 499*4882a593Smuzhiyun This selects the default access restrictions for debugfs. 500*4882a593Smuzhiyun It can be overridden with kernel command line option 501*4882a593Smuzhiyun debugfs=[on,no-mount,off]. The restrictions apply for API access 502*4882a593Smuzhiyun and filesystem registration. 503*4882a593Smuzhiyun 504*4882a593Smuzhiyunconfig DEBUG_FS_ALLOW_ALL 505*4882a593Smuzhiyun bool "Access normal" 506*4882a593Smuzhiyun help 507*4882a593Smuzhiyun No restrictions apply. Both API and filesystem registration 508*4882a593Smuzhiyun is on. This is the normal default operation. 509*4882a593Smuzhiyun 510*4882a593Smuzhiyunconfig DEBUG_FS_DISALLOW_MOUNT 511*4882a593Smuzhiyun bool "Do not register debugfs as filesystem" 512*4882a593Smuzhiyun help 513*4882a593Smuzhiyun The API is open but filesystem is not loaded. Clients can still do 514*4882a593Smuzhiyun their work and read with debug tools that do not need 515*4882a593Smuzhiyun debugfs filesystem. 516*4882a593Smuzhiyun 517*4882a593Smuzhiyunconfig DEBUG_FS_ALLOW_NONE 518*4882a593Smuzhiyun bool "No access" 519*4882a593Smuzhiyun help 520*4882a593Smuzhiyun Access is off. Clients get -PERM when trying to create nodes in 521*4882a593Smuzhiyun debugfs tree and debugfs is not registered as a filesystem. 522*4882a593Smuzhiyun Client can then back-off or continue without debugfs access. 523*4882a593Smuzhiyun 524*4882a593Smuzhiyunendchoice 525*4882a593Smuzhiyun 526*4882a593Smuzhiyunsource "lib/Kconfig.kgdb" 527*4882a593Smuzhiyunsource "lib/Kconfig.ubsan" 528*4882a593Smuzhiyunsource "lib/Kconfig.kcsan" 529*4882a593Smuzhiyun 530*4882a593Smuzhiyunendmenu 531*4882a593Smuzhiyun 532*4882a593Smuzhiyunconfig DEBUG_KERNEL 533*4882a593Smuzhiyun bool "Kernel debugging" 534*4882a593Smuzhiyun help 535*4882a593Smuzhiyun Say Y here if you are developing drivers or trying to debug and 536*4882a593Smuzhiyun identify kernel problems. 537*4882a593Smuzhiyun 538*4882a593Smuzhiyunconfig DEBUG_MISC 539*4882a593Smuzhiyun bool "Miscellaneous debug code" 540*4882a593Smuzhiyun default DEBUG_KERNEL 541*4882a593Smuzhiyun depends on DEBUG_KERNEL 542*4882a593Smuzhiyun help 543*4882a593Smuzhiyun Say Y here if you need to enable miscellaneous debug code that should 544*4882a593Smuzhiyun be under a more specific debug option but isn't. 545*4882a593Smuzhiyun 546*4882a593Smuzhiyun 547*4882a593Smuzhiyunmenu "Memory Debugging" 548*4882a593Smuzhiyun 549*4882a593Smuzhiyunsource "mm/Kconfig.debug" 550*4882a593Smuzhiyun 551*4882a593Smuzhiyunconfig DEBUG_OBJECTS 552*4882a593Smuzhiyun bool "Debug object operations" 553*4882a593Smuzhiyun depends on DEBUG_KERNEL 554*4882a593Smuzhiyun help 555*4882a593Smuzhiyun If you say Y here, additional code will be inserted into the 556*4882a593Smuzhiyun kernel to track the life time of various objects and validate 557*4882a593Smuzhiyun the operations on those objects. 558*4882a593Smuzhiyun 559*4882a593Smuzhiyunconfig DEBUG_OBJECTS_SELFTEST 560*4882a593Smuzhiyun bool "Debug objects selftest" 561*4882a593Smuzhiyun depends on DEBUG_OBJECTS 562*4882a593Smuzhiyun help 563*4882a593Smuzhiyun This enables the selftest of the object debug code. 564*4882a593Smuzhiyun 565*4882a593Smuzhiyunconfig DEBUG_OBJECTS_FREE 566*4882a593Smuzhiyun bool "Debug objects in freed memory" 567*4882a593Smuzhiyun depends on DEBUG_OBJECTS 568*4882a593Smuzhiyun help 569*4882a593Smuzhiyun This enables checks whether a k/v free operation frees an area 570*4882a593Smuzhiyun which contains an object which has not been deactivated 571*4882a593Smuzhiyun properly. This can make kmalloc/kfree-intensive workloads 572*4882a593Smuzhiyun much slower. 573*4882a593Smuzhiyun 574*4882a593Smuzhiyunconfig DEBUG_OBJECTS_TIMERS 575*4882a593Smuzhiyun bool "Debug timer objects" 576*4882a593Smuzhiyun depends on DEBUG_OBJECTS 577*4882a593Smuzhiyun help 578*4882a593Smuzhiyun If you say Y here, additional code will be inserted into the 579*4882a593Smuzhiyun timer routines to track the life time of timer objects and 580*4882a593Smuzhiyun validate the timer operations. 581*4882a593Smuzhiyun 582*4882a593Smuzhiyunconfig DEBUG_OBJECTS_WORK 583*4882a593Smuzhiyun bool "Debug work objects" 584*4882a593Smuzhiyun depends on DEBUG_OBJECTS 585*4882a593Smuzhiyun help 586*4882a593Smuzhiyun If you say Y here, additional code will be inserted into the 587*4882a593Smuzhiyun work queue routines to track the life time of work objects and 588*4882a593Smuzhiyun validate the work operations. 589*4882a593Smuzhiyun 590*4882a593Smuzhiyunconfig DEBUG_OBJECTS_RCU_HEAD 591*4882a593Smuzhiyun bool "Debug RCU callbacks objects" 592*4882a593Smuzhiyun depends on DEBUG_OBJECTS 593*4882a593Smuzhiyun help 594*4882a593Smuzhiyun Enable this to turn on debugging of RCU list heads (call_rcu() usage). 595*4882a593Smuzhiyun 596*4882a593Smuzhiyunconfig DEBUG_OBJECTS_PERCPU_COUNTER 597*4882a593Smuzhiyun bool "Debug percpu counter objects" 598*4882a593Smuzhiyun depends on DEBUG_OBJECTS 599*4882a593Smuzhiyun help 600*4882a593Smuzhiyun If you say Y here, additional code will be inserted into the 601*4882a593Smuzhiyun percpu counter routines to track the life time of percpu counter 602*4882a593Smuzhiyun objects and validate the percpu counter operations. 603*4882a593Smuzhiyun 604*4882a593Smuzhiyunconfig DEBUG_OBJECTS_ENABLE_DEFAULT 605*4882a593Smuzhiyun int "debug_objects bootup default value (0-1)" 606*4882a593Smuzhiyun range 0 1 607*4882a593Smuzhiyun default "1" 608*4882a593Smuzhiyun depends on DEBUG_OBJECTS 609*4882a593Smuzhiyun help 610*4882a593Smuzhiyun Debug objects boot parameter default value 611*4882a593Smuzhiyun 612*4882a593Smuzhiyunconfig DEBUG_SLAB 613*4882a593Smuzhiyun bool "Debug slab memory allocations" 614*4882a593Smuzhiyun depends on DEBUG_KERNEL && SLAB 615*4882a593Smuzhiyun help 616*4882a593Smuzhiyun Say Y here to have the kernel do limited verification on memory 617*4882a593Smuzhiyun allocation as well as poisoning memory on free to catch use of freed 618*4882a593Smuzhiyun memory. This can make kmalloc/kfree-intensive workloads much slower. 619*4882a593Smuzhiyun 620*4882a593Smuzhiyunconfig SLUB_DEBUG_ON 621*4882a593Smuzhiyun bool "SLUB debugging on by default" 622*4882a593Smuzhiyun depends on SLUB && SLUB_DEBUG 623*4882a593Smuzhiyun default n 624*4882a593Smuzhiyun help 625*4882a593Smuzhiyun Boot with debugging on by default. SLUB boots by default with 626*4882a593Smuzhiyun the runtime debug capabilities switched off. Enabling this is 627*4882a593Smuzhiyun equivalent to specifying the "slub_debug" parameter on boot. 628*4882a593Smuzhiyun There is no support for more fine grained debug control like 629*4882a593Smuzhiyun possible with slub_debug=xxx. SLUB debugging may be switched 630*4882a593Smuzhiyun off in a kernel built with CONFIG_SLUB_DEBUG_ON by specifying 631*4882a593Smuzhiyun "slub_debug=-". 632*4882a593Smuzhiyun 633*4882a593Smuzhiyunconfig SLUB_STATS 634*4882a593Smuzhiyun default n 635*4882a593Smuzhiyun bool "Enable SLUB performance statistics" 636*4882a593Smuzhiyun depends on SLUB && SYSFS 637*4882a593Smuzhiyun help 638*4882a593Smuzhiyun SLUB statistics are useful to debug SLUBs allocation behavior in 639*4882a593Smuzhiyun order find ways to optimize the allocator. This should never be 640*4882a593Smuzhiyun enabled for production use since keeping statistics slows down 641*4882a593Smuzhiyun the allocator by a few percentage points. The slabinfo command 642*4882a593Smuzhiyun supports the determination of the most active slabs to figure 643*4882a593Smuzhiyun out which slabs are relevant to a particular load. 644*4882a593Smuzhiyun Try running: slabinfo -DA 645*4882a593Smuzhiyun 646*4882a593Smuzhiyunconfig HAVE_DEBUG_KMEMLEAK 647*4882a593Smuzhiyun bool 648*4882a593Smuzhiyun 649*4882a593Smuzhiyunconfig DEBUG_KMEMLEAK 650*4882a593Smuzhiyun bool "Kernel memory leak detector" 651*4882a593Smuzhiyun depends on DEBUG_KERNEL && HAVE_DEBUG_KMEMLEAK 652*4882a593Smuzhiyun select DEBUG_FS 653*4882a593Smuzhiyun select STACKTRACE if STACKTRACE_SUPPORT 654*4882a593Smuzhiyun select KALLSYMS 655*4882a593Smuzhiyun select CRC32 656*4882a593Smuzhiyun help 657*4882a593Smuzhiyun Say Y here if you want to enable the memory leak 658*4882a593Smuzhiyun detector. The memory allocation/freeing is traced in a way 659*4882a593Smuzhiyun similar to the Boehm's conservative garbage collector, the 660*4882a593Smuzhiyun difference being that the orphan objects are not freed but 661*4882a593Smuzhiyun only shown in /sys/kernel/debug/kmemleak. Enabling this 662*4882a593Smuzhiyun feature will introduce an overhead to memory 663*4882a593Smuzhiyun allocations. See Documentation/dev-tools/kmemleak.rst for more 664*4882a593Smuzhiyun details. 665*4882a593Smuzhiyun 666*4882a593Smuzhiyun Enabling DEBUG_SLAB or SLUB_DEBUG may increase the chances 667*4882a593Smuzhiyun of finding leaks due to the slab objects poisoning. 668*4882a593Smuzhiyun 669*4882a593Smuzhiyun In order to access the kmemleak file, debugfs needs to be 670*4882a593Smuzhiyun mounted (usually at /sys/kernel/debug). 671*4882a593Smuzhiyun 672*4882a593Smuzhiyunconfig DEBUG_KMEMLEAK_MEM_POOL_SIZE 673*4882a593Smuzhiyun int "Kmemleak memory pool size" 674*4882a593Smuzhiyun depends on DEBUG_KMEMLEAK 675*4882a593Smuzhiyun range 200 1000000 676*4882a593Smuzhiyun default 16000 677*4882a593Smuzhiyun help 678*4882a593Smuzhiyun Kmemleak must track all the memory allocations to avoid 679*4882a593Smuzhiyun reporting false positives. Since memory may be allocated or 680*4882a593Smuzhiyun freed before kmemleak is fully initialised, use a static pool 681*4882a593Smuzhiyun of metadata objects to track such callbacks. After kmemleak is 682*4882a593Smuzhiyun fully initialised, this memory pool acts as an emergency one 683*4882a593Smuzhiyun if slab allocations fail. 684*4882a593Smuzhiyun 685*4882a593Smuzhiyunconfig DEBUG_KMEMLEAK_TEST 686*4882a593Smuzhiyun tristate "Simple test for the kernel memory leak detector" 687*4882a593Smuzhiyun depends on DEBUG_KMEMLEAK && m 688*4882a593Smuzhiyun help 689*4882a593Smuzhiyun This option enables a module that explicitly leaks memory. 690*4882a593Smuzhiyun 691*4882a593Smuzhiyun If unsure, say N. 692*4882a593Smuzhiyun 693*4882a593Smuzhiyunconfig DEBUG_KMEMLEAK_DEFAULT_OFF 694*4882a593Smuzhiyun bool "Default kmemleak to off" 695*4882a593Smuzhiyun depends on DEBUG_KMEMLEAK 696*4882a593Smuzhiyun help 697*4882a593Smuzhiyun Say Y here to disable kmemleak by default. It can then be enabled 698*4882a593Smuzhiyun on the command line via kmemleak=on. 699*4882a593Smuzhiyun 700*4882a593Smuzhiyunconfig DEBUG_KMEMLEAK_AUTO_SCAN 701*4882a593Smuzhiyun bool "Enable kmemleak auto scan thread on boot up" 702*4882a593Smuzhiyun default y 703*4882a593Smuzhiyun depends on DEBUG_KMEMLEAK 704*4882a593Smuzhiyun help 705*4882a593Smuzhiyun Depending on the cpu, kmemleak scan may be cpu intensive and can 706*4882a593Smuzhiyun stall user tasks at times. This option enables/disables automatic 707*4882a593Smuzhiyun kmemleak scan at boot up. 708*4882a593Smuzhiyun 709*4882a593Smuzhiyun Say N here to disable kmemleak auto scan thread to stop automatic 710*4882a593Smuzhiyun scanning. Disabling this option disables automatic reporting of 711*4882a593Smuzhiyun memory leaks. 712*4882a593Smuzhiyun 713*4882a593Smuzhiyun If unsure, say Y. 714*4882a593Smuzhiyun 715*4882a593Smuzhiyunconfig DEBUG_STACK_USAGE 716*4882a593Smuzhiyun bool "Stack utilization instrumentation" 717*4882a593Smuzhiyun depends on DEBUG_KERNEL && !IA64 718*4882a593Smuzhiyun help 719*4882a593Smuzhiyun Enables the display of the minimum amount of free stack which each 720*4882a593Smuzhiyun task has ever had available in the sysrq-T and sysrq-P debug output. 721*4882a593Smuzhiyun 722*4882a593Smuzhiyun This option will slow down process creation somewhat. 723*4882a593Smuzhiyun 724*4882a593Smuzhiyunconfig SCHED_STACK_END_CHECK 725*4882a593Smuzhiyun bool "Detect stack corruption on calls to schedule()" 726*4882a593Smuzhiyun depends on DEBUG_KERNEL 727*4882a593Smuzhiyun default n 728*4882a593Smuzhiyun help 729*4882a593Smuzhiyun This option checks for a stack overrun on calls to schedule(). 730*4882a593Smuzhiyun If the stack end location is found to be over written always panic as 731*4882a593Smuzhiyun the content of the corrupted region can no longer be trusted. 732*4882a593Smuzhiyun This is to ensure no erroneous behaviour occurs which could result in 733*4882a593Smuzhiyun data corruption or a sporadic crash at a later stage once the region 734*4882a593Smuzhiyun is examined. The runtime overhead introduced is minimal. 735*4882a593Smuzhiyun 736*4882a593Smuzhiyunconfig ARCH_HAS_DEBUG_VM_PGTABLE 737*4882a593Smuzhiyun bool 738*4882a593Smuzhiyun help 739*4882a593Smuzhiyun An architecture should select this when it can successfully 740*4882a593Smuzhiyun build and run DEBUG_VM_PGTABLE. 741*4882a593Smuzhiyun 742*4882a593Smuzhiyunconfig DEBUG_VM 743*4882a593Smuzhiyun bool "Debug VM" 744*4882a593Smuzhiyun depends on DEBUG_KERNEL 745*4882a593Smuzhiyun help 746*4882a593Smuzhiyun Enable this to turn on extended checks in the virtual-memory system 747*4882a593Smuzhiyun that may impact performance. 748*4882a593Smuzhiyun 749*4882a593Smuzhiyun If unsure, say N. 750*4882a593Smuzhiyun 751*4882a593Smuzhiyunconfig DEBUG_VM_VMACACHE 752*4882a593Smuzhiyun bool "Debug VMA caching" 753*4882a593Smuzhiyun depends on DEBUG_VM 754*4882a593Smuzhiyun help 755*4882a593Smuzhiyun Enable this to turn on VMA caching debug information. Doing so 756*4882a593Smuzhiyun can cause significant overhead, so only enable it in non-production 757*4882a593Smuzhiyun environments. 758*4882a593Smuzhiyun 759*4882a593Smuzhiyun If unsure, say N. 760*4882a593Smuzhiyun 761*4882a593Smuzhiyunconfig DEBUG_VM_RB 762*4882a593Smuzhiyun bool "Debug VM red-black trees" 763*4882a593Smuzhiyun depends on DEBUG_VM 764*4882a593Smuzhiyun help 765*4882a593Smuzhiyun Enable VM red-black tree debugging information and extra validations. 766*4882a593Smuzhiyun 767*4882a593Smuzhiyun If unsure, say N. 768*4882a593Smuzhiyun 769*4882a593Smuzhiyunconfig DEBUG_VM_PGFLAGS 770*4882a593Smuzhiyun bool "Debug page-flags operations" 771*4882a593Smuzhiyun depends on DEBUG_VM 772*4882a593Smuzhiyun help 773*4882a593Smuzhiyun Enables extra validation on page flags operations. 774*4882a593Smuzhiyun 775*4882a593Smuzhiyun If unsure, say N. 776*4882a593Smuzhiyun 777*4882a593Smuzhiyunconfig DEBUG_VM_PGTABLE 778*4882a593Smuzhiyun bool "Debug arch page table for semantics compliance" 779*4882a593Smuzhiyun depends on MMU 780*4882a593Smuzhiyun depends on ARCH_HAS_DEBUG_VM_PGTABLE 781*4882a593Smuzhiyun default y if DEBUG_VM 782*4882a593Smuzhiyun help 783*4882a593Smuzhiyun This option provides a debug method which can be used to test 784*4882a593Smuzhiyun architecture page table helper functions on various platforms in 785*4882a593Smuzhiyun verifying if they comply with expected generic MM semantics. This 786*4882a593Smuzhiyun will help architecture code in making sure that any changes or 787*4882a593Smuzhiyun new additions of these helpers still conform to expected 788*4882a593Smuzhiyun semantics of the generic MM. Platforms will have to opt in for 789*4882a593Smuzhiyun this through ARCH_HAS_DEBUG_VM_PGTABLE. 790*4882a593Smuzhiyun 791*4882a593Smuzhiyun If unsure, say N. 792*4882a593Smuzhiyun 793*4882a593Smuzhiyunconfig ARCH_HAS_DEBUG_VIRTUAL 794*4882a593Smuzhiyun bool 795*4882a593Smuzhiyun 796*4882a593Smuzhiyunconfig DEBUG_VIRTUAL 797*4882a593Smuzhiyun bool "Debug VM translations" 798*4882a593Smuzhiyun depends on DEBUG_KERNEL && ARCH_HAS_DEBUG_VIRTUAL 799*4882a593Smuzhiyun help 800*4882a593Smuzhiyun Enable some costly sanity checks in virtual to page code. This can 801*4882a593Smuzhiyun catch mistakes with virt_to_page() and friends. 802*4882a593Smuzhiyun 803*4882a593Smuzhiyun If unsure, say N. 804*4882a593Smuzhiyun 805*4882a593Smuzhiyunconfig DEBUG_NOMMU_REGIONS 806*4882a593Smuzhiyun bool "Debug the global anon/private NOMMU mapping region tree" 807*4882a593Smuzhiyun depends on DEBUG_KERNEL && !MMU 808*4882a593Smuzhiyun help 809*4882a593Smuzhiyun This option causes the global tree of anonymous and private mapping 810*4882a593Smuzhiyun regions to be regularly checked for invalid topology. 811*4882a593Smuzhiyun 812*4882a593Smuzhiyunconfig DEBUG_MEMORY_INIT 813*4882a593Smuzhiyun bool "Debug memory initialisation" if EXPERT 814*4882a593Smuzhiyun default !EXPERT 815*4882a593Smuzhiyun help 816*4882a593Smuzhiyun Enable this for additional checks during memory initialisation. 817*4882a593Smuzhiyun The sanity checks verify aspects of the VM such as the memory model 818*4882a593Smuzhiyun and other information provided by the architecture. Verbose 819*4882a593Smuzhiyun information will be printed at KERN_DEBUG loglevel depending 820*4882a593Smuzhiyun on the mminit_loglevel= command-line option. 821*4882a593Smuzhiyun 822*4882a593Smuzhiyun If unsure, say Y 823*4882a593Smuzhiyun 824*4882a593Smuzhiyunconfig MEMORY_NOTIFIER_ERROR_INJECT 825*4882a593Smuzhiyun tristate "Memory hotplug notifier error injection module" 826*4882a593Smuzhiyun depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION 827*4882a593Smuzhiyun help 828*4882a593Smuzhiyun This option provides the ability to inject artificial errors to 829*4882a593Smuzhiyun memory hotplug notifier chain callbacks. It is controlled through 830*4882a593Smuzhiyun debugfs interface under /sys/kernel/debug/notifier-error-inject/memory 831*4882a593Smuzhiyun 832*4882a593Smuzhiyun If the notifier call chain should be failed with some events 833*4882a593Smuzhiyun notified, write the error code to "actions/<notifier event>/error". 834*4882a593Smuzhiyun 835*4882a593Smuzhiyun Example: Inject memory hotplug offline error (-12 == -ENOMEM) 836*4882a593Smuzhiyun 837*4882a593Smuzhiyun # cd /sys/kernel/debug/notifier-error-inject/memory 838*4882a593Smuzhiyun # echo -12 > actions/MEM_GOING_OFFLINE/error 839*4882a593Smuzhiyun # echo offline > /sys/devices/system/memory/memoryXXX/state 840*4882a593Smuzhiyun bash: echo: write error: Cannot allocate memory 841*4882a593Smuzhiyun 842*4882a593Smuzhiyun To compile this code as a module, choose M here: the module will 843*4882a593Smuzhiyun be called memory-notifier-error-inject. 844*4882a593Smuzhiyun 845*4882a593Smuzhiyun If unsure, say N. 846*4882a593Smuzhiyun 847*4882a593Smuzhiyunconfig DEBUG_PER_CPU_MAPS 848*4882a593Smuzhiyun bool "Debug access to per_cpu maps" 849*4882a593Smuzhiyun depends on DEBUG_KERNEL 850*4882a593Smuzhiyun depends on SMP 851*4882a593Smuzhiyun help 852*4882a593Smuzhiyun Say Y to verify that the per_cpu map being accessed has 853*4882a593Smuzhiyun been set up. This adds a fair amount of code to kernel memory 854*4882a593Smuzhiyun and decreases performance. 855*4882a593Smuzhiyun 856*4882a593Smuzhiyun Say N if unsure. 857*4882a593Smuzhiyun 858*4882a593Smuzhiyunconfig DEBUG_HIGHMEM 859*4882a593Smuzhiyun bool "Highmem debugging" 860*4882a593Smuzhiyun depends on DEBUG_KERNEL && HIGHMEM 861*4882a593Smuzhiyun help 862*4882a593Smuzhiyun This option enables additional error checking for high memory 863*4882a593Smuzhiyun systems. Disable for production systems. 864*4882a593Smuzhiyun 865*4882a593Smuzhiyunconfig HAVE_DEBUG_STACKOVERFLOW 866*4882a593Smuzhiyun bool 867*4882a593Smuzhiyun 868*4882a593Smuzhiyunconfig DEBUG_STACKOVERFLOW 869*4882a593Smuzhiyun bool "Check for stack overflows" 870*4882a593Smuzhiyun depends on DEBUG_KERNEL && HAVE_DEBUG_STACKOVERFLOW 871*4882a593Smuzhiyun help 872*4882a593Smuzhiyun Say Y here if you want to check for overflows of kernel, IRQ 873*4882a593Smuzhiyun and exception stacks (if your architecture uses them). This 874*4882a593Smuzhiyun option will show detailed messages if free stack space drops 875*4882a593Smuzhiyun below a certain limit. 876*4882a593Smuzhiyun 877*4882a593Smuzhiyun These kinds of bugs usually occur when call-chains in the 878*4882a593Smuzhiyun kernel get too deep, especially when interrupts are 879*4882a593Smuzhiyun involved. 880*4882a593Smuzhiyun 881*4882a593Smuzhiyun Use this in cases where you see apparently random memory 882*4882a593Smuzhiyun corruption, especially if it appears in 'struct thread_info' 883*4882a593Smuzhiyun 884*4882a593Smuzhiyun If in doubt, say "N". 885*4882a593Smuzhiyun 886*4882a593Smuzhiyunsource "lib/Kconfig.kasan" 887*4882a593Smuzhiyunsource "lib/Kconfig.kfence" 888*4882a593Smuzhiyun 889*4882a593Smuzhiyunendmenu # "Memory Debugging" 890*4882a593Smuzhiyun 891*4882a593Smuzhiyunconfig DEBUG_SHIRQ 892*4882a593Smuzhiyun bool "Debug shared IRQ handlers" 893*4882a593Smuzhiyun depends on DEBUG_KERNEL 894*4882a593Smuzhiyun help 895*4882a593Smuzhiyun Enable this to generate a spurious interrupt just before a shared 896*4882a593Smuzhiyun interrupt handler is deregistered (generating one when registering 897*4882a593Smuzhiyun is currently disabled). Drivers need to handle this correctly. Some 898*4882a593Smuzhiyun don't and need to be caught. 899*4882a593Smuzhiyun 900*4882a593Smuzhiyunmenu "Debug Oops, Lockups and Hangs" 901*4882a593Smuzhiyun 902*4882a593Smuzhiyunconfig PANIC_ON_OOPS 903*4882a593Smuzhiyun bool "Panic on Oops" 904*4882a593Smuzhiyun help 905*4882a593Smuzhiyun Say Y here to enable the kernel to panic when it oopses. This 906*4882a593Smuzhiyun has the same effect as setting oops=panic on the kernel command 907*4882a593Smuzhiyun line. 908*4882a593Smuzhiyun 909*4882a593Smuzhiyun This feature is useful to ensure that the kernel does not do 910*4882a593Smuzhiyun anything erroneous after an oops which could result in data 911*4882a593Smuzhiyun corruption or other issues. 912*4882a593Smuzhiyun 913*4882a593Smuzhiyun Say N if unsure. 914*4882a593Smuzhiyun 915*4882a593Smuzhiyunconfig PANIC_ON_OOPS_VALUE 916*4882a593Smuzhiyun int 917*4882a593Smuzhiyun range 0 1 918*4882a593Smuzhiyun default 0 if !PANIC_ON_OOPS 919*4882a593Smuzhiyun default 1 if PANIC_ON_OOPS 920*4882a593Smuzhiyun 921*4882a593Smuzhiyunconfig PANIC_TIMEOUT 922*4882a593Smuzhiyun int "panic timeout" 923*4882a593Smuzhiyun default 0 924*4882a593Smuzhiyun help 925*4882a593Smuzhiyun Set the timeout value (in seconds) until a reboot occurs when 926*4882a593Smuzhiyun the kernel panics. If n = 0, then we wait forever. A timeout 927*4882a593Smuzhiyun value n > 0 will wait n seconds before rebooting, while a timeout 928*4882a593Smuzhiyun value n < 0 will reboot immediately. 929*4882a593Smuzhiyun 930*4882a593Smuzhiyunconfig LOCKUP_DETECTOR 931*4882a593Smuzhiyun bool 932*4882a593Smuzhiyun 933*4882a593Smuzhiyunconfig SOFTLOCKUP_DETECTOR 934*4882a593Smuzhiyun bool "Detect Soft Lockups" 935*4882a593Smuzhiyun depends on DEBUG_KERNEL && !S390 936*4882a593Smuzhiyun select LOCKUP_DETECTOR 937*4882a593Smuzhiyun help 938*4882a593Smuzhiyun Say Y here to enable the kernel to act as a watchdog to detect 939*4882a593Smuzhiyun soft lockups. 940*4882a593Smuzhiyun 941*4882a593Smuzhiyun Softlockups are bugs that cause the kernel to loop in kernel 942*4882a593Smuzhiyun mode for more than 20 seconds, without giving other tasks a 943*4882a593Smuzhiyun chance to run. The current stack trace is displayed upon 944*4882a593Smuzhiyun detection and the system will stay locked up. 945*4882a593Smuzhiyun 946*4882a593Smuzhiyunconfig BOOTPARAM_SOFTLOCKUP_PANIC 947*4882a593Smuzhiyun bool "Panic (Reboot) On Soft Lockups" 948*4882a593Smuzhiyun depends on SOFTLOCKUP_DETECTOR 949*4882a593Smuzhiyun help 950*4882a593Smuzhiyun Say Y here to enable the kernel to panic on "soft lockups", 951*4882a593Smuzhiyun which are bugs that cause the kernel to loop in kernel 952*4882a593Smuzhiyun mode for more than 20 seconds (configurable using the watchdog_thresh 953*4882a593Smuzhiyun sysctl), without giving other tasks a chance to run. 954*4882a593Smuzhiyun 955*4882a593Smuzhiyun The panic can be used in combination with panic_timeout, 956*4882a593Smuzhiyun to cause the system to reboot automatically after a 957*4882a593Smuzhiyun lockup has been detected. This feature is useful for 958*4882a593Smuzhiyun high-availability systems that have uptime guarantees and 959*4882a593Smuzhiyun where a lockup must be resolved ASAP. 960*4882a593Smuzhiyun 961*4882a593Smuzhiyun Say N if unsure. 962*4882a593Smuzhiyun 963*4882a593Smuzhiyunconfig BOOTPARAM_SOFTLOCKUP_PANIC_VALUE 964*4882a593Smuzhiyun int 965*4882a593Smuzhiyun depends on SOFTLOCKUP_DETECTOR 966*4882a593Smuzhiyun range 0 1 967*4882a593Smuzhiyun default 0 if !BOOTPARAM_SOFTLOCKUP_PANIC 968*4882a593Smuzhiyun default 1 if BOOTPARAM_SOFTLOCKUP_PANIC 969*4882a593Smuzhiyun 970*4882a593Smuzhiyunconfig HARDLOCKUP_DETECTOR_PERF 971*4882a593Smuzhiyun bool 972*4882a593Smuzhiyun select SOFTLOCKUP_DETECTOR 973*4882a593Smuzhiyun 974*4882a593Smuzhiyun# 975*4882a593Smuzhiyun# Enables a timestamp based low pass filter to compensate for perf based 976*4882a593Smuzhiyun# hard lockup detection which runs too fast due to turbo modes. 977*4882a593Smuzhiyun# 978*4882a593Smuzhiyunconfig HARDLOCKUP_CHECK_TIMESTAMP 979*4882a593Smuzhiyun bool 980*4882a593Smuzhiyun 981*4882a593Smuzhiyun# 982*4882a593Smuzhiyun# arch/ can define HAVE_HARDLOCKUP_DETECTOR_ARCH to provide their own hard 983*4882a593Smuzhiyun# lockup detector rather than the perf based detector. 984*4882a593Smuzhiyun# 985*4882a593Smuzhiyunconfig HAVE_HARDLOCKUP_DETECTOR_OTHER_CPU 986*4882a593Smuzhiyun def_bool y 987*4882a593Smuzhiyun depends on NO_GKI 988*4882a593Smuzhiyun depends on SMP 989*4882a593Smuzhiyun depends on !HAVE_HARDLOCKUP_DETECTOR_PERF && !HAVE_HARDLOCKUP_DETECTOR_ARCH 990*4882a593Smuzhiyun 991*4882a593Smuzhiyunconfig HARDLOCKUP_DETECTOR_OTHER_CPU 992*4882a593Smuzhiyun bool 993*4882a593Smuzhiyun select SOFTLOCKUP_DETECTOR 994*4882a593Smuzhiyun 995*4882a593Smuzhiyunconfig HARDLOCKUP_DETECTOR 996*4882a593Smuzhiyun bool "Detect Hard Lockups" 997*4882a593Smuzhiyun depends on DEBUG_KERNEL && !S390 998*4882a593Smuzhiyun depends on HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_ARCH || HAVE_HARDLOCKUP_DETECTOR_OTHER_CPU 999*4882a593Smuzhiyun select LOCKUP_DETECTOR 1000*4882a593Smuzhiyun select HARDLOCKUP_DETECTOR_PERF if HAVE_HARDLOCKUP_DETECTOR_PERF 1001*4882a593Smuzhiyun select HARDLOCKUP_DETECTOR_OTHER_CPU if HAVE_HARDLOCKUP_DETECTOR_OTHER_CPU 1002*4882a593Smuzhiyun help 1003*4882a593Smuzhiyun Say Y here to enable the kernel to act as a watchdog to detect 1004*4882a593Smuzhiyun hard lockups. 1005*4882a593Smuzhiyun 1006*4882a593Smuzhiyun Hardlockups are bugs that cause the CPU to loop in kernel mode 1007*4882a593Smuzhiyun for more than 10 seconds, without letting other interrupts have a 1008*4882a593Smuzhiyun chance to run. The current stack trace is displayed upon detection 1009*4882a593Smuzhiyun and the system will stay locked up. 1010*4882a593Smuzhiyun 1011*4882a593Smuzhiyunconfig BOOTPARAM_HARDLOCKUP_PANIC 1012*4882a593Smuzhiyun bool "Panic (Reboot) On Hard Lockups" 1013*4882a593Smuzhiyun depends on HARDLOCKUP_DETECTOR 1014*4882a593Smuzhiyun help 1015*4882a593Smuzhiyun Say Y here to enable the kernel to panic on "hard lockups", 1016*4882a593Smuzhiyun which are bugs that cause the kernel to loop in kernel 1017*4882a593Smuzhiyun mode with interrupts disabled for more than 10 seconds (configurable 1018*4882a593Smuzhiyun using the watchdog_thresh sysctl). 1019*4882a593Smuzhiyun 1020*4882a593Smuzhiyun Say N if unsure. 1021*4882a593Smuzhiyun 1022*4882a593Smuzhiyunconfig BOOTPARAM_HARDLOCKUP_PANIC_VALUE 1023*4882a593Smuzhiyun int 1024*4882a593Smuzhiyun depends on HARDLOCKUP_DETECTOR 1025*4882a593Smuzhiyun range 0 1 1026*4882a593Smuzhiyun default 0 if !BOOTPARAM_HARDLOCKUP_PANIC 1027*4882a593Smuzhiyun default 1 if BOOTPARAM_HARDLOCKUP_PANIC 1028*4882a593Smuzhiyun 1029*4882a593Smuzhiyunconfig DETECT_HUNG_TASK 1030*4882a593Smuzhiyun bool "Detect Hung Tasks" 1031*4882a593Smuzhiyun depends on DEBUG_KERNEL 1032*4882a593Smuzhiyun default SOFTLOCKUP_DETECTOR 1033*4882a593Smuzhiyun help 1034*4882a593Smuzhiyun Say Y here to enable the kernel to detect "hung tasks", 1035*4882a593Smuzhiyun which are bugs that cause the task to be stuck in 1036*4882a593Smuzhiyun uninterruptible "D" state indefinitely. 1037*4882a593Smuzhiyun 1038*4882a593Smuzhiyun When a hung task is detected, the kernel will print the 1039*4882a593Smuzhiyun current stack trace (which you should report), but the 1040*4882a593Smuzhiyun task will stay in uninterruptible state. If lockdep is 1041*4882a593Smuzhiyun enabled then all held locks will also be reported. This 1042*4882a593Smuzhiyun feature has negligible overhead. 1043*4882a593Smuzhiyun 1044*4882a593Smuzhiyunconfig DEFAULT_HUNG_TASK_TIMEOUT 1045*4882a593Smuzhiyun int "Default timeout for hung task detection (in seconds)" 1046*4882a593Smuzhiyun depends on DETECT_HUNG_TASK 1047*4882a593Smuzhiyun default 120 1048*4882a593Smuzhiyun help 1049*4882a593Smuzhiyun This option controls the default timeout (in seconds) used 1050*4882a593Smuzhiyun to determine when a task has become non-responsive and should 1051*4882a593Smuzhiyun be considered hung. 1052*4882a593Smuzhiyun 1053*4882a593Smuzhiyun It can be adjusted at runtime via the kernel.hung_task_timeout_secs 1054*4882a593Smuzhiyun sysctl or by writing a value to 1055*4882a593Smuzhiyun /proc/sys/kernel/hung_task_timeout_secs. 1056*4882a593Smuzhiyun 1057*4882a593Smuzhiyun A timeout of 0 disables the check. The default is two minutes. 1058*4882a593Smuzhiyun Keeping the default should be fine in most cases. 1059*4882a593Smuzhiyun 1060*4882a593Smuzhiyunconfig BOOTPARAM_HUNG_TASK_PANIC 1061*4882a593Smuzhiyun bool "Panic (Reboot) On Hung Tasks" 1062*4882a593Smuzhiyun depends on DETECT_HUNG_TASK 1063*4882a593Smuzhiyun help 1064*4882a593Smuzhiyun Say Y here to enable the kernel to panic on "hung tasks", 1065*4882a593Smuzhiyun which are bugs that cause the kernel to leave a task stuck 1066*4882a593Smuzhiyun in uninterruptible "D" state. 1067*4882a593Smuzhiyun 1068*4882a593Smuzhiyun The panic can be used in combination with panic_timeout, 1069*4882a593Smuzhiyun to cause the system to reboot automatically after a 1070*4882a593Smuzhiyun hung task has been detected. This feature is useful for 1071*4882a593Smuzhiyun high-availability systems that have uptime guarantees and 1072*4882a593Smuzhiyun where a hung tasks must be resolved ASAP. 1073*4882a593Smuzhiyun 1074*4882a593Smuzhiyun Say N if unsure. 1075*4882a593Smuzhiyun 1076*4882a593Smuzhiyunconfig BOOTPARAM_HUNG_TASK_PANIC_VALUE 1077*4882a593Smuzhiyun int 1078*4882a593Smuzhiyun depends on DETECT_HUNG_TASK 1079*4882a593Smuzhiyun range 0 1 1080*4882a593Smuzhiyun default 0 if !BOOTPARAM_HUNG_TASK_PANIC 1081*4882a593Smuzhiyun default 1 if BOOTPARAM_HUNG_TASK_PANIC 1082*4882a593Smuzhiyun 1083*4882a593Smuzhiyunconfig WQ_WATCHDOG 1084*4882a593Smuzhiyun bool "Detect Workqueue Stalls" 1085*4882a593Smuzhiyun depends on DEBUG_KERNEL 1086*4882a593Smuzhiyun help 1087*4882a593Smuzhiyun Say Y here to enable stall detection on workqueues. If a 1088*4882a593Smuzhiyun worker pool doesn't make forward progress on a pending work 1089*4882a593Smuzhiyun item for over a given amount of time, 30s by default, a 1090*4882a593Smuzhiyun warning message is printed along with dump of workqueue 1091*4882a593Smuzhiyun state. This can be configured through kernel parameter 1092*4882a593Smuzhiyun "workqueue.watchdog_thresh" and its sysfs counterpart. 1093*4882a593Smuzhiyun 1094*4882a593Smuzhiyunconfig TEST_LOCKUP 1095*4882a593Smuzhiyun tristate "Test module to generate lockups" 1096*4882a593Smuzhiyun depends on m 1097*4882a593Smuzhiyun help 1098*4882a593Smuzhiyun This builds the "test_lockup" module that helps to make sure 1099*4882a593Smuzhiyun that watchdogs and lockup detectors are working properly. 1100*4882a593Smuzhiyun 1101*4882a593Smuzhiyun Depending on module parameters it could emulate soft or hard 1102*4882a593Smuzhiyun lockup, "hung task", or locking arbitrary lock for a long time. 1103*4882a593Smuzhiyun Also it could generate series of lockups with cooling-down periods. 1104*4882a593Smuzhiyun 1105*4882a593Smuzhiyun If unsure, say N. 1106*4882a593Smuzhiyun 1107*4882a593Smuzhiyunendmenu # "Debug lockups and hangs" 1108*4882a593Smuzhiyun 1109*4882a593Smuzhiyunmenu "Scheduler Debugging" 1110*4882a593Smuzhiyun 1111*4882a593Smuzhiyunconfig SCHED_DEBUG 1112*4882a593Smuzhiyun bool "Collect scheduler debugging info" 1113*4882a593Smuzhiyun depends on DEBUG_KERNEL && PROC_FS 1114*4882a593Smuzhiyun default y 1115*4882a593Smuzhiyun help 1116*4882a593Smuzhiyun If you say Y here, the /proc/sched_debug file will be provided 1117*4882a593Smuzhiyun that can help debug the scheduler. The runtime overhead of this 1118*4882a593Smuzhiyun option is minimal. 1119*4882a593Smuzhiyun 1120*4882a593Smuzhiyunconfig SCHED_INFO 1121*4882a593Smuzhiyun bool 1122*4882a593Smuzhiyun default n 1123*4882a593Smuzhiyun 1124*4882a593Smuzhiyunconfig SCHEDSTATS 1125*4882a593Smuzhiyun bool "Collect scheduler statistics" 1126*4882a593Smuzhiyun depends on DEBUG_KERNEL && PROC_FS 1127*4882a593Smuzhiyun select SCHED_INFO 1128*4882a593Smuzhiyun help 1129*4882a593Smuzhiyun If you say Y here, additional code will be inserted into the 1130*4882a593Smuzhiyun scheduler and related routines to collect statistics about 1131*4882a593Smuzhiyun scheduler behavior and provide them in /proc/schedstat. These 1132*4882a593Smuzhiyun stats may be useful for both tuning and debugging the scheduler 1133*4882a593Smuzhiyun If you aren't debugging the scheduler or trying to tune a specific 1134*4882a593Smuzhiyun application, you can say N to avoid the very slight overhead 1135*4882a593Smuzhiyun this adds. 1136*4882a593Smuzhiyun 1137*4882a593Smuzhiyunendmenu 1138*4882a593Smuzhiyun 1139*4882a593Smuzhiyunconfig DEBUG_TIMEKEEPING 1140*4882a593Smuzhiyun bool "Enable extra timekeeping sanity checking" 1141*4882a593Smuzhiyun help 1142*4882a593Smuzhiyun This option will enable additional timekeeping sanity checks 1143*4882a593Smuzhiyun which may be helpful when diagnosing issues where timekeeping 1144*4882a593Smuzhiyun problems are suspected. 1145*4882a593Smuzhiyun 1146*4882a593Smuzhiyun This may include checks in the timekeeping hotpaths, so this 1147*4882a593Smuzhiyun option may have a (very small) performance impact to some 1148*4882a593Smuzhiyun workloads. 1149*4882a593Smuzhiyun 1150*4882a593Smuzhiyun If unsure, say N. 1151*4882a593Smuzhiyun 1152*4882a593Smuzhiyunconfig DEBUG_PREEMPT 1153*4882a593Smuzhiyun bool "Debug preemptible kernel" 1154*4882a593Smuzhiyun depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT 1155*4882a593Smuzhiyun default y 1156*4882a593Smuzhiyun help 1157*4882a593Smuzhiyun If you say Y here then the kernel will use a debug variant of the 1158*4882a593Smuzhiyun commonly used smp_processor_id() function and will print warnings 1159*4882a593Smuzhiyun if kernel code uses it in a preemption-unsafe way. Also, the kernel 1160*4882a593Smuzhiyun will detect preemption count underflows. 1161*4882a593Smuzhiyun 1162*4882a593Smuzhiyunmenu "Lock Debugging (spinlocks, mutexes, etc...)" 1163*4882a593Smuzhiyun 1164*4882a593Smuzhiyunconfig LOCK_DEBUGGING_SUPPORT 1165*4882a593Smuzhiyun bool 1166*4882a593Smuzhiyun depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 1167*4882a593Smuzhiyun default y 1168*4882a593Smuzhiyun 1169*4882a593Smuzhiyunconfig PROVE_LOCKING 1170*4882a593Smuzhiyun bool "Lock debugging: prove locking correctness" 1171*4882a593Smuzhiyun depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1172*4882a593Smuzhiyun select LOCKDEP 1173*4882a593Smuzhiyun select DEBUG_SPINLOCK 1174*4882a593Smuzhiyun select DEBUG_MUTEXES 1175*4882a593Smuzhiyun select DEBUG_RT_MUTEXES if RT_MUTEXES 1176*4882a593Smuzhiyun select DEBUG_RWSEMS 1177*4882a593Smuzhiyun select DEBUG_WW_MUTEX_SLOWPATH 1178*4882a593Smuzhiyun select DEBUG_LOCK_ALLOC 1179*4882a593Smuzhiyun select PREEMPT_COUNT if !ARCH_NO_PREEMPT 1180*4882a593Smuzhiyun select TRACE_IRQFLAGS 1181*4882a593Smuzhiyun default n 1182*4882a593Smuzhiyun help 1183*4882a593Smuzhiyun This feature enables the kernel to prove that all locking 1184*4882a593Smuzhiyun that occurs in the kernel runtime is mathematically 1185*4882a593Smuzhiyun correct: that under no circumstance could an arbitrary (and 1186*4882a593Smuzhiyun not yet triggered) combination of observed locking 1187*4882a593Smuzhiyun sequences (on an arbitrary number of CPUs, running an 1188*4882a593Smuzhiyun arbitrary number of tasks and interrupt contexts) cause a 1189*4882a593Smuzhiyun deadlock. 1190*4882a593Smuzhiyun 1191*4882a593Smuzhiyun In short, this feature enables the kernel to report locking 1192*4882a593Smuzhiyun related deadlocks before they actually occur. 1193*4882a593Smuzhiyun 1194*4882a593Smuzhiyun The proof does not depend on how hard and complex a 1195*4882a593Smuzhiyun deadlock scenario would be to trigger: how many 1196*4882a593Smuzhiyun participant CPUs, tasks and irq-contexts would be needed 1197*4882a593Smuzhiyun for it to trigger. The proof also does not depend on 1198*4882a593Smuzhiyun timing: if a race and a resulting deadlock is possible 1199*4882a593Smuzhiyun theoretically (no matter how unlikely the race scenario 1200*4882a593Smuzhiyun is), it will be proven so and will immediately be 1201*4882a593Smuzhiyun reported by the kernel (once the event is observed that 1202*4882a593Smuzhiyun makes the deadlock theoretically possible). 1203*4882a593Smuzhiyun 1204*4882a593Smuzhiyun If a deadlock is impossible (i.e. the locking rules, as 1205*4882a593Smuzhiyun observed by the kernel, are mathematically correct), the 1206*4882a593Smuzhiyun kernel reports nothing. 1207*4882a593Smuzhiyun 1208*4882a593Smuzhiyun NOTE: this feature can also be enabled for rwlocks, mutexes 1209*4882a593Smuzhiyun and rwsems - in which case all dependencies between these 1210*4882a593Smuzhiyun different locking variants are observed and mapped too, and 1211*4882a593Smuzhiyun the proof of observed correctness is also maintained for an 1212*4882a593Smuzhiyun arbitrary combination of these separate locking variants. 1213*4882a593Smuzhiyun 1214*4882a593Smuzhiyun For more details, see Documentation/locking/lockdep-design.rst. 1215*4882a593Smuzhiyun 1216*4882a593Smuzhiyunconfig PROVE_RAW_LOCK_NESTING 1217*4882a593Smuzhiyun bool "Enable raw_spinlock - spinlock nesting checks" 1218*4882a593Smuzhiyun depends on PROVE_LOCKING 1219*4882a593Smuzhiyun default n 1220*4882a593Smuzhiyun help 1221*4882a593Smuzhiyun Enable the raw_spinlock vs. spinlock nesting checks which ensure 1222*4882a593Smuzhiyun that the lock nesting rules for PREEMPT_RT enabled kernels are 1223*4882a593Smuzhiyun not violated. 1224*4882a593Smuzhiyun 1225*4882a593Smuzhiyun NOTE: There are known nesting problems. So if you enable this 1226*4882a593Smuzhiyun option expect lockdep splats until these problems have been fully 1227*4882a593Smuzhiyun addressed which is work in progress. This config switch allows to 1228*4882a593Smuzhiyun identify and analyze these problems. It will be removed and the 1229*4882a593Smuzhiyun check permanentely enabled once the main issues have been fixed. 1230*4882a593Smuzhiyun 1231*4882a593Smuzhiyun If unsure, select N. 1232*4882a593Smuzhiyun 1233*4882a593Smuzhiyunconfig LOCK_STAT 1234*4882a593Smuzhiyun bool "Lock usage statistics" 1235*4882a593Smuzhiyun depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1236*4882a593Smuzhiyun select LOCKDEP 1237*4882a593Smuzhiyun select DEBUG_SPINLOCK 1238*4882a593Smuzhiyun select DEBUG_MUTEXES 1239*4882a593Smuzhiyun select DEBUG_RT_MUTEXES if RT_MUTEXES 1240*4882a593Smuzhiyun select DEBUG_LOCK_ALLOC 1241*4882a593Smuzhiyun default n 1242*4882a593Smuzhiyun help 1243*4882a593Smuzhiyun This feature enables tracking lock contention points 1244*4882a593Smuzhiyun 1245*4882a593Smuzhiyun For more details, see Documentation/locking/lockstat.rst 1246*4882a593Smuzhiyun 1247*4882a593Smuzhiyun This also enables lock events required by "perf lock", 1248*4882a593Smuzhiyun subcommand of perf. 1249*4882a593Smuzhiyun If you want to use "perf lock", you also need to turn on 1250*4882a593Smuzhiyun CONFIG_EVENT_TRACING. 1251*4882a593Smuzhiyun 1252*4882a593Smuzhiyun CONFIG_LOCK_STAT defines "contended" and "acquired" lock events. 1253*4882a593Smuzhiyun (CONFIG_LOCKDEP defines "acquire" and "release" events.) 1254*4882a593Smuzhiyun 1255*4882a593Smuzhiyunconfig DEBUG_RT_MUTEXES 1256*4882a593Smuzhiyun bool "RT Mutex debugging, deadlock detection" 1257*4882a593Smuzhiyun depends on DEBUG_KERNEL && RT_MUTEXES 1258*4882a593Smuzhiyun help 1259*4882a593Smuzhiyun This allows rt mutex semantics violations and rt mutex related 1260*4882a593Smuzhiyun deadlocks (lockups) to be detected and reported automatically. 1261*4882a593Smuzhiyun 1262*4882a593Smuzhiyunconfig DEBUG_SPINLOCK 1263*4882a593Smuzhiyun bool "Spinlock and rw-lock debugging: basic checks" 1264*4882a593Smuzhiyun depends on DEBUG_KERNEL 1265*4882a593Smuzhiyun select UNINLINE_SPIN_UNLOCK 1266*4882a593Smuzhiyun help 1267*4882a593Smuzhiyun Say Y here and build SMP to catch missing spinlock initialization 1268*4882a593Smuzhiyun and certain other kinds of spinlock errors commonly made. This is 1269*4882a593Smuzhiyun best used in conjunction with the NMI watchdog so that spinlock 1270*4882a593Smuzhiyun deadlocks are also debuggable. 1271*4882a593Smuzhiyun 1272*4882a593Smuzhiyunconfig DEBUG_MUTEXES 1273*4882a593Smuzhiyun bool "Mutex debugging: basic checks" 1274*4882a593Smuzhiyun depends on DEBUG_KERNEL 1275*4882a593Smuzhiyun help 1276*4882a593Smuzhiyun This feature allows mutex semantics violations to be detected and 1277*4882a593Smuzhiyun reported. 1278*4882a593Smuzhiyun 1279*4882a593Smuzhiyunconfig DEBUG_WW_MUTEX_SLOWPATH 1280*4882a593Smuzhiyun bool "Wait/wound mutex debugging: Slowpath testing" 1281*4882a593Smuzhiyun depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1282*4882a593Smuzhiyun select DEBUG_LOCK_ALLOC 1283*4882a593Smuzhiyun select DEBUG_SPINLOCK 1284*4882a593Smuzhiyun select DEBUG_MUTEXES 1285*4882a593Smuzhiyun help 1286*4882a593Smuzhiyun This feature enables slowpath testing for w/w mutex users by 1287*4882a593Smuzhiyun injecting additional -EDEADLK wound/backoff cases. Together with 1288*4882a593Smuzhiyun the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this 1289*4882a593Smuzhiyun will test all possible w/w mutex interface abuse with the 1290*4882a593Smuzhiyun exception of simply not acquiring all the required locks. 1291*4882a593Smuzhiyun Note that this feature can introduce significant overhead, so 1292*4882a593Smuzhiyun it really should not be enabled in a production or distro kernel, 1293*4882a593Smuzhiyun even a debug kernel. If you are a driver writer, enable it. If 1294*4882a593Smuzhiyun you are a distro, do not. 1295*4882a593Smuzhiyun 1296*4882a593Smuzhiyunconfig DEBUG_RWSEMS 1297*4882a593Smuzhiyun bool "RW Semaphore debugging: basic checks" 1298*4882a593Smuzhiyun depends on DEBUG_KERNEL 1299*4882a593Smuzhiyun help 1300*4882a593Smuzhiyun This debugging feature allows mismatched rw semaphore locks 1301*4882a593Smuzhiyun and unlocks to be detected and reported. 1302*4882a593Smuzhiyun 1303*4882a593Smuzhiyunconfig DEBUG_LOCK_ALLOC 1304*4882a593Smuzhiyun bool "Lock debugging: detect incorrect freeing of live locks" 1305*4882a593Smuzhiyun depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1306*4882a593Smuzhiyun select DEBUG_SPINLOCK 1307*4882a593Smuzhiyun select DEBUG_MUTEXES 1308*4882a593Smuzhiyun select DEBUG_RT_MUTEXES if RT_MUTEXES 1309*4882a593Smuzhiyun select LOCKDEP 1310*4882a593Smuzhiyun help 1311*4882a593Smuzhiyun This feature will check whether any held lock (spinlock, rwlock, 1312*4882a593Smuzhiyun mutex or rwsem) is incorrectly freed by the kernel, via any of the 1313*4882a593Smuzhiyun memory-freeing routines (kfree(), kmem_cache_free(), free_pages(), 1314*4882a593Smuzhiyun vfree(), etc.), whether a live lock is incorrectly reinitialized via 1315*4882a593Smuzhiyun spin_lock_init()/mutex_init()/etc., or whether there is any lock 1316*4882a593Smuzhiyun held during task exit. 1317*4882a593Smuzhiyun 1318*4882a593Smuzhiyunconfig LOCKDEP 1319*4882a593Smuzhiyun bool 1320*4882a593Smuzhiyun depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT 1321*4882a593Smuzhiyun select STACKTRACE 1322*4882a593Smuzhiyun select KALLSYMS 1323*4882a593Smuzhiyun select KALLSYMS_ALL 1324*4882a593Smuzhiyun 1325*4882a593Smuzhiyunconfig LOCKDEP_SMALL 1326*4882a593Smuzhiyun bool 1327*4882a593Smuzhiyun 1328*4882a593Smuzhiyunconfig LOCKDEP_BITS 1329*4882a593Smuzhiyun int "Bitsize for MAX_LOCKDEP_ENTRIES" 1330*4882a593Smuzhiyun depends on LOCKDEP && !LOCKDEP_SMALL 1331*4882a593Smuzhiyun range 10 30 1332*4882a593Smuzhiyun default 15 1333*4882a593Smuzhiyun help 1334*4882a593Smuzhiyun Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message. 1335*4882a593Smuzhiyun 1336*4882a593Smuzhiyunconfig LOCKDEP_CHAINS_BITS 1337*4882a593Smuzhiyun int "Bitsize for MAX_LOCKDEP_CHAINS" 1338*4882a593Smuzhiyun depends on LOCKDEP && !LOCKDEP_SMALL 1339*4882a593Smuzhiyun range 10 30 1340*4882a593Smuzhiyun default 16 1341*4882a593Smuzhiyun help 1342*4882a593Smuzhiyun Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!" message. 1343*4882a593Smuzhiyun 1344*4882a593Smuzhiyunconfig LOCKDEP_STACK_TRACE_BITS 1345*4882a593Smuzhiyun int "Bitsize for MAX_STACK_TRACE_ENTRIES" 1346*4882a593Smuzhiyun depends on LOCKDEP && !LOCKDEP_SMALL 1347*4882a593Smuzhiyun range 10 30 1348*4882a593Smuzhiyun default 19 1349*4882a593Smuzhiyun help 1350*4882a593Smuzhiyun Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message. 1351*4882a593Smuzhiyun 1352*4882a593Smuzhiyunconfig LOCKDEP_STACK_TRACE_HASH_BITS 1353*4882a593Smuzhiyun int "Bitsize for STACK_TRACE_HASH_SIZE" 1354*4882a593Smuzhiyun depends on LOCKDEP && !LOCKDEP_SMALL 1355*4882a593Smuzhiyun range 10 30 1356*4882a593Smuzhiyun default 14 1357*4882a593Smuzhiyun help 1358*4882a593Smuzhiyun Try increasing this value if you need large MAX_STACK_TRACE_ENTRIES. 1359*4882a593Smuzhiyun 1360*4882a593Smuzhiyunconfig LOCKDEP_CIRCULAR_QUEUE_BITS 1361*4882a593Smuzhiyun int "Bitsize for elements in circular_queue struct" 1362*4882a593Smuzhiyun depends on LOCKDEP 1363*4882a593Smuzhiyun range 10 30 1364*4882a593Smuzhiyun default 12 1365*4882a593Smuzhiyun help 1366*4882a593Smuzhiyun Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure. 1367*4882a593Smuzhiyun 1368*4882a593Smuzhiyunconfig DEBUG_LOCKDEP 1369*4882a593Smuzhiyun bool "Lock dependency engine debugging" 1370*4882a593Smuzhiyun depends on DEBUG_KERNEL && LOCKDEP 1371*4882a593Smuzhiyun help 1372*4882a593Smuzhiyun If you say Y here, the lock dependency engine will do 1373*4882a593Smuzhiyun additional runtime checks to debug itself, at the price 1374*4882a593Smuzhiyun of more runtime overhead. 1375*4882a593Smuzhiyun 1376*4882a593Smuzhiyunconfig DEBUG_ATOMIC_SLEEP 1377*4882a593Smuzhiyun bool "Sleep inside atomic section checking" 1378*4882a593Smuzhiyun select PREEMPT_COUNT 1379*4882a593Smuzhiyun depends on DEBUG_KERNEL 1380*4882a593Smuzhiyun depends on !ARCH_NO_PREEMPT 1381*4882a593Smuzhiyun help 1382*4882a593Smuzhiyun If you say Y here, various routines which may sleep will become very 1383*4882a593Smuzhiyun noisy if they are called inside atomic sections: when a spinlock is 1384*4882a593Smuzhiyun held, inside an rcu read side critical section, inside preempt disabled 1385*4882a593Smuzhiyun sections, inside an interrupt, etc... 1386*4882a593Smuzhiyun 1387*4882a593Smuzhiyunconfig DEBUG_LOCKING_API_SELFTESTS 1388*4882a593Smuzhiyun bool "Locking API boot-time self-tests" 1389*4882a593Smuzhiyun depends on DEBUG_KERNEL 1390*4882a593Smuzhiyun help 1391*4882a593Smuzhiyun Say Y here if you want the kernel to run a short self-test during 1392*4882a593Smuzhiyun bootup. The self-test checks whether common types of locking bugs 1393*4882a593Smuzhiyun are detected by debugging mechanisms or not. (if you disable 1394*4882a593Smuzhiyun lock debugging then those bugs wont be detected of course.) 1395*4882a593Smuzhiyun The following locking APIs are covered: spinlocks, rwlocks, 1396*4882a593Smuzhiyun mutexes and rwsems. 1397*4882a593Smuzhiyun 1398*4882a593Smuzhiyunconfig LOCK_TORTURE_TEST 1399*4882a593Smuzhiyun tristate "torture tests for locking" 1400*4882a593Smuzhiyun depends on DEBUG_KERNEL 1401*4882a593Smuzhiyun select TORTURE_TEST 1402*4882a593Smuzhiyun help 1403*4882a593Smuzhiyun This option provides a kernel module that runs torture tests 1404*4882a593Smuzhiyun on kernel locking primitives. The kernel module may be built 1405*4882a593Smuzhiyun after the fact on the running kernel to be tested, if desired. 1406*4882a593Smuzhiyun 1407*4882a593Smuzhiyun Say Y here if you want kernel locking-primitive torture tests 1408*4882a593Smuzhiyun to be built into the kernel. 1409*4882a593Smuzhiyun Say M if you want these torture tests to build as a module. 1410*4882a593Smuzhiyun Say N if you are unsure. 1411*4882a593Smuzhiyun 1412*4882a593Smuzhiyunconfig WW_MUTEX_SELFTEST 1413*4882a593Smuzhiyun tristate "Wait/wound mutex selftests" 1414*4882a593Smuzhiyun help 1415*4882a593Smuzhiyun This option provides a kernel module that runs tests on the 1416*4882a593Smuzhiyun on the struct ww_mutex locking API. 1417*4882a593Smuzhiyun 1418*4882a593Smuzhiyun It is recommended to enable DEBUG_WW_MUTEX_SLOWPATH in conjunction 1419*4882a593Smuzhiyun with this test harness. 1420*4882a593Smuzhiyun 1421*4882a593Smuzhiyun Say M if you want these self tests to build as a module. 1422*4882a593Smuzhiyun Say N if you are unsure. 1423*4882a593Smuzhiyun 1424*4882a593Smuzhiyunconfig SCF_TORTURE_TEST 1425*4882a593Smuzhiyun tristate "torture tests for smp_call_function*()" 1426*4882a593Smuzhiyun depends on DEBUG_KERNEL 1427*4882a593Smuzhiyun select TORTURE_TEST 1428*4882a593Smuzhiyun help 1429*4882a593Smuzhiyun This option provides a kernel module that runs torture tests 1430*4882a593Smuzhiyun on the smp_call_function() family of primitives. The kernel 1431*4882a593Smuzhiyun module may be built after the fact on the running kernel to 1432*4882a593Smuzhiyun be tested, if desired. 1433*4882a593Smuzhiyun 1434*4882a593Smuzhiyunconfig CSD_LOCK_WAIT_DEBUG 1435*4882a593Smuzhiyun bool "Debugging for csd_lock_wait(), called from smp_call_function*()" 1436*4882a593Smuzhiyun depends on DEBUG_KERNEL 1437*4882a593Smuzhiyun depends on 64BIT 1438*4882a593Smuzhiyun default n 1439*4882a593Smuzhiyun help 1440*4882a593Smuzhiyun This option enables debug prints when CPUs are slow to respond 1441*4882a593Smuzhiyun to the smp_call_function*() IPI wrappers. These debug prints 1442*4882a593Smuzhiyun include the IPI handler function currently executing (if any) 1443*4882a593Smuzhiyun and relevant stack traces. 1444*4882a593Smuzhiyun 1445*4882a593Smuzhiyunendmenu # lock debugging 1446*4882a593Smuzhiyun 1447*4882a593Smuzhiyunconfig TRACE_IRQFLAGS 1448*4882a593Smuzhiyun depends on TRACE_IRQFLAGS_SUPPORT 1449*4882a593Smuzhiyun bool 1450*4882a593Smuzhiyun help 1451*4882a593Smuzhiyun Enables hooks to interrupt enabling and disabling for 1452*4882a593Smuzhiyun either tracing or lock debugging. 1453*4882a593Smuzhiyun 1454*4882a593Smuzhiyunconfig TRACE_IRQFLAGS_NMI 1455*4882a593Smuzhiyun def_bool y 1456*4882a593Smuzhiyun depends on TRACE_IRQFLAGS 1457*4882a593Smuzhiyun depends on TRACE_IRQFLAGS_NMI_SUPPORT 1458*4882a593Smuzhiyun 1459*4882a593Smuzhiyunconfig STACKTRACE 1460*4882a593Smuzhiyun bool "Stack backtrace support" 1461*4882a593Smuzhiyun depends on STACKTRACE_SUPPORT 1462*4882a593Smuzhiyun help 1463*4882a593Smuzhiyun This option causes the kernel to create a /proc/pid/stack for 1464*4882a593Smuzhiyun every process, showing its current stack trace. 1465*4882a593Smuzhiyun It is also used by various kernel debugging features that require 1466*4882a593Smuzhiyun stack trace generation. 1467*4882a593Smuzhiyun 1468*4882a593Smuzhiyunconfig WARN_ALL_UNSEEDED_RANDOM 1469*4882a593Smuzhiyun bool "Warn for all uses of unseeded randomness" 1470*4882a593Smuzhiyun default n 1471*4882a593Smuzhiyun help 1472*4882a593Smuzhiyun Some parts of the kernel contain bugs relating to their use of 1473*4882a593Smuzhiyun cryptographically secure random numbers before it's actually possible 1474*4882a593Smuzhiyun to generate those numbers securely. This setting ensures that these 1475*4882a593Smuzhiyun flaws don't go unnoticed, by enabling a message, should this ever 1476*4882a593Smuzhiyun occur. This will allow people with obscure setups to know when things 1477*4882a593Smuzhiyun are going wrong, so that they might contact developers about fixing 1478*4882a593Smuzhiyun it. 1479*4882a593Smuzhiyun 1480*4882a593Smuzhiyun Unfortunately, on some models of some architectures getting 1481*4882a593Smuzhiyun a fully seeded CRNG is extremely difficult, and so this can 1482*4882a593Smuzhiyun result in dmesg getting spammed for a surprisingly long 1483*4882a593Smuzhiyun time. This is really bad from a security perspective, and 1484*4882a593Smuzhiyun so architecture maintainers really need to do what they can 1485*4882a593Smuzhiyun to get the CRNG seeded sooner after the system is booted. 1486*4882a593Smuzhiyun However, since users cannot do anything actionable to 1487*4882a593Smuzhiyun address this, by default this option is disabled. 1488*4882a593Smuzhiyun 1489*4882a593Smuzhiyun Say Y here if you want to receive warnings for all uses of 1490*4882a593Smuzhiyun unseeded randomness. This will be of use primarily for 1491*4882a593Smuzhiyun those developers interested in improving the security of 1492*4882a593Smuzhiyun Linux kernels running on their architecture (or 1493*4882a593Smuzhiyun subarchitecture). 1494*4882a593Smuzhiyun 1495*4882a593Smuzhiyunconfig DEBUG_KOBJECT 1496*4882a593Smuzhiyun bool "kobject debugging" 1497*4882a593Smuzhiyun depends on DEBUG_KERNEL 1498*4882a593Smuzhiyun help 1499*4882a593Smuzhiyun If you say Y here, some extra kobject debugging messages will be sent 1500*4882a593Smuzhiyun to the syslog. 1501*4882a593Smuzhiyun 1502*4882a593Smuzhiyunconfig DEBUG_KOBJECT_RELEASE 1503*4882a593Smuzhiyun bool "kobject release debugging" 1504*4882a593Smuzhiyun depends on DEBUG_OBJECTS_TIMERS 1505*4882a593Smuzhiyun help 1506*4882a593Smuzhiyun kobjects are reference counted objects. This means that their 1507*4882a593Smuzhiyun last reference count put is not predictable, and the kobject can 1508*4882a593Smuzhiyun live on past the point at which a driver decides to drop it's 1509*4882a593Smuzhiyun initial reference to the kobject gained on allocation. An 1510*4882a593Smuzhiyun example of this would be a struct device which has just been 1511*4882a593Smuzhiyun unregistered. 1512*4882a593Smuzhiyun 1513*4882a593Smuzhiyun However, some buggy drivers assume that after such an operation, 1514*4882a593Smuzhiyun the memory backing the kobject can be immediately freed. This 1515*4882a593Smuzhiyun goes completely against the principles of a refcounted object. 1516*4882a593Smuzhiyun 1517*4882a593Smuzhiyun If you say Y here, the kernel will delay the release of kobjects 1518*4882a593Smuzhiyun on the last reference count to improve the visibility of this 1519*4882a593Smuzhiyun kind of kobject release bug. 1520*4882a593Smuzhiyun 1521*4882a593Smuzhiyunconfig HAVE_DEBUG_BUGVERBOSE 1522*4882a593Smuzhiyun bool 1523*4882a593Smuzhiyun 1524*4882a593Smuzhiyunmenu "Debug kernel data structures" 1525*4882a593Smuzhiyun 1526*4882a593Smuzhiyunconfig DEBUG_LIST 1527*4882a593Smuzhiyun bool "Debug linked list manipulation" 1528*4882a593Smuzhiyun depends on DEBUG_KERNEL || BUG_ON_DATA_CORRUPTION 1529*4882a593Smuzhiyun help 1530*4882a593Smuzhiyun Enable this to turn on extended checks in the linked-list 1531*4882a593Smuzhiyun walking routines. 1532*4882a593Smuzhiyun 1533*4882a593Smuzhiyun If unsure, say N. 1534*4882a593Smuzhiyun 1535*4882a593Smuzhiyunconfig DEBUG_PLIST 1536*4882a593Smuzhiyun bool "Debug priority linked list manipulation" 1537*4882a593Smuzhiyun depends on DEBUG_KERNEL 1538*4882a593Smuzhiyun help 1539*4882a593Smuzhiyun Enable this to turn on extended checks in the priority-ordered 1540*4882a593Smuzhiyun linked-list (plist) walking routines. This checks the entire 1541*4882a593Smuzhiyun list multiple times during each manipulation. 1542*4882a593Smuzhiyun 1543*4882a593Smuzhiyun If unsure, say N. 1544*4882a593Smuzhiyun 1545*4882a593Smuzhiyunconfig DEBUG_SG 1546*4882a593Smuzhiyun bool "Debug SG table operations" 1547*4882a593Smuzhiyun depends on DEBUG_KERNEL 1548*4882a593Smuzhiyun help 1549*4882a593Smuzhiyun Enable this to turn on checks on scatter-gather tables. This can 1550*4882a593Smuzhiyun help find problems with drivers that do not properly initialize 1551*4882a593Smuzhiyun their sg tables. 1552*4882a593Smuzhiyun 1553*4882a593Smuzhiyun If unsure, say N. 1554*4882a593Smuzhiyun 1555*4882a593Smuzhiyunconfig DEBUG_NOTIFIERS 1556*4882a593Smuzhiyun bool "Debug notifier call chains" 1557*4882a593Smuzhiyun depends on DEBUG_KERNEL 1558*4882a593Smuzhiyun help 1559*4882a593Smuzhiyun Enable this to turn on sanity checking for notifier call chains. 1560*4882a593Smuzhiyun This is most useful for kernel developers to make sure that 1561*4882a593Smuzhiyun modules properly unregister themselves from notifier chains. 1562*4882a593Smuzhiyun This is a relatively cheap check but if you care about maximum 1563*4882a593Smuzhiyun performance, say N. 1564*4882a593Smuzhiyun 1565*4882a593Smuzhiyunconfig BUG_ON_DATA_CORRUPTION 1566*4882a593Smuzhiyun bool "Trigger a BUG when data corruption is detected" 1567*4882a593Smuzhiyun select DEBUG_LIST 1568*4882a593Smuzhiyun help 1569*4882a593Smuzhiyun Select this option if the kernel should BUG when it encounters 1570*4882a593Smuzhiyun data corruption in kernel memory structures when they get checked 1571*4882a593Smuzhiyun for validity. 1572*4882a593Smuzhiyun 1573*4882a593Smuzhiyun If unsure, say N. 1574*4882a593Smuzhiyun 1575*4882a593Smuzhiyunendmenu 1576*4882a593Smuzhiyun 1577*4882a593Smuzhiyunconfig DEBUG_CREDENTIALS 1578*4882a593Smuzhiyun bool "Debug credential management" 1579*4882a593Smuzhiyun depends on DEBUG_KERNEL 1580*4882a593Smuzhiyun help 1581*4882a593Smuzhiyun Enable this to turn on some debug checking for credential 1582*4882a593Smuzhiyun management. The additional code keeps track of the number of 1583*4882a593Smuzhiyun pointers from task_structs to any given cred struct, and checks to 1584*4882a593Smuzhiyun see that this number never exceeds the usage count of the cred 1585*4882a593Smuzhiyun struct. 1586*4882a593Smuzhiyun 1587*4882a593Smuzhiyun Furthermore, if SELinux is enabled, this also checks that the 1588*4882a593Smuzhiyun security pointer in the cred struct is never seen to be invalid. 1589*4882a593Smuzhiyun 1590*4882a593Smuzhiyun If unsure, say N. 1591*4882a593Smuzhiyun 1592*4882a593Smuzhiyunsource "kernel/rcu/Kconfig.debug" 1593*4882a593Smuzhiyun 1594*4882a593Smuzhiyunconfig DEBUG_WQ_FORCE_RR_CPU 1595*4882a593Smuzhiyun bool "Force round-robin CPU selection for unbound work items" 1596*4882a593Smuzhiyun depends on DEBUG_KERNEL 1597*4882a593Smuzhiyun default n 1598*4882a593Smuzhiyun help 1599*4882a593Smuzhiyun Workqueue used to implicitly guarantee that work items queued 1600*4882a593Smuzhiyun without explicit CPU specified are put on the local CPU. This 1601*4882a593Smuzhiyun guarantee is no longer true and while local CPU is still 1602*4882a593Smuzhiyun preferred work items may be put on foreign CPUs. Kernel 1603*4882a593Smuzhiyun parameter "workqueue.debug_force_rr_cpu" is added to force 1604*4882a593Smuzhiyun round-robin CPU selection to flush out usages which depend on the 1605*4882a593Smuzhiyun now broken guarantee. This config option enables the debug 1606*4882a593Smuzhiyun feature by default. When enabled, memory and cache locality will 1607*4882a593Smuzhiyun be impacted. 1608*4882a593Smuzhiyun 1609*4882a593Smuzhiyunconfig DEBUG_BLOCK_EXT_DEVT 1610*4882a593Smuzhiyun bool "Force extended block device numbers and spread them" 1611*4882a593Smuzhiyun depends on DEBUG_KERNEL 1612*4882a593Smuzhiyun depends on BLOCK 1613*4882a593Smuzhiyun default n 1614*4882a593Smuzhiyun help 1615*4882a593Smuzhiyun BIG FAT WARNING: ENABLING THIS OPTION MIGHT BREAK BOOTING ON 1616*4882a593Smuzhiyun SOME DISTRIBUTIONS. DO NOT ENABLE THIS UNLESS YOU KNOW WHAT 1617*4882a593Smuzhiyun YOU ARE DOING. Distros, please enable this and fix whatever 1618*4882a593Smuzhiyun is broken. 1619*4882a593Smuzhiyun 1620*4882a593Smuzhiyun Conventionally, block device numbers are allocated from 1621*4882a593Smuzhiyun predetermined contiguous area. However, extended block area 1622*4882a593Smuzhiyun may introduce non-contiguous block device numbers. This 1623*4882a593Smuzhiyun option forces most block device numbers to be allocated from 1624*4882a593Smuzhiyun the extended space and spreads them to discover kernel or 1625*4882a593Smuzhiyun userland code paths which assume predetermined contiguous 1626*4882a593Smuzhiyun device number allocation. 1627*4882a593Smuzhiyun 1628*4882a593Smuzhiyun Note that turning on this debug option shuffles all the 1629*4882a593Smuzhiyun device numbers for all IDE and SCSI devices including libata 1630*4882a593Smuzhiyun ones, so root partition specified using device number 1631*4882a593Smuzhiyun directly (via rdev or root=MAJ:MIN) won't work anymore. 1632*4882a593Smuzhiyun Textual device names (root=/dev/sdXn) will continue to work. 1633*4882a593Smuzhiyun 1634*4882a593Smuzhiyun Say N if you are unsure. 1635*4882a593Smuzhiyun 1636*4882a593Smuzhiyunconfig CPU_HOTPLUG_STATE_CONTROL 1637*4882a593Smuzhiyun bool "Enable CPU hotplug state control" 1638*4882a593Smuzhiyun depends on DEBUG_KERNEL 1639*4882a593Smuzhiyun depends on HOTPLUG_CPU 1640*4882a593Smuzhiyun default n 1641*4882a593Smuzhiyun help 1642*4882a593Smuzhiyun Allows to write steps between "offline" and "online" to the CPUs 1643*4882a593Smuzhiyun sysfs target file so states can be stepped granular. This is a debug 1644*4882a593Smuzhiyun option for now as the hotplug machinery cannot be stopped and 1645*4882a593Smuzhiyun restarted at arbitrary points yet. 1646*4882a593Smuzhiyun 1647*4882a593Smuzhiyun Say N if your are unsure. 1648*4882a593Smuzhiyun 1649*4882a593Smuzhiyunconfig LATENCYTOP 1650*4882a593Smuzhiyun bool "Latency measuring infrastructure" 1651*4882a593Smuzhiyun depends on DEBUG_KERNEL 1652*4882a593Smuzhiyun depends on STACKTRACE_SUPPORT 1653*4882a593Smuzhiyun depends on PROC_FS 1654*4882a593Smuzhiyun depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 1655*4882a593Smuzhiyun select KALLSYMS 1656*4882a593Smuzhiyun select KALLSYMS_ALL 1657*4882a593Smuzhiyun select STACKTRACE 1658*4882a593Smuzhiyun select SCHEDSTATS 1659*4882a593Smuzhiyun select SCHED_DEBUG 1660*4882a593Smuzhiyun help 1661*4882a593Smuzhiyun Enable this option if you want to use the LatencyTOP tool 1662*4882a593Smuzhiyun to find out which userspace is blocking on what kernel operations. 1663*4882a593Smuzhiyun 1664*4882a593Smuzhiyunsource "kernel/trace/Kconfig" 1665*4882a593Smuzhiyun 1666*4882a593Smuzhiyunconfig PROVIDE_OHCI1394_DMA_INIT 1667*4882a593Smuzhiyun bool "Remote debugging over FireWire early on boot" 1668*4882a593Smuzhiyun depends on PCI && X86 1669*4882a593Smuzhiyun help 1670*4882a593Smuzhiyun If you want to debug problems which hang or crash the kernel early 1671*4882a593Smuzhiyun on boot and the crashing machine has a FireWire port, you can use 1672*4882a593Smuzhiyun this feature to remotely access the memory of the crashed machine 1673*4882a593Smuzhiyun over FireWire. This employs remote DMA as part of the OHCI1394 1674*4882a593Smuzhiyun specification which is now the standard for FireWire controllers. 1675*4882a593Smuzhiyun 1676*4882a593Smuzhiyun With remote DMA, you can monitor the printk buffer remotely using 1677*4882a593Smuzhiyun firescope and access all memory below 4GB using fireproxy from gdb. 1678*4882a593Smuzhiyun Even controlling a kernel debugger is possible using remote DMA. 1679*4882a593Smuzhiyun 1680*4882a593Smuzhiyun Usage: 1681*4882a593Smuzhiyun 1682*4882a593Smuzhiyun If ohci1394_dma=early is used as boot parameter, it will initialize 1683*4882a593Smuzhiyun all OHCI1394 controllers which are found in the PCI config space. 1684*4882a593Smuzhiyun 1685*4882a593Smuzhiyun As all changes to the FireWire bus such as enabling and disabling 1686*4882a593Smuzhiyun devices cause a bus reset and thereby disable remote DMA for all 1687*4882a593Smuzhiyun devices, be sure to have the cable plugged and FireWire enabled on 1688*4882a593Smuzhiyun the debugging host before booting the debug target for debugging. 1689*4882a593Smuzhiyun 1690*4882a593Smuzhiyun This code (~1k) is freed after boot. By then, the firewire stack 1691*4882a593Smuzhiyun in charge of the OHCI-1394 controllers should be used instead. 1692*4882a593Smuzhiyun 1693*4882a593Smuzhiyun See Documentation/core-api/debugging-via-ohci1394.rst for more information. 1694*4882a593Smuzhiyun 1695*4882a593Smuzhiyunsource "samples/Kconfig" 1696*4882a593Smuzhiyun 1697*4882a593Smuzhiyunconfig ARCH_HAS_DEVMEM_IS_ALLOWED 1698*4882a593Smuzhiyun bool 1699*4882a593Smuzhiyun 1700*4882a593Smuzhiyunconfig STRICT_DEVMEM 1701*4882a593Smuzhiyun bool "Filter access to /dev/mem" 1702*4882a593Smuzhiyun depends on MMU && DEVMEM 1703*4882a593Smuzhiyun depends on ARCH_HAS_DEVMEM_IS_ALLOWED 1704*4882a593Smuzhiyun default y if PPC || X86 || ARM64 1705*4882a593Smuzhiyun help 1706*4882a593Smuzhiyun If this option is disabled, you allow userspace (root) access to all 1707*4882a593Smuzhiyun of memory, including kernel and userspace memory. Accidental 1708*4882a593Smuzhiyun access to this is obviously disastrous, but specific access can 1709*4882a593Smuzhiyun be used by people debugging the kernel. Note that with PAT support 1710*4882a593Smuzhiyun enabled, even in this case there are restrictions on /dev/mem 1711*4882a593Smuzhiyun use due to the cache aliasing requirements. 1712*4882a593Smuzhiyun 1713*4882a593Smuzhiyun If this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem 1714*4882a593Smuzhiyun file only allows userspace access to PCI space and the BIOS code and 1715*4882a593Smuzhiyun data regions. This is sufficient for dosemu and X and all common 1716*4882a593Smuzhiyun users of /dev/mem. 1717*4882a593Smuzhiyun 1718*4882a593Smuzhiyun If in doubt, say Y. 1719*4882a593Smuzhiyun 1720*4882a593Smuzhiyunconfig IO_STRICT_DEVMEM 1721*4882a593Smuzhiyun bool "Filter I/O access to /dev/mem" 1722*4882a593Smuzhiyun depends on STRICT_DEVMEM 1723*4882a593Smuzhiyun help 1724*4882a593Smuzhiyun If this option is disabled, you allow userspace (root) access to all 1725*4882a593Smuzhiyun io-memory regardless of whether a driver is actively using that 1726*4882a593Smuzhiyun range. Accidental access to this is obviously disastrous, but 1727*4882a593Smuzhiyun specific access can be used by people debugging kernel drivers. 1728*4882a593Smuzhiyun 1729*4882a593Smuzhiyun If this option is switched on, the /dev/mem file only allows 1730*4882a593Smuzhiyun userspace access to *idle* io-memory ranges (see /proc/iomem) This 1731*4882a593Smuzhiyun may break traditional users of /dev/mem (dosemu, legacy X, etc...) 1732*4882a593Smuzhiyun if the driver using a given range cannot be disabled. 1733*4882a593Smuzhiyun 1734*4882a593Smuzhiyun If in doubt, say Y. 1735*4882a593Smuzhiyun 1736*4882a593Smuzhiyunmenu "$(SRCARCH) Debugging" 1737*4882a593Smuzhiyun 1738*4882a593Smuzhiyunsource "arch/$(SRCARCH)/Kconfig.debug" 1739*4882a593Smuzhiyun 1740*4882a593Smuzhiyunendmenu 1741*4882a593Smuzhiyun 1742*4882a593Smuzhiyunmenu "Kernel Testing and Coverage" 1743*4882a593Smuzhiyun 1744*4882a593Smuzhiyunsource "lib/kunit/Kconfig" 1745*4882a593Smuzhiyun 1746*4882a593Smuzhiyunconfig NOTIFIER_ERROR_INJECTION 1747*4882a593Smuzhiyun tristate "Notifier error injection" 1748*4882a593Smuzhiyun depends on DEBUG_KERNEL 1749*4882a593Smuzhiyun select DEBUG_FS 1750*4882a593Smuzhiyun help 1751*4882a593Smuzhiyun This option provides the ability to inject artificial errors to 1752*4882a593Smuzhiyun specified notifier chain callbacks. It is useful to test the error 1753*4882a593Smuzhiyun handling of notifier call chain failures. 1754*4882a593Smuzhiyun 1755*4882a593Smuzhiyun Say N if unsure. 1756*4882a593Smuzhiyun 1757*4882a593Smuzhiyunconfig PM_NOTIFIER_ERROR_INJECT 1758*4882a593Smuzhiyun tristate "PM notifier error injection module" 1759*4882a593Smuzhiyun depends on PM && NOTIFIER_ERROR_INJECTION 1760*4882a593Smuzhiyun default m if PM_DEBUG 1761*4882a593Smuzhiyun help 1762*4882a593Smuzhiyun This option provides the ability to inject artificial errors to 1763*4882a593Smuzhiyun PM notifier chain callbacks. It is controlled through debugfs 1764*4882a593Smuzhiyun interface /sys/kernel/debug/notifier-error-inject/pm 1765*4882a593Smuzhiyun 1766*4882a593Smuzhiyun If the notifier call chain should be failed with some events 1767*4882a593Smuzhiyun notified, write the error code to "actions/<notifier event>/error". 1768*4882a593Smuzhiyun 1769*4882a593Smuzhiyun Example: Inject PM suspend error (-12 = -ENOMEM) 1770*4882a593Smuzhiyun 1771*4882a593Smuzhiyun # cd /sys/kernel/debug/notifier-error-inject/pm/ 1772*4882a593Smuzhiyun # echo -12 > actions/PM_SUSPEND_PREPARE/error 1773*4882a593Smuzhiyun # echo mem > /sys/power/state 1774*4882a593Smuzhiyun bash: echo: write error: Cannot allocate memory 1775*4882a593Smuzhiyun 1776*4882a593Smuzhiyun To compile this code as a module, choose M here: the module will 1777*4882a593Smuzhiyun be called pm-notifier-error-inject. 1778*4882a593Smuzhiyun 1779*4882a593Smuzhiyun If unsure, say N. 1780*4882a593Smuzhiyun 1781*4882a593Smuzhiyunconfig OF_RECONFIG_NOTIFIER_ERROR_INJECT 1782*4882a593Smuzhiyun tristate "OF reconfig notifier error injection module" 1783*4882a593Smuzhiyun depends on OF_DYNAMIC && NOTIFIER_ERROR_INJECTION 1784*4882a593Smuzhiyun help 1785*4882a593Smuzhiyun This option provides the ability to inject artificial errors to 1786*4882a593Smuzhiyun OF reconfig notifier chain callbacks. It is controlled 1787*4882a593Smuzhiyun through debugfs interface under 1788*4882a593Smuzhiyun /sys/kernel/debug/notifier-error-inject/OF-reconfig/ 1789*4882a593Smuzhiyun 1790*4882a593Smuzhiyun If the notifier call chain should be failed with some events 1791*4882a593Smuzhiyun notified, write the error code to "actions/<notifier event>/error". 1792*4882a593Smuzhiyun 1793*4882a593Smuzhiyun To compile this code as a module, choose M here: the module will 1794*4882a593Smuzhiyun be called of-reconfig-notifier-error-inject. 1795*4882a593Smuzhiyun 1796*4882a593Smuzhiyun If unsure, say N. 1797*4882a593Smuzhiyun 1798*4882a593Smuzhiyunconfig NETDEV_NOTIFIER_ERROR_INJECT 1799*4882a593Smuzhiyun tristate "Netdev notifier error injection module" 1800*4882a593Smuzhiyun depends on NET && NOTIFIER_ERROR_INJECTION 1801*4882a593Smuzhiyun help 1802*4882a593Smuzhiyun This option provides the ability to inject artificial errors to 1803*4882a593Smuzhiyun netdevice notifier chain callbacks. It is controlled through debugfs 1804*4882a593Smuzhiyun interface /sys/kernel/debug/notifier-error-inject/netdev 1805*4882a593Smuzhiyun 1806*4882a593Smuzhiyun If the notifier call chain should be failed with some events 1807*4882a593Smuzhiyun notified, write the error code to "actions/<notifier event>/error". 1808*4882a593Smuzhiyun 1809*4882a593Smuzhiyun Example: Inject netdevice mtu change error (-22 = -EINVAL) 1810*4882a593Smuzhiyun 1811*4882a593Smuzhiyun # cd /sys/kernel/debug/notifier-error-inject/netdev 1812*4882a593Smuzhiyun # echo -22 > actions/NETDEV_CHANGEMTU/error 1813*4882a593Smuzhiyun # ip link set eth0 mtu 1024 1814*4882a593Smuzhiyun RTNETLINK answers: Invalid argument 1815*4882a593Smuzhiyun 1816*4882a593Smuzhiyun To compile this code as a module, choose M here: the module will 1817*4882a593Smuzhiyun be called netdev-notifier-error-inject. 1818*4882a593Smuzhiyun 1819*4882a593Smuzhiyun If unsure, say N. 1820*4882a593Smuzhiyun 1821*4882a593Smuzhiyunconfig FUNCTION_ERROR_INJECTION 1822*4882a593Smuzhiyun bool "Fault-injections of functions" 1823*4882a593Smuzhiyun depends on HAVE_FUNCTION_ERROR_INJECTION && KPROBES 1824*4882a593Smuzhiyun help 1825*4882a593Smuzhiyun Add fault injections into various functions that are annotated with 1826*4882a593Smuzhiyun ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return 1827*4882a593Smuzhiyun value of theses functions. This is useful to test error paths of code. 1828*4882a593Smuzhiyun 1829*4882a593Smuzhiyun If unsure, say N 1830*4882a593Smuzhiyun 1831*4882a593Smuzhiyunconfig FAULT_INJECTION 1832*4882a593Smuzhiyun bool "Fault-injection framework" 1833*4882a593Smuzhiyun depends on DEBUG_KERNEL 1834*4882a593Smuzhiyun help 1835*4882a593Smuzhiyun Provide fault-injection framework. 1836*4882a593Smuzhiyun For more details, see Documentation/fault-injection/. 1837*4882a593Smuzhiyun 1838*4882a593Smuzhiyunconfig FAILSLAB 1839*4882a593Smuzhiyun bool "Fault-injection capability for kmalloc" 1840*4882a593Smuzhiyun depends on FAULT_INJECTION 1841*4882a593Smuzhiyun depends on SLAB || SLUB 1842*4882a593Smuzhiyun help 1843*4882a593Smuzhiyun Provide fault-injection capability for kmalloc. 1844*4882a593Smuzhiyun 1845*4882a593Smuzhiyunconfig FAIL_PAGE_ALLOC 1846*4882a593Smuzhiyun bool "Fault-injection capability for alloc_pages()" 1847*4882a593Smuzhiyun depends on FAULT_INJECTION 1848*4882a593Smuzhiyun help 1849*4882a593Smuzhiyun Provide fault-injection capability for alloc_pages(). 1850*4882a593Smuzhiyun 1851*4882a593Smuzhiyunconfig FAULT_INJECTION_USERCOPY 1852*4882a593Smuzhiyun bool "Fault injection capability for usercopy functions" 1853*4882a593Smuzhiyun depends on FAULT_INJECTION 1854*4882a593Smuzhiyun help 1855*4882a593Smuzhiyun Provides fault-injection capability to inject failures 1856*4882a593Smuzhiyun in usercopy functions (copy_from_user(), get_user(), ...). 1857*4882a593Smuzhiyun 1858*4882a593Smuzhiyunconfig FAIL_MAKE_REQUEST 1859*4882a593Smuzhiyun bool "Fault-injection capability for disk IO" 1860*4882a593Smuzhiyun depends on FAULT_INJECTION && BLOCK 1861*4882a593Smuzhiyun help 1862*4882a593Smuzhiyun Provide fault-injection capability for disk IO. 1863*4882a593Smuzhiyun 1864*4882a593Smuzhiyunconfig FAIL_IO_TIMEOUT 1865*4882a593Smuzhiyun bool "Fault-injection capability for faking disk interrupts" 1866*4882a593Smuzhiyun depends on FAULT_INJECTION && BLOCK 1867*4882a593Smuzhiyun help 1868*4882a593Smuzhiyun Provide fault-injection capability on end IO handling. This 1869*4882a593Smuzhiyun will make the block layer "forget" an interrupt as configured, 1870*4882a593Smuzhiyun thus exercising the error handling. 1871*4882a593Smuzhiyun 1872*4882a593Smuzhiyun Only works with drivers that use the generic timeout handling, 1873*4882a593Smuzhiyun for others it wont do anything. 1874*4882a593Smuzhiyun 1875*4882a593Smuzhiyunconfig FAIL_FUTEX 1876*4882a593Smuzhiyun bool "Fault-injection capability for futexes" 1877*4882a593Smuzhiyun select DEBUG_FS 1878*4882a593Smuzhiyun depends on FAULT_INJECTION && FUTEX 1879*4882a593Smuzhiyun help 1880*4882a593Smuzhiyun Provide fault-injection capability for futexes. 1881*4882a593Smuzhiyun 1882*4882a593Smuzhiyunconfig FAULT_INJECTION_DEBUG_FS 1883*4882a593Smuzhiyun bool "Debugfs entries for fault-injection capabilities" 1884*4882a593Smuzhiyun depends on FAULT_INJECTION && SYSFS && DEBUG_FS 1885*4882a593Smuzhiyun help 1886*4882a593Smuzhiyun Enable configuration of fault-injection capabilities via debugfs. 1887*4882a593Smuzhiyun 1888*4882a593Smuzhiyunconfig FAIL_FUNCTION 1889*4882a593Smuzhiyun bool "Fault-injection capability for functions" 1890*4882a593Smuzhiyun depends on FAULT_INJECTION_DEBUG_FS && FUNCTION_ERROR_INJECTION 1891*4882a593Smuzhiyun help 1892*4882a593Smuzhiyun Provide function-based fault-injection capability. 1893*4882a593Smuzhiyun This will allow you to override a specific function with a return 1894*4882a593Smuzhiyun with given return value. As a result, function caller will see 1895*4882a593Smuzhiyun an error value and have to handle it. This is useful to test the 1896*4882a593Smuzhiyun error handling in various subsystems. 1897*4882a593Smuzhiyun 1898*4882a593Smuzhiyunconfig FAIL_MMC_REQUEST 1899*4882a593Smuzhiyun bool "Fault-injection capability for MMC IO" 1900*4882a593Smuzhiyun depends on FAULT_INJECTION_DEBUG_FS && MMC 1901*4882a593Smuzhiyun help 1902*4882a593Smuzhiyun Provide fault-injection capability for MMC IO. 1903*4882a593Smuzhiyun This will make the mmc core return data errors. This is 1904*4882a593Smuzhiyun useful to test the error handling in the mmc block device 1905*4882a593Smuzhiyun and to test how the mmc host driver handles retries from 1906*4882a593Smuzhiyun the block device. 1907*4882a593Smuzhiyun 1908*4882a593Smuzhiyunconfig FAULT_INJECTION_STACKTRACE_FILTER 1909*4882a593Smuzhiyun bool "stacktrace filter for fault-injection capabilities" 1910*4882a593Smuzhiyun depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT 1911*4882a593Smuzhiyun depends on !X86_64 1912*4882a593Smuzhiyun select STACKTRACE 1913*4882a593Smuzhiyun depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 1914*4882a593Smuzhiyun help 1915*4882a593Smuzhiyun Provide stacktrace filter for fault-injection capabilities 1916*4882a593Smuzhiyun 1917*4882a593Smuzhiyunconfig ARCH_HAS_KCOV 1918*4882a593Smuzhiyun bool 1919*4882a593Smuzhiyun help 1920*4882a593Smuzhiyun An architecture should select this when it can successfully 1921*4882a593Smuzhiyun build and run with CONFIG_KCOV. This typically requires 1922*4882a593Smuzhiyun disabling instrumentation for some early boot code. 1923*4882a593Smuzhiyun 1924*4882a593Smuzhiyunconfig CC_HAS_SANCOV_TRACE_PC 1925*4882a593Smuzhiyun def_bool $(cc-option,-fsanitize-coverage=trace-pc) 1926*4882a593Smuzhiyun 1927*4882a593Smuzhiyun 1928*4882a593Smuzhiyunconfig KCOV 1929*4882a593Smuzhiyun bool "Code coverage for fuzzing" 1930*4882a593Smuzhiyun depends on ARCH_HAS_KCOV 1931*4882a593Smuzhiyun depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS 1932*4882a593Smuzhiyun select DEBUG_FS 1933*4882a593Smuzhiyun select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC 1934*4882a593Smuzhiyun select SKB_EXTENSIONS if NET 1935*4882a593Smuzhiyun help 1936*4882a593Smuzhiyun KCOV exposes kernel code coverage information in a form suitable 1937*4882a593Smuzhiyun for coverage-guided fuzzing (randomized testing). 1938*4882a593Smuzhiyun 1939*4882a593Smuzhiyun If RANDOMIZE_BASE is enabled, PC values will not be stable across 1940*4882a593Smuzhiyun different machines and across reboots. If you need stable PC values, 1941*4882a593Smuzhiyun disable RANDOMIZE_BASE. 1942*4882a593Smuzhiyun 1943*4882a593Smuzhiyun For more details, see Documentation/dev-tools/kcov.rst. 1944*4882a593Smuzhiyun 1945*4882a593Smuzhiyunconfig KCOV_ENABLE_COMPARISONS 1946*4882a593Smuzhiyun bool "Enable comparison operands collection by KCOV" 1947*4882a593Smuzhiyun depends on KCOV 1948*4882a593Smuzhiyun depends on $(cc-option,-fsanitize-coverage=trace-cmp) 1949*4882a593Smuzhiyun help 1950*4882a593Smuzhiyun KCOV also exposes operands of every comparison in the instrumented 1951*4882a593Smuzhiyun code along with operand sizes and PCs of the comparison instructions. 1952*4882a593Smuzhiyun These operands can be used by fuzzing engines to improve the quality 1953*4882a593Smuzhiyun of fuzzing coverage. 1954*4882a593Smuzhiyun 1955*4882a593Smuzhiyunconfig KCOV_INSTRUMENT_ALL 1956*4882a593Smuzhiyun bool "Instrument all code by default" 1957*4882a593Smuzhiyun depends on KCOV 1958*4882a593Smuzhiyun default y 1959*4882a593Smuzhiyun help 1960*4882a593Smuzhiyun If you are doing generic system call fuzzing (like e.g. syzkaller), 1961*4882a593Smuzhiyun then you will want to instrument the whole kernel and you should 1962*4882a593Smuzhiyun say y here. If you are doing more targeted fuzzing (like e.g. 1963*4882a593Smuzhiyun filesystem fuzzing with AFL) then you will want to enable coverage 1964*4882a593Smuzhiyun for more specific subsets of files, and should say n here. 1965*4882a593Smuzhiyun 1966*4882a593Smuzhiyunconfig KCOV_IRQ_AREA_SIZE 1967*4882a593Smuzhiyun hex "Size of interrupt coverage collection area in words" 1968*4882a593Smuzhiyun depends on KCOV 1969*4882a593Smuzhiyun default 0x40000 1970*4882a593Smuzhiyun help 1971*4882a593Smuzhiyun KCOV uses preallocated per-cpu areas to collect coverage from 1972*4882a593Smuzhiyun soft interrupts. This specifies the size of those areas in the 1973*4882a593Smuzhiyun number of unsigned long words. 1974*4882a593Smuzhiyun 1975*4882a593Smuzhiyunmenuconfig RUNTIME_TESTING_MENU 1976*4882a593Smuzhiyun bool "Runtime Testing" 1977*4882a593Smuzhiyun def_bool y 1978*4882a593Smuzhiyun 1979*4882a593Smuzhiyunif RUNTIME_TESTING_MENU 1980*4882a593Smuzhiyun 1981*4882a593Smuzhiyunconfig LKDTM 1982*4882a593Smuzhiyun tristate "Linux Kernel Dump Test Tool Module" 1983*4882a593Smuzhiyun depends on DEBUG_FS 1984*4882a593Smuzhiyun help 1985*4882a593Smuzhiyun This module enables testing of the different dumping mechanisms by 1986*4882a593Smuzhiyun inducing system failures at predefined crash points. 1987*4882a593Smuzhiyun If you don't need it: say N 1988*4882a593Smuzhiyun Choose M here to compile this code as a module. The module will be 1989*4882a593Smuzhiyun called lkdtm. 1990*4882a593Smuzhiyun 1991*4882a593Smuzhiyun Documentation on how to use the module can be found in 1992*4882a593Smuzhiyun Documentation/fault-injection/provoke-crashes.rst 1993*4882a593Smuzhiyun 1994*4882a593Smuzhiyunconfig TEST_LIST_SORT 1995*4882a593Smuzhiyun tristate "Linked list sorting test" 1996*4882a593Smuzhiyun depends on DEBUG_KERNEL || m 1997*4882a593Smuzhiyun help 1998*4882a593Smuzhiyun Enable this to turn on 'list_sort()' function test. This test is 1999*4882a593Smuzhiyun executed only once during system boot (so affects only boot time), 2000*4882a593Smuzhiyun or at module load time. 2001*4882a593Smuzhiyun 2002*4882a593Smuzhiyun If unsure, say N. 2003*4882a593Smuzhiyun 2004*4882a593Smuzhiyunconfig TEST_MIN_HEAP 2005*4882a593Smuzhiyun tristate "Min heap test" 2006*4882a593Smuzhiyun depends on DEBUG_KERNEL || m 2007*4882a593Smuzhiyun help 2008*4882a593Smuzhiyun Enable this to turn on min heap function tests. This test is 2009*4882a593Smuzhiyun executed only once during system boot (so affects only boot time), 2010*4882a593Smuzhiyun or at module load time. 2011*4882a593Smuzhiyun 2012*4882a593Smuzhiyun If unsure, say N. 2013*4882a593Smuzhiyun 2014*4882a593Smuzhiyunconfig TEST_SORT 2015*4882a593Smuzhiyun tristate "Array-based sort test" 2016*4882a593Smuzhiyun depends on DEBUG_KERNEL || m 2017*4882a593Smuzhiyun help 2018*4882a593Smuzhiyun This option enables the self-test function of 'sort()' at boot, 2019*4882a593Smuzhiyun or at module load time. 2020*4882a593Smuzhiyun 2021*4882a593Smuzhiyun If unsure, say N. 2022*4882a593Smuzhiyun 2023*4882a593Smuzhiyunconfig KPROBES_SANITY_TEST 2024*4882a593Smuzhiyun bool "Kprobes sanity tests" 2025*4882a593Smuzhiyun depends on DEBUG_KERNEL 2026*4882a593Smuzhiyun depends on KPROBES 2027*4882a593Smuzhiyun help 2028*4882a593Smuzhiyun This option provides for testing basic kprobes functionality on 2029*4882a593Smuzhiyun boot. Samples of kprobe and kretprobe are inserted and 2030*4882a593Smuzhiyun verified for functionality. 2031*4882a593Smuzhiyun 2032*4882a593Smuzhiyun Say N if you are unsure. 2033*4882a593Smuzhiyun 2034*4882a593Smuzhiyunconfig BACKTRACE_SELF_TEST 2035*4882a593Smuzhiyun tristate "Self test for the backtrace code" 2036*4882a593Smuzhiyun depends on DEBUG_KERNEL 2037*4882a593Smuzhiyun help 2038*4882a593Smuzhiyun This option provides a kernel module that can be used to test 2039*4882a593Smuzhiyun the kernel stack backtrace code. This option is not useful 2040*4882a593Smuzhiyun for distributions or general kernels, but only for kernel 2041*4882a593Smuzhiyun developers working on architecture code. 2042*4882a593Smuzhiyun 2043*4882a593Smuzhiyun Note that if you want to also test saved backtraces, you will 2044*4882a593Smuzhiyun have to enable STACKTRACE as well. 2045*4882a593Smuzhiyun 2046*4882a593Smuzhiyun Say N if you are unsure. 2047*4882a593Smuzhiyun 2048*4882a593Smuzhiyunconfig RBTREE_TEST 2049*4882a593Smuzhiyun tristate "Red-Black tree test" 2050*4882a593Smuzhiyun depends on DEBUG_KERNEL 2051*4882a593Smuzhiyun help 2052*4882a593Smuzhiyun A benchmark measuring the performance of the rbtree library. 2053*4882a593Smuzhiyun Also includes rbtree invariant checks. 2054*4882a593Smuzhiyun 2055*4882a593Smuzhiyunconfig REED_SOLOMON_TEST 2056*4882a593Smuzhiyun tristate "Reed-Solomon library test" 2057*4882a593Smuzhiyun depends on DEBUG_KERNEL || m 2058*4882a593Smuzhiyun select REED_SOLOMON 2059*4882a593Smuzhiyun select REED_SOLOMON_ENC16 2060*4882a593Smuzhiyun select REED_SOLOMON_DEC16 2061*4882a593Smuzhiyun help 2062*4882a593Smuzhiyun This option enables the self-test function of rslib at boot, 2063*4882a593Smuzhiyun or at module load time. 2064*4882a593Smuzhiyun 2065*4882a593Smuzhiyun If unsure, say N. 2066*4882a593Smuzhiyun 2067*4882a593Smuzhiyunconfig INTERVAL_TREE_TEST 2068*4882a593Smuzhiyun tristate "Interval tree test" 2069*4882a593Smuzhiyun depends on DEBUG_KERNEL 2070*4882a593Smuzhiyun select INTERVAL_TREE 2071*4882a593Smuzhiyun help 2072*4882a593Smuzhiyun A benchmark measuring the performance of the interval tree library 2073*4882a593Smuzhiyun 2074*4882a593Smuzhiyunconfig PERCPU_TEST 2075*4882a593Smuzhiyun tristate "Per cpu operations test" 2076*4882a593Smuzhiyun depends on m && DEBUG_KERNEL 2077*4882a593Smuzhiyun help 2078*4882a593Smuzhiyun Enable this option to build test module which validates per-cpu 2079*4882a593Smuzhiyun operations. 2080*4882a593Smuzhiyun 2081*4882a593Smuzhiyun If unsure, say N. 2082*4882a593Smuzhiyun 2083*4882a593Smuzhiyunconfig ATOMIC64_SELFTEST 2084*4882a593Smuzhiyun tristate "Perform an atomic64_t self-test" 2085*4882a593Smuzhiyun help 2086*4882a593Smuzhiyun Enable this option to test the atomic64_t functions at boot or 2087*4882a593Smuzhiyun at module load time. 2088*4882a593Smuzhiyun 2089*4882a593Smuzhiyun If unsure, say N. 2090*4882a593Smuzhiyun 2091*4882a593Smuzhiyunconfig ASYNC_RAID6_TEST 2092*4882a593Smuzhiyun tristate "Self test for hardware accelerated raid6 recovery" 2093*4882a593Smuzhiyun depends on ASYNC_RAID6_RECOV 2094*4882a593Smuzhiyun select ASYNC_MEMCPY 2095*4882a593Smuzhiyun help 2096*4882a593Smuzhiyun This is a one-shot self test that permutes through the 2097*4882a593Smuzhiyun recovery of all the possible two disk failure scenarios for a 2098*4882a593Smuzhiyun N-disk array. Recovery is performed with the asynchronous 2099*4882a593Smuzhiyun raid6 recovery routines, and will optionally use an offload 2100*4882a593Smuzhiyun engine if one is available. 2101*4882a593Smuzhiyun 2102*4882a593Smuzhiyun If unsure, say N. 2103*4882a593Smuzhiyun 2104*4882a593Smuzhiyunconfig TEST_HEXDUMP 2105*4882a593Smuzhiyun tristate "Test functions located in the hexdump module at runtime" 2106*4882a593Smuzhiyun 2107*4882a593Smuzhiyunconfig TEST_STRING_HELPERS 2108*4882a593Smuzhiyun tristate "Test functions located in the string_helpers module at runtime" 2109*4882a593Smuzhiyun 2110*4882a593Smuzhiyunconfig TEST_STRSCPY 2111*4882a593Smuzhiyun tristate "Test strscpy*() family of functions at runtime" 2112*4882a593Smuzhiyun 2113*4882a593Smuzhiyunconfig TEST_KSTRTOX 2114*4882a593Smuzhiyun tristate "Test kstrto*() family of functions at runtime" 2115*4882a593Smuzhiyun 2116*4882a593Smuzhiyunconfig TEST_PRINTF 2117*4882a593Smuzhiyun tristate "Test printf() family of functions at runtime" 2118*4882a593Smuzhiyun 2119*4882a593Smuzhiyunconfig TEST_BITMAP 2120*4882a593Smuzhiyun tristate "Test bitmap_*() family of functions at runtime" 2121*4882a593Smuzhiyun help 2122*4882a593Smuzhiyun Enable this option to test the bitmap functions at boot. 2123*4882a593Smuzhiyun 2124*4882a593Smuzhiyun If unsure, say N. 2125*4882a593Smuzhiyun 2126*4882a593Smuzhiyunconfig TEST_UUID 2127*4882a593Smuzhiyun tristate "Test functions located in the uuid module at runtime" 2128*4882a593Smuzhiyun 2129*4882a593Smuzhiyunconfig TEST_XARRAY 2130*4882a593Smuzhiyun tristate "Test the XArray code at runtime" 2131*4882a593Smuzhiyun 2132*4882a593Smuzhiyunconfig TEST_OVERFLOW 2133*4882a593Smuzhiyun tristate "Test check_*_overflow() functions at runtime" 2134*4882a593Smuzhiyun 2135*4882a593Smuzhiyunconfig TEST_RHASHTABLE 2136*4882a593Smuzhiyun tristate "Perform selftest on resizable hash table" 2137*4882a593Smuzhiyun help 2138*4882a593Smuzhiyun Enable this option to test the rhashtable functions at boot. 2139*4882a593Smuzhiyun 2140*4882a593Smuzhiyun If unsure, say N. 2141*4882a593Smuzhiyun 2142*4882a593Smuzhiyunconfig TEST_HASH 2143*4882a593Smuzhiyun tristate "Perform selftest on hash functions" 2144*4882a593Smuzhiyun help 2145*4882a593Smuzhiyun Enable this option to test the kernel's integer (<linux/hash.h>), 2146*4882a593Smuzhiyun string (<linux/stringhash.h>), and siphash (<linux/siphash.h>) 2147*4882a593Smuzhiyun hash functions on boot (or module load). 2148*4882a593Smuzhiyun 2149*4882a593Smuzhiyun This is intended to help people writing architecture-specific 2150*4882a593Smuzhiyun optimized versions. If unsure, say N. 2151*4882a593Smuzhiyun 2152*4882a593Smuzhiyunconfig TEST_IDA 2153*4882a593Smuzhiyun tristate "Perform selftest on IDA functions" 2154*4882a593Smuzhiyun 2155*4882a593Smuzhiyunconfig TEST_PARMAN 2156*4882a593Smuzhiyun tristate "Perform selftest on priority array manager" 2157*4882a593Smuzhiyun depends on PARMAN 2158*4882a593Smuzhiyun help 2159*4882a593Smuzhiyun Enable this option to test priority array manager on boot 2160*4882a593Smuzhiyun (or module load). 2161*4882a593Smuzhiyun 2162*4882a593Smuzhiyun If unsure, say N. 2163*4882a593Smuzhiyun 2164*4882a593Smuzhiyunconfig TEST_IRQ_TIMINGS 2165*4882a593Smuzhiyun bool "IRQ timings selftest" 2166*4882a593Smuzhiyun depends on IRQ_TIMINGS 2167*4882a593Smuzhiyun help 2168*4882a593Smuzhiyun Enable this option to test the irq timings code on boot. 2169*4882a593Smuzhiyun 2170*4882a593Smuzhiyun If unsure, say N. 2171*4882a593Smuzhiyun 2172*4882a593Smuzhiyunconfig TEST_LKM 2173*4882a593Smuzhiyun tristate "Test module loading with 'hello world' module" 2174*4882a593Smuzhiyun depends on m 2175*4882a593Smuzhiyun help 2176*4882a593Smuzhiyun This builds the "test_module" module that emits "Hello, world" 2177*4882a593Smuzhiyun on printk when loaded. It is designed to be used for basic 2178*4882a593Smuzhiyun evaluation of the module loading subsystem (for example when 2179*4882a593Smuzhiyun validating module verification). It lacks any extra dependencies, 2180*4882a593Smuzhiyun and will not normally be loaded by the system unless explicitly 2181*4882a593Smuzhiyun requested by name. 2182*4882a593Smuzhiyun 2183*4882a593Smuzhiyun If unsure, say N. 2184*4882a593Smuzhiyun 2185*4882a593Smuzhiyunconfig TEST_BITOPS 2186*4882a593Smuzhiyun tristate "Test module for compilation of bitops operations" 2187*4882a593Smuzhiyun depends on m 2188*4882a593Smuzhiyun help 2189*4882a593Smuzhiyun This builds the "test_bitops" module that is much like the 2190*4882a593Smuzhiyun TEST_LKM module except that it does a basic exercise of the 2191*4882a593Smuzhiyun set/clear_bit macros and get_count_order/long to make sure there are 2192*4882a593Smuzhiyun no compiler warnings from C=1 sparse checker or -Wextra 2193*4882a593Smuzhiyun compilations. It has no dependencies and doesn't run or load unless 2194*4882a593Smuzhiyun explicitly requested by name. for example: modprobe test_bitops. 2195*4882a593Smuzhiyun 2196*4882a593Smuzhiyun If unsure, say N. 2197*4882a593Smuzhiyun 2198*4882a593Smuzhiyunconfig TEST_VMALLOC 2199*4882a593Smuzhiyun tristate "Test module for stress/performance analysis of vmalloc allocator" 2200*4882a593Smuzhiyun default n 2201*4882a593Smuzhiyun depends on MMU 2202*4882a593Smuzhiyun depends on m 2203*4882a593Smuzhiyun help 2204*4882a593Smuzhiyun This builds the "test_vmalloc" module that should be used for 2205*4882a593Smuzhiyun stress and performance analysis. So, any new change for vmalloc 2206*4882a593Smuzhiyun subsystem can be evaluated from performance and stability point 2207*4882a593Smuzhiyun of view. 2208*4882a593Smuzhiyun 2209*4882a593Smuzhiyun If unsure, say N. 2210*4882a593Smuzhiyun 2211*4882a593Smuzhiyunconfig TEST_USER_COPY 2212*4882a593Smuzhiyun tristate "Test user/kernel boundary protections" 2213*4882a593Smuzhiyun depends on m 2214*4882a593Smuzhiyun help 2215*4882a593Smuzhiyun This builds the "test_user_copy" module that runs sanity checks 2216*4882a593Smuzhiyun on the copy_to/from_user infrastructure, making sure basic 2217*4882a593Smuzhiyun user/kernel boundary testing is working. If it fails to load, 2218*4882a593Smuzhiyun a regression has been detected in the user/kernel memory boundary 2219*4882a593Smuzhiyun protections. 2220*4882a593Smuzhiyun 2221*4882a593Smuzhiyun If unsure, say N. 2222*4882a593Smuzhiyun 2223*4882a593Smuzhiyunconfig TEST_BPF 2224*4882a593Smuzhiyun tristate "Test BPF filter functionality" 2225*4882a593Smuzhiyun depends on m && NET 2226*4882a593Smuzhiyun help 2227*4882a593Smuzhiyun This builds the "test_bpf" module that runs various test vectors 2228*4882a593Smuzhiyun against the BPF interpreter or BPF JIT compiler depending on the 2229*4882a593Smuzhiyun current setting. This is in particular useful for BPF JIT compiler 2230*4882a593Smuzhiyun development, but also to run regression tests against changes in 2231*4882a593Smuzhiyun the interpreter code. It also enables test stubs for eBPF maps and 2232*4882a593Smuzhiyun verifier used by user space verifier testsuite. 2233*4882a593Smuzhiyun 2234*4882a593Smuzhiyun If unsure, say N. 2235*4882a593Smuzhiyun 2236*4882a593Smuzhiyunconfig TEST_BLACKHOLE_DEV 2237*4882a593Smuzhiyun tristate "Test blackhole netdev functionality" 2238*4882a593Smuzhiyun depends on m && NET 2239*4882a593Smuzhiyun help 2240*4882a593Smuzhiyun This builds the "test_blackhole_dev" module that validates the 2241*4882a593Smuzhiyun data path through this blackhole netdev. 2242*4882a593Smuzhiyun 2243*4882a593Smuzhiyun If unsure, say N. 2244*4882a593Smuzhiyun 2245*4882a593Smuzhiyunconfig FIND_BIT_BENCHMARK 2246*4882a593Smuzhiyun tristate "Test find_bit functions" 2247*4882a593Smuzhiyun help 2248*4882a593Smuzhiyun This builds the "test_find_bit" module that measure find_*_bit() 2249*4882a593Smuzhiyun functions performance. 2250*4882a593Smuzhiyun 2251*4882a593Smuzhiyun If unsure, say N. 2252*4882a593Smuzhiyun 2253*4882a593Smuzhiyunconfig TEST_FIRMWARE 2254*4882a593Smuzhiyun tristate "Test firmware loading via userspace interface" 2255*4882a593Smuzhiyun depends on FW_LOADER 2256*4882a593Smuzhiyun help 2257*4882a593Smuzhiyun This builds the "test_firmware" module that creates a userspace 2258*4882a593Smuzhiyun interface for testing firmware loading. This can be used to 2259*4882a593Smuzhiyun control the triggering of firmware loading without needing an 2260*4882a593Smuzhiyun actual firmware-using device. The contents can be rechecked by 2261*4882a593Smuzhiyun userspace. 2262*4882a593Smuzhiyun 2263*4882a593Smuzhiyun If unsure, say N. 2264*4882a593Smuzhiyun 2265*4882a593Smuzhiyunconfig TEST_SYSCTL 2266*4882a593Smuzhiyun tristate "sysctl test driver" 2267*4882a593Smuzhiyun depends on PROC_SYSCTL 2268*4882a593Smuzhiyun help 2269*4882a593Smuzhiyun This builds the "test_sysctl" module. This driver enables to test the 2270*4882a593Smuzhiyun proc sysctl interfaces available to drivers safely without affecting 2271*4882a593Smuzhiyun production knobs which might alter system functionality. 2272*4882a593Smuzhiyun 2273*4882a593Smuzhiyun If unsure, say N. 2274*4882a593Smuzhiyun 2275*4882a593Smuzhiyunconfig BITFIELD_KUNIT 2276*4882a593Smuzhiyun tristate "KUnit test bitfield functions at runtime" 2277*4882a593Smuzhiyun depends on KUNIT 2278*4882a593Smuzhiyun help 2279*4882a593Smuzhiyun Enable this option to test the bitfield functions at boot. 2280*4882a593Smuzhiyun 2281*4882a593Smuzhiyun KUnit tests run during boot and output the results to the debug log 2282*4882a593Smuzhiyun in TAP format (http://testanything.org/). Only useful for kernel devs 2283*4882a593Smuzhiyun running the KUnit test harness, and not intended for inclusion into a 2284*4882a593Smuzhiyun production build. 2285*4882a593Smuzhiyun 2286*4882a593Smuzhiyun For more information on KUnit and unit tests in general please refer 2287*4882a593Smuzhiyun to the KUnit documentation in Documentation/dev-tools/kunit/. 2288*4882a593Smuzhiyun 2289*4882a593Smuzhiyun If unsure, say N. 2290*4882a593Smuzhiyun 2291*4882a593Smuzhiyunconfig SYSCTL_KUNIT_TEST 2292*4882a593Smuzhiyun tristate "KUnit test for sysctl" if !KUNIT_ALL_TESTS 2293*4882a593Smuzhiyun depends on KUNIT 2294*4882a593Smuzhiyun default KUNIT_ALL_TESTS 2295*4882a593Smuzhiyun help 2296*4882a593Smuzhiyun This builds the proc sysctl unit test, which runs on boot. 2297*4882a593Smuzhiyun Tests the API contract and implementation correctness of sysctl. 2298*4882a593Smuzhiyun For more information on KUnit and unit tests in general please refer 2299*4882a593Smuzhiyun to the KUnit documentation in Documentation/dev-tools/kunit/. 2300*4882a593Smuzhiyun 2301*4882a593Smuzhiyun If unsure, say N. 2302*4882a593Smuzhiyun 2303*4882a593Smuzhiyunconfig LIST_KUNIT_TEST 2304*4882a593Smuzhiyun tristate "KUnit Test for Kernel Linked-list structures" if !KUNIT_ALL_TESTS 2305*4882a593Smuzhiyun depends on KUNIT 2306*4882a593Smuzhiyun default KUNIT_ALL_TESTS 2307*4882a593Smuzhiyun help 2308*4882a593Smuzhiyun This builds the linked list KUnit test suite. 2309*4882a593Smuzhiyun It tests that the API and basic functionality of the list_head type 2310*4882a593Smuzhiyun and associated macros. 2311*4882a593Smuzhiyun 2312*4882a593Smuzhiyun KUnit tests run during boot and output the results to the debug log 2313*4882a593Smuzhiyun in TAP format (https://testanything.org/). Only useful for kernel devs 2314*4882a593Smuzhiyun running the KUnit test harness, and not intended for inclusion into a 2315*4882a593Smuzhiyun production build. 2316*4882a593Smuzhiyun 2317*4882a593Smuzhiyun For more information on KUnit and unit tests in general please refer 2318*4882a593Smuzhiyun to the KUnit documentation in Documentation/dev-tools/kunit/. 2319*4882a593Smuzhiyun 2320*4882a593Smuzhiyun If unsure, say N. 2321*4882a593Smuzhiyun 2322*4882a593Smuzhiyunconfig LINEAR_RANGES_TEST 2323*4882a593Smuzhiyun tristate "KUnit test for linear_ranges" 2324*4882a593Smuzhiyun depends on KUNIT 2325*4882a593Smuzhiyun select LINEAR_RANGES 2326*4882a593Smuzhiyun help 2327*4882a593Smuzhiyun This builds the linear_ranges unit test, which runs on boot. 2328*4882a593Smuzhiyun Tests the linear_ranges logic correctness. 2329*4882a593Smuzhiyun For more information on KUnit and unit tests in general please refer 2330*4882a593Smuzhiyun to the KUnit documentation in Documentation/dev-tools/kunit/. 2331*4882a593Smuzhiyun 2332*4882a593Smuzhiyun If unsure, say N. 2333*4882a593Smuzhiyun 2334*4882a593Smuzhiyunconfig BITS_TEST 2335*4882a593Smuzhiyun tristate "KUnit test for bits.h" 2336*4882a593Smuzhiyun depends on KUNIT 2337*4882a593Smuzhiyun help 2338*4882a593Smuzhiyun This builds the bits unit test. 2339*4882a593Smuzhiyun Tests the logic of macros defined in bits.h. 2340*4882a593Smuzhiyun For more information on KUnit and unit tests in general please refer 2341*4882a593Smuzhiyun to the KUnit documentation in Documentation/dev-tools/kunit/. 2342*4882a593Smuzhiyun 2343*4882a593Smuzhiyun If unsure, say N. 2344*4882a593Smuzhiyun 2345*4882a593Smuzhiyunconfig TEST_UDELAY 2346*4882a593Smuzhiyun tristate "udelay test driver" 2347*4882a593Smuzhiyun help 2348*4882a593Smuzhiyun This builds the "udelay_test" module that helps to make sure 2349*4882a593Smuzhiyun that udelay() is working properly. 2350*4882a593Smuzhiyun 2351*4882a593Smuzhiyun If unsure, say N. 2352*4882a593Smuzhiyun 2353*4882a593Smuzhiyunconfig TEST_STATIC_KEYS 2354*4882a593Smuzhiyun tristate "Test static keys" 2355*4882a593Smuzhiyun depends on m 2356*4882a593Smuzhiyun help 2357*4882a593Smuzhiyun Test the static key interfaces. 2358*4882a593Smuzhiyun 2359*4882a593Smuzhiyun If unsure, say N. 2360*4882a593Smuzhiyun 2361*4882a593Smuzhiyunconfig TEST_KMOD 2362*4882a593Smuzhiyun tristate "kmod stress tester" 2363*4882a593Smuzhiyun depends on m 2364*4882a593Smuzhiyun depends on NETDEVICES && NET_CORE && INET # for TUN 2365*4882a593Smuzhiyun depends on BLOCK 2366*4882a593Smuzhiyun select TEST_LKM 2367*4882a593Smuzhiyun select XFS_FS 2368*4882a593Smuzhiyun select TUN 2369*4882a593Smuzhiyun select BTRFS_FS 2370*4882a593Smuzhiyun help 2371*4882a593Smuzhiyun Test the kernel's module loading mechanism: kmod. kmod implements 2372*4882a593Smuzhiyun support to load modules using the Linux kernel's usermode helper. 2373*4882a593Smuzhiyun This test provides a series of tests against kmod. 2374*4882a593Smuzhiyun 2375*4882a593Smuzhiyun Although technically you can either build test_kmod as a module or 2376*4882a593Smuzhiyun into the kernel we disallow building it into the kernel since 2377*4882a593Smuzhiyun it stress tests request_module() and this will very likely cause 2378*4882a593Smuzhiyun some issues by taking over precious threads available from other 2379*4882a593Smuzhiyun module load requests, ultimately this could be fatal. 2380*4882a593Smuzhiyun 2381*4882a593Smuzhiyun To run tests run: 2382*4882a593Smuzhiyun 2383*4882a593Smuzhiyun tools/testing/selftests/kmod/kmod.sh --help 2384*4882a593Smuzhiyun 2385*4882a593Smuzhiyun If unsure, say N. 2386*4882a593Smuzhiyun 2387*4882a593Smuzhiyunconfig TEST_DEBUG_VIRTUAL 2388*4882a593Smuzhiyun tristate "Test CONFIG_DEBUG_VIRTUAL feature" 2389*4882a593Smuzhiyun depends on DEBUG_VIRTUAL 2390*4882a593Smuzhiyun help 2391*4882a593Smuzhiyun Test the kernel's ability to detect incorrect calls to 2392*4882a593Smuzhiyun virt_to_phys() done against the non-linear part of the 2393*4882a593Smuzhiyun kernel's virtual address map. 2394*4882a593Smuzhiyun 2395*4882a593Smuzhiyun If unsure, say N. 2396*4882a593Smuzhiyun 2397*4882a593Smuzhiyunconfig TEST_MEMCAT_P 2398*4882a593Smuzhiyun tristate "Test memcat_p() helper function" 2399*4882a593Smuzhiyun help 2400*4882a593Smuzhiyun Test the memcat_p() helper for correctly merging two 2401*4882a593Smuzhiyun pointer arrays together. 2402*4882a593Smuzhiyun 2403*4882a593Smuzhiyun If unsure, say N. 2404*4882a593Smuzhiyun 2405*4882a593Smuzhiyunconfig TEST_LIVEPATCH 2406*4882a593Smuzhiyun tristate "Test livepatching" 2407*4882a593Smuzhiyun default n 2408*4882a593Smuzhiyun depends on DYNAMIC_DEBUG 2409*4882a593Smuzhiyun depends on LIVEPATCH 2410*4882a593Smuzhiyun depends on m 2411*4882a593Smuzhiyun help 2412*4882a593Smuzhiyun Test kernel livepatching features for correctness. The tests will 2413*4882a593Smuzhiyun load test modules that will be livepatched in various scenarios. 2414*4882a593Smuzhiyun 2415*4882a593Smuzhiyun To run all the livepatching tests: 2416*4882a593Smuzhiyun 2417*4882a593Smuzhiyun make -C tools/testing/selftests TARGETS=livepatch run_tests 2418*4882a593Smuzhiyun 2419*4882a593Smuzhiyun Alternatively, individual tests may be invoked: 2420*4882a593Smuzhiyun 2421*4882a593Smuzhiyun tools/testing/selftests/livepatch/test-callbacks.sh 2422*4882a593Smuzhiyun tools/testing/selftests/livepatch/test-livepatch.sh 2423*4882a593Smuzhiyun tools/testing/selftests/livepatch/test-shadow-vars.sh 2424*4882a593Smuzhiyun 2425*4882a593Smuzhiyun If unsure, say N. 2426*4882a593Smuzhiyun 2427*4882a593Smuzhiyunconfig TEST_OBJAGG 2428*4882a593Smuzhiyun tristate "Perform selftest on object aggreration manager" 2429*4882a593Smuzhiyun default n 2430*4882a593Smuzhiyun depends on OBJAGG 2431*4882a593Smuzhiyun help 2432*4882a593Smuzhiyun Enable this option to test object aggregation manager on boot 2433*4882a593Smuzhiyun (or module load). 2434*4882a593Smuzhiyun 2435*4882a593Smuzhiyun 2436*4882a593Smuzhiyunconfig TEST_STACKINIT 2437*4882a593Smuzhiyun tristate "Test level of stack variable initialization" 2438*4882a593Smuzhiyun help 2439*4882a593Smuzhiyun Test if the kernel is zero-initializing stack variables and 2440*4882a593Smuzhiyun padding. Coverage is controlled by compiler flags, 2441*4882a593Smuzhiyun CONFIG_GCC_PLUGIN_STRUCTLEAK, CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF, 2442*4882a593Smuzhiyun or CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL. 2443*4882a593Smuzhiyun 2444*4882a593Smuzhiyun If unsure, say N. 2445*4882a593Smuzhiyun 2446*4882a593Smuzhiyunconfig TEST_MEMINIT 2447*4882a593Smuzhiyun tristate "Test heap/page initialization" 2448*4882a593Smuzhiyun help 2449*4882a593Smuzhiyun Test if the kernel is zero-initializing heap and page allocations. 2450*4882a593Smuzhiyun This can be useful to test init_on_alloc and init_on_free features. 2451*4882a593Smuzhiyun 2452*4882a593Smuzhiyun If unsure, say N. 2453*4882a593Smuzhiyun 2454*4882a593Smuzhiyunconfig TEST_HMM 2455*4882a593Smuzhiyun tristate "Test HMM (Heterogeneous Memory Management)" 2456*4882a593Smuzhiyun depends on TRANSPARENT_HUGEPAGE 2457*4882a593Smuzhiyun depends on DEVICE_PRIVATE 2458*4882a593Smuzhiyun select HMM_MIRROR 2459*4882a593Smuzhiyun select MMU_NOTIFIER 2460*4882a593Smuzhiyun help 2461*4882a593Smuzhiyun This is a pseudo device driver solely for testing HMM. 2462*4882a593Smuzhiyun Say M here if you want to build the HMM test module. 2463*4882a593Smuzhiyun Doing so will allow you to run tools/testing/selftest/vm/hmm-tests. 2464*4882a593Smuzhiyun 2465*4882a593Smuzhiyun If unsure, say N. 2466*4882a593Smuzhiyun 2467*4882a593Smuzhiyunconfig TEST_FREE_PAGES 2468*4882a593Smuzhiyun tristate "Test freeing pages" 2469*4882a593Smuzhiyun help 2470*4882a593Smuzhiyun Test that a memory leak does not occur due to a race between 2471*4882a593Smuzhiyun freeing a block of pages and a speculative page reference. 2472*4882a593Smuzhiyun Loading this module is safe if your kernel has the bug fixed. 2473*4882a593Smuzhiyun If the bug is not fixed, it will leak gigabytes of memory and 2474*4882a593Smuzhiyun probably OOM your system. 2475*4882a593Smuzhiyun 2476*4882a593Smuzhiyunconfig TEST_FPU 2477*4882a593Smuzhiyun tristate "Test floating point operations in kernel space" 2478*4882a593Smuzhiyun depends on X86 && !KCOV_INSTRUMENT_ALL 2479*4882a593Smuzhiyun help 2480*4882a593Smuzhiyun Enable this option to add /sys/kernel/debug/selftest_helpers/test_fpu 2481*4882a593Smuzhiyun which will trigger a sequence of floating point operations. This is used 2482*4882a593Smuzhiyun for self-testing floating point control register setting in 2483*4882a593Smuzhiyun kernel_fpu_begin(). 2484*4882a593Smuzhiyun 2485*4882a593Smuzhiyun If unsure, say N. 2486*4882a593Smuzhiyun 2487*4882a593Smuzhiyunendif # RUNTIME_TESTING_MENU 2488*4882a593Smuzhiyun 2489*4882a593Smuzhiyunconfig MEMTEST 2490*4882a593Smuzhiyun bool "Memtest" 2491*4882a593Smuzhiyun help 2492*4882a593Smuzhiyun This option adds a kernel parameter 'memtest', which allows memtest 2493*4882a593Smuzhiyun to be set. 2494*4882a593Smuzhiyun memtest=0, mean disabled; -- default 2495*4882a593Smuzhiyun memtest=1, mean do 1 test pattern; 2496*4882a593Smuzhiyun ... 2497*4882a593Smuzhiyun memtest=17, mean do 17 test patterns. 2498*4882a593Smuzhiyun If you are unsure how to answer this question, answer N. 2499*4882a593Smuzhiyun 2500*4882a593Smuzhiyun 2501*4882a593Smuzhiyun 2502*4882a593Smuzhiyunconfig HYPERV_TESTING 2503*4882a593Smuzhiyun bool "Microsoft Hyper-V driver testing" 2504*4882a593Smuzhiyun default n 2505*4882a593Smuzhiyun depends on HYPERV && DEBUG_FS 2506*4882a593Smuzhiyun help 2507*4882a593Smuzhiyun Select this option to enable Hyper-V vmbus testing. 2508*4882a593Smuzhiyun 2509*4882a593Smuzhiyunendmenu # "Kernel Testing and Coverage" 2510*4882a593Smuzhiyun 2511*4882a593Smuzhiyunsource "Documentation/Kconfig" 2512*4882a593Smuzhiyun 2513*4882a593Smuzhiyunendmenu # Kernel hacking 2514