1# SPDX-License-Identifier: GPL-2.0-only
2#
3# RCU-related debugging configuration options
4#
5
6menu "RCU Debugging"
7
8config PROVE_RCU
9	def_bool PROVE_LOCKING
10
11config PROVE_RCU_LIST
12	bool "RCU list lockdep debugging"
13	depends on PROVE_RCU && RCU_EXPERT
14	default n
15	help
16	  Enable RCU lockdep checking for list usages. By default it is
17	  turned off since there are several list RCU users that still
18	  need to be converted to pass a lockdep expression. To prevent
19	  false-positive splats, we keep it default disabled but once all
20	  users are converted, we can remove this config option.
21
22config TORTURE_TEST
23	tristate
24	default n
25
26config RCU_SCALE_TEST
27	tristate "performance tests for RCU"
28	depends on DEBUG_KERNEL
29	select TORTURE_TEST
30	default n
31	help
32	  This option provides a kernel module that runs performance
33	  tests on the RCU infrastructure.  The kernel module may be built
34	  after the fact on the running kernel to be tested, if desired.
35
36	  Say Y here if you want RCU performance tests to be built into
37	  the kernel.
38	  Say M if you want the RCU performance tests to build as a module.
39	  Say N if you are unsure.
40
41config RCU_TORTURE_TEST
42	tristate "torture tests for RCU"
43	depends on DEBUG_KERNEL
44	select TORTURE_TEST
45	default n
46	help
47	  This option provides a kernel module that runs torture tests
48	  on the RCU infrastructure.  The kernel module may be built
49	  after the fact on the running kernel to be tested, if desired.
50
51	  Say Y here if you want RCU torture tests to be built into
52	  the kernel.
53	  Say M if you want the RCU torture tests to build as a module.
54	  Say N if you are unsure.
55
56config RCU_TORTURE_TEST_CHK_RDR_STATE
57	bool "Check rcutorture reader state"
58	depends on RCU_TORTURE_TEST
59	default n
60	help
61	  This option causes rcutorture to check the desired rcutorture
62	  reader state for each segment against the actual context.
63	  Note that PREEMPT_COUNT must be enabled if the preempt-disabled
64	  and bh-disabled checks are to take effect, and that PREEMPT_RCU
65	  must be enabled for the RCU-nesting checks to take effect.
66	  These checks add overhead, and this Kconfig options is therefore
67	  disabled by default.
68
69	  Say Y here if you want rcutorture reader contexts checked.
70	  Say N if you are unsure.
71
72config RCU_TORTURE_TEST_LOG_CPU
73	bool "Log CPU for rcutorture failures"
74	depends on RCU_TORTURE_TEST
75	default n
76	help
77	  This option causes rcutorture to decorate each entry of its
78	  log of failure/close-call rcutorture reader segments with the
79	  number of the CPU that the reader was running on at the time.
80	  This information can be useful, but it does incur additional
81	  overhead, overhead that can make both failures and close calls
82	  less probable.
83
84	  Say Y here if you want CPU IDs logged.
85	  Say N if you are unsure.
86
87config RCU_TORTURE_TEST_LOG_GP
88	bool "Log grace-period numbers for rcutorture failures"
89	depends on RCU_TORTURE_TEST
90	default n
91	help
92	  This option causes rcutorture to decorate each entry of its
93	  log of failure/close-call rcutorture reader segments with the
94	  corresponding grace-period sequence numbers.	This information
95	  can be useful, but it does incur additional overhead, overhead
96	  that can make both failures and close calls less probable.
97
98	  Say Y here if you want grace-period sequence numbers logged.
99	  Say N if you are unsure.
100
101config RCU_REF_SCALE_TEST
102	tristate "Scalability tests for read-side synchronization (RCU and others)"
103	depends on DEBUG_KERNEL
104	select TORTURE_TEST
105	default n
106	help
107	  This option provides a kernel module that runs performance tests
108	  useful comparing RCU with various read-side synchronization mechanisms.
109	  The kernel module may be built after the fact on the running kernel to be
110	  tested, if desired.
111
112	  Say Y here if you want these performance tests built into the kernel.
113	  Say M if you want to build it as a module instead.
114	  Say N if you are unsure.
115
116config RCU_CPU_STALL_TIMEOUT
117	int "RCU CPU stall timeout in seconds"
118	depends on RCU_STALL_COMMON
119	range 3 300
120	default 21
121	help
122	  If a given RCU grace period extends more than the specified
123	  number of seconds, a CPU stall warning is printed.  If the
124	  RCU grace period persists, additional CPU stall warnings are
125	  printed at more widely spaced intervals.
126
127config RCU_EXP_CPU_STALL_TIMEOUT
128	int "Expedited RCU CPU stall timeout in milliseconds"
129	depends on RCU_STALL_COMMON
130	range 0 300000
131	default 0
132	help
133	  If a given expedited RCU grace period extends more than the
134	  specified number of milliseconds, a CPU stall warning is printed.
135	  If the RCU grace period persists, additional CPU stall warnings
136	  are printed at more widely spaced intervals.  A value of zero
137	  says to use the RCU_CPU_STALL_TIMEOUT value converted from
138	  seconds to milliseconds.
139
140config RCU_CPU_STALL_CPUTIME
141	bool "Provide additional RCU stall debug information"
142	depends on RCU_STALL_COMMON
143	default n
144	help
145	  Collect statistics during the sampling period, such as the number of
146	  (hard interrupts, soft interrupts, task switches) and the cputime of
147	  (hard interrupts, soft interrupts, kernel tasks) are added to the
148	  RCU stall report. For multiple continuous RCU stalls, all sampling
149	  periods begin at half of the first RCU stall timeout.
150	  The boot option rcupdate.rcu_cpu_stall_cputime has the same function
151	  as this one, but will override this if it exists.
152
153config RCU_CPU_STALL_NOTIFIER
154	bool "Provide RCU CPU-stall notifiers"
155	depends on RCU_STALL_COMMON
156	depends on DEBUG_KERNEL
157	depends on RCU_EXPERT
158	default n
159	help
160	  WARNING:  You almost certainly do not want this!!!
161
162	  Enable RCU CPU-stall notifiers, which are invoked just before
163	  printing the RCU CPU stall warning.  As such, bugs in notifier
164	  callbacks can prevent stall warnings from being printed.
165	  And the whole reason that a stall warning is being printed is
166	  that something is hung up somewhere.	Therefore, the notifier
167	  callbacks must be written extremely carefully, preferably
168	  containing only lockless code.  After all, it is quite possible
169	  that the whole reason that the RCU CPU stall is happening in
170	  the first place is that someone forgot to release whatever lock
171	  that you are thinking of acquiring.  In which case, having your
172	  notifier callback acquire that lock will hang, preventing the
173	  RCU CPU stall warning from appearing.
174
175	  Say Y here if you want RCU CPU stall notifiers (you don't want them)
176	  Say N if you are unsure.
177
178config RCU_TRACE
179	bool "Enable tracing for RCU"
180	depends on DEBUG_KERNEL
181	default y if TREE_RCU
182	select TRACE_CLOCK
183	help
184	  This option enables additional tracepoints for ftrace-style
185	  event tracing.
186
187	  Say Y here if you want to enable RCU tracing
188	  Say N if you are unsure.
189
190config RCU_EQS_DEBUG
191	bool "Provide debugging asserts for adding NO_HZ support to an arch"
192	depends on DEBUG_KERNEL
193	help
194	  This option provides consistency checks in RCU's handling of
195	  NO_HZ.  These checks have proven quite helpful in detecting
196	  bugs in arch-specific NO_HZ code.
197
198	  Say N here if you need ultimate kernel/user switch latencies
199	  Say Y if you are unsure
200
201config RCU_STRICT_GRACE_PERIOD
202	bool "Provide debug RCU implementation with short grace periods"
203	depends on DEBUG_KERNEL && RCU_EXPERT && NR_CPUS <= 4 && !TINY_RCU
204	default n
205	select PREEMPT_COUNT if PREEMPT=n
206	help
207	  Select this option to build an RCU variant that is strict about
208	  grace periods, making them as short as it can.  This limits
209	  scalability, destroys real-time response, degrades battery
210	  lifetime and kills performance.  Don't try this on large
211	  machines, as in systems with more than about 10 or 20 CPUs.
212	  But in conjunction with tools like KASAN, it can be helpful
213	  when looking for certain types of RCU usage bugs, for example,
214	  too-short RCU read-side critical sections.
215
216endmenu # "RCU Debugging"
217