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