UDF: Fix a null pointer dereference in udf_sb_free_partitions
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / rcutree_trace.c
index 3312ed7..0d095dc 100644 (file)
@@ -78,29 +78,26 @@ static void r_stop(struct seq_file *m, void *v)
 {
 }
 
-static int show_rcubarrier(struct seq_file *m, void *unused)
+static int show_rcubarrier(struct seq_file *m, void *v)
 {
-       struct rcu_state *rsp;
-
-       for_each_rcu_flavor(rsp)
-               seq_printf(m, "%s: bcc: %d nbd: %lu\n",
-                          rsp->name,
-                          atomic_read(&rsp->barrier_cpu_count),
-                          rsp->n_barrier_done);
+       struct rcu_state *rsp = (struct rcu_state *)m->private;
+       seq_printf(m, "bcc: %d nbd: %lu\n",
+                  atomic_read(&rsp->barrier_cpu_count),
+                  rsp->n_barrier_done);
        return 0;
 }
 
 static int rcubarrier_open(struct inode *inode, struct file *file)
 {
-       return single_open(file, show_rcubarrier, NULL);
+       return single_open(file, show_rcubarrier, inode->i_private);
 }
 
 static const struct file_operations rcubarrier_fops = {
        .owner = THIS_MODULE,
        .open = rcubarrier_open,
        .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
+       .llseek = no_llseek,
+       .release = seq_release,
 };
 
 #ifdef CONFIG_RCU_BOOST
@@ -116,6 +113,8 @@ static char convert_kthread_status(unsigned int kthread_status)
 
 static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 {
+       long ql, qll;
+
        if (!rdp->beenonline)
                return;
        seq_printf(m, "%3d%cc=%ld g=%ld pq=%d qp=%d",
@@ -129,8 +128,11 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
                   rdp->dynticks->dynticks_nmi_nesting,
                   rdp->dynticks_fqs);
        seq_printf(m, " of=%lu", rdp->offline_fqs);
+       rcu_nocb_q_lengths(rdp, &ql, &qll);
+       qll += rdp->qlen_lazy;
+       ql += rdp->qlen;
        seq_printf(m, " ql=%ld/%ld qs=%c%c%c%c",
-                  rdp->qlen_lazy, rdp->qlen,
+                  qll, ql,
                   ".N"[rdp->nxttail[RCU_NEXT_READY_TAIL] !=
                        rdp->nxttail[RCU_NEXT_TAIL]],
                   ".R"[rdp->nxttail[RCU_WAIT_TAIL] !=
@@ -146,8 +148,9 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
                   per_cpu(rcu_cpu_kthread_loops, rdp->cpu) & 0xffff);
 #endif /* #ifdef CONFIG_RCU_BOOST */
        seq_printf(m, " b=%ld", rdp->blimit);
-       seq_printf(m, " ci=%lu co=%lu ca=%lu\n",
-                  rdp->n_cbs_invoked, rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
+       seq_printf(m, " ci=%lu nci=%lu co=%lu ca=%lu\n",
+                  rdp->n_cbs_invoked, rdp->n_nocbs_invoked,
+                  rdp->n_cbs_orphaned, rdp->n_cbs_adopted);
 }
 
 static int show_rcudata(struct seq_file *m, void *v)
@@ -176,6 +179,38 @@ static const struct file_operations rcudata_fops = {
        .release = seq_release,
 };
 
+static int show_rcuexp(struct seq_file *m, void *v)
+{
+       struct rcu_state *rsp = (struct rcu_state *)m->private;
+
+       seq_printf(m, "s=%lu d=%lu w=%lu tf=%lu wd1=%lu wd2=%lu n=%lu sc=%lu dt=%lu dl=%lu dx=%lu\n",
+                  atomic_long_read(&rsp->expedited_start),
+                  atomic_long_read(&rsp->expedited_done),
+                  atomic_long_read(&rsp->expedited_wrap),
+                  atomic_long_read(&rsp->expedited_tryfail),
+                  atomic_long_read(&rsp->expedited_workdone1),
+                  atomic_long_read(&rsp->expedited_workdone2),
+                  atomic_long_read(&rsp->expedited_normal),
+                  atomic_long_read(&rsp->expedited_stoppedcpus),
+                  atomic_long_read(&rsp->expedited_done_tries),
+                  atomic_long_read(&rsp->expedited_done_lost),
+                  atomic_long_read(&rsp->expedited_done_exit));
+       return 0;
+}
+
+static int rcuexp_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, show_rcuexp, inode->i_private);
+}
+
+static const struct file_operations rcuexp_fops = {
+       .owner = THIS_MODULE,
+       .open = rcuexp_open,
+       .read = seq_read,
+       .llseek = no_llseek,
+       .release = seq_release,
+};
+
 #ifdef CONFIG_RCU_BOOST
 
 static void print_one_rcu_node_boost(struct seq_file *m, struct rcu_node *rnp)
@@ -219,27 +254,11 @@ static const struct file_operations rcu_node_boost_fops = {
        .owner = THIS_MODULE,
        .open = rcu_node_boost_open,
        .read = seq_read,
-       .llseek = seq_lseek,
+       .llseek = no_llseek,
        .release = single_release,
 };
 
-/*
- * Create the rcuboost debugfs entry.  Standard error return.
- */
-static int rcu_boost_trace_create_file(struct dentry *rcudir)
-{
-       return !debugfs_create_file("rcuboost", 0444, rcudir, NULL,
-                                   &rcu_node_boost_fops);
-}
-
-#else /* #ifdef CONFIG_RCU_BOOST */
-
-static int rcu_boost_trace_create_file(struct dentry *rcudir)
-{
-       return 0;  /* There cannot be an error if we didn't create it! */
-}
-
-#endif /* #else #ifdef CONFIG_RCU_BOOST */
+#endif /* #ifdef CONFIG_RCU_BOOST */
 
 static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
 {
@@ -248,8 +267,8 @@ static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
        struct rcu_node *rnp;
 
        gpnum = rsp->gpnum;
-       seq_printf(m, "%s: c=%ld g=%ld s=%d jfq=%ld j=%x ",
-                  rsp->name, ulong2long(rsp->completed), ulong2long(gpnum),
+       seq_printf(m, "c=%ld g=%ld s=%d jfq=%ld j=%x ",
+                  ulong2long(rsp->completed), ulong2long(gpnum),
                   rsp->fqs_state,
                   (long)(rsp->jiffies_force_qs - jiffies),
                   (int)(jiffies & 0xffff));
@@ -272,26 +291,24 @@ static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)
        seq_puts(m, "\n");
 }
 
-static int show_rcuhier(struct seq_file *m, void *unused)
+static int show_rcuhier(struct seq_file *m, void *v)
 {
-       struct rcu_state *rsp;
-
-       for_each_rcu_flavor(rsp)
-               print_one_rcu_state(m, rsp);
+       struct rcu_state *rsp = (struct rcu_state *)m->private;
+       print_one_rcu_state(m, rsp);
        return 0;
 }
 
 static int rcuhier_open(struct inode *inode, struct file *file)
 {
-       return single_open(file, show_rcuhier, NULL);
+       return single_open(file, show_rcuhier, inode->i_private);
 }
 
 static const struct file_operations rcuhier_fops = {
        .owner = THIS_MODULE,
        .open = rcuhier_open,
        .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
+       .llseek = no_llseek,
+       .release = seq_release,
 };
 
 static void show_one_rcugp(struct seq_file *m, struct rcu_state *rsp)
@@ -312,30 +329,28 @@ static void show_one_rcugp(struct seq_file *m, struct rcu_state *rsp)
                gpage = jiffies - rsp->gp_start;
        gpmax = rsp->gp_max;
        raw_spin_unlock_irqrestore(&rnp->lock, flags);
-       seq_printf(m, "%s: completed=%ld  gpnum=%ld  age=%ld  max=%ld\n",
-                  rsp->name, ulong2long(completed), ulong2long(gpnum), gpage, gpmax);
+       seq_printf(m, "completed=%ld  gpnum=%ld  age=%ld  max=%ld\n",
+                  ulong2long(completed), ulong2long(gpnum), gpage, gpmax);
 }
 
-static int show_rcugp(struct seq_file *m, void *unused)
+static int show_rcugp(struct seq_file *m, void *v)
 {
-       struct rcu_state *rsp;
-
-       for_each_rcu_flavor(rsp)
-               show_one_rcugp(m, rsp);
+       struct rcu_state *rsp = (struct rcu_state *)m->private;
+       show_one_rcugp(m, rsp);
        return 0;
 }
 
 static int rcugp_open(struct inode *inode, struct file *file)
 {
-       return single_open(file, show_rcugp, NULL);
+       return single_open(file, show_rcugp, inode->i_private);
 }
 
 static const struct file_operations rcugp_fops = {
        .owner = THIS_MODULE,
        .open = rcugp_open,
        .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
+       .llseek = no_llseek,
+       .release = seq_release,
 };
 
 static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp)
@@ -423,33 +438,45 @@ static int __init rcutree_trace_init(void)
                if (!rspdir)
                        goto free_out;
 
-                       retval = debugfs_create_file("rcudata", 0444,
-                                       rspdir, rsp, &rcudata_fops);
-                       if (!retval)
-                               goto free_out;
+               retval = debugfs_create_file("rcudata", 0444,
+                               rspdir, rsp, &rcudata_fops);
+               if (!retval)
+                       goto free_out;
 
-                       retval = debugfs_create_file("rcu_pending", 0444,
-                                       rspdir, rsp, &rcu_pending_fops);
-                       if (!retval)
-                               goto free_out;
-       }
+               retval = debugfs_create_file("rcuexp", 0444,
+                               rspdir, rsp, &rcuexp_fops);
+               if (!retval)
+                       goto free_out;
 
-       retval = debugfs_create_file("rcubarrier", 0444, rcudir,
-                                               NULL, &rcubarrier_fops);
-       if (!retval)
-               goto free_out;
+               retval = debugfs_create_file("rcu_pending", 0444,
+                               rspdir, rsp, &rcu_pending_fops);
+               if (!retval)
+                       goto free_out;
 
-       if (rcu_boost_trace_create_file(rcudir))
-               goto free_out;
+               retval = debugfs_create_file("rcubarrier", 0444,
+                               rspdir, rsp, &rcubarrier_fops);
+               if (!retval)
+                       goto free_out;
 
-       retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops);
-       if (!retval)
-               goto free_out;
+#ifdef CONFIG_RCU_BOOST
+               if (rsp == &rcu_preempt_state) {
+                       retval = debugfs_create_file("rcuboost", 0444,
+                               rspdir, NULL, &rcu_node_boost_fops);
+                       if (!retval)
+                               goto free_out;
+               }
+#endif
 
-       retval = debugfs_create_file("rcuhier", 0444, rcudir,
-                                               NULL, &rcuhier_fops);
-       if (!retval)
-               goto free_out;
+               retval = debugfs_create_file("rcugp", 0444,
+                               rspdir, rsp, &rcugp_fops);
+               if (!retval)
+                       goto free_out;
+
+               retval = debugfs_create_file("rcuhier", 0444,
+                               rspdir, rsp, &rcuhier_fops);
+               if (!retval)
+                       goto free_out;
+       }
 
        retval = debugfs_create_file("rcutorture", 0444, rcudir,
                                                NULL, &rcutorture_fops);