]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
rcutorture: Convert rcutorture_get_gp_data() to ->gp_seq
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 1 May 2018 13:42:51 +0000 (06:42 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 12 Jul 2018 21:27:57 +0000 (14:27 -0700)
SRCU has long used ->srcu_gp_seq, and now RCU uses ->gp_seq.  This
commit therefore moves the rcutorture_get_gp_data() function from
a ->gpnum / ->completed pair to ->gp_seq.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/rcu.h
kernel/rcu/rcutorture.c
kernel/rcu/srcutree.c
kernel/rcu/tree.c

index 7568a3fd08152899eb6c8be924529a8c6cd89b9a..003671825d62a1f2a857f1e1b0483bd2e2a89737 100644 (file)
@@ -425,7 +425,7 @@ enum rcutorture_type {
 
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
 void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
-                           unsigned long *gpnum, unsigned long *completed);
+                           unsigned long *gp_seq);
 void rcutorture_record_test_transition(void);
 void rcutorture_record_progress(unsigned long vernum);
 void do_trace_rcu_torture_read(const char *rcutorturename,
@@ -435,13 +435,10 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
                               unsigned long c);
 #else
 static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
-                                         int *flags,
-                                         unsigned long *gpnum,
-                                         unsigned long *completed)
+                                         int *flags, unsigned long *gp_seq)
 {
        *flags = 0;
-       *gpnum = 0;
-       *completed = 0;
+       *gp_seq = 0;
 }
 static inline void rcutorture_record_test_transition(void) { }
 static inline void rcutorture_record_progress(unsigned long vernum) { }
@@ -461,21 +458,19 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
 
 static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
                                           struct srcu_struct *sp, int *flags,
-                                          unsigned long *gpnum,
-                                          unsigned long *completed)
+                                          unsigned long *gp_seq)
 {
        if (test_type != SRCU_FLAVOR)
                return;
        *flags = 0;
-       *completed = sp->srcu_idx;
-       *gpnum = *completed;
+       *gp_seq = sp->srcu_idx;
 }
 
 #elif defined(CONFIG_TREE_SRCU)
 
 void srcutorture_get_gp_data(enum rcutorture_type test_type,
                             struct srcu_struct *sp, int *flags,
-                            unsigned long *gpnum, unsigned long *completed);
+                            unsigned long *gp_seq);
 
 #endif
 
index 1f66597c7783e23e196486b703cbc93bf7c4185f..81fb43530d646d81d917afaeb754d3e1b0de023d 100644 (file)
@@ -1313,18 +1313,16 @@ rcu_torture_stats_print(void)
        if (rtcv_snap == rcu_torture_current_version &&
            rcu_torture_current != NULL) {
                int __maybe_unused flags = 0;
-               unsigned long __maybe_unused gpnum = 0;
-               unsigned long __maybe_unused completed = 0;
+               unsigned long __maybe_unused gp_seq = 0;
 
                rcutorture_get_gp_data(cur_ops->ttype,
-                                      &flags, &gpnum, &completed);
+                                      &flags, &gp_seq);
                srcutorture_get_gp_data(cur_ops->ttype, srcu_ctlp,
-                                       &flags, &gpnum, &completed);
+                                       &flags, &gp_seq);
                wtp = READ_ONCE(writer_task);
-               pr_alert("??? Writer stall state %s(%d) g%lu c%lu f%#x ->state %#lx cpu %d\n",
+               pr_alert("??? Writer stall state %s(%d) g%lu f%#x ->state %#lx cpu %d\n",
                         rcu_torture_writer_state_getname(),
-                        rcu_torture_writer_state,
-                        gpnum, completed, flags,
+                        rcu_torture_writer_state, gp_seq, flags,
                         wtp == NULL ? ~0UL : wtp->state,
                         wtp == NULL ? -1 : (int)task_cpu(wtp));
                if (!splatted && wtp) {
@@ -1605,8 +1603,7 @@ static void
 rcu_torture_cleanup(void)
 {
        int flags = 0;
-       unsigned long gpnum = 0;
-       unsigned long completed = 0;
+       unsigned long gp_seq = 0;
        int i;
 
        rcutorture_record_test_transition();
@@ -1637,11 +1634,10 @@ rcu_torture_cleanup(void)
                fakewriter_tasks = NULL;
        }
 
-       rcutorture_get_gp_data(cur_ops->ttype, &flags, &gpnum, &completed);
-       srcutorture_get_gp_data(cur_ops->ttype, srcu_ctlp,
-                               &flags, &gpnum, &completed);
-       pr_alert("%s:  End-test grace-period state: g%lu c%lu f%#x\n",
-                cur_ops->name, gpnum, completed, flags);
+       rcutorture_get_gp_data(cur_ops->ttype, &flags, &gp_seq);
+       srcutorture_get_gp_data(cur_ops->ttype, srcu_ctlp, &flags, &gp_seq);
+       pr_alert("%s:  End-test grace-period state: g%lu f%#x\n",
+                cur_ops->name, gp_seq, flags);
        torture_stop_kthread(rcu_torture_stats, stats_task);
        torture_stop_kthread(rcu_torture_fqs, fqs_task);
        for (i = 0; i < ncbflooders; i++)
index 5a1a9a07b407b0f1f47a36acc49d786bab8847c3..d6d6ea9738c070ff0dcb17f5cf209d0b7f94b3e1 100644 (file)
@@ -1249,13 +1249,12 @@ static void process_srcu(struct work_struct *work)
 
 void srcutorture_get_gp_data(enum rcutorture_type test_type,
                             struct srcu_struct *sp, int *flags,
-                            unsigned long *gpnum, unsigned long *completed)
+                            unsigned long *gp_seq)
 {
        if (test_type != SRCU_FLAVOR)
                return;
        *flags = 0;
-       *completed = rcu_seq_ctr(sp->srcu_gp_seq);
-       *gpnum = rcu_seq_ctr(sp->srcu_gp_seq_needed);
+       *gp_seq = rcu_seq_current(&sp->srcu_gp_seq);
 }
 EXPORT_SYMBOL_GPL(srcutorture_get_gp_data);
 
index 9e619c4878d3b3dee0e82aea87d8442ac55ed88d..4a528a062cd482cec18c4141011b9f38502d83c8 100644 (file)
@@ -638,7 +638,7 @@ EXPORT_SYMBOL_GPL(rcutorture_record_test_transition);
  * Send along grace-period-related data for rcutorture diagnostics.
  */
 void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
-                           unsigned long *gpnum, unsigned long *completed)
+                           unsigned long *gp_seq)
 {
        struct rcu_state *rsp = NULL;
 
@@ -658,8 +658,7 @@ void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
        if (rsp == NULL)
                return;
        *flags = READ_ONCE(rsp->gp_flags);
-       *gpnum = READ_ONCE(rsp->gpnum);
-       *completed = READ_ONCE(rsp->completed);
+       *gp_seq = rcu_seq_current(&rsp->gp_seq);
 }
 EXPORT_SYMBOL_GPL(rcutorture_get_gp_data);