rcu: Move torture-related definitions from rcupdate.h to rcu.h
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 3 May 2017 17:22:57 +0000 (10:22 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 9 Jun 2017 01:52:28 +0000 (18:52 -0700)
The include/linux/rcupdate.h file contains a number of definitions that
are used only to communicate between rcutorture, rcuperf, and the RCU code
itself.  There is no point in having these definitions exposed globally
throughout the kernel, so this commit moves them to kernel/rcu/rcu.h.
This change has the added benefit of shrinking rcupdate.h.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/rcupdate.h
include/linux/rcutiny.h
include/linux/rcutree.h
include/linux/srcuclassic.h
include/linux/srcutiny.h
include/linux/srcutree.h
kernel/rcu/rcu.h

index 049c62c59f1b4d4908c0e7501c7acfcbafeb1009..7557499d8e70cb9b6fe971a87886aee72d9e7a3d 100644 (file)
 #include <linux/ktime.h>
 #include <linux/irqflags.h>
 
-enum rcutorture_type {
-       RCU_FLAVOR,
-       RCU_BH_FLAVOR,
-       RCU_SCHED_FLAVOR,
-       RCU_TASKS_FLAVOR,
-       SRCU_FLAVOR,
-       INVALID_RCU_FLAVOR
-};
-
-#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);
-void rcutorture_record_test_transition(void);
-void rcutorture_record_progress(unsigned long vernum);
-void do_trace_rcu_torture_read(const char *rcutorturename,
-                              struct rcu_head *rhp,
-                              unsigned long secs,
-                              unsigned long c_old,
-                              unsigned long c);
-bool rcu_irq_enter_disabled(void);
-#else
-static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
-                                         int *flags,
-                                         unsigned long *gpnum,
-                                         unsigned long *completed)
-{
-       *flags = 0;
-       *gpnum = 0;
-       *completed = 0;
-}
-static inline void rcutorture_record_test_transition(void)
-{
-}
-static inline void rcutorture_record_progress(unsigned long vernum)
-{
-}
-static inline bool rcu_irq_enter_disabled(void)
-{
-       return false;
-}
-#ifdef CONFIG_RCU_TRACE
-void do_trace_rcu_torture_read(const char *rcutorturename,
-                              struct rcu_head *rhp,
-                              unsigned long secs,
-                              unsigned long c_old,
-                              unsigned long c);
-#else
-#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
-       do { } while (0)
-#endif
-#endif
-
 #define UINT_CMP_GE(a, b)      (UINT_MAX / 2 >= (a) - (b))
 #define UINT_CMP_LT(a, b)      (UINT_MAX / 2 < (a) - (b))
 #define ULONG_CMP_GE(a, b)     (ULONG_MAX / 2 >= (a) - (b))
index 74d9c3a1feeec494b693501c6ec976c9dd487186..ade360e0d58caeafb5094c8a913411d74d3dd9e4 100644 (file)
@@ -202,6 +202,11 @@ static inline void rcu_irq_enter(void)
 {
 }
 
+static inline bool rcu_irq_enter_disabled(void)
+{
+       return false;
+}
+
 static inline void rcu_irq_exit_irqson(void)
 {
 }
index 0bacb6b2af6973681b3724a9e4d4311daf730c30..28af91a1957396a86e90847fa7426be19a79e6ef 100644 (file)
@@ -101,6 +101,7 @@ void rcu_irq_enter(void);
 void rcu_irq_exit(void);
 void rcu_irq_enter_irqson(void);
 void rcu_irq_exit_irqson(void);
+bool rcu_irq_enter_disabled(void);
 
 void exit_rcu(void);
 
index 5753f73222629c1340d363eba4e50510e437c575..41cf99930f342fbf622ac6dd133f0bd5cc74a216 100644 (file)
@@ -98,18 +98,4 @@ void synchronize_srcu_expedited(struct srcu_struct *sp);
 void srcu_barrier(struct srcu_struct *sp);
 unsigned long srcu_batches_completed(struct srcu_struct *sp);
 
-static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
-                                          struct srcu_struct *sp, int *flags,
-                                          unsigned long *gpnum,
-                                          unsigned long *completed)
-{
-       if (test_type != SRCU_FLAVOR)
-               return;
-       *flags = 0;
-       *completed = sp->completed;
-       *gpnum = *completed;
-       if (sp->batch_queue.head || sp->batch_check0.head || sp->batch_check0.head)
-               (*gpnum)++;
-}
-
 #endif
index b6edd9c8fdce4045ef0621301ada61c8b489b75c..85bddce6a7a6c8d30022d26e92a8eb78978abbf7 100644 (file)
@@ -93,16 +93,4 @@ static inline unsigned long srcu_batches_completed(struct srcu_struct *sp)
        return 0;
 }
 
-static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
-                                          struct srcu_struct *sp, int *flags,
-                                          unsigned long *gpnum,
-                                          unsigned long *completed)
-{
-       if (test_type != SRCU_FLAVOR)
-               return;
-       *flags = 0;
-       *completed = sp->srcu_gp_seq;
-       *gpnum = *completed;
-}
-
 #endif
index 32e86d85fd11f54bd973129a6428c4c09c104ace..f4adfed17b51f3d9a50b0361f41efac9ac2c55b0 100644 (file)
@@ -143,8 +143,4 @@ void synchronize_srcu_expedited(struct srcu_struct *sp);
 void srcu_barrier(struct srcu_struct *sp);
 unsigned long srcu_batches_completed(struct srcu_struct *sp);
 
-void srcutorture_get_gp_data(enum rcutorture_type test_type,
-                            struct srcu_struct *sp, int *flags,
-                            unsigned long *gpnum, unsigned long *completed);
-
 #endif
index ceb78110db1bf64ece4331fea32102932e8b8043..f190fc1c8215e3b462a8c9cfbebfe4d620bdde72 100644 (file)
@@ -319,4 +319,89 @@ void rcu_unexpedite_gp(void);
 void rcupdate_announce_bootup_oddness(void);
 #endif /* #else #ifdef CONFIG_TINY_RCU */
 
+enum rcutorture_type {
+       RCU_FLAVOR,
+       RCU_BH_FLAVOR,
+       RCU_SCHED_FLAVOR,
+       RCU_TASKS_FLAVOR,
+       SRCU_FLAVOR,
+       INVALID_RCU_FLAVOR
+};
+
+#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);
+void rcutorture_record_test_transition(void);
+void rcutorture_record_progress(unsigned long vernum);
+void do_trace_rcu_torture_read(const char *rcutorturename,
+                              struct rcu_head *rhp,
+                              unsigned long secs,
+                              unsigned long c_old,
+                              unsigned long c);
+#else
+static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
+                                         int *flags,
+                                         unsigned long *gpnum,
+                                         unsigned long *completed)
+{
+       *flags = 0;
+       *gpnum = 0;
+       *completed = 0;
+}
+static inline void rcutorture_record_test_transition(void)
+{
+}
+static inline void rcutorture_record_progress(unsigned long vernum)
+{
+}
+#ifdef CONFIG_RCU_TRACE
+void do_trace_rcu_torture_read(const char *rcutorturename,
+                              struct rcu_head *rhp,
+                              unsigned long secs,
+                              unsigned long c_old,
+                              unsigned long c);
+#else
+#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
+       do { } while (0)
+#endif
+#endif
+
+#ifdef CONFIG_TINY_SRCU
+
+static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
+                                          struct srcu_struct *sp, int *flags,
+                                          unsigned long *gpnum,
+                                          unsigned long *completed)
+{
+       if (test_type != SRCU_FLAVOR)
+               return;
+       *flags = 0;
+       *completed = sp->srcu_gp_seq;
+       *gpnum = *completed;
+}
+
+#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);
+
+#elif defined(CONFIG_CLASSIC_SRCU)
+
+static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
+                                          struct srcu_struct *sp, int *flags,
+                                          unsigned long *gpnum,
+                                          unsigned long *completed)
+{
+       if (test_type != SRCU_FLAVOR)
+               return;
+       *flags = 0;
+       *completed = sp->completed;
+       *gpnum = *completed;
+       if (sp->batch_queue.head || sp->batch_check0.head || sp->batch_check0.head)
+               (*gpnum)++;
+}
+
+#endif
+
 #endif /* __LINUX_RCU_H */