rcu: eliminate unused boosting statistics
[deliverable/linux.git] / kernel / rcutree_trace.c
CommitLineData
64db4cff
PM
1/*
2 * Read-Copy Update tracing for classic 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, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2008
19 *
20 * Papers: http://www.rdrop.com/users/paulmck/RCU
21 *
22 * For detailed explanation of Read-Copy Update mechanism see -
a71fca58 23 * Documentation/RCU
64db4cff
PM
24 *
25 */
26#include <linux/types.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/spinlock.h>
30#include <linux/smp.h>
31#include <linux/rcupdate.h>
32#include <linux/interrupt.h>
33#include <linux/sched.h>
34#include <asm/atomic.h>
35#include <linux/bitops.h>
36#include <linux/module.h>
37#include <linux/completion.h>
38#include <linux/moduleparam.h>
39#include <linux/percpu.h>
40#include <linux/notifier.h>
41#include <linux/cpu.h>
42#include <linux/mutex.h>
43#include <linux/debugfs.h>
44#include <linux/seq_file.h>
45
9f77da9f 46#define RCU_TREE_NONCORE
6258c4fb
IM
47#include "rcutree.h"
48
64db4cff
PM
49static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
50{
51 if (!rdp->beenonline)
52 return;
20133cfc 53 seq_printf(m, "%3d%cc=%lu g=%lu pq=%d pqc=%lu qp=%d",
64db4cff
PM
54 rdp->cpu,
55 cpu_is_offline(rdp->cpu) ? '!' : ' ',
56 rdp->completed, rdp->gpnum,
57 rdp->passed_quiesc, rdp->passed_quiesc_completed,
ef631b0c 58 rdp->qs_pending);
64db4cff 59#ifdef CONFIG_NO_HZ
e59fb312
PM
60 seq_printf(m, " dt=%d/%d/%d df=%lu",
61 atomic_read(&rdp->dynticks->dynticks),
64db4cff 62 rdp->dynticks->dynticks_nesting,
e59fb312 63 rdp->dynticks->dynticks_nmi_nesting,
64db4cff
PM
64 rdp->dynticks_fqs);
65#endif /* #ifdef CONFIG_NO_HZ */
66 seq_printf(m, " of=%lu ri=%lu", rdp->offline_fqs, rdp->resched_ipi);
269dcc1c
PM
67 seq_printf(m, " ql=%ld b=%ld", rdp->qlen, rdp->blimit);
68 seq_printf(m, " ci=%lu co=%lu ca=%lu\n",
69 rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
64db4cff
PM
70}
71
72#define PRINT_RCU_DATA(name, func, m) \
73 do { \
74 int _p_r_d_i; \
75 \
76 for_each_possible_cpu(_p_r_d_i) \
77 func(m, &per_cpu(name, _p_r_d_i)); \
78 } while (0)
79
80static int show_rcudata(struct seq_file *m, void *unused)
81{
f41d911f
PM
82#ifdef CONFIG_TREE_PREEMPT_RCU
83 seq_puts(m, "rcu_preempt:\n");
84 PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data, m);
85#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
d6714c22
PM
86 seq_puts(m, "rcu_sched:\n");
87 PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data, m);
64db4cff
PM
88 seq_puts(m, "rcu_bh:\n");
89 PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data, m);
90 return 0;
91}
92
93static int rcudata_open(struct inode *inode, struct file *file)
94{
95 return single_open(file, show_rcudata, NULL);
96}
97
9b2619af 98static const struct file_operations rcudata_fops = {
64db4cff
PM
99 .owner = THIS_MODULE,
100 .open = rcudata_open,
101 .read = seq_read,
102 .llseek = seq_lseek,
103 .release = single_release,
104};
105
106static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp)
107{
108 if (!rdp->beenonline)
109 return;
20133cfc 110 seq_printf(m, "%d,%s,%lu,%lu,%d,%lu,%d",
64db4cff 111 rdp->cpu,
5699ed8f 112 cpu_is_offline(rdp->cpu) ? "\"N\"" : "\"Y\"",
64db4cff
PM
113 rdp->completed, rdp->gpnum,
114 rdp->passed_quiesc, rdp->passed_quiesc_completed,
ef631b0c 115 rdp->qs_pending);
64db4cff
PM
116#ifdef CONFIG_NO_HZ
117 seq_printf(m, ",%d,%d,%d,%lu",
e59fb312 118 atomic_read(&rdp->dynticks->dynticks),
64db4cff 119 rdp->dynticks->dynticks_nesting,
e59fb312 120 rdp->dynticks->dynticks_nmi_nesting,
64db4cff
PM
121 rdp->dynticks_fqs);
122#endif /* #ifdef CONFIG_NO_HZ */
123 seq_printf(m, ",%lu,%lu", rdp->offline_fqs, rdp->resched_ipi);
269dcc1c
PM
124 seq_printf(m, ",%ld,%ld", rdp->qlen, rdp->blimit);
125 seq_printf(m, ",%lu,%lu,%lu\n",
126 rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
64db4cff
PM
127}
128
129static int show_rcudata_csv(struct seq_file *m, void *unused)
130{
ef631b0c 131 seq_puts(m, "\"CPU\",\"Online?\",\"c\",\"g\",\"pq\",\"pqc\",\"pq\",");
64db4cff 132#ifdef CONFIG_NO_HZ
e59fb312 133 seq_puts(m, "\"dt\",\"dt nesting\",\"dt NMI nesting\",\"df\",");
64db4cff 134#endif /* #ifdef CONFIG_NO_HZ */
269dcc1c 135 seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\",\"ci\",\"co\",\"ca\"\n");
f41d911f
PM
136#ifdef CONFIG_TREE_PREEMPT_RCU
137 seq_puts(m, "\"rcu_preempt:\"\n");
138 PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data_csv, m);
139#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
d6714c22
PM
140 seq_puts(m, "\"rcu_sched:\"\n");
141 PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data_csv, m);
64db4cff
PM
142 seq_puts(m, "\"rcu_bh:\"\n");
143 PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data_csv, m);
144 return 0;
145}
146
147static int rcudata_csv_open(struct inode *inode, struct file *file)
148{
149 return single_open(file, show_rcudata_csv, NULL);
150}
151
9b2619af 152static const struct file_operations rcudata_csv_fops = {
64db4cff
PM
153 .owner = THIS_MODULE,
154 .open = rcudata_csv_open,
155 .read = seq_read,
156 .llseek = seq_lseek,
157 .release = single_release,
158};
159
160static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
161{
20133cfc 162 unsigned long gpnum;
64db4cff
PM
163 int level = 0;
164 struct rcu_node *rnp;
165
3397e040 166 gpnum = rsp->gpnum;
20133cfc 167 seq_printf(m, "c=%lu g=%lu s=%d jfq=%ld j=%x "
29494be7 168 "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu\n",
3397e040 169 rsp->completed, gpnum, rsp->signaled,
64db4cff
PM
170 (long)(rsp->jiffies_force_qs - jiffies),
171 (int)(jiffies & 0xffff),
172 rsp->n_force_qs, rsp->n_force_qs_ngp,
173 rsp->n_force_qs - rsp->n_force_qs_ngp,
29494be7 174 rsp->n_force_qs_lh);
64db4cff
PM
175 for (rnp = &rsp->node[0]; rnp - &rsp->node[0] < NUM_RCU_NODES; rnp++) {
176 if (rnp->level != level) {
177 seq_puts(m, "\n");
178 level = rnp->level;
179 }
12f5f524 180 seq_printf(m, "%lx/%lx %c%c>%c %d:%d ^%d ",
64db4cff 181 rnp->qsmask, rnp->qsmaskinit,
12f5f524
PM
182 ".G"[rnp->gp_tasks != NULL],
183 ".E"[rnp->exp_tasks != NULL],
184 ".T"[!list_empty(&rnp->blkd_tasks)],
64db4cff
PM
185 rnp->grplo, rnp->grphi, rnp->grpnum);
186 }
187 seq_puts(m, "\n");
188}
189
190static int show_rcuhier(struct seq_file *m, void *unused)
191{
f41d911f
PM
192#ifdef CONFIG_TREE_PREEMPT_RCU
193 seq_puts(m, "rcu_preempt:\n");
194 print_one_rcu_state(m, &rcu_preempt_state);
195#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
d6714c22
PM
196 seq_puts(m, "rcu_sched:\n");
197 print_one_rcu_state(m, &rcu_sched_state);
64db4cff
PM
198 seq_puts(m, "rcu_bh:\n");
199 print_one_rcu_state(m, &rcu_bh_state);
200 return 0;
201}
202
203static int rcuhier_open(struct inode *inode, struct file *file)
204{
205 return single_open(file, show_rcuhier, NULL);
206}
207
9b2619af 208static const struct file_operations rcuhier_fops = {
64db4cff
PM
209 .owner = THIS_MODULE,
210 .open = rcuhier_open,
211 .read = seq_read,
212 .llseek = seq_lseek,
213 .release = single_release,
214};
215
216static int show_rcugp(struct seq_file *m, void *unused)
217{
f41d911f 218#ifdef CONFIG_TREE_PREEMPT_RCU
20133cfc 219 seq_printf(m, "rcu_preempt: completed=%ld gpnum=%lu\n",
f41d911f
PM
220 rcu_preempt_state.completed, rcu_preempt_state.gpnum);
221#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
20133cfc 222 seq_printf(m, "rcu_sched: completed=%ld gpnum=%lu\n",
d6714c22 223 rcu_sched_state.completed, rcu_sched_state.gpnum);
20133cfc 224 seq_printf(m, "rcu_bh: completed=%ld gpnum=%lu\n",
64db4cff
PM
225 rcu_bh_state.completed, rcu_bh_state.gpnum);
226 return 0;
227}
228
229static int rcugp_open(struct inode *inode, struct file *file)
230{
231 return single_open(file, show_rcugp, NULL);
232}
233
9b2619af 234static const struct file_operations rcugp_fops = {
64db4cff
PM
235 .owner = THIS_MODULE,
236 .open = rcugp_open,
237 .read = seq_read,
238 .llseek = seq_lseek,
239 .release = single_release,
240};
241
7ba5c840
PM
242static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp)
243{
244 seq_printf(m, "%3d%cnp=%ld "
d21670ac
PM
245 "qsp=%ld rpq=%ld cbr=%ld cng=%ld "
246 "gpc=%ld gps=%ld nf=%ld nn=%ld\n",
7ba5c840
PM
247 rdp->cpu,
248 cpu_is_offline(rdp->cpu) ? '!' : ' ',
249 rdp->n_rcu_pending,
250 rdp->n_rp_qs_pending,
d21670ac 251 rdp->n_rp_report_qs,
7ba5c840
PM
252 rdp->n_rp_cb_ready,
253 rdp->n_rp_cpu_needs_gp,
254 rdp->n_rp_gp_completed,
255 rdp->n_rp_gp_started,
256 rdp->n_rp_need_fqs,
257 rdp->n_rp_need_nothing);
258}
259
260static void print_rcu_pendings(struct seq_file *m, struct rcu_state *rsp)
261{
262 int cpu;
263 struct rcu_data *rdp;
264
265 for_each_possible_cpu(cpu) {
394f99a9 266 rdp = per_cpu_ptr(rsp->rda, cpu);
7ba5c840
PM
267 if (rdp->beenonline)
268 print_one_rcu_pending(m, rdp);
269 }
270}
271
272static int show_rcu_pending(struct seq_file *m, void *unused)
273{
f41d911f
PM
274#ifdef CONFIG_TREE_PREEMPT_RCU
275 seq_puts(m, "rcu_preempt:\n");
276 print_rcu_pendings(m, &rcu_preempt_state);
277#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
d6714c22
PM
278 seq_puts(m, "rcu_sched:\n");
279 print_rcu_pendings(m, &rcu_sched_state);
7ba5c840
PM
280 seq_puts(m, "rcu_bh:\n");
281 print_rcu_pendings(m, &rcu_bh_state);
282 return 0;
283}
284
285static int rcu_pending_open(struct inode *inode, struct file *file)
286{
287 return single_open(file, show_rcu_pending, NULL);
288}
289
9b2619af 290static const struct file_operations rcu_pending_fops = {
7ba5c840
PM
291 .owner = THIS_MODULE,
292 .open = rcu_pending_open,
293 .read = seq_read,
294 .llseek = seq_lseek,
295 .release = single_release,
296};
297
298static struct dentry *rcudir;
7ba5c840 299
deb7a418 300static int __init rcutree_trace_init(void)
64db4cff 301{
22f00b69
PM
302 struct dentry *retval;
303
64db4cff
PM
304 rcudir = debugfs_create_dir("rcu", NULL);
305 if (!rcudir)
22f00b69 306 goto free_out;
64db4cff 307
22f00b69 308 retval = debugfs_create_file("rcudata", 0444, rcudir,
64db4cff 309 NULL, &rcudata_fops);
22f00b69 310 if (!retval)
64db4cff
PM
311 goto free_out;
312
22f00b69 313 retval = debugfs_create_file("rcudata.csv", 0444, rcudir,
64db4cff 314 NULL, &rcudata_csv_fops);
22f00b69 315 if (!retval)
64db4cff
PM
316 goto free_out;
317
22f00b69
PM
318 retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops);
319 if (!retval)
64db4cff
PM
320 goto free_out;
321
22f00b69 322 retval = debugfs_create_file("rcuhier", 0444, rcudir,
64db4cff 323 NULL, &rcuhier_fops);
22f00b69 324 if (!retval)
64db4cff 325 goto free_out;
7ba5c840 326
22f00b69 327 retval = debugfs_create_file("rcu_pending", 0444, rcudir,
7ba5c840 328 NULL, &rcu_pending_fops);
22f00b69 329 if (!retval)
7ba5c840 330 goto free_out;
64db4cff
PM
331 return 0;
332free_out:
22f00b69 333 debugfs_remove_recursive(rcudir);
64db4cff
PM
334 return 1;
335}
336
deb7a418 337static void __exit rcutree_trace_cleanup(void)
64db4cff 338{
22f00b69 339 debugfs_remove_recursive(rcudir);
64db4cff
PM
340}
341
342
deb7a418
PM
343module_init(rcutree_trace_init);
344module_exit(rcutree_trace_cleanup);
64db4cff
PM
345
346MODULE_AUTHOR("Paul E. McKenney");
347MODULE_DESCRIPTION("Read-Copy Update tracing for hierarchical implementation");
348MODULE_LICENSE("GPL");
This page took 0.147718 seconds and 5 git commands to generate.