projects/linux·blob v7.3-rc4 · refs

3642 lines · 118.8 KiB

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