aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-01-27 19:27:00 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-02-23 12:01:00 -0500
commit9e2502254132261e0ea8010692fd447b1cedf627 (patch)
tree58310c4c524d2f5f5370114ddf970f4562125518
parentdaeda23de108fab1202b6843e5adb59de0a261f9 (diff)
rcutorture: Abstract torture_param()
Create a torture_param() macro and apply it to rcutorture in order to save a few lines of code. This same macro may be applied to other torture frameworks. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--include/linux/torture.h9
-rw-r--r--kernel/rcu/rcutorture.c103
2 files changed, 41 insertions, 71 deletions
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 979e3e6b378a..5aae880b6b4e 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -35,13 +35,18 @@
35#include <linux/bug.h> 35#include <linux/bug.h>
36#include <linux/compiler.h> 36#include <linux/compiler.h>
37 37
38/* Definitions for a non-string torture-test module parameter. */
39#define torture_param(type, name, init, msg) \
40 static type name = init; \
41 module_param(name, type, 0444); \
42 MODULE_PARM_DESC(name, msg);
43
44/* Low-rider random number generator. */
38struct torture_random_state { 45struct torture_random_state {
39 unsigned long trs_state; 46 unsigned long trs_state;
40 long trs_count; 47 long trs_count;
41}; 48};
42
43#define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 } 49#define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 }
44
45unsigned long torture_random(struct torture_random_state *trsp); 50unsigned long torture_random(struct torture_random_state *trsp);
46 51
47#endif /* __LINUX_TORTURE_H */ 52#endif /* __LINUX_TORTURE_H */
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 94b1cd8b214c..930791e0698d 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -59,78 +59,43 @@ MODULE_ALIAS("rcutorture");
59#endif 59#endif
60#define MODULE_PARAM_PREFIX "rcutorture." 60#define MODULE_PARAM_PREFIX "rcutorture."
61 61
62static int fqs_duration; 62torture_param(int, fqs_duration, 0,
63module_param(fqs_duration, int, 0444); 63 "Duration of fqs bursts (us), 0 to disable");
64MODULE_PARM_DESC(fqs_duration, "Duration of fqs bursts (us), 0 to disable"); 64torture_param(int, fqs_holdoff, 0, "Holdoff time within fqs bursts (us)");
65static int fqs_holdoff; 65torture_param(int, fqs_stutter, 3, "Wait time between fqs bursts (s)");
66module_param(fqs_holdoff, int, 0444); 66torture_param(bool, gp_exp, false, "Use expedited GP wait primitives");
67MODULE_PARM_DESC(fqs_holdoff, "Holdoff time within fqs bursts (us)"); 67torture_param(bool, gp_normal, false,
68static int fqs_stutter = 3; 68 "Use normal (non-expedited) GP wait primitives");
69module_param(fqs_stutter, int, 0444); 69torture_param(int, irqreader, 1, "Allow RCU readers from irq handlers");
70MODULE_PARM_DESC(fqs_stutter, "Wait time between fqs bursts (s)"); 70torture_param(int, n_barrier_cbs, 0,
71static bool gp_exp; 71 "# of callbacks/kthreads for barrier testing");
72module_param(gp_exp, bool, 0444); 72torture_param(int, nfakewriters, 4, "Number of RCU fake writer threads");
73MODULE_PARM_DESC(gp_exp, "Use expedited GP wait primitives"); 73torture_param(int, nreaders, -1, "Number of RCU reader threads");
74static bool gp_normal; 74torture_param(int, object_debug, 0,
75module_param(gp_normal, bool, 0444); 75 "Enable debug-object double call_rcu() testing");
76MODULE_PARM_DESC(gp_normal, "Use normal (non-expedited) GP wait primitives"); 76torture_param(int, onoff_holdoff, 0, "Time after boot before CPU hotplugs (s)");
77static int irqreader = 1; 77torture_param(int, onoff_interval, 0,
78module_param(irqreader, int, 0444); 78 "Time between CPU hotplugs (s), 0=disable");
79MODULE_PARM_DESC(irqreader, "Allow RCU readers from irq handlers"); 79torture_param(int, shuffle_interval, 3, "Number of seconds between shuffles");
80static int n_barrier_cbs; 80torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable.");
81module_param(n_barrier_cbs, int, 0444); 81torture_param(int, stall_cpu, 0, "Stall duration (s), zero to disable.");
82MODULE_PARM_DESC(n_barrier_cbs, "# of callbacks/kthreads for barrier testing"); 82torture_param(int, stall_cpu_holdoff, 10,
83static int nfakewriters = 4; 83 "Time to wait before starting stall (s).");
84module_param(nfakewriters, int, 0444); 84torture_param(int, stat_interval, 60,
85MODULE_PARM_DESC(nfakewriters, "Number of RCU fake writer threads"); 85 "Number of seconds between stats printk()s");
86static int nreaders = -1; 86torture_param(int, stutter, 5, "Number of seconds to run/halt test");
87module_param(nreaders, int, 0444); 87torture_param(int, test_boost, 1, "Test RCU prio boost: 0=no, 1=maybe, 2=yes.");
88MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); 88torture_param(int, test_boost_duration, 4,
89static int object_debug; 89 "Duration of each boost test, seconds.");
90module_param(object_debug, int, 0444); 90torture_param(int, test_boost_interval, 7,
91MODULE_PARM_DESC(object_debug, "Enable debug-object double call_rcu() testing"); 91 "Interval between boost tests, seconds.");
92static int onoff_holdoff; 92torture_param(bool, test_no_idle_hz, true,
93module_param(onoff_holdoff, int, 0444); 93 "Test support for tickless idle CPUs");
94MODULE_PARM_DESC(onoff_holdoff, "Time after boot before CPU hotplugs (s)"); 94torture_param(bool, verbose, false, "Enable verbose debugging printk()s");
95static int onoff_interval; 95
96module_param(onoff_interval, int, 0444);
97MODULE_PARM_DESC(onoff_interval, "Time between CPU hotplugs (s), 0=disable");
98static int shuffle_interval = 3;
99module_param(shuffle_interval, int, 0444);
100MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
101static int shutdown_secs;
102module_param(shutdown_secs, int, 0444);
103MODULE_PARM_DESC(shutdown_secs, "Shutdown time (s), <= zero to disable.");
104static int stall_cpu;
105module_param(stall_cpu, int, 0444);
106MODULE_PARM_DESC(stall_cpu, "Stall duration (s), zero to disable.");
107static int stall_cpu_holdoff = 10;
108module_param(stall_cpu_holdoff, int, 0444);
109MODULE_PARM_DESC(stall_cpu_holdoff, "Time to wait before starting stall (s).");
110static int stat_interval = 60;
111module_param(stat_interval, int, 0644);
112MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s");
113static int stutter = 5;
114module_param(stutter, int, 0444);
115MODULE_PARM_DESC(stutter, "Number of seconds to run/halt test");
116static int test_boost = 1;
117module_param(test_boost, int, 0444);
118MODULE_PARM_DESC(test_boost, "Test RCU prio boost: 0=no, 1=maybe, 2=yes.");
119static int test_boost_duration = 4;
120module_param(test_boost_duration, int, 0444);
121MODULE_PARM_DESC(test_boost_duration, "Duration of each boost test, seconds.");
122static int test_boost_interval = 7;
123module_param(test_boost_interval, int, 0444);
124MODULE_PARM_DESC(test_boost_interval, "Interval between boost tests, seconds.");
125static bool test_no_idle_hz = true;
126module_param(test_no_idle_hz, bool, 0444);
127MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs");
128static char *torture_type = "rcu"; 96static char *torture_type = "rcu";
129module_param(torture_type, charp, 0444); 97module_param(torture_type, charp, 0444);
130MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)"); 98MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)");
131static bool verbose;
132module_param(verbose, bool, 0444);
133MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s");
134 99
135#define TORTURE_FLAG "-torture:" 100#define TORTURE_FLAG "-torture:"
136#define PRINTK_STRING(s) \ 101#define PRINTK_STRING(s) \