aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2017-05-15 18:30:32 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2017-06-08 21:52:43 -0400
commitae91aa0adb14dc33114d566feca2f7cb7a96b8b7 (patch)
treed52dfad4c7c9be2acac7c8f0c6890acd38547d60
parentbd8cc5a062f41e334596edbe823e2fa0adddd1b7 (diff)
rcu: Remove debugfs tracing
RCU's debugfs tracing used to be the only reasonable low-level debug information available, but ftrace and event tracing has since surpassed the RCU debugfs level of usefulness. This commit therefore removes RCU's debugfs tracing. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--Documentation/RCU/00-INDEX2
-rw-r--r--Documentation/RCU/Design/Requirements/Requirements.html2
-rw-r--r--Documentation/RCU/trace.txt535
-rw-r--r--init/Kconfig8
-rw-r--r--kernel/rcu/Makefile1
-rw-r--r--kernel/rcu/tiny_plugin.h45
-rw-r--r--kernel/rcu/tree.h27
-rw-r--r--kernel/rcu/tree_plugin.h31
-rw-r--r--kernel/rcu/tree_trace.c494
-rw-r--r--lib/Kconfig.debug5
-rw-r--r--tools/testing/selftests/rcutorture/configs/rcu/TREE02-T21
-rw-r--r--tools/testing/selftests/rcutorture/configs/rcu/TREE08-T21
-rw-r--r--tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt4
13 files changed, 4 insertions, 1192 deletions
diff --git a/Documentation/RCU/00-INDEX b/Documentation/RCU/00-INDEX
index 1672573b037a..f46980c060aa 100644
--- a/Documentation/RCU/00-INDEX
+++ b/Documentation/RCU/00-INDEX
@@ -28,8 +28,6 @@ stallwarn.txt
28 - RCU CPU stall warnings (module parameter rcu_cpu_stall_suppress) 28 - RCU CPU stall warnings (module parameter rcu_cpu_stall_suppress)
29torture.txt 29torture.txt
30 - RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST) 30 - RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST)
31trace.txt
32 - CONFIG_RCU_TRACE debugfs files and formats
33UP.txt 31UP.txt
34 - RCU on Uniprocessor Systems 32 - RCU on Uniprocessor Systems
35whatisRCU.txt 33whatisRCU.txt
diff --git a/Documentation/RCU/Design/Requirements/Requirements.html b/Documentation/RCU/Design/Requirements/Requirements.html
index 0e6550a8c926..95b30fa25d56 100644
--- a/Documentation/RCU/Design/Requirements/Requirements.html
+++ b/Documentation/RCU/Design/Requirements/Requirements.html
@@ -2034,7 +2034,7 @@ guard against mishaps and misuse:
2034 some other synchronization mechanism, for example, reference 2034 some other synchronization mechanism, for example, reference
2035 counting. 2035 counting.
2036<li> In kernels built with <tt>CONFIG_RCU_TRACE=y</tt>, RCU-related 2036<li> In kernels built with <tt>CONFIG_RCU_TRACE=y</tt>, RCU-related
2037 information is provided via both debugfs and event tracing. 2037 information is provided via event tracing.
2038<li> Open-coded use of <tt>rcu_assign_pointer()</tt> and 2038<li> Open-coded use of <tt>rcu_assign_pointer()</tt> and
2039 <tt>rcu_dereference()</tt> to create typical linked 2039 <tt>rcu_dereference()</tt> to create typical linked
2040 data structures can be surprisingly error-prone. 2040 data structures can be surprisingly error-prone.
diff --git a/Documentation/RCU/trace.txt b/Documentation/RCU/trace.txt
deleted file mode 100644
index 6549012033f9..000000000000
--- a/Documentation/RCU/trace.txt
+++ /dev/null
@@ -1,535 +0,0 @@
1CONFIG_RCU_TRACE debugfs Files and Formats
2
3
4The rcutree and rcutiny implementations of RCU provide debugfs trace
5output that summarizes counters and state. This information is useful for
6debugging RCU itself, and can sometimes also help to debug abuses of RCU.
7The following sections describe the debugfs files and formats, first
8for rcutree and next for rcutiny.
9
10
11CONFIG_TREE_RCU and CONFIG_PREEMPT_RCU debugfs Files and Formats
12
13These implementations of RCU provide several debugfs directories under the
14top-level directory "rcu":
15
16rcu/rcu_bh
17rcu/rcu_preempt
18rcu/rcu_sched
19
20Each directory contains files for the corresponding flavor of RCU.
21Note that rcu/rcu_preempt is only present for CONFIG_PREEMPT_RCU.
22For CONFIG_TREE_RCU, the RCU flavor maps onto the RCU-sched flavor,
23so that activity for both appears in rcu/rcu_sched.
24
25In addition, the following file appears in the top-level directory:
26rcu/rcutorture. This file displays rcutorture test progress. The output
27of "cat rcu/rcutorture" looks as follows:
28
29rcutorture test sequence: 0 (test in progress)
30rcutorture update version number: 615
31
32The first line shows the number of rcutorture tests that have completed
33since boot. If a test is currently running, the "(test in progress)"
34string will appear as shown above. The second line shows the number of
35update cycles that the current test has started, or zero if there is
36no test in progress.
37
38
39Within each flavor directory (rcu/rcu_bh, rcu/rcu_sched, and possibly
40also rcu/rcu_preempt) the following files will be present:
41
42rcudata:
43 Displays fields in struct rcu_data.
44rcuexp:
45 Displays statistics for expedited grace periods.
46rcugp:
47 Displays grace-period counters.
48rcuhier:
49 Displays the struct rcu_node hierarchy.
50rcu_pending:
51 Displays counts of the reasons rcu_pending() decided that RCU had
52 work to do.
53rcuboost:
54 Displays RCU boosting statistics. Only present if
55 CONFIG_RCU_BOOST=y.
56
57The output of "cat rcu/rcu_preempt/rcudata" looks as follows:
58
59 0!c=30455 g=30456 cnq=1/0:1 dt=126535/140000000000000/0 df=2002 of=4 ql=0/0 qs=N... b=10 ci=74572 nci=0 co=1131 ca=716
60 1!c=30719 g=30720 cnq=1/0:0 dt=132007/140000000000000/0 df=1874 of=10 ql=0/0 qs=N... b=10 ci=123209 nci=0 co=685 ca=982
61 2!c=30150 g=30151 cnq=1/1:1 dt=138537/140000000000000/0 df=1707 of=8 ql=0/0 qs=N... b=10 ci=80132 nci=0 co=1328 ca=1458
62 3 c=31249 g=31250 cnq=1/1:0 dt=107255/140000000000000/0 df=1749 of=6 ql=0/450 qs=NRW. b=10 ci=151700 nci=0 co=509 ca=622
63 4!c=29502 g=29503 cnq=1/0:1 dt=83647/140000000000000/0 df=965 of=5 ql=0/0 qs=N... b=10 ci=65643 nci=0 co=1373 ca=1521
64 5 c=31201 g=31202 cnq=1/0:1 dt=70422/0/0 df=535 of=7 ql=0/0 qs=.... b=10 ci=58500 nci=0 co=764 ca=698
65 6!c=30253 g=30254 cnq=1/0:1 dt=95363/140000000000000/0 df=780 of=5 ql=0/0 qs=N... b=10 ci=100607 nci=0 co=1414 ca=1353
66 7 c=31178 g=31178 cnq=1/0:0 dt=91536/0/0 df=547 of=4 ql=0/0 qs=.... b=10 ci=109819 nci=0 co=1115 ca=969
67
68This file has one line per CPU, or eight for this 8-CPU system.
69The fields are as follows:
70
71o The number at the beginning of each line is the CPU number.
72 CPUs numbers followed by an exclamation mark are offline,
73 but have been online at least once since boot. There will be
74 no output for CPUs that have never been online, which can be
75 a good thing in the surprisingly common case where NR_CPUS is
76 substantially larger than the number of actual CPUs.
77
78o "c" is the count of grace periods that this CPU believes have
79 completed. Offlined CPUs and CPUs in dynticks idle mode may lag
80 quite a ways behind, for example, CPU 4 under "rcu_sched" above,
81 which has been offline through 16 RCU grace periods. It is not
82 unusual to see offline CPUs lagging by thousands of grace periods.
83 Note that although the grace-period number is an unsigned long,
84 it is printed out as a signed long to allow more human-friendly
85 representation near boot time.
86
87o "g" is the count of grace periods that this CPU believes have
88 started. Again, offlined CPUs and CPUs in dynticks idle mode
89 may lag behind. If the "c" and "g" values are equal, this CPU
90 has already reported a quiescent state for the last RCU grace
91 period that it is aware of, otherwise, the CPU believes that it
92 owes RCU a quiescent state.
93
94o "pq" indicates that this CPU has passed through a quiescent state
95 for the current grace period. It is possible for "pq" to be
96 "1" and "c" different than "g", which indicates that although
97 the CPU has passed through a quiescent state, either (1) this
98 CPU has not yet reported that fact, (2) some other CPU has not
99 yet reported for this grace period, or (3) both.
100
101o "qp" indicates that RCU still expects a quiescent state from
102 this CPU. Offlined CPUs and CPUs in dyntick idle mode might
103 well have qp=1, which is OK: RCU is still ignoring them.
104
105o "dt" is the current value of the dyntick counter that is incremented
106 when entering or leaving idle, either due to a context switch or
107 due to an interrupt. This number is even if the CPU is in idle
108 from RCU's viewpoint and odd otherwise. The number after the
109 first "/" is the interrupt nesting depth when in idle state,
110 or a large number added to the interrupt-nesting depth when
111 running a non-idle task. Some architectures do not accurately
112 count interrupt nesting when running in non-idle kernel context,
113 which can result in interesting anomalies such as negative
114 interrupt-nesting levels. The number after the second "/"
115 is the NMI nesting depth.
116
117o "df" is the number of times that some other CPU has forced a
118 quiescent state on behalf of this CPU due to this CPU being in
119 idle state.
120
121o "of" is the number of times that some other CPU has forced a
122 quiescent state on behalf of this CPU due to this CPU being
123 offline. In a perfect world, this might never happen, but it
124 turns out that offlining and onlining a CPU can take several grace
125 periods, and so there is likely to be an extended period of time
126 when RCU believes that the CPU is online when it really is not.
127 Please note that erring in the other direction (RCU believing a
128 CPU is offline when it is really alive and kicking) is a fatal
129 error, so it makes sense to err conservatively.
130
131o "ql" is the number of RCU callbacks currently residing on
132 this CPU. The first number is the number of "lazy" callbacks
133 that are known to RCU to only be freeing memory, and the number
134 after the "/" is the total number of callbacks, lazy or not.
135 These counters count callbacks regardless of what phase of
136 grace-period processing that they are in (new, waiting for
137 grace period to start, waiting for grace period to end, ready
138 to invoke).
139
140o "qs" gives an indication of the state of the callback queue
141 with four characters:
142
143 "N" Indicates that there are callbacks queued that are not
144 ready to be handled by the next grace period, and thus
145 will be handled by the grace period following the next
146 one.
147
148 "R" Indicates that there are callbacks queued that are
149 ready to be handled by the next grace period.
150
151 "W" Indicates that there are callbacks queued that are
152 waiting on the current grace period.
153
154 "D" Indicates that there are callbacks queued that have
155 already been handled by a prior grace period, and are
156 thus waiting to be invoked. Note that callbacks in
157 the process of being invoked are not counted here.
158 Callbacks in the process of being invoked are those
159 that have been removed from the rcu_data structures
160 queues by rcu_do_batch(), but which have not yet been
161 invoked.
162
163 If there are no callbacks in a given one of the above states,
164 the corresponding character is replaced by ".".
165
166o "b" is the batch limit for this CPU. If more than this number
167 of RCU callbacks is ready to invoke, then the remainder will
168 be deferred.
169
170o "ci" is the number of RCU callbacks that have been invoked for
171 this CPU. Note that ci+nci+ql is the number of callbacks that have
172 been registered in absence of CPU-hotplug activity.
173
174o "nci" is the number of RCU callbacks that have been offloaded from
175 this CPU. This will always be zero unless the kernel was built
176 with CONFIG_RCU_NOCB_CPU=y and the "rcu_nocbs=" kernel boot
177 parameter was specified.
178
179o "co" is the number of RCU callbacks that have been orphaned due to
180 this CPU going offline. These orphaned callbacks have been moved
181 to an arbitrarily chosen online CPU.
182
183o "ca" is the number of RCU callbacks that have been adopted by this
184 CPU due to other CPUs going offline. Note that ci+co-ca+ql is
185 the number of RCU callbacks registered on this CPU.
186
187
188Kernels compiled with CONFIG_RCU_BOOST=y display the following from
189/debug/rcu/rcu_preempt/rcudata:
190
191 0!c=12865 g=12866 cnq=1/0:1 dt=83113/140000000000000/0 df=288 of=11 ql=0/0 qs=N... kt=0/O ktl=944 b=10 ci=60709 nci=0 co=748 ca=871
192 1 c=14407 g=14408 cnq=1/0:0 dt=100679/140000000000000/0 df=378 of=7 ql=0/119 qs=NRW. kt=0/W ktl=9b6 b=10 ci=109740 nci=0 co=589 ca=485
193 2 c=14407 g=14408 cnq=1/0:0 dt=105486/0/0 df=90 of=9 ql=0/89 qs=NRW. kt=0/W ktl=c0c b=10 ci=83113 nci=0 co=533 ca=490
194 3 c=14407 g=14408 cnq=1/0:0 dt=107138/0/0 df=142 of=8 ql=0/188 qs=NRW. kt=0/W ktl=b96 b=10 ci=121114 nci=0 co=426 ca=290
195 4 c=14405 g=14406 cnq=1/0:1 dt=50238/0/0 df=706 of=7 ql=0/0 qs=.... kt=0/W ktl=812 b=10 ci=34929 nci=0 co=643 ca=114
196 5!c=14168 g=14169 cnq=1/0:0 dt=45465/140000000000000/0 df=161 of=11 ql=0/0 qs=N... kt=0/O ktl=b4d b=10 ci=47712 nci=0 co=677 ca=722
197 6 c=14404 g=14405 cnq=1/0:0 dt=59454/0/0 df=94 of=6 ql=0/0 qs=.... kt=0/W ktl=e57 b=10 ci=55597 nci=0 co=701 ca=811
198 7 c=14407 g=14408 cnq=1/0:1 dt=68850/0/0 df=31 of=8 ql=0/0 qs=.... kt=0/W ktl=14bd b=10 ci=77475 nci=0 co=508 ca=1042
199
200This is similar to the output discussed above, but contains the following
201additional fields:
202
203o "kt" is the per-CPU kernel-thread state. The digit preceding
204 the first slash is zero if there is no work pending and 1
205 otherwise. The character between the first pair of slashes is
206 as follows:
207
208 "S" The kernel thread is stopped, in other words, all
209 CPUs corresponding to this rcu_node structure are
210 offline.
211
212 "R" The kernel thread is running.
213
214 "W" The kernel thread is waiting because there is no work
215 for it to do.
216
217 "O" The kernel thread is waiting because it has been
218 forced off of its designated CPU or because its
219 ->cpus_allowed mask permits it to run on other than
220 its designated CPU.
221
222 "Y" The kernel thread is yielding to avoid hogging CPU.
223
224 "?" Unknown value, indicates a bug.
225
226 The number after the final slash is the CPU that the kthread
227 is actually running on.
228
229 This field is displayed only for CONFIG_RCU_BOOST kernels.
230
231o "ktl" is the low-order 16 bits (in hexadecimal) of the count of
232 the number of times that this CPU's per-CPU kthread has gone
233 through its loop servicing invoke_rcu_cpu_kthread() requests.
234
235 This field is displayed only for CONFIG_RCU_BOOST kernels.
236
237
238The output of "cat rcu/rcu_preempt/rcuexp" looks as follows:
239
240s=21872 wd1=0 wd2=0 wd3=5 enq=0 sc=21872
241
242These fields are as follows:
243
244o "s" is the sequence number, with an odd number indicating that
245 an expedited grace period is in progress.
246
247o "wd1", "wd2", and "wd3" are the number of times that an attempt
248 to start an expedited grace period found that someone else had
249 completed an expedited grace period that satisfies the attempted
250 request. "Our work is done."
251
252o "enq" is the number of quiescent states still outstanding.
253
254o "sc" is the number of times that the attempt to start a
255 new expedited grace period succeeded.
256
257
258The output of "cat rcu/rcu_preempt/rcugp" looks as follows:
259
260completed=31249 gpnum=31250 age=1 max=18
261
262These fields are taken from the rcu_state structure, and are as follows:
263
264o "completed" is the number of grace periods that have completed.
265 It is comparable to the "c" field from rcu/rcudata in that a
266 CPU whose "c" field matches the value of "completed" is aware
267 that the corresponding RCU grace period has completed.
268
269o "gpnum" is the number of grace periods that have started. It is
270 similarly comparable to the "g" field from rcu/rcudata in that
271 a CPU whose "g" field matches the value of "gpnum" is aware that
272 the corresponding RCU grace period has started.
273
274 If these two fields are equal, then there is no grace period
275 in progress, in other words, RCU is idle. On the other hand,
276 if the two fields differ (as they are above), then an RCU grace
277 period is in progress.
278
279o "age" is the number of jiffies that the current grace period
280 has extended for, or zero if there is no grace period currently
281 in effect.
282
283o "max" is the age in jiffies of the longest-duration grace period
284 thus far.
285
286The output of "cat rcu/rcu_preempt/rcuhier" looks as follows:
287
288c=14407 g=14408 s=0 jfq=2 j=c863 nfqs=12040/nfqsng=0(12040) fqlh=1051 oqlen=0/0
2893/3 ..>. 0:7 ^0
290e/e ..>. 0:3 ^0 d/d ..>. 4:7 ^1
291
292The fields are as follows:
293
294o "c" is exactly the same as "completed" under rcu/rcu_preempt/rcugp.
295
296o "g" is exactly the same as "gpnum" under rcu/rcu_preempt/rcugp.
297
298o "s" is the current state of the force_quiescent_state()
299 state machine.
300
301o "jfq" is the number of jiffies remaining for this grace period
302 before force_quiescent_state() is invoked to help push things
303 along. Note that CPUs in idle mode throughout the grace period
304 will not report on their own, but rather must be check by some
305 other CPU via force_quiescent_state().
306
307o "j" is the low-order four hex digits of the jiffies counter.
308 Yes, Paul did run into a number of problems that turned out to
309 be due to the jiffies counter no longer counting. Why do you ask?
310
311o "nfqs" is the number of calls to force_quiescent_state() since
312 boot.
313
314o "nfqsng" is the number of useless calls to force_quiescent_state(),
315 where there wasn't actually a grace period active. This can
316 no longer happen due to grace-period processing being pushed
317 into a kthread. The number in parentheses is the difference
318 between "nfqs" and "nfqsng", or the number of times that
319 force_quiescent_state() actually did some real work.
320
321o "fqlh" is the number of calls to force_quiescent_state() that
322 exited immediately (without even being counted in nfqs above)
323 due to contention on ->fqslock.
324
325o Each element of the form "3/3 ..>. 0:7 ^0" represents one rcu_node
326 structure. Each line represents one level of the hierarchy,
327 from root to leaves. It is best to think of the rcu_data
328 structures as forming yet another level after the leaves.
329 Note that there might be either one, two, three, or even four
330 levels of rcu_node structures, depending on the relationship
331 between CONFIG_RCU_FANOUT, CONFIG_RCU_FANOUT_LEAF (possibly
332 adjusted using the rcu_fanout_leaf kernel boot parameter), and
333 CONFIG_NR_CPUS (possibly adjusted using the nr_cpu_ids count of
334 possible CPUs for the booting hardware).
335
336 o The numbers separated by the "/" are the qsmask followed
337 by the qsmaskinit. The qsmask will have one bit
338 set for each entity in the next lower level that has
339 not yet checked in for the current grace period ("e"
340 indicating CPUs 5, 6, and 7 in the example above).
341 The qsmaskinit will have one bit for each entity that is
342 currently expected to check in during each grace period.
343 The value of qsmaskinit is assigned to that of qsmask
344 at the beginning of each grace period.
345
346 o The characters separated by the ">" indicate the state
347 of the blocked-tasks lists. A "G" preceding the ">"
348 indicates that at least one task blocked in an RCU
349 read-side critical section blocks the current grace
350 period, while a "E" preceding the ">" indicates that
351 at least one task blocked in an RCU read-side critical
352 section blocks the current expedited grace period.
353 A "T" character following the ">" indicates that at
354 least one task is blocked within an RCU read-side
355 critical section, regardless of whether any current
356 grace period (expedited or normal) is inconvenienced.
357 A "." character appears if the corresponding condition
358 does not hold, so that "..>." indicates that no tasks
359 are blocked. In contrast, "GE>T" indicates maximal
360 inconvenience from blocked tasks. CONFIG_TREE_RCU
361 builds of the kernel will always show "..>.".
362
363 o The numbers separated by the ":" are the range of CPUs
364 served by this struct rcu_node. This can be helpful
365 in working out how the hierarchy is wired together.
366
367 For example, the example rcu_node structure shown above
368 has "0:7", indicating that it covers CPUs 0 through 7.
369
370 o The number after the "^" indicates the bit in the
371 next higher level rcu_node structure that this rcu_node
372 structure corresponds to. For example, the "d/d ..>. 4:7
373 ^1" has a "1" in this position, indicating that it
374 corresponds to the "1" bit in the "3" shown in the
375 "3/3 ..>. 0:7 ^0" entry on the next level up.
376
377
378The output of "cat rcu/rcu_sched/rcu_pending" looks as follows:
379
380 0!np=26111 qsp=29 rpq=5386 cbr=1 cng=570 gpc=3674 gps=577 nn=15903 ndw=0
381 1!np=28913 qsp=35 rpq=6097 cbr=1 cng=448 gpc=3700 gps=554 nn=18113 ndw=0
382 2!np=32740 qsp=37 rpq=6202 cbr=0 cng=476 gpc=4627 gps=546 nn=20889 ndw=0
383 3 np=23679 qsp=22 rpq=5044 cbr=1 cng=415 gpc=3403 gps=347 nn=14469 ndw=0
384 4!np=30714 qsp=4 rpq=5574 cbr=0 cng=528 gpc=3931 gps=639 nn=20042 ndw=0
385 5 np=28910 qsp=2 rpq=5246 cbr=0 cng=428 gpc=4105 gps=709 nn=18422 ndw=0
386 6!np=38648 qsp=5 rpq=7076 cbr=0 cng=840 gpc=4072 gps=961 nn=25699 ndw=0
387 7 np=37275 qsp=2 rpq=6873 cbr=0 cng=868 gpc=3416 gps=971 nn=25147 ndw=0
388
389The fields are as follows:
390
391o The leading number is the CPU number, with "!" indicating
392 an offline CPU.
393
394o "np" is the number of times that __rcu_pending() has been invoked
395 for the corresponding flavor of RCU.
396
397o "qsp" is the number of times that the RCU was waiting for a
398 quiescent state from this CPU.
399
400o "rpq" is the number of times that the CPU had passed through
401 a quiescent state, but not yet reported it to RCU.
402
403o "cbr" is the number of times that this CPU had RCU callbacks
404 that had passed through a grace period, and were thus ready
405 to be invoked.
406
407o "cng" is the number of times that this CPU needed another
408 grace period while RCU was idle.
409
410o "gpc" is the number of times that an old grace period had
411 completed, but this CPU was not yet aware of it.
412
413o "gps" is the number of times that a new grace period had started,
414 but this CPU was not yet aware of it.
415
416o "ndw" is the number of times that a wakeup of an rcuo
417 callback-offload kthread had to be deferred in order to avoid
418 deadlock.
419
420o "nn" is the number of times that this CPU needed nothing.
421
422
423The output of "cat rcu/rcuboost" looks as follows:
424
4250:3 tasks=.... kt=W ntb=0 neb=0 nnb=0 j=c864 bt=c894
426 balk: nt=0 egt=4695 bt=0 nb=0 ny=56 nos=0
4274:7 tasks=.... kt=W ntb=0 neb=0 nnb=0 j=c864 bt=c894
428 balk: nt=0 egt=6541 bt=0 nb=0 ny=126 nos=0
429
430This information is output only for rcu_preempt. Each two-line entry
431corresponds to a leaf rcu_node structure. The fields are as follows:
432
433o "n:m" is the CPU-number range for the corresponding two-line
434 entry. In the sample output above, the first entry covers
435 CPUs zero through three and the second entry covers CPUs four
436 through seven.
437
438o "tasks=TNEB" gives the state of the various segments of the
439 rnp->blocked_tasks list:
440
441 "T" This indicates that there are some tasks that blocked
442 while running on one of the corresponding CPUs while
443 in an RCU read-side critical section.
444
445 "N" This indicates that some of the blocked tasks are preventing
446 the current normal (non-expedited) grace period from
447 completing.
448
449 "E" This indicates that some of the blocked tasks are preventing
450 the current expedited grace period from completing.
451
452 "B" This indicates that some of the blocked tasks are in
453 need of RCU priority boosting.
454
455 Each character is replaced with "." if the corresponding
456 condition does not hold.
457
458o "kt" is the state of the RCU priority-boosting kernel
459 thread associated with the corresponding rcu_node structure.
460 The state can be one of the following:
461
462 "S" The kernel thread is stopped, in other words, all
463 CPUs corresponding to this rcu_node structure are
464 offline.
465
466 "R" The kernel thread is running.
467
468 "W" The kernel thread is waiting because there is no work
469 for it to do.
470
471 "Y" The kernel thread is yielding to avoid hogging CPU.
472
473 "?" Unknown value, indicates a bug.
474
475o "ntb" is the number of tasks boosted.
476
477o "neb" is the number of tasks boosted in order to complete an
478 expedited grace period.
479
480o "nnb" is the number of tasks boosted in order to complete a
481 normal (non-expedited) grace period. When boosting a task
482 that was blocking both an expedited and a normal grace period,
483 it is counted against the expedited total above.
484
485o "j" is the low-order 16 bits of the jiffies counter in
486 hexadecimal.
487
488o "bt" is the low-order 16 bits of the value that the jiffies
489 counter will have when we next start boosting, assuming that
490 the current grace period does not end beforehand. This is
491 also in hexadecimal.
492
493o "balk: nt" counts the number of times we didn't boost (in
494 other words, we balked) even though it was time to boost because
495 there were no blocked tasks to boost. This situation occurs
496 when there is one blocked task on one rcu_node structure and
497 none on some other rcu_node structure.
498
499o "egt" counts the number of times we balked because although
500 there were blocked tasks, none of them were blocking the
501 current grace period, whether expedited or otherwise.
502
503o "bt" counts the number of times we balked because boosting
504 had already been initiated for the current grace period.
505
506o "nb" counts the number of times we balked because there
507 was at least one task blocking the current non-expedited grace
508 period that never had blocked. If it is already running, it
509 just won't help to boost its priority!
510
511o "ny" counts the number of times we balked because it was
512 not yet time to start boosting.
513
514o "nos" counts the number of times we balked for other
515 reasons, e.g., the grace period ended first.
516
517
518CONFIG_TINY_RCU debugfs Files and Formats
519
520These implementations of RCU provides a single debugfs file under the
521top-level directory RCU, namely rcu/rcudata, which displays fields in
522rcu_bh_ctrlblk and rcu_sched_ctrlblk.
523
524The output of "cat rcu/rcudata" is as follows:
525
526rcu_sched: qlen: 0
527rcu_bh: qlen: 0
528
529This is split into rcu_sched and rcu_bh sections. The field is as
530follows:
531
532o "qlen" is the number of RCU callbacks currently waiting either
533 for an RCU grace period or waiting to be invoked. This is the
534 only field present for rcu_sched and rcu_bh, due to the
535 short-circuiting of grace period in those two cases.
diff --git a/init/Kconfig b/init/Kconfig
index 2aa14ff40e88..3025383ab443 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -659,14 +659,6 @@ config RCU_FAST_NO_HZ
659 659
660 Say N if you are unsure. 660 Say N if you are unsure.
661 661
662config TREE_RCU_TRACE
663 def_bool RCU_TRACE && ( TREE_RCU || PREEMPT_RCU )
664 select DEBUG_FS
665 help
666 This option provides tracing for the TREE_RCU and
667 PREEMPT_RCU implementations, permitting Makefile to
668 trivially select kernel/rcutree_trace.c.
669
670config RCU_BOOST 662config RCU_BOOST
671 bool "Enable RCU priority boosting" 663 bool "Enable RCU priority boosting"
672 depends on RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT 664 depends on RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT
diff --git a/kernel/rcu/Makefile b/kernel/rcu/Makefile
index 3945337c8ce4..13c0fc852767 100644
--- a/kernel/rcu/Makefile
+++ b/kernel/rcu/Makefile
@@ -9,6 +9,5 @@ obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
9obj-$(CONFIG_RCU_PERF_TEST) += rcuperf.o 9obj-$(CONFIG_RCU_PERF_TEST) += rcuperf.o
10obj-$(CONFIG_TREE_RCU) += tree.o 10obj-$(CONFIG_TREE_RCU) += tree.o
11obj-$(CONFIG_PREEMPT_RCU) += tree.o 11obj-$(CONFIG_PREEMPT_RCU) += tree.o
12obj-$(CONFIG_TREE_RCU_TRACE) += tree_trace.o
13obj-$(CONFIG_TINY_RCU) += tiny.o 12obj-$(CONFIG_TINY_RCU) += tiny.o
14obj-$(CONFIG_RCU_NEED_SEGCBLIST) += rcu_segcblist.o 13obj-$(CONFIG_RCU_NEED_SEGCBLIST) += rcu_segcblist.o
diff --git a/kernel/rcu/tiny_plugin.h b/kernel/rcu/tiny_plugin.h
index 371034e77f87..c642f23f1582 100644
--- a/kernel/rcu/tiny_plugin.h
+++ b/kernel/rcu/tiny_plugin.h
@@ -24,8 +24,6 @@
24 24
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/debugfs.h>
28#include <linux/seq_file.h>
29 27
30/* Global control variables for rcupdate callback mechanism. */ 28/* Global control variables for rcupdate callback mechanism. */
31struct rcu_ctrlblk { 29struct rcu_ctrlblk {
@@ -87,49 +85,6 @@ static void rcu_trace_sub_qlen(struct rcu_ctrlblk *rcp, int n)
87 local_irq_restore(flags); 85 local_irq_restore(flags);
88} 86}
89 87
90/*
91 * Dump statistics for TINY_RCU, such as they are.
92 */
93static int show_tiny_stats(struct seq_file *m, void *unused)
94{
95 seq_printf(m, "rcu_sched: qlen: %ld\n", rcu_sched_ctrlblk.qlen);
96 seq_printf(m, "rcu_bh: qlen: %ld\n", rcu_bh_ctrlblk.qlen);
97 return 0;
98}
99
100static int show_tiny_stats_open(struct inode *inode, struct file *file)
101{
102 return single_open(file, show_tiny_stats, NULL);
103}
104
105static const struct file_operations show_tiny_stats_fops = {
106 .owner = THIS_MODULE,
107 .open = show_tiny_stats_open,
108 .read = seq_read,
109 .llseek = seq_lseek,
110 .release = single_release,
111};
112
113static struct dentry *rcudir;
114
115static int __init rcutiny_trace_init(void)
116{
117 struct dentry *retval;
118
119 rcudir = debugfs_create_dir("rcu", NULL);
120 if (!rcudir)
121 goto free_out;
122 retval = debugfs_create_file("rcudata", 0444, rcudir,
123 NULL, &show_tiny_stats_fops);
124 if (!retval)
125 goto free_out;
126 return 0;
127free_out:
128 debugfs_remove_recursive(rcudir);
129 return 1;
130}
131device_initcall(rcutiny_trace_init);
132
133static void check_cpu_stall(struct rcu_ctrlblk *rcp) 88static void check_cpu_stall(struct rcu_ctrlblk *rcp)
134{ 89{
135 unsigned long j; 90 unsigned long j;
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 2c112bb11aa8..9af0f31d6847 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -152,19 +152,6 @@ struct rcu_node {
152 /* Number of tasks boosted for expedited GP. */ 152 /* Number of tasks boosted for expedited GP. */
153 unsigned long n_normal_boosts; 153 unsigned long n_normal_boosts;
154 /* Number of tasks boosted for normal GP. */ 154 /* Number of tasks boosted for normal GP. */
155 unsigned long n_balk_blkd_tasks;
156 /* Refused to boost: no blocked tasks. */
157 unsigned long n_balk_exp_gp_tasks;
158 /* Refused to boost: nothing blocking GP. */
159 unsigned long n_balk_boost_tasks;
160 /* Refused to boost: already boosting. */
161 unsigned long n_balk_notblocked;
162 /* Refused to boost: RCU RS CS still running. */
163 unsigned long n_balk_notyet;
164 /* Refused to boost: not yet time. */
165 unsigned long n_balk_nos;
166 /* Refused to boost: not sure why, though. */
167 /* This can happen due to race conditions. */
168#ifdef CONFIG_RCU_NOCB_CPU 155#ifdef CONFIG_RCU_NOCB_CPU
169 struct swait_queue_head nocb_gp_wq[2]; 156 struct swait_queue_head nocb_gp_wq[2];
170 /* Place for rcu_nocb_kthread() to wait GP. */ 157 /* Place for rcu_nocb_kthread() to wait GP. */
@@ -535,17 +522,3 @@ void srcu_offline_cpu(unsigned int cpu) { }
535#endif /* #else #ifdef CONFIG_SRCU */ 522#endif /* #else #ifdef CONFIG_SRCU */
536 523
537#endif /* #ifndef RCU_TREE_NONCORE */ 524#endif /* #ifndef RCU_TREE_NONCORE */
538
539#ifdef CONFIG_RCU_TRACE
540/* Read out queue lengths for tracing. */
541static inline void rcu_nocb_q_lengths(struct rcu_data *rdp, long *ql, long *qll)
542{
543#ifdef CONFIG_RCU_NOCB_CPU
544 *ql = atomic_long_read(&rdp->nocb_q_count);
545 *qll = atomic_long_read(&rdp->nocb_q_count_lazy);
546#else /* #ifdef CONFIG_RCU_NOCB_CPU */
547 *ql = 0;
548 *qll = 0;
549#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
550}
551#endif /* #ifdef CONFIG_RCU_TRACE */
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 7f5919ab24c4..43f2f8026b4a 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -70,7 +70,7 @@ static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */
70static void __init rcu_bootup_announce_oddness(void) 70static void __init rcu_bootup_announce_oddness(void)
71{ 71{
72 if (IS_ENABLED(CONFIG_RCU_TRACE)) 72 if (IS_ENABLED(CONFIG_RCU_TRACE))
73 pr_info("\tRCU debugfs-based tracing is enabled.\n"); 73 pr_info("\tRCU event tracing is enabled.\n");
74 if ((IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 64) || 74 if ((IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 64) ||
75 (!IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 32)) 75 (!IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 32))
76 pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n", 76 pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
@@ -899,33 +899,6 @@ void exit_rcu(void)
899 899
900#include "../locking/rtmutex_common.h" 900#include "../locking/rtmutex_common.h"
901 901
902#ifdef CONFIG_RCU_TRACE
903
904static void rcu_initiate_boost_trace(struct rcu_node *rnp)
905{
906 if (!rcu_preempt_has_tasks(rnp))
907 rnp->n_balk_blkd_tasks++;
908 else if (rnp->exp_tasks == NULL && rnp->gp_tasks == NULL)
909 rnp->n_balk_exp_gp_tasks++;
910 else if (rnp->gp_tasks != NULL && rnp->boost_tasks != NULL)
911 rnp->n_balk_boost_tasks++;
912 else if (rnp->gp_tasks != NULL && rnp->qsmask != 0)
913 rnp->n_balk_notblocked++;
914 else if (rnp->gp_tasks != NULL &&
915 ULONG_CMP_LT(jiffies, rnp->boost_time))
916 rnp->n_balk_notyet++;
917 else
918 rnp->n_balk_nos++;
919}
920
921#else /* #ifdef CONFIG_RCU_TRACE */
922
923static void rcu_initiate_boost_trace(struct rcu_node *rnp)
924{
925}
926
927#endif /* #else #ifdef CONFIG_RCU_TRACE */
928
929static void rcu_wake_cond(struct task_struct *t, int status) 902static void rcu_wake_cond(struct task_struct *t, int status)
930{ 903{
931 /* 904 /*
@@ -1058,7 +1031,6 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags)
1058 1031
1059 lockdep_assert_held(&rnp->lock); 1032 lockdep_assert_held(&rnp->lock);
1060 if (!rcu_preempt_blocked_readers_cgp(rnp) && rnp->exp_tasks == NULL) { 1033 if (!rcu_preempt_blocked_readers_cgp(rnp) && rnp->exp_tasks == NULL) {
1061 rnp->n_balk_exp_gp_tasks++;
1062 raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 1034 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
1063 return; 1035 return;
1064 } 1036 }
@@ -1074,7 +1046,6 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags)
1074 if (t) 1046 if (t)
1075 rcu_wake_cond(t, rnp->boost_kthread_status); 1047 rcu_wake_cond(t, rnp->boost_kthread_status);
1076 } else { 1048 } else {
1077 rcu_initiate_boost_trace(rnp);
1078 raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 1049 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
1079 } 1050 }
1080} 1051}
diff --git a/kernel/rcu/tree_trace.c b/kernel/rcu/tree_trace.c
deleted file mode 100644
index 6cea17a1ea30..000000000000
--- a/kernel/rcu/tree_trace.c
+++ /dev/null
@@ -1,494 +0,0 @@
1/*
2 * Read-Copy Update tracing for hierarchical implementation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, you can access it online at
16 * http://www.gnu.org/licenses/gpl-2.0.html.
17 *
18 * Copyright IBM Corporation, 2008
19 * Author: Paul E. McKenney
20 *
21 * Papers: http://www.rdrop.com/users/paulmck/RCU
22 *
23 * For detailed explanation of Read-Copy Update mechanism see -
24 * Documentation/RCU
25 *
26 */
27#include <linux/types.h>
28#include <linux/kernel.h>
29#include <linux/init.h>
30#include <linux/spinlock.h>
31#include <linux/smp.h>
32#include <linux/rcupdate.h>
33#include <linux/interrupt.h>
34#include <linux/sched.h>
35#include <linux/atomic.h>
36#include <linux/bitops.h>
37#include <linux/completion.h>
38#include <linux/percpu.h>
39#include <linux/notifier.h>
40#include <linux/cpu.h>
41#include <linux/mutex.h>
42#include <linux/debugfs.h>
43#include <linux/seq_file.h>
44#include <linux/prefetch.h>
45
46#define RCU_TREE_NONCORE
47#include "tree.h"
48#include "rcu.h"
49
50static int r_open(struct inode *inode, struct file *file,
51 const struct seq_operations *op)
52{
53 int ret = seq_open(file, op);
54 if (!ret) {
55 struct seq_file *m = (struct seq_file *)file->private_data;
56 m->private = inode->i_private;
57 }
58 return ret;
59}
60
61static void *r_start(struct seq_file *m, loff_t *pos)
62{
63 struct rcu_state *rsp = (struct rcu_state *)m->private;
64 *pos = cpumask_next(*pos - 1, cpu_possible_mask);
65 if ((*pos) < nr_cpu_ids)
66 return per_cpu_ptr(rsp->rda, *pos);
67 return NULL;
68}
69
70static void *r_next(struct seq_file *m, void *v, loff_t *pos)
71{
72 (*pos)++;
73 return r_start(m, pos);
74}
75
76static void r_stop(struct seq_file *m, void *v)
77{
78}
79
80static int show_rcubarrier(struct seq_file *m, void *v)
81{
82 struct rcu_state *rsp = (struct rcu_state *)m->private;
83 seq_printf(m, "bcc: %d bseq: %lu\n",
84 atomic_read(&rsp->barrier_cpu_count),
85 rsp->barrier_sequence);
86 return 0;
87}
88
89static int rcubarrier_open(struct inode *inode, struct file *file)
90{
91 return single_open(file, show_rcubarrier, inode->i_private);
92}
93
94static const struct file_operations rcubarrier_fops = {
95 .owner = THIS_MODULE,
96 .open = rcubarrier_open,
97 .read = seq_read,
98 .llseek = no_llseek,
99 .release = single_release,
100};
101
102#ifdef CONFIG_RCU_BOOST
103
104static char convert_kthread_status(unsigned int kthread_status)
105{
106 if (kthread_status > RCU_KTHREAD_MAX)
107 return '?';
108 return "SRWOY"[kthread_status];
109}
110
111#endif /* #ifdef CONFIG_RCU_BOOST */
112
113static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
114{
115 long ql, qll;
116
117 if (!rdp->beenonline)
118 return;
119 seq_printf(m, "%3d%cc=%ld g=%ld cnq=%d/%d:%d",
120 rdp->cpu,
121 cpu_is_offline(rdp->cpu) ? '!' : ' ',
122 ulong2long(rdp->completed), ulong2long(rdp->gpnum),
123 rdp->cpu_no_qs.b.norm,
124 rdp->rcu_qs_ctr_snap == per_cpu(rdp->dynticks->rcu_qs_ctr, rdp->cpu),
125 rdp->core_needs_qs);
126 seq_printf(m, " dt=%d/%llx/%d df=%lu",
127 rcu_dynticks_snap(rdp->dynticks),
128 rdp->dynticks->dynticks_nesting,
129 rdp->dynticks->dynticks_nmi_nesting,
130 rdp->dynticks_fqs);
131 seq_printf(m, " of=%lu", rdp->offline_fqs);
132 rcu_nocb_q_lengths(rdp, &ql, &qll);
133 qll += rcu_segcblist_n_lazy_cbs(&rdp->cblist);
134 ql += rcu_segcblist_n_cbs(&rdp->cblist);
135 seq_printf(m, " ql=%ld/%ld qs=%c%c%c%c",
136 qll, ql,
137 ".N"[!rcu_segcblist_segempty(&rdp->cblist, RCU_NEXT_TAIL)],
138 ".R"[!rcu_segcblist_segempty(&rdp->cblist,
139 RCU_NEXT_READY_TAIL)],
140 ".W"[!rcu_segcblist_segempty(&rdp->cblist, RCU_WAIT_TAIL)],
141 ".D"[!rcu_segcblist_segempty(&rdp->cblist, RCU_DONE_TAIL)]);
142#ifdef CONFIG_RCU_BOOST
143 seq_printf(m, " kt=%d/%c ktl=%x",
144 per_cpu(rcu_cpu_has_work, rdp->cpu),
145 convert_kthread_status(per_cpu(rcu_cpu_kthread_status,
146 rdp->cpu)),
147 per_cpu(rcu_cpu_kthread_loops, rdp->cpu) & 0xffff);
148#endif /* #ifdef CONFIG_RCU_BOOST */
149 seq_printf(m, " b=%ld", rdp->blimit);
150 seq_printf(m, " ci=%lu nci=%lu co=%lu ca=%lu\n",
151 rdp->n_cbs_invoked, rdp->n_nocbs_invoked,
152 rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
153}
154
155static int show_rcudata(struct seq_file *m, void *v)
156{
157 print_one_rcu_data(m, (struct rcu_data *)v);
158 return 0;
159}
160
161static const struct seq_operations rcudate_op = {
162 .start = r_start,
163 .next = r_next,
164 .stop = r_stop,
165 .show = show_rcudata,
166};
167
168static int rcudata_open(struct inode *inode, struct file *file)
169{
170 return r_open(inode, file, &rcudate_op);
171}
172
173static const struct file_operations rcudata_fops = {
174 .owner = THIS_MODULE,
175 .open = rcudata_open,
176 .read = seq_read,
177 .llseek = no_llseek,
178 .release = seq_release,
179};
180
181static int show_rcuexp(struct seq_file *m, void *v)
182{
183 int cpu;
184 struct rcu_state *rsp = (struct rcu_state *)m->private;
185 struct rcu_data *rdp;
186 unsigned long s0 = 0, s1 = 0, s2 = 0, s3 = 0;
187
188 for_each_possible_cpu(cpu) {
189 rdp = per_cpu_ptr(rsp->rda, cpu);
190 s0 += atomic_long_read(&rdp->exp_workdone0);
191 s1 += atomic_long_read(&rdp->exp_workdone1);
192 s2 += atomic_long_read(&rdp->exp_workdone2);
193 s3 += atomic_long_read(&rdp->exp_workdone3);
194 }
195 seq_printf(m, "s=%lu wd0=%lu wd1=%lu wd2=%lu wd3=%lu enq=%d sc=%lu\n",
196 rsp->expedited_sequence, s0, s1, s2, s3,
197 atomic_read(&rsp->expedited_need_qs),
198 rsp->expedited_sequence / 2);
199 return 0;
200}
201
202static int rcuexp_open(struct inode *inode, struct file *file)
203{
204 return single_open(file, show_rcuexp, inode->i_private);
205}
206
207static const struct file_operations rcuexp_fops = {
208 .owner = THIS_MODULE,
209 .open = rcuexp_open,
210 .read = seq_read,
211 .llseek = no_llseek,
212 .release = single_release,
213};
214
215#ifdef CONFIG_RCU_BOOST
216
217static void print_one_rcu_node_boost(struct seq_file *m, struct rcu_node *rnp)
218{
219 seq_printf(m, "%d:%d tasks=%c%c%c%c kt=%c ntb=%lu neb=%lu nnb=%lu ",
220 rnp->grplo, rnp->grphi,
221 "T."[list_empty(&rnp->blkd_tasks)],
222 "N."[!rnp->gp_tasks],
223 "E."[!rnp->exp_tasks],
224 "B."[!rnp->boost_tasks],
225 convert_kthread_status(rnp->boost_kthread_status),
226 rnp->n_tasks_boosted, rnp->n_exp_boosts,
227 rnp->n_normal_boosts);
228 seq_printf(m, "j=%04x bt=%04x\n",
229 (int)(jiffies & 0xffff),
230 (int)(rnp->boost_time & 0xffff));
231 seq_printf(m, " balk: nt=%lu egt=%lu bt=%lu nb=%lu ny=%lu nos=%lu\n",
232 rnp->n_balk_blkd_tasks,
233 rnp->n_balk_exp_gp_tasks,
234 rnp->n_balk_boost_tasks,
235 rnp->n_balk_notblocked,
236 rnp->n_balk_notyet,
237 rnp->n_balk_nos);
238}
239
240static int show_rcu_node_boost(struct seq_file *m, void *unused)
241{
242 struct rcu_node *rnp;
243
244 rcu_for_each_leaf_node(&rcu_preempt_state, rnp)
245 print_one_rcu_node_boost(m, rnp);
246 return 0;
247}
248
249static int rcu_node_boost_open(struct inode *inode, struct file *file)
250{
251 return single_open(file, show_rcu_node_boost, NULL);
252}
253
254static const struct file_operations rcu_node_boost_fops = {
255 .owner = THIS_MODULE,
256 .open = rcu_node_boost_open,
257 .read = seq_read,
258 .llseek = no_llseek,
259 .release = single_release,
260};
261
262#endif /* #ifdef CONFIG_RCU_BOOST */
263
264static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
265{
266 unsigned long gpnum;
267 int level = 0;
268 struct rcu_node *rnp;
269
270 gpnum = rsp->gpnum;
271 seq_printf(m, "c=%ld g=%ld s=%d jfq=%ld j=%x ",
272 ulong2long(rsp->completed), ulong2long(gpnum),
273 rsp->gp_state,
274 (long)(rsp->jiffies_force_qs - jiffies),
275 (int)(jiffies & 0xffff));
276 seq_printf(m, "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu oqlen=%ld/%ld\n",
277 rsp->n_force_qs, rsp->n_force_qs_ngp,
278 rsp->n_force_qs - rsp->n_force_qs_ngp,
279 READ_ONCE(rsp->n_force_qs_lh),
280 rsp->orphan_done.len_lazy,
281 rsp->orphan_done.len);
282 for (rnp = &rsp->node[0]; rnp - &rsp->node[0] < rcu_num_nodes; rnp++) {
283 if (rnp->level != level) {
284 seq_puts(m, "\n");
285 level = rnp->level;
286 }
287 seq_printf(m, "%lx/%lx->%lx %c%c>%c %d:%d ^%d ",
288 rnp->qsmask, rnp->qsmaskinit, rnp->qsmaskinitnext,
289 ".G"[rnp->gp_tasks != NULL],
290 ".E"[rnp->exp_tasks != NULL],
291 ".T"[!list_empty(&rnp->blkd_tasks)],
292 rnp->grplo, rnp->grphi, rnp->grpnum);
293 }
294 seq_puts(m, "\n");
295}
296
297static int show_rcuhier(struct seq_file *m, void *v)
298{
299 struct rcu_state *rsp = (struct rcu_state *)m->private;
300 print_one_rcu_state(m, rsp);
301 return 0;
302}
303
304static int rcuhier_open(struct inode *inode, struct file *file)
305{
306 return single_open(file, show_rcuhier, inode->i_private);
307}
308
309static const struct file_operations rcuhier_fops = {
310 .owner = THIS_MODULE,
311 .open = rcuhier_open,
312 .read = seq_read,
313 .llseek = no_llseek,
314 .release = single_release,
315};
316
317static void show_one_rcugp(struct seq_file *m, struct rcu_state *rsp)
318{
319 unsigned long flags;
320 unsigned long completed;
321 unsigned long gpnum;
322 unsigned long gpage;
323 unsigned long gpmax;
324 struct rcu_node *rnp = &rsp->node[0];
325
326 raw_spin_lock_irqsave_rcu_node(rnp, flags);
327 completed = READ_ONCE(rsp->completed);
328 gpnum = READ_ONCE(rsp->gpnum);
329 if (completed == gpnum)
330 gpage = 0;
331 else
332 gpage = jiffies - rsp->gp_start;
333 gpmax = rsp->gp_max;
334 raw_spin_unlock_irqrestore(&rnp->lock, flags);
335 seq_printf(m, "completed=%ld gpnum=%ld age=%ld max=%ld\n",
336 ulong2long(completed), ulong2long(gpnum), gpage, gpmax);
337}
338
339static int show_rcugp(struct seq_file *m, void *v)
340{
341 struct rcu_state *rsp = (struct rcu_state *)m->private;
342 show_one_rcugp(m, rsp);
343 return 0;
344}
345
346static int rcugp_open(struct inode *inode, struct file *file)
347{
348 return single_open(file, show_rcugp, inode->i_private);
349}
350
351static const struct file_operations rcugp_fops = {
352 .owner = THIS_MODULE,
353 .open = rcugp_open,
354 .read = seq_read,
355 .llseek = no_llseek,
356 .release = single_release,
357};
358
359static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp)
360{
361 if (!rdp->beenonline)
362 return;
363 seq_printf(m, "%3d%cnp=%ld ",
364 rdp->cpu,
365 cpu_is_offline(rdp->cpu) ? '!' : ' ',
366 rdp->n_rcu_pending);
367 seq_printf(m, "qsp=%ld rpq=%ld cbr=%ld cng=%ld ",
368 rdp->n_rp_core_needs_qs,
369 rdp->n_rp_report_qs,
370 rdp->n_rp_cb_ready,
371 rdp->n_rp_cpu_needs_gp);
372 seq_printf(m, "gpc=%ld gps=%ld nn=%ld ndw%ld\n",
373 rdp->n_rp_gp_completed,
374 rdp->n_rp_gp_started,
375 rdp->n_rp_nocb_defer_wakeup,
376 rdp->n_rp_need_nothing);
377}
378
379static int show_rcu_pending(struct seq_file *m, void *v)
380{
381 print_one_rcu_pending(m, (struct rcu_data *)v);
382 return 0;
383}
384
385static const struct seq_operations rcu_pending_op = {
386 .start = r_start,
387 .next = r_next,
388 .stop = r_stop,
389 .show = show_rcu_pending,
390};
391
392static int rcu_pending_open(struct inode *inode, struct file *file)
393{
394 return r_open(inode, file, &rcu_pending_op);
395}
396
397static const struct file_operations rcu_pending_fops = {
398 .owner = THIS_MODULE,
399 .open = rcu_pending_open,
400 .read = seq_read,
401 .llseek = no_llseek,
402 .release = seq_release,
403};
404
405static int show_rcutorture(struct seq_file *m, void *unused)
406{
407 seq_printf(m, "rcutorture test sequence: %lu %s\n",
408 rcutorture_testseq >> 1,
409 (rcutorture_testseq & 0x1) ? "(test in progress)" : "");
410 seq_printf(m, "rcutorture update version number: %lu\n",
411 rcutorture_vernum);
412 return 0;
413}
414
415static int rcutorture_open(struct inode *inode, struct file *file)
416{
417 return single_open(file, show_rcutorture, NULL);
418}
419
420static const struct file_operations rcutorture_fops = {
421 .owner = THIS_MODULE,
422 .open = rcutorture_open,
423 .read = seq_read,
424 .llseek = seq_lseek,
425 .release = single_release,
426};
427
428static struct dentry *rcudir;
429
430static int __init rcutree_trace_init(void)
431{
432 struct rcu_state *rsp;
433 struct dentry *retval;
434 struct dentry *rspdir;
435
436 rcudir = debugfs_create_dir("rcu", NULL);
437 if (!rcudir)
438 goto free_out;
439
440 for_each_rcu_flavor(rsp) {
441 rspdir = debugfs_create_dir(rsp->name, rcudir);
442 if (!rspdir)
443 goto free_out;
444
445 retval = debugfs_create_file("rcudata", 0444,
446 rspdir, rsp, &rcudata_fops);
447 if (!retval)
448 goto free_out;
449
450 retval = debugfs_create_file("rcuexp", 0444,
451 rspdir, rsp, &rcuexp_fops);
452 if (!retval)
453 goto free_out;
454
455 retval = debugfs_create_file("rcu_pending", 0444,
456 rspdir, rsp, &rcu_pending_fops);
457 if (!retval)
458 goto free_out;
459
460 retval = debugfs_create_file("rcubarrier", 0444,
461 rspdir, rsp, &rcubarrier_fops);
462 if (!retval)
463 goto free_out;
464
465#ifdef CONFIG_RCU_BOOST
466 if (rsp == &rcu_preempt_state) {
467 retval = debugfs_create_file("rcuboost", 0444,
468 rspdir, NULL, &rcu_node_boost_fops);
469 if (!retval)
470 goto free_out;
471 }
472#endif
473
474 retval = debugfs_create_file("rcugp", 0444,
475 rspdir, rsp, &rcugp_fops);
476 if (!retval)
477 goto free_out;
478
479 retval = debugfs_create_file("rcuhier", 0444,
480 rspdir, rsp, &rcuhier_fops);
481 if (!retval)
482 goto free_out;
483 }
484
485 retval = debugfs_create_file("rcutorture", 0444, rcudir,
486 NULL, &rcutorture_fops);
487 if (!retval)
488 goto free_out;
489 return 0;
490free_out:
491 debugfs_remove_recursive(rcudir);
492 return 1;
493}
494device_initcall(rcutree_trace_init);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 498d5dd63bf4..8c10b5a97b9e 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1361,9 +1361,8 @@ config RCU_TRACE
1361 default y if TREE_RCU 1361 default y if TREE_RCU
1362 select TRACE_CLOCK 1362 select TRACE_CLOCK
1363 help 1363 help
1364 This option provides tracing in RCU which presents stats 1364 This option enables additional tracepoints for ftrace-style
1365 in debugfs for debugging RCU implementation. It also enables 1365 event tracing.
1366 additional tracepoints for ftrace-style event tracing.
1367 1366
1368 Say Y here if you want to enable RCU tracing 1367 Say Y here if you want to enable RCU tracing
1369 Say N if you are unsure. 1368 Say N if you are unsure.
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE02-T b/tools/testing/selftests/rcutorture/configs/rcu/TREE02-T
deleted file mode 100644
index 917d2517b5b5..000000000000
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE02-T
+++ /dev/null
@@ -1,21 +0,0 @@
1CONFIG_SMP=y
2CONFIG_NR_CPUS=8
3CONFIG_PREEMPT_NONE=n
4CONFIG_PREEMPT_VOLUNTARY=n
5CONFIG_PREEMPT=y
6#CHECK#CONFIG_PREEMPT_RCU=y
7CONFIG_HZ_PERIODIC=n
8CONFIG_NO_HZ_IDLE=y
9CONFIG_NO_HZ_FULL=n
10CONFIG_RCU_FAST_NO_HZ=n
11CONFIG_RCU_TRACE=y
12CONFIG_HOTPLUG_CPU=n
13CONFIG_SUSPEND=n
14CONFIG_HIBERNATION=n
15CONFIG_RCU_FANOUT=3
16CONFIG_RCU_FANOUT_LEAF=3
17CONFIG_RCU_NOCB_CPU=n
18CONFIG_DEBUG_LOCK_ALLOC=y
19CONFIG_PROVE_LOCKING=n
20CONFIG_RCU_BOOST=n
21CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE08-T b/tools/testing/selftests/rcutorture/configs/rcu/TREE08-T
deleted file mode 100644
index 2ad13f0d29cc..000000000000
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE08-T
+++ /dev/null
@@ -1,21 +0,0 @@
1CONFIG_SMP=y
2CONFIG_NR_CPUS=16
3CONFIG_PREEMPT_NONE=n
4CONFIG_PREEMPT_VOLUNTARY=n
5CONFIG_PREEMPT=y
6#CHECK#CONFIG_PREEMPT_RCU=y
7CONFIG_HZ_PERIODIC=n
8CONFIG_NO_HZ_IDLE=y
9CONFIG_NO_HZ_FULL=n
10CONFIG_RCU_FAST_NO_HZ=n
11CONFIG_RCU_TRACE=y
12CONFIG_HOTPLUG_CPU=n
13CONFIG_SUSPEND=n
14CONFIG_HIBERNATION=n
15CONFIG_RCU_FANOUT=3
16CONFIG_RCU_FANOUT_LEAF=2
17CONFIG_RCU_NOCB_CPU=y
18CONFIG_RCU_NOCB_CPU_ALL=y
19CONFIG_DEBUG_LOCK_ALLOC=n
20CONFIG_RCU_BOOST=n
21CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
diff --git a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
index c5c29fb7438c..928fadaecc25 100644
--- a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
+++ b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
@@ -79,9 +79,5 @@ CONFIG_TASKS_RCU
79 79
80 Selected by CONFIG_RCU_TORTURE_TEST, so cannot disable. 80 Selected by CONFIG_RCU_TORTURE_TEST, so cannot disable.
81 81
82CONFIG_RCU_TRACE
83
84 Implied by CONFIG_RCU_TRACE for Tree RCU.
85
86 82
87boot parameters ignored: TBD 83boot parameters ignored: TBD