aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-01-30 16:38:09 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-02-23 12:01:07 -0500
commitb5daa8f3b3b2b0133ad40e13d4f722070119ce36 (patch)
tree0c11133084c120238af88fe9ce62046bb489b7d8 /kernel/rcu
parent2e9e8081d2e7a4efb582a240aa7fee991bbbabb0 (diff)
rcutorture: Abstract torture-test initialization
This commit creates torture_init_begin() and torture_init_end() functions to abstract locking and allow the torture_type and verbose variables in kernel/torture.o to become static. With a bit more abstraction, fullstop_mutex will also become static. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/rcutorture.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 0e8b52b71d76..93aca2f9261e 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -91,15 +91,12 @@ torture_param(int, test_boost_interval, 7,
91 "Interval between boost tests, seconds."); 91 "Interval between boost tests, seconds.");
92torture_param(bool, test_no_idle_hz, true, 92torture_param(bool, test_no_idle_hz, true,
93 "Test support for tickless idle CPUs"); 93 "Test support for tickless idle CPUs");
94torture_param(bool, verbose, true,
95 "Enable verbose debugging printk()s");
94 96
95char *torture_type = "rcu"; 97static char *torture_type = "rcu";
96EXPORT_SYMBOL_GPL(torture_type);
97module_param(torture_type, charp, 0444); 98module_param(torture_type, charp, 0444);
98MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)"); 99MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)");
99bool verbose;
100EXPORT_SYMBOL_GPL(verbose);
101module_param(verbose, bool, 0444);
102MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s");
103 100
104static int nrealreaders; 101static int nrealreaders;
105static struct task_struct *writer_task; 102static struct task_struct *writer_task;
@@ -1425,8 +1422,8 @@ rcu_torture_cleanup(void)
1425{ 1422{
1426 int i; 1423 int i;
1427 1424
1428 mutex_lock(&fullstop_mutex);
1429 rcutorture_record_test_transition(); 1425 rcutorture_record_test_transition();
1426 mutex_lock(&fullstop_mutex);
1430 if (fullstop == FULLSTOP_SHUTDOWN) { 1427 if (fullstop == FULLSTOP_SHUTDOWN) {
1431 pr_warn(/* but going down anyway, so... */ 1428 pr_warn(/* but going down anyway, so... */
1432 "Concurrent 'rmmod rcutorture' and shutdown illegal!\n"); 1429 "Concurrent 'rmmod rcutorture' and shutdown illegal!\n");
@@ -1589,7 +1586,7 @@ rcu_torture_init(void)
1589 &rcu_ops, &rcu_bh_ops, &srcu_ops, &sched_ops, 1586 &rcu_ops, &rcu_bh_ops, &srcu_ops, &sched_ops,
1590 }; 1587 };
1591 1588
1592 mutex_lock(&fullstop_mutex); 1589 torture_init_begin(torture_type, verbose);
1593 1590
1594 /* Process args and tell the world that the torturer is on the job. */ 1591 /* Process args and tell the world that the torturer is on the job. */
1595 for (i = 0; i < ARRAY_SIZE(torture_ops); i++) { 1592 for (i = 0; i < ARRAY_SIZE(torture_ops); i++) {
@@ -1604,7 +1601,7 @@ rcu_torture_init(void)
1604 for (i = 0; i < ARRAY_SIZE(torture_ops); i++) 1601 for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
1605 pr_alert(" %s", torture_ops[i]->name); 1602 pr_alert(" %s", torture_ops[i]->name);
1606 pr_alert("\n"); 1603 pr_alert("\n");
1607 mutex_unlock(&fullstop_mutex); 1604 torture_init_end();
1608 return -EINVAL; 1605 return -EINVAL;
1609 } 1606 }
1610 if (cur_ops->fqs == NULL && fqs_duration != 0) { 1607 if (cur_ops->fqs == NULL && fqs_duration != 0) {
@@ -1800,11 +1797,11 @@ rcu_torture_init(void)
1800 if (object_debug) 1797 if (object_debug)
1801 rcu_test_debug_objects(); 1798 rcu_test_debug_objects();
1802 rcutorture_record_test_transition(); 1799 rcutorture_record_test_transition();
1803 mutex_unlock(&fullstop_mutex); 1800 torture_init_end();
1804 return 0; 1801 return 0;
1805 1802
1806unwind: 1803unwind:
1807 mutex_unlock(&fullstop_mutex); 1804 torture_init_end();
1808 rcu_torture_cleanup(); 1805 rcu_torture_cleanup();
1809 return firsterr; 1806 return firsterr;
1810} 1807}