blob: 3baa235786b568e0e6334be907a41fa10f9182ec [file] [log] [blame]
Paul E. McKenney64db4cf2008-12-18 21:55:32 +01001/*
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 -
Paul E. McKenneya71fca52009-09-18 10:28:19 -070023 * Documentation/RCU
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010024 *
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
Paul E. McKenney9f77da92009-08-22 13:56:45 -070046#define RCU_TREE_NONCORE
Ingo Molnar6258c4f2009-03-25 16:42:24 +010047#include "rcutree.h"
48
Paul E. McKenneyd71df902011-03-29 17:48:28 -070049DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_status);
50DECLARE_PER_CPU(char, rcu_cpu_has_work);
51
52static char convert_kthread_status(unsigned int kthread_status)
53{
54 if (kthread_status > RCU_KTHREAD_MAX)
55 return '?';
56 return "SRWY"[kthread_status];
57}
58
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010059static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
60{
61 if (!rdp->beenonline)
62 return;
Paul E. McKenney20133cf2010-02-22 17:05:01 -080063 seq_printf(m, "%3d%cc=%lu g=%lu pq=%d pqc=%lu qp=%d",
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010064 rdp->cpu,
65 cpu_is_offline(rdp->cpu) ? '!' : ' ',
66 rdp->completed, rdp->gpnum,
67 rdp->passed_quiesc, rdp->passed_quiesc_completed,
Paul E. McKenneyef631b02009-04-13 21:31:16 -070068 rdp->qs_pending);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010069#ifdef CONFIG_NO_HZ
Paul E. McKenneye59fb312010-09-07 10:38:22 -070070 seq_printf(m, " dt=%d/%d/%d df=%lu",
71 atomic_read(&rdp->dynticks->dynticks),
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010072 rdp->dynticks->dynticks_nesting,
Paul E. McKenneye59fb312010-09-07 10:38:22 -070073 rdp->dynticks->dynticks_nmi_nesting,
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010074 rdp->dynticks_fqs);
75#endif /* #ifdef CONFIG_NO_HZ */
76 seq_printf(m, " of=%lu ri=%lu", rdp->offline_fqs, rdp->resched_ipi);
Paul E. McKenneyd71df902011-03-29 17:48:28 -070077 seq_printf(m, " ql=%ld qs=%c%c%c%c kt=%d/%c b=%ld",
Paul E. McKenney0ac3d132011-03-28 15:47:07 -070078 rdp->qlen,
79 ".N"[rdp->nxttail[RCU_NEXT_READY_TAIL] !=
80 rdp->nxttail[RCU_NEXT_TAIL]],
81 ".R"[rdp->nxttail[RCU_WAIT_TAIL] !=
82 rdp->nxttail[RCU_NEXT_READY_TAIL]],
83 ".W"[rdp->nxttail[RCU_DONE_TAIL] !=
84 rdp->nxttail[RCU_WAIT_TAIL]],
85 ".D"[&rdp->nxtlist != rdp->nxttail[RCU_DONE_TAIL]],
Paul E. McKenneyd71df902011-03-29 17:48:28 -070086 per_cpu(rcu_cpu_has_work, rdp->cpu),
87 convert_kthread_status(per_cpu(rcu_cpu_kthread_status,
88 rdp->cpu)),
Paul E. McKenney0ac3d132011-03-28 15:47:07 -070089 rdp->blimit);
Paul E. McKenney269dcc12010-09-07 14:23:09 -070090 seq_printf(m, " ci=%lu co=%lu ca=%lu\n",
91 rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010092}
93
94#define PRINT_RCU_DATA(name, func, m) \
95 do { \
96 int _p_r_d_i; \
97 \
98 for_each_possible_cpu(_p_r_d_i) \
99 func(m, &per_cpu(name, _p_r_d_i)); \
100 } while (0)
101
102static int show_rcudata(struct seq_file *m, void *unused)
103{
Paul E. McKenneyf41d9112009-08-22 13:56:52 -0700104#ifdef CONFIG_TREE_PREEMPT_RCU
105 seq_puts(m, "rcu_preempt:\n");
106 PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data, m);
107#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
Paul E. McKenneyd6714c22009-08-22 13:56:46 -0700108 seq_puts(m, "rcu_sched:\n");
109 PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data, m);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100110 seq_puts(m, "rcu_bh:\n");
111 PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data, m);
112 return 0;
113}
114
115static int rcudata_open(struct inode *inode, struct file *file)
116{
117 return single_open(file, show_rcudata, NULL);
118}
119
Paul E. McKenney9b2619a2009-09-23 09:50:43 -0700120static const struct file_operations rcudata_fops = {
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100121 .owner = THIS_MODULE,
122 .open = rcudata_open,
123 .read = seq_read,
124 .llseek = seq_lseek,
125 .release = single_release,
126};
127
128static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp)
129{
130 if (!rdp->beenonline)
131 return;
Paul E. McKenney20133cf2010-02-22 17:05:01 -0800132 seq_printf(m, "%d,%s,%lu,%lu,%d,%lu,%d",
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100133 rdp->cpu,
Paul E. McKenney5699ed82009-08-22 13:56:48 -0700134 cpu_is_offline(rdp->cpu) ? "\"N\"" : "\"Y\"",
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100135 rdp->completed, rdp->gpnum,
136 rdp->passed_quiesc, rdp->passed_quiesc_completed,
Paul E. McKenneyef631b02009-04-13 21:31:16 -0700137 rdp->qs_pending);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100138#ifdef CONFIG_NO_HZ
139 seq_printf(m, ",%d,%d,%d,%lu",
Paul E. McKenneye59fb312010-09-07 10:38:22 -0700140 atomic_read(&rdp->dynticks->dynticks),
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100141 rdp->dynticks->dynticks_nesting,
Paul E. McKenneye59fb312010-09-07 10:38:22 -0700142 rdp->dynticks->dynticks_nmi_nesting,
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100143 rdp->dynticks_fqs);
144#endif /* #ifdef CONFIG_NO_HZ */
145 seq_printf(m, ",%lu,%lu", rdp->offline_fqs, rdp->resched_ipi);
Paul E. McKenneyd71df902011-03-29 17:48:28 -0700146 seq_printf(m, ",%ld,\"%c%c%c%c\",%d,\"%c\",%ld", rdp->qlen,
Paul E. McKenney0ac3d132011-03-28 15:47:07 -0700147 ".N"[rdp->nxttail[RCU_NEXT_READY_TAIL] !=
148 rdp->nxttail[RCU_NEXT_TAIL]],
149 ".R"[rdp->nxttail[RCU_WAIT_TAIL] !=
150 rdp->nxttail[RCU_NEXT_READY_TAIL]],
151 ".W"[rdp->nxttail[RCU_DONE_TAIL] !=
152 rdp->nxttail[RCU_WAIT_TAIL]],
153 ".D"[&rdp->nxtlist != rdp->nxttail[RCU_DONE_TAIL]],
Paul E. McKenneyd71df902011-03-29 17:48:28 -0700154 per_cpu(rcu_cpu_has_work, rdp->cpu),
155 convert_kthread_status(per_cpu(rcu_cpu_kthread_status,
156 rdp->cpu)),
Paul E. McKenney0ac3d132011-03-28 15:47:07 -0700157 rdp->blimit);
Paul E. McKenney269dcc12010-09-07 14:23:09 -0700158 seq_printf(m, ",%lu,%lu,%lu\n",
159 rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100160}
161
162static int show_rcudata_csv(struct seq_file *m, void *unused)
163{
Paul E. McKenneyef631b02009-04-13 21:31:16 -0700164 seq_puts(m, "\"CPU\",\"Online?\",\"c\",\"g\",\"pq\",\"pqc\",\"pq\",");
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100165#ifdef CONFIG_NO_HZ
Paul E. McKenneye59fb312010-09-07 10:38:22 -0700166 seq_puts(m, "\"dt\",\"dt nesting\",\"dt NMI nesting\",\"df\",");
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100167#endif /* #ifdef CONFIG_NO_HZ */
Paul E. McKenney269dcc12010-09-07 14:23:09 -0700168 seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\",\"ci\",\"co\",\"ca\"\n");
Paul E. McKenneyf41d9112009-08-22 13:56:52 -0700169#ifdef CONFIG_TREE_PREEMPT_RCU
170 seq_puts(m, "\"rcu_preempt:\"\n");
171 PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data_csv, m);
172#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
Paul E. McKenneyd6714c22009-08-22 13:56:46 -0700173 seq_puts(m, "\"rcu_sched:\"\n");
174 PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data_csv, m);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100175 seq_puts(m, "\"rcu_bh:\"\n");
176 PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data_csv, m);
177 return 0;
178}
179
180static int rcudata_csv_open(struct inode *inode, struct file *file)
181{
182 return single_open(file, show_rcudata_csv, NULL);
183}
184
Paul E. McKenney9b2619a2009-09-23 09:50:43 -0700185static const struct file_operations rcudata_csv_fops = {
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100186 .owner = THIS_MODULE,
187 .open = rcudata_csv_open,
188 .read = seq_read,
189 .llseek = seq_lseek,
190 .release = single_release,
191};
192
Paul E. McKenney0ea1f2e2011-02-22 13:42:43 -0800193#ifdef CONFIG_RCU_BOOST
194
195static void print_one_rcu_node_boost(struct seq_file *m, struct rcu_node *rnp)
196{
Paul E. McKenneyd71df902011-03-29 17:48:28 -0700197 seq_printf(m, "%d:%d tasks=%c%c%c%c kt=%c ntb=%lu neb=%lu nnb=%lu "
Paul E. McKenney0ea1f2e2011-02-22 13:42:43 -0800198 "j=%04x bt=%04x\n",
199 rnp->grplo, rnp->grphi,
200 "T."[list_empty(&rnp->blkd_tasks)],
201 "N."[!rnp->gp_tasks],
202 "E."[!rnp->exp_tasks],
203 "B."[!rnp->boost_tasks],
Paul E. McKenneyd71df902011-03-29 17:48:28 -0700204 convert_kthread_status(rnp->boost_kthread_status),
Paul E. McKenney0ea1f2e2011-02-22 13:42:43 -0800205 rnp->n_tasks_boosted, rnp->n_exp_boosts,
206 rnp->n_normal_boosts,
207 (int)(jiffies & 0xffff),
208 (int)(rnp->boost_time & 0xffff));
209 seq_printf(m, "%s: nt=%lu egt=%lu bt=%lu nb=%lu ny=%lu nos=%lu\n",
210 " balk",
211 rnp->n_balk_blkd_tasks,
212 rnp->n_balk_exp_gp_tasks,
213 rnp->n_balk_boost_tasks,
214 rnp->n_balk_notblocked,
215 rnp->n_balk_notyet,
216 rnp->n_balk_nos);
217}
218
219static int show_rcu_node_boost(struct seq_file *m, void *unused)
220{
221 struct rcu_node *rnp;
222
223 rcu_for_each_leaf_node(&rcu_preempt_state, rnp)
224 print_one_rcu_node_boost(m, rnp);
225 return 0;
226}
227
228static int rcu_node_boost_open(struct inode *inode, struct file *file)
229{
230 return single_open(file, show_rcu_node_boost, NULL);
231}
232
233static const struct file_operations rcu_node_boost_fops = {
234 .owner = THIS_MODULE,
235 .open = rcu_node_boost_open,
236 .read = seq_read,
237 .llseek = seq_lseek,
238 .release = single_release,
239};
240
241/*
242 * Create the rcuboost debugfs entry. Standard error return.
243 */
244static int rcu_boost_trace_create_file(struct dentry *rcudir)
245{
246 return !debugfs_create_file("rcuboost", 0444, rcudir, NULL,
247 &rcu_node_boost_fops);
248}
249
250#else /* #ifdef CONFIG_RCU_BOOST */
251
252static int rcu_boost_trace_create_file(struct dentry *rcudir)
253{
254 return 0; /* There cannot be an error if we didn't create it! */
255}
256
257#endif /* #else #ifdef CONFIG_RCU_BOOST */
258
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100259static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
260{
Paul E. McKenney20133cf2010-02-22 17:05:01 -0800261 unsigned long gpnum;
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100262 int level = 0;
263 struct rcu_node *rnp;
264
Paul E. McKenney3397e042009-10-14 16:36:38 -0700265 gpnum = rsp->gpnum;
Paul E. McKenney20133cf2010-02-22 17:05:01 -0800266 seq_printf(m, "c=%lu g=%lu s=%d jfq=%ld j=%x "
Lai Jiangshan29494be2010-10-20 14:13:06 +0800267 "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu\n",
Paul E. McKenney3397e042009-10-14 16:36:38 -0700268 rsp->completed, gpnum, rsp->signaled,
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100269 (long)(rsp->jiffies_force_qs - jiffies),
270 (int)(jiffies & 0xffff),
271 rsp->n_force_qs, rsp->n_force_qs_ngp,
272 rsp->n_force_qs - rsp->n_force_qs_ngp,
Lai Jiangshan29494be2010-10-20 14:13:06 +0800273 rsp->n_force_qs_lh);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100274 for (rnp = &rsp->node[0]; rnp - &rsp->node[0] < NUM_RCU_NODES; rnp++) {
275 if (rnp->level != level) {
276 seq_puts(m, "\n");
277 level = rnp->level;
278 }
Paul E. McKenney12f5f522010-11-29 21:56:39 -0800279 seq_printf(m, "%lx/%lx %c%c>%c %d:%d ^%d ",
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100280 rnp->qsmask, rnp->qsmaskinit,
Paul E. McKenney12f5f522010-11-29 21:56:39 -0800281 ".G"[rnp->gp_tasks != NULL],
282 ".E"[rnp->exp_tasks != NULL],
283 ".T"[!list_empty(&rnp->blkd_tasks)],
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100284 rnp->grplo, rnp->grphi, rnp->grpnum);
285 }
286 seq_puts(m, "\n");
287}
288
289static int show_rcuhier(struct seq_file *m, void *unused)
290{
Paul E. McKenneyf41d9112009-08-22 13:56:52 -0700291#ifdef CONFIG_TREE_PREEMPT_RCU
292 seq_puts(m, "rcu_preempt:\n");
293 print_one_rcu_state(m, &rcu_preempt_state);
294#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
Paul E. McKenneyd6714c22009-08-22 13:56:46 -0700295 seq_puts(m, "rcu_sched:\n");
296 print_one_rcu_state(m, &rcu_sched_state);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100297 seq_puts(m, "rcu_bh:\n");
298 print_one_rcu_state(m, &rcu_bh_state);
299 return 0;
300}
301
302static int rcuhier_open(struct inode *inode, struct file *file)
303{
304 return single_open(file, show_rcuhier, NULL);
305}
306
Paul E. McKenney9b2619a2009-09-23 09:50:43 -0700307static const struct file_operations rcuhier_fops = {
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100308 .owner = THIS_MODULE,
309 .open = rcuhier_open,
310 .read = seq_read,
311 .llseek = seq_lseek,
312 .release = single_release,
313};
314
315static int show_rcugp(struct seq_file *m, void *unused)
316{
Paul E. McKenneyf41d9112009-08-22 13:56:52 -0700317#ifdef CONFIG_TREE_PREEMPT_RCU
Paul E. McKenney20133cf2010-02-22 17:05:01 -0800318 seq_printf(m, "rcu_preempt: completed=%ld gpnum=%lu\n",
Paul E. McKenneyf41d9112009-08-22 13:56:52 -0700319 rcu_preempt_state.completed, rcu_preempt_state.gpnum);
320#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
Paul E. McKenney20133cf2010-02-22 17:05:01 -0800321 seq_printf(m, "rcu_sched: completed=%ld gpnum=%lu\n",
Paul E. McKenneyd6714c22009-08-22 13:56:46 -0700322 rcu_sched_state.completed, rcu_sched_state.gpnum);
Paul E. McKenney20133cf2010-02-22 17:05:01 -0800323 seq_printf(m, "rcu_bh: completed=%ld gpnum=%lu\n",
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100324 rcu_bh_state.completed, rcu_bh_state.gpnum);
325 return 0;
326}
327
328static int rcugp_open(struct inode *inode, struct file *file)
329{
330 return single_open(file, show_rcugp, NULL);
331}
332
Paul E. McKenney9b2619a2009-09-23 09:50:43 -0700333static const struct file_operations rcugp_fops = {
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100334 .owner = THIS_MODULE,
335 .open = rcugp_open,
336 .read = seq_read,
337 .llseek = seq_lseek,
338 .release = single_release,
339};
340
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700341static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp)
342{
343 seq_printf(m, "%3d%cnp=%ld "
Paul E. McKenneyd21670a2010-04-14 17:39:26 -0700344 "qsp=%ld rpq=%ld cbr=%ld cng=%ld "
345 "gpc=%ld gps=%ld nf=%ld nn=%ld\n",
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700346 rdp->cpu,
347 cpu_is_offline(rdp->cpu) ? '!' : ' ',
348 rdp->n_rcu_pending,
349 rdp->n_rp_qs_pending,
Paul E. McKenneyd21670a2010-04-14 17:39:26 -0700350 rdp->n_rp_report_qs,
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700351 rdp->n_rp_cb_ready,
352 rdp->n_rp_cpu_needs_gp,
353 rdp->n_rp_gp_completed,
354 rdp->n_rp_gp_started,
355 rdp->n_rp_need_fqs,
356 rdp->n_rp_need_nothing);
357}
358
359static void print_rcu_pendings(struct seq_file *m, struct rcu_state *rsp)
360{
361 int cpu;
362 struct rcu_data *rdp;
363
364 for_each_possible_cpu(cpu) {
Lai Jiangshan394f99a2010-06-28 16:25:04 +0800365 rdp = per_cpu_ptr(rsp->rda, cpu);
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700366 if (rdp->beenonline)
367 print_one_rcu_pending(m, rdp);
368 }
369}
370
371static int show_rcu_pending(struct seq_file *m, void *unused)
372{
Paul E. McKenneyf41d9112009-08-22 13:56:52 -0700373#ifdef CONFIG_TREE_PREEMPT_RCU
374 seq_puts(m, "rcu_preempt:\n");
375 print_rcu_pendings(m, &rcu_preempt_state);
376#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
Paul E. McKenneyd6714c22009-08-22 13:56:46 -0700377 seq_puts(m, "rcu_sched:\n");
378 print_rcu_pendings(m, &rcu_sched_state);
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700379 seq_puts(m, "rcu_bh:\n");
380 print_rcu_pendings(m, &rcu_bh_state);
381 return 0;
382}
383
384static int rcu_pending_open(struct inode *inode, struct file *file)
385{
386 return single_open(file, show_rcu_pending, NULL);
387}
388
Paul E. McKenney9b2619a2009-09-23 09:50:43 -0700389static const struct file_operations rcu_pending_fops = {
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700390 .owner = THIS_MODULE,
391 .open = rcu_pending_open,
392 .read = seq_read,
393 .llseek = seq_lseek,
394 .release = single_release,
395};
396
Paul E. McKenney4a298652011-04-03 21:33:51 -0700397static int show_rcutorture(struct seq_file *m, void *unused)
398{
399 seq_printf(m, "rcutorture test sequence: %lu %s\n",
400 rcutorture_testseq >> 1,
401 (rcutorture_testseq & 0x1) ? "(test in progress)" : "");
402 seq_printf(m, "rcutorture update version number: %lu\n",
403 rcutorture_vernum);
404 return 0;
405}
406
407static int rcutorture_open(struct inode *inode, struct file *file)
408{
409 return single_open(file, show_rcutorture, NULL);
410}
411
412static const struct file_operations rcutorture_fops = {
413 .owner = THIS_MODULE,
414 .open = rcutorture_open,
415 .read = seq_read,
416 .llseek = seq_lseek,
417 .release = single_release,
418};
419
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700420static struct dentry *rcudir;
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700421
Paul E. McKenneydeb7a412010-09-30 21:33:32 -0700422static int __init rcutree_trace_init(void)
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100423{
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700424 struct dentry *retval;
425
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100426 rcudir = debugfs_create_dir("rcu", NULL);
427 if (!rcudir)
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700428 goto free_out;
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100429
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700430 retval = debugfs_create_file("rcudata", 0444, rcudir,
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100431 NULL, &rcudata_fops);
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700432 if (!retval)
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100433 goto free_out;
434
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700435 retval = debugfs_create_file("rcudata.csv", 0444, rcudir,
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100436 NULL, &rcudata_csv_fops);
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700437 if (!retval)
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100438 goto free_out;
439
Paul E. McKenney0ea1f2e2011-02-22 13:42:43 -0800440 if (rcu_boost_trace_create_file(rcudir))
441 goto free_out;
442
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700443 retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops);
444 if (!retval)
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100445 goto free_out;
446
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700447 retval = debugfs_create_file("rcuhier", 0444, rcudir,
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100448 NULL, &rcuhier_fops);
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700449 if (!retval)
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100450 goto free_out;
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700451
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700452 retval = debugfs_create_file("rcu_pending", 0444, rcudir,
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700453 NULL, &rcu_pending_fops);
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700454 if (!retval)
Paul E. McKenney7ba5c842009-04-13 21:31:17 -0700455 goto free_out;
Paul E. McKenney4a298652011-04-03 21:33:51 -0700456
457 retval = debugfs_create_file("rcutorture", 0444, rcudir,
458 NULL, &rcutorture_fops);
459 if (!retval)
460 goto free_out;
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100461 return 0;
462free_out:
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700463 debugfs_remove_recursive(rcudir);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100464 return 1;
465}
466
Paul E. McKenneydeb7a412010-09-30 21:33:32 -0700467static void __exit rcutree_trace_cleanup(void)
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100468{
Paul E. McKenney22f00b62009-08-22 13:56:50 -0700469 debugfs_remove_recursive(rcudir);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100470}
471
472
Paul E. McKenneydeb7a412010-09-30 21:33:32 -0700473module_init(rcutree_trace_init);
474module_exit(rcutree_trace_cleanup);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +0100475
476MODULE_AUTHOR("Paul E. McKenney");
477MODULE_DESCRIPTION("Read-Copy Update tracing for hierarchical implementation");
478MODULE_LICENSE("GPL");