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