Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 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 - |
Paul E. McKenney | a71fca5 | 2009-09-18 10:28:19 -0700 | [diff] [blame] | 23 | * Documentation/RCU |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 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 | |
Paul E. McKenney | 9f77da9 | 2009-08-22 13:56:45 -0700 | [diff] [blame] | 46 | #define RCU_TREE_NONCORE |
Ingo Molnar | 6258c4f | 2009-03-25 16:42:24 +0100 | [diff] [blame] | 47 | #include "rcutree.h" |
| 48 | |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 49 | static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp) |
| 50 | { |
| 51 | if (!rdp->beenonline) |
| 52 | return; |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 53 | seq_printf(m, "%3d%cc=%lu g=%lu pq=%d pqc=%lu qp=%d", |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 54 | rdp->cpu, |
| 55 | cpu_is_offline(rdp->cpu) ? '!' : ' ', |
| 56 | rdp->completed, rdp->gpnum, |
| 57 | rdp->passed_quiesc, rdp->passed_quiesc_completed, |
Paul E. McKenney | ef631b0 | 2009-04-13 21:31:16 -0700 | [diff] [blame] | 58 | rdp->qs_pending); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 59 | #ifdef CONFIG_NO_HZ |
Paul E. McKenney | e59fb31 | 2010-09-07 10:38:22 -0700 | [diff] [blame] | 60 | seq_printf(m, " dt=%d/%d/%d df=%lu", |
| 61 | atomic_read(&rdp->dynticks->dynticks), |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 62 | rdp->dynticks->dynticks_nesting, |
Paul E. McKenney | e59fb31 | 2010-09-07 10:38:22 -0700 | [diff] [blame] | 63 | rdp->dynticks->dynticks_nmi_nesting, |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 64 | rdp->dynticks_fqs); |
| 65 | #endif /* #ifdef CONFIG_NO_HZ */ |
| 66 | seq_printf(m, " of=%lu ri=%lu", rdp->offline_fqs, rdp->resched_ipi); |
Paul E. McKenney | 269dcc1 | 2010-09-07 14:23:09 -0700 | [diff] [blame] | 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); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 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 | |
| 80 | static int show_rcudata(struct seq_file *m, void *unused) |
| 81 | { |
Paul E. McKenney | f41d911 | 2009-08-22 13:56:52 -0700 | [diff] [blame] | 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 */ |
Paul E. McKenney | d6714c2 | 2009-08-22 13:56:46 -0700 | [diff] [blame] | 86 | seq_puts(m, "rcu_sched:\n"); |
| 87 | PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data, m); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 88 | seq_puts(m, "rcu_bh:\n"); |
| 89 | PRINT_RCU_DATA(rcu_bh_data, print_one_rcu_data, m); |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | static int rcudata_open(struct inode *inode, struct file *file) |
| 94 | { |
| 95 | return single_open(file, show_rcudata, NULL); |
| 96 | } |
| 97 | |
Paul E. McKenney | 9b2619a | 2009-09-23 09:50:43 -0700 | [diff] [blame] | 98 | static const struct file_operations rcudata_fops = { |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 99 | .owner = THIS_MODULE, |
| 100 | .open = rcudata_open, |
| 101 | .read = seq_read, |
| 102 | .llseek = seq_lseek, |
| 103 | .release = single_release, |
| 104 | }; |
| 105 | |
| 106 | static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp) |
| 107 | { |
| 108 | if (!rdp->beenonline) |
| 109 | return; |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 110 | seq_printf(m, "%d,%s,%lu,%lu,%d,%lu,%d", |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 111 | rdp->cpu, |
Paul E. McKenney | 5699ed8 | 2009-08-22 13:56:48 -0700 | [diff] [blame] | 112 | cpu_is_offline(rdp->cpu) ? "\"N\"" : "\"Y\"", |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 113 | rdp->completed, rdp->gpnum, |
| 114 | rdp->passed_quiesc, rdp->passed_quiesc_completed, |
Paul E. McKenney | ef631b0 | 2009-04-13 21:31:16 -0700 | [diff] [blame] | 115 | rdp->qs_pending); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 116 | #ifdef CONFIG_NO_HZ |
| 117 | seq_printf(m, ",%d,%d,%d,%lu", |
Paul E. McKenney | e59fb31 | 2010-09-07 10:38:22 -0700 | [diff] [blame] | 118 | atomic_read(&rdp->dynticks->dynticks), |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 119 | rdp->dynticks->dynticks_nesting, |
Paul E. McKenney | e59fb31 | 2010-09-07 10:38:22 -0700 | [diff] [blame] | 120 | rdp->dynticks->dynticks_nmi_nesting, |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 121 | rdp->dynticks_fqs); |
| 122 | #endif /* #ifdef CONFIG_NO_HZ */ |
| 123 | seq_printf(m, ",%lu,%lu", rdp->offline_fqs, rdp->resched_ipi); |
Paul E. McKenney | 269dcc1 | 2010-09-07 14:23:09 -0700 | [diff] [blame] | 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); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | static int show_rcudata_csv(struct seq_file *m, void *unused) |
| 130 | { |
Paul E. McKenney | ef631b0 | 2009-04-13 21:31:16 -0700 | [diff] [blame] | 131 | seq_puts(m, "\"CPU\",\"Online?\",\"c\",\"g\",\"pq\",\"pqc\",\"pq\","); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 132 | #ifdef CONFIG_NO_HZ |
Paul E. McKenney | e59fb31 | 2010-09-07 10:38:22 -0700 | [diff] [blame] | 133 | seq_puts(m, "\"dt\",\"dt nesting\",\"dt NMI nesting\",\"df\","); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 134 | #endif /* #ifdef CONFIG_NO_HZ */ |
Paul E. McKenney | 269dcc1 | 2010-09-07 14:23:09 -0700 | [diff] [blame] | 135 | seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\",\"ci\",\"co\",\"ca\"\n"); |
Paul E. McKenney | f41d911 | 2009-08-22 13:56:52 -0700 | [diff] [blame] | 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 */ |
Paul E. McKenney | d6714c2 | 2009-08-22 13:56:46 -0700 | [diff] [blame] | 140 | seq_puts(m, "\"rcu_sched:\"\n"); |
| 141 | PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data_csv, m); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 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 | |
| 147 | static int rcudata_csv_open(struct inode *inode, struct file *file) |
| 148 | { |
| 149 | return single_open(file, show_rcudata_csv, NULL); |
| 150 | } |
| 151 | |
Paul E. McKenney | 9b2619a | 2009-09-23 09:50:43 -0700 | [diff] [blame] | 152 | static const struct file_operations rcudata_csv_fops = { |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 153 | .owner = THIS_MODULE, |
| 154 | .open = rcudata_csv_open, |
| 155 | .read = seq_read, |
| 156 | .llseek = seq_lseek, |
| 157 | .release = single_release, |
| 158 | }; |
| 159 | |
Paul E. McKenney | 0ea1f2e | 2011-02-22 13:42:43 -0800 | [diff] [blame^] | 160 | #ifdef CONFIG_RCU_BOOST |
| 161 | |
| 162 | static void print_one_rcu_node_boost(struct seq_file *m, struct rcu_node *rnp) |
| 163 | { |
| 164 | seq_printf(m, "%d:%d tasks=%c%c%c%c ntb=%lu neb=%lu nnb=%lu " |
| 165 | "j=%04x bt=%04x\n", |
| 166 | rnp->grplo, rnp->grphi, |
| 167 | "T."[list_empty(&rnp->blkd_tasks)], |
| 168 | "N."[!rnp->gp_tasks], |
| 169 | "E."[!rnp->exp_tasks], |
| 170 | "B."[!rnp->boost_tasks], |
| 171 | rnp->n_tasks_boosted, rnp->n_exp_boosts, |
| 172 | rnp->n_normal_boosts, |
| 173 | (int)(jiffies & 0xffff), |
| 174 | (int)(rnp->boost_time & 0xffff)); |
| 175 | seq_printf(m, "%s: nt=%lu egt=%lu bt=%lu nb=%lu ny=%lu nos=%lu\n", |
| 176 | " balk", |
| 177 | rnp->n_balk_blkd_tasks, |
| 178 | rnp->n_balk_exp_gp_tasks, |
| 179 | rnp->n_balk_boost_tasks, |
| 180 | rnp->n_balk_notblocked, |
| 181 | rnp->n_balk_notyet, |
| 182 | rnp->n_balk_nos); |
| 183 | } |
| 184 | |
| 185 | static int show_rcu_node_boost(struct seq_file *m, void *unused) |
| 186 | { |
| 187 | struct rcu_node *rnp; |
| 188 | |
| 189 | rcu_for_each_leaf_node(&rcu_preempt_state, rnp) |
| 190 | print_one_rcu_node_boost(m, rnp); |
| 191 | return 0; |
| 192 | } |
| 193 | |
| 194 | static int rcu_node_boost_open(struct inode *inode, struct file *file) |
| 195 | { |
| 196 | return single_open(file, show_rcu_node_boost, NULL); |
| 197 | } |
| 198 | |
| 199 | static const struct file_operations rcu_node_boost_fops = { |
| 200 | .owner = THIS_MODULE, |
| 201 | .open = rcu_node_boost_open, |
| 202 | .read = seq_read, |
| 203 | .llseek = seq_lseek, |
| 204 | .release = single_release, |
| 205 | }; |
| 206 | |
| 207 | /* |
| 208 | * Create the rcuboost debugfs entry. Standard error return. |
| 209 | */ |
| 210 | static int rcu_boost_trace_create_file(struct dentry *rcudir) |
| 211 | { |
| 212 | return !debugfs_create_file("rcuboost", 0444, rcudir, NULL, |
| 213 | &rcu_node_boost_fops); |
| 214 | } |
| 215 | |
| 216 | #else /* #ifdef CONFIG_RCU_BOOST */ |
| 217 | |
| 218 | static int rcu_boost_trace_create_file(struct dentry *rcudir) |
| 219 | { |
| 220 | return 0; /* There cannot be an error if we didn't create it! */ |
| 221 | } |
| 222 | |
| 223 | #endif /* #else #ifdef CONFIG_RCU_BOOST */ |
| 224 | |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 225 | static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp) |
| 226 | { |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 227 | unsigned long gpnum; |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 228 | int level = 0; |
| 229 | struct rcu_node *rnp; |
| 230 | |
Paul E. McKenney | 3397e04 | 2009-10-14 16:36:38 -0700 | [diff] [blame] | 231 | gpnum = rsp->gpnum; |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 232 | seq_printf(m, "c=%lu g=%lu s=%d jfq=%ld j=%x " |
Lai Jiangshan | 29494be | 2010-10-20 14:13:06 +0800 | [diff] [blame] | 233 | "nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu\n", |
Paul E. McKenney | 3397e04 | 2009-10-14 16:36:38 -0700 | [diff] [blame] | 234 | rsp->completed, gpnum, rsp->signaled, |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 235 | (long)(rsp->jiffies_force_qs - jiffies), |
| 236 | (int)(jiffies & 0xffff), |
| 237 | rsp->n_force_qs, rsp->n_force_qs_ngp, |
| 238 | rsp->n_force_qs - rsp->n_force_qs_ngp, |
Lai Jiangshan | 29494be | 2010-10-20 14:13:06 +0800 | [diff] [blame] | 239 | rsp->n_force_qs_lh); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 240 | for (rnp = &rsp->node[0]; rnp - &rsp->node[0] < NUM_RCU_NODES; rnp++) { |
| 241 | if (rnp->level != level) { |
| 242 | seq_puts(m, "\n"); |
| 243 | level = rnp->level; |
| 244 | } |
Paul E. McKenney | 12f5f52 | 2010-11-29 21:56:39 -0800 | [diff] [blame] | 245 | seq_printf(m, "%lx/%lx %c%c>%c %d:%d ^%d ", |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 246 | rnp->qsmask, rnp->qsmaskinit, |
Paul E. McKenney | 12f5f52 | 2010-11-29 21:56:39 -0800 | [diff] [blame] | 247 | ".G"[rnp->gp_tasks != NULL], |
| 248 | ".E"[rnp->exp_tasks != NULL], |
| 249 | ".T"[!list_empty(&rnp->blkd_tasks)], |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 250 | rnp->grplo, rnp->grphi, rnp->grpnum); |
| 251 | } |
| 252 | seq_puts(m, "\n"); |
| 253 | } |
| 254 | |
| 255 | static int show_rcuhier(struct seq_file *m, void *unused) |
| 256 | { |
Paul E. McKenney | f41d911 | 2009-08-22 13:56:52 -0700 | [diff] [blame] | 257 | #ifdef CONFIG_TREE_PREEMPT_RCU |
| 258 | seq_puts(m, "rcu_preempt:\n"); |
| 259 | print_one_rcu_state(m, &rcu_preempt_state); |
| 260 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
Paul E. McKenney | d6714c2 | 2009-08-22 13:56:46 -0700 | [diff] [blame] | 261 | seq_puts(m, "rcu_sched:\n"); |
| 262 | print_one_rcu_state(m, &rcu_sched_state); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 263 | seq_puts(m, "rcu_bh:\n"); |
| 264 | print_one_rcu_state(m, &rcu_bh_state); |
| 265 | return 0; |
| 266 | } |
| 267 | |
| 268 | static int rcuhier_open(struct inode *inode, struct file *file) |
| 269 | { |
| 270 | return single_open(file, show_rcuhier, NULL); |
| 271 | } |
| 272 | |
Paul E. McKenney | 9b2619a | 2009-09-23 09:50:43 -0700 | [diff] [blame] | 273 | static const struct file_operations rcuhier_fops = { |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 274 | .owner = THIS_MODULE, |
| 275 | .open = rcuhier_open, |
| 276 | .read = seq_read, |
| 277 | .llseek = seq_lseek, |
| 278 | .release = single_release, |
| 279 | }; |
| 280 | |
| 281 | static int show_rcugp(struct seq_file *m, void *unused) |
| 282 | { |
Paul E. McKenney | f41d911 | 2009-08-22 13:56:52 -0700 | [diff] [blame] | 283 | #ifdef CONFIG_TREE_PREEMPT_RCU |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 284 | seq_printf(m, "rcu_preempt: completed=%ld gpnum=%lu\n", |
Paul E. McKenney | f41d911 | 2009-08-22 13:56:52 -0700 | [diff] [blame] | 285 | rcu_preempt_state.completed, rcu_preempt_state.gpnum); |
| 286 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 287 | seq_printf(m, "rcu_sched: completed=%ld gpnum=%lu\n", |
Paul E. McKenney | d6714c2 | 2009-08-22 13:56:46 -0700 | [diff] [blame] | 288 | rcu_sched_state.completed, rcu_sched_state.gpnum); |
Paul E. McKenney | 20133cf | 2010-02-22 17:05:01 -0800 | [diff] [blame] | 289 | seq_printf(m, "rcu_bh: completed=%ld gpnum=%lu\n", |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 290 | rcu_bh_state.completed, rcu_bh_state.gpnum); |
| 291 | return 0; |
| 292 | } |
| 293 | |
| 294 | static int rcugp_open(struct inode *inode, struct file *file) |
| 295 | { |
| 296 | return single_open(file, show_rcugp, NULL); |
| 297 | } |
| 298 | |
Paul E. McKenney | 9b2619a | 2009-09-23 09:50:43 -0700 | [diff] [blame] | 299 | static const struct file_operations rcugp_fops = { |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 300 | .owner = THIS_MODULE, |
| 301 | .open = rcugp_open, |
| 302 | .read = seq_read, |
| 303 | .llseek = seq_lseek, |
| 304 | .release = single_release, |
| 305 | }; |
| 306 | |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 307 | static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp) |
| 308 | { |
| 309 | seq_printf(m, "%3d%cnp=%ld " |
Paul E. McKenney | d21670a | 2010-04-14 17:39:26 -0700 | [diff] [blame] | 310 | "qsp=%ld rpq=%ld cbr=%ld cng=%ld " |
| 311 | "gpc=%ld gps=%ld nf=%ld nn=%ld\n", |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 312 | rdp->cpu, |
| 313 | cpu_is_offline(rdp->cpu) ? '!' : ' ', |
| 314 | rdp->n_rcu_pending, |
| 315 | rdp->n_rp_qs_pending, |
Paul E. McKenney | d21670a | 2010-04-14 17:39:26 -0700 | [diff] [blame] | 316 | rdp->n_rp_report_qs, |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 317 | rdp->n_rp_cb_ready, |
| 318 | rdp->n_rp_cpu_needs_gp, |
| 319 | rdp->n_rp_gp_completed, |
| 320 | rdp->n_rp_gp_started, |
| 321 | rdp->n_rp_need_fqs, |
| 322 | rdp->n_rp_need_nothing); |
| 323 | } |
| 324 | |
| 325 | static void print_rcu_pendings(struct seq_file *m, struct rcu_state *rsp) |
| 326 | { |
| 327 | int cpu; |
| 328 | struct rcu_data *rdp; |
| 329 | |
| 330 | for_each_possible_cpu(cpu) { |
Lai Jiangshan | 394f99a | 2010-06-28 16:25:04 +0800 | [diff] [blame] | 331 | rdp = per_cpu_ptr(rsp->rda, cpu); |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 332 | if (rdp->beenonline) |
| 333 | print_one_rcu_pending(m, rdp); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | static int show_rcu_pending(struct seq_file *m, void *unused) |
| 338 | { |
Paul E. McKenney | f41d911 | 2009-08-22 13:56:52 -0700 | [diff] [blame] | 339 | #ifdef CONFIG_TREE_PREEMPT_RCU |
| 340 | seq_puts(m, "rcu_preempt:\n"); |
| 341 | print_rcu_pendings(m, &rcu_preempt_state); |
| 342 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
Paul E. McKenney | d6714c2 | 2009-08-22 13:56:46 -0700 | [diff] [blame] | 343 | seq_puts(m, "rcu_sched:\n"); |
| 344 | print_rcu_pendings(m, &rcu_sched_state); |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 345 | seq_puts(m, "rcu_bh:\n"); |
| 346 | print_rcu_pendings(m, &rcu_bh_state); |
| 347 | return 0; |
| 348 | } |
| 349 | |
| 350 | static int rcu_pending_open(struct inode *inode, struct file *file) |
| 351 | { |
| 352 | return single_open(file, show_rcu_pending, NULL); |
| 353 | } |
| 354 | |
Paul E. McKenney | 9b2619a | 2009-09-23 09:50:43 -0700 | [diff] [blame] | 355 | static const struct file_operations rcu_pending_fops = { |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 356 | .owner = THIS_MODULE, |
| 357 | .open = rcu_pending_open, |
| 358 | .read = seq_read, |
| 359 | .llseek = seq_lseek, |
| 360 | .release = single_release, |
| 361 | }; |
| 362 | |
| 363 | static struct dentry *rcudir; |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 364 | |
Paul E. McKenney | deb7a41 | 2010-09-30 21:33:32 -0700 | [diff] [blame] | 365 | static int __init rcutree_trace_init(void) |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 366 | { |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 367 | struct dentry *retval; |
| 368 | |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 369 | rcudir = debugfs_create_dir("rcu", NULL); |
| 370 | if (!rcudir) |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 371 | goto free_out; |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 372 | |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 373 | retval = debugfs_create_file("rcudata", 0444, rcudir, |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 374 | NULL, &rcudata_fops); |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 375 | if (!retval) |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 376 | goto free_out; |
| 377 | |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 378 | retval = debugfs_create_file("rcudata.csv", 0444, rcudir, |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 379 | NULL, &rcudata_csv_fops); |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 380 | if (!retval) |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 381 | goto free_out; |
| 382 | |
Paul E. McKenney | 0ea1f2e | 2011-02-22 13:42:43 -0800 | [diff] [blame^] | 383 | if (rcu_boost_trace_create_file(rcudir)) |
| 384 | goto free_out; |
| 385 | |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 386 | retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops); |
| 387 | if (!retval) |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 388 | goto free_out; |
| 389 | |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 390 | retval = debugfs_create_file("rcuhier", 0444, rcudir, |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 391 | NULL, &rcuhier_fops); |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 392 | if (!retval) |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 393 | goto free_out; |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 394 | |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 395 | retval = debugfs_create_file("rcu_pending", 0444, rcudir, |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 396 | NULL, &rcu_pending_fops); |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 397 | if (!retval) |
Paul E. McKenney | 7ba5c84 | 2009-04-13 21:31:17 -0700 | [diff] [blame] | 398 | goto free_out; |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 399 | return 0; |
| 400 | free_out: |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 401 | debugfs_remove_recursive(rcudir); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 402 | return 1; |
| 403 | } |
| 404 | |
Paul E. McKenney | deb7a41 | 2010-09-30 21:33:32 -0700 | [diff] [blame] | 405 | static void __exit rcutree_trace_cleanup(void) |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 406 | { |
Paul E. McKenney | 22f00b6 | 2009-08-22 13:56:50 -0700 | [diff] [blame] | 407 | debugfs_remove_recursive(rcudir); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | |
Paul E. McKenney | deb7a41 | 2010-09-30 21:33:32 -0700 | [diff] [blame] | 411 | module_init(rcutree_trace_init); |
| 412 | module_exit(rcutree_trace_cleanup); |
Paul E. McKenney | 64db4cf | 2008-12-18 21:55:32 +0100 | [diff] [blame] | 413 | |
| 414 | MODULE_AUTHOR("Paul E. McKenney"); |
| 415 | MODULE_DESCRIPTION("Read-Copy Update tracing for hierarchical implementation"); |
| 416 | MODULE_LICENSE("GPL"); |