~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to kernel/rcutree_trace.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#define RCU_TREE_NONCORE
47
47
#include "rcutree.h"
48
48
 
 
49
#ifdef CONFIG_RCU_BOOST
 
50
 
 
51
DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_status);
 
52
DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_cpu);
 
53
DECLARE_PER_CPU(unsigned int, rcu_cpu_kthread_loops);
 
54
DECLARE_PER_CPU(char, rcu_cpu_has_work);
 
55
 
 
56
static char convert_kthread_status(unsigned int kthread_status)
 
57
{
 
58
        if (kthread_status > RCU_KTHREAD_MAX)
 
59
                return '?';
 
60
        return "SRWOY"[kthread_status];
 
61
}
 
62
 
 
63
#endif /* #ifdef CONFIG_RCU_BOOST */
 
64
 
49
65
static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
50
66
{
51
67
        if (!rdp->beenonline)
57
73
                   rdp->passed_quiesc, rdp->passed_quiesc_completed,
58
74
                   rdp->qs_pending);
59
75
#ifdef CONFIG_NO_HZ
60
 
        seq_printf(m, " dt=%d/%d dn=%d df=%lu",
61
 
                   rdp->dynticks->dynticks,
 
76
        seq_printf(m, " dt=%d/%d/%d df=%lu",
 
77
                   atomic_read(&rdp->dynticks->dynticks),
62
78
                   rdp->dynticks->dynticks_nesting,
63
 
                   rdp->dynticks->dynticks_nmi,
 
79
                   rdp->dynticks->dynticks_nmi_nesting,
64
80
                   rdp->dynticks_fqs);
65
81
#endif /* #ifdef CONFIG_NO_HZ */
66
82
        seq_printf(m, " of=%lu ri=%lu", rdp->offline_fqs, rdp->resched_ipi);
67
 
        seq_printf(m, " ql=%ld b=%ld", rdp->qlen, rdp->blimit);
 
83
        seq_printf(m, " ql=%ld qs=%c%c%c%c",
 
84
                   rdp->qlen,
 
85
                   ".N"[rdp->nxttail[RCU_NEXT_READY_TAIL] !=
 
86
                        rdp->nxttail[RCU_NEXT_TAIL]],
 
87
                   ".R"[rdp->nxttail[RCU_WAIT_TAIL] !=
 
88
                        rdp->nxttail[RCU_NEXT_READY_TAIL]],
 
89
                   ".W"[rdp->nxttail[RCU_DONE_TAIL] !=
 
90
                        rdp->nxttail[RCU_WAIT_TAIL]],
 
91
                   ".D"[&rdp->nxtlist != rdp->nxttail[RCU_DONE_TAIL]]);
 
92
#ifdef CONFIG_RCU_BOOST
 
93
        seq_printf(m, " kt=%d/%c/%d ktl=%x",
 
94
                   per_cpu(rcu_cpu_has_work, rdp->cpu),
 
95
                   convert_kthread_status(per_cpu(rcu_cpu_kthread_status,
 
96
                                          rdp->cpu)),
 
97
                   per_cpu(rcu_cpu_kthread_cpu, rdp->cpu),
 
98
                   per_cpu(rcu_cpu_kthread_loops, rdp->cpu) & 0xffff);
 
99
#endif /* #ifdef CONFIG_RCU_BOOST */
 
100
        seq_printf(m, " b=%ld", rdp->blimit);
68
101
        seq_printf(m, " ci=%lu co=%lu ca=%lu\n",
69
102
                   rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
70
103
}
115
148
                   rdp->qs_pending);
116
149
#ifdef CONFIG_NO_HZ
117
150
        seq_printf(m, ",%d,%d,%d,%lu",
118
 
                   rdp->dynticks->dynticks,
 
151
                   atomic_read(&rdp->dynticks->dynticks),
119
152
                   rdp->dynticks->dynticks_nesting,
120
 
                   rdp->dynticks->dynticks_nmi,
 
153
                   rdp->dynticks->dynticks_nmi_nesting,
121
154
                   rdp->dynticks_fqs);
122
155
#endif /* #ifdef CONFIG_NO_HZ */
123
156
        seq_printf(m, ",%lu,%lu", rdp->offline_fqs, rdp->resched_ipi);
124
 
        seq_printf(m, ",%ld,%ld", rdp->qlen, rdp->blimit);
 
157
        seq_printf(m, ",%ld,\"%c%c%c%c\"", rdp->qlen,
 
158
                   ".N"[rdp->nxttail[RCU_NEXT_READY_TAIL] !=
 
159
                        rdp->nxttail[RCU_NEXT_TAIL]],
 
160
                   ".R"[rdp->nxttail[RCU_WAIT_TAIL] !=
 
161
                        rdp->nxttail[RCU_NEXT_READY_TAIL]],
 
162
                   ".W"[rdp->nxttail[RCU_DONE_TAIL] !=
 
163
                        rdp->nxttail[RCU_WAIT_TAIL]],
 
164
                   ".D"[&rdp->nxtlist != rdp->nxttail[RCU_DONE_TAIL]]);
 
165
#ifdef CONFIG_RCU_BOOST
 
166
        seq_printf(m, ",%d,\"%c\"",
 
167
                   per_cpu(rcu_cpu_has_work, rdp->cpu),
 
168
                   convert_kthread_status(per_cpu(rcu_cpu_kthread_status,
 
169
                                          rdp->cpu)));
 
170
#endif /* #ifdef CONFIG_RCU_BOOST */
 
171
        seq_printf(m, ",%ld", rdp->blimit);
125
172
        seq_printf(m, ",%lu,%lu,%lu\n",
126
173
                   rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
127
174
}
130
177
{
131
178
        seq_puts(m, "\"CPU\",\"Online?\",\"c\",\"g\",\"pq\",\"pqc\",\"pq\",");
132
179
#ifdef CONFIG_NO_HZ
133
 
        seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\",");
 
180
        seq_puts(m, "\"dt\",\"dt nesting\",\"dt NMI nesting\",\"df\",");
134
181
#endif /* #ifdef CONFIG_NO_HZ */
135
 
        seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\",\"ci\",\"co\",\"ca\"\n");
 
182
        seq_puts(m, "\"of\",\"ri\",\"ql\",\"qs\"");
 
183
#ifdef CONFIG_RCU_BOOST
 
184
        seq_puts(m, "\"kt\",\"ktl\"");
 
185
#endif /* #ifdef CONFIG_RCU_BOOST */
 
186
        seq_puts(m, ",\"b\",\"ci\",\"co\",\"ca\"\n");
136
187
#ifdef CONFIG_TREE_PREEMPT_RCU
137
188
        seq_puts(m, "\"rcu_preempt:\"\n");
138
189
        PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data_csv, m);
157
208
        .release = single_release,
158
209
};
159
210
 
 
211
#ifdef CONFIG_RCU_BOOST
 
212
 
 
213
static void print_one_rcu_node_boost(struct seq_file *m, struct rcu_node *rnp)
 
214
{
 
215
        seq_printf(m,  "%d:%d tasks=%c%c%c%c kt=%c ntb=%lu neb=%lu nnb=%lu "
 
216
                   "j=%04x bt=%04x\n",
 
217
                   rnp->grplo, rnp->grphi,
 
218
                   "T."[list_empty(&rnp->blkd_tasks)],
 
219
                   "N."[!rnp->gp_tasks],
 
220
                   "E."[!rnp->exp_tasks],
 
221
                   "B."[!rnp->boost_tasks],
 
222
                   convert_kthread_status(rnp->boost_kthread_status),
 
223
                   rnp->n_tasks_boosted, rnp->n_exp_boosts,
 
224
                   rnp->n_normal_boosts,
 
225
                   (int)(jiffies & 0xffff),
 
226
                   (int)(rnp->boost_time & 0xffff));
 
227
        seq_printf(m, "%s: nt=%lu egt=%lu bt=%lu nb=%lu ny=%lu nos=%lu\n",
 
228
                   "     balk",
 
229
                   rnp->n_balk_blkd_tasks,
 
230
                   rnp->n_balk_exp_gp_tasks,
 
231
                   rnp->n_balk_boost_tasks,
 
232
                   rnp->n_balk_notblocked,
 
233
                   rnp->n_balk_notyet,
 
234
                   rnp->n_balk_nos);
 
235
}
 
236
 
 
237
static int show_rcu_node_boost(struct seq_file *m, void *unused)
 
238
{
 
239
        struct rcu_node *rnp;
 
240
 
 
241
        rcu_for_each_leaf_node(&rcu_preempt_state, rnp)
 
242
                print_one_rcu_node_boost(m, rnp);
 
243
        return 0;
 
244
}
 
245
 
 
246
static int rcu_node_boost_open(struct inode *inode, struct file *file)
 
247
{
 
248
        return single_open(file, show_rcu_node_boost, NULL);
 
249
}
 
250
 
 
251
static const struct file_operations rcu_node_boost_fops = {
 
252
        .owner = THIS_MODULE,
 
253
        .open = rcu_node_boost_open,
 
254
        .read = seq_read,
 
255
        .llseek = seq_lseek,
 
256
        .release = single_release,
 
257
};
 
258
 
 
259
/*
 
260
 * Create the rcuboost debugfs entry.  Standard error return.
 
261
 */
 
262
static int rcu_boost_trace_create_file(struct dentry *rcudir)
 
263
{
 
264
        return !debugfs_create_file("rcuboost", 0444, rcudir, NULL,
 
265
                                    &rcu_node_boost_fops);
 
266
}
 
267
 
 
268
#else /* #ifdef CONFIG_RCU_BOOST */
 
269
 
 
270
static int rcu_boost_trace_create_file(struct dentry *rcudir)
 
271
{
 
272
        return 0;  /* There cannot be an error if we didn't create it! */
 
273
}
 
274
 
 
275
#endif /* #else #ifdef CONFIG_RCU_BOOST */
 
276
 
160
277
static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
161
278
{
162
279
        unsigned long gpnum;
163
280
        int level = 0;
164
 
        int phase;
165
281
        struct rcu_node *rnp;
166
282
 
167
283
        gpnum = rsp->gpnum;
178
294
                        seq_puts(m, "\n");
179
295
                        level = rnp->level;
180
296
                }
181
 
                phase = gpnum & 0x1;
182
 
                seq_printf(m, "%lx/%lx %c%c>%c%c %d:%d ^%d    ",
 
297
                seq_printf(m, "%lx/%lx %c%c>%c %d:%d ^%d    ",
183
298
                           rnp->qsmask, rnp->qsmaskinit,
184
 
                           "T."[list_empty(&rnp->blocked_tasks[phase])],
185
 
                           "E."[list_empty(&rnp->blocked_tasks[phase + 2])],
186
 
                           "T."[list_empty(&rnp->blocked_tasks[!phase])],
187
 
                           "E."[list_empty(&rnp->blocked_tasks[!phase + 2])],
 
299
                           ".G"[rnp->gp_tasks != NULL],
 
300
                           ".E"[rnp->exp_tasks != NULL],
 
301
                           ".T"[!list_empty(&rnp->blkd_tasks)],
188
302
                           rnp->grplo, rnp->grphi, rnp->grpnum);
189
303
        }
190
304
        seq_puts(m, "\n");
216
330
        .release = single_release,
217
331
};
218
332
 
 
333
static void show_one_rcugp(struct seq_file *m, struct rcu_state *rsp)
 
334
{
 
335
        unsigned long flags;
 
336
        unsigned long completed;
 
337
        unsigned long gpnum;
 
338
        unsigned long gpage;
 
339
        unsigned long gpmax;
 
340
        struct rcu_node *rnp = &rsp->node[0];
 
341
 
 
342
        raw_spin_lock_irqsave(&rnp->lock, flags);
 
343
        completed = rsp->completed;
 
344
        gpnum = rsp->gpnum;
 
345
        if (rsp->completed == rsp->gpnum)
 
346
                gpage = 0;
 
347
        else
 
348
                gpage = jiffies - rsp->gp_start;
 
349
        gpmax = rsp->gp_max;
 
350
        raw_spin_unlock_irqrestore(&rnp->lock, flags);
 
351
        seq_printf(m, "%s: completed=%ld  gpnum=%lu  age=%ld  max=%ld\n",
 
352
                   rsp->name, completed, gpnum, gpage, gpmax);
 
353
}
 
354
 
219
355
static int show_rcugp(struct seq_file *m, void *unused)
220
356
{
221
357
#ifdef CONFIG_TREE_PREEMPT_RCU
222
 
        seq_printf(m, "rcu_preempt: completed=%ld  gpnum=%lu\n",
223
 
                   rcu_preempt_state.completed, rcu_preempt_state.gpnum);
 
358
        show_one_rcugp(m, &rcu_preempt_state);
224
359
#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
225
 
        seq_printf(m, "rcu_sched: completed=%ld  gpnum=%lu\n",
226
 
                   rcu_sched_state.completed, rcu_sched_state.gpnum);
227
 
        seq_printf(m, "rcu_bh: completed=%ld  gpnum=%lu\n",
228
 
                   rcu_bh_state.completed, rcu_bh_state.gpnum);
 
360
        show_one_rcugp(m, &rcu_sched_state);
 
361
        show_one_rcugp(m, &rcu_bh_state);
229
362
        return 0;
230
363
}
231
364
 
298
431
        .release = single_release,
299
432
};
300
433
 
 
434
static int show_rcutorture(struct seq_file *m, void *unused)
 
435
{
 
436
        seq_printf(m, "rcutorture test sequence: %lu %s\n",
 
437
                   rcutorture_testseq >> 1,
 
438
                   (rcutorture_testseq & 0x1) ? "(test in progress)" : "");
 
439
        seq_printf(m, "rcutorture update version number: %lu\n",
 
440
                   rcutorture_vernum);
 
441
        return 0;
 
442
}
 
443
 
 
444
static int rcutorture_open(struct inode *inode, struct file *file)
 
445
{
 
446
        return single_open(file, show_rcutorture, NULL);
 
447
}
 
448
 
 
449
static const struct file_operations rcutorture_fops = {
 
450
        .owner = THIS_MODULE,
 
451
        .open = rcutorture_open,
 
452
        .read = seq_read,
 
453
        .llseek = seq_lseek,
 
454
        .release = single_release,
 
455
};
 
456
 
301
457
static struct dentry *rcudir;
302
458
 
303
459
static int __init rcutree_trace_init(void)
318
474
        if (!retval)
319
475
                goto free_out;
320
476
 
 
477
        if (rcu_boost_trace_create_file(rcudir))
 
478
                goto free_out;
 
479
 
321
480
        retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops);
322
481
        if (!retval)
323
482
                goto free_out;
331
490
                                                NULL, &rcu_pending_fops);
332
491
        if (!retval)
333
492
                goto free_out;
 
493
 
 
494
        retval = debugfs_create_file("rcutorture", 0444, rcudir,
 
495
                                                NULL, &rcutorture_fops);
 
496
        if (!retval)
 
497
                goto free_out;
334
498
        return 0;
335
499
free_out:
336
500
        debugfs_remove_recursive(rcudir);