diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-01-27 19:27:00 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-02-23 12:01:00 -0500 |
commit | 9e2502254132261e0ea8010692fd447b1cedf627 (patch) | |
tree | 58310c4c524d2f5f5370114ddf970f4562125518 | |
parent | daeda23de108fab1202b6843e5adb59de0a261f9 (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.h | 9 | ||||
-rw-r--r-- | kernel/rcu/rcutorture.c | 103 |
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. */ | ||
38 | struct torture_random_state { | 45 | struct 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 | |||
45 | unsigned long torture_random(struct torture_random_state *trsp); | 50 | unsigned 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 | ||
62 | static int fqs_duration; | 62 | torture_param(int, fqs_duration, 0, |
63 | module_param(fqs_duration, int, 0444); | 63 | "Duration of fqs bursts (us), 0 to disable"); |
64 | MODULE_PARM_DESC(fqs_duration, "Duration of fqs bursts (us), 0 to disable"); | 64 | torture_param(int, fqs_holdoff, 0, "Holdoff time within fqs bursts (us)"); |
65 | static int fqs_holdoff; | 65 | torture_param(int, fqs_stutter, 3, "Wait time between fqs bursts (s)"); |
66 | module_param(fqs_holdoff, int, 0444); | 66 | torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); |
67 | MODULE_PARM_DESC(fqs_holdoff, "Holdoff time within fqs bursts (us)"); | 67 | torture_param(bool, gp_normal, false, |
68 | static int fqs_stutter = 3; | 68 | "Use normal (non-expedited) GP wait primitives"); |
69 | module_param(fqs_stutter, int, 0444); | 69 | torture_param(int, irqreader, 1, "Allow RCU readers from irq handlers"); |
70 | MODULE_PARM_DESC(fqs_stutter, "Wait time between fqs bursts (s)"); | 70 | torture_param(int, n_barrier_cbs, 0, |
71 | static bool gp_exp; | 71 | "# of callbacks/kthreads for barrier testing"); |
72 | module_param(gp_exp, bool, 0444); | 72 | torture_param(int, nfakewriters, 4, "Number of RCU fake writer threads"); |
73 | MODULE_PARM_DESC(gp_exp, "Use expedited GP wait primitives"); | 73 | torture_param(int, nreaders, -1, "Number of RCU reader threads"); |
74 | static bool gp_normal; | 74 | torture_param(int, object_debug, 0, |
75 | module_param(gp_normal, bool, 0444); | 75 | "Enable debug-object double call_rcu() testing"); |
76 | MODULE_PARM_DESC(gp_normal, "Use normal (non-expedited) GP wait primitives"); | 76 | torture_param(int, onoff_holdoff, 0, "Time after boot before CPU hotplugs (s)"); |
77 | static int irqreader = 1; | 77 | torture_param(int, onoff_interval, 0, |
78 | module_param(irqreader, int, 0444); | 78 | "Time between CPU hotplugs (s), 0=disable"); |
79 | MODULE_PARM_DESC(irqreader, "Allow RCU readers from irq handlers"); | 79 | torture_param(int, shuffle_interval, 3, "Number of seconds between shuffles"); |
80 | static int n_barrier_cbs; | 80 | torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable."); |
81 | module_param(n_barrier_cbs, int, 0444); | 81 | torture_param(int, stall_cpu, 0, "Stall duration (s), zero to disable."); |
82 | MODULE_PARM_DESC(n_barrier_cbs, "# of callbacks/kthreads for barrier testing"); | 82 | torture_param(int, stall_cpu_holdoff, 10, |
83 | static int nfakewriters = 4; | 83 | "Time to wait before starting stall (s)."); |
84 | module_param(nfakewriters, int, 0444); | 84 | torture_param(int, stat_interval, 60, |
85 | MODULE_PARM_DESC(nfakewriters, "Number of RCU fake writer threads"); | 85 | "Number of seconds between stats printk()s"); |
86 | static int nreaders = -1; | 86 | torture_param(int, stutter, 5, "Number of seconds to run/halt test"); |
87 | module_param(nreaders, int, 0444); | 87 | torture_param(int, test_boost, 1, "Test RCU prio boost: 0=no, 1=maybe, 2=yes."); |
88 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); | 88 | torture_param(int, test_boost_duration, 4, |
89 | static int object_debug; | 89 | "Duration of each boost test, seconds."); |
90 | module_param(object_debug, int, 0444); | 90 | torture_param(int, test_boost_interval, 7, |
91 | MODULE_PARM_DESC(object_debug, "Enable debug-object double call_rcu() testing"); | 91 | "Interval between boost tests, seconds."); |
92 | static int onoff_holdoff; | 92 | torture_param(bool, test_no_idle_hz, true, |
93 | module_param(onoff_holdoff, int, 0444); | 93 | "Test support for tickless idle CPUs"); |
94 | MODULE_PARM_DESC(onoff_holdoff, "Time after boot before CPU hotplugs (s)"); | 94 | torture_param(bool, verbose, false, "Enable verbose debugging printk()s"); |
95 | static int onoff_interval; | 95 | |
96 | module_param(onoff_interval, int, 0444); | ||
97 | MODULE_PARM_DESC(onoff_interval, "Time between CPU hotplugs (s), 0=disable"); | ||
98 | static int shuffle_interval = 3; | ||
99 | module_param(shuffle_interval, int, 0444); | ||
100 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); | ||
101 | static int shutdown_secs; | ||
102 | module_param(shutdown_secs, int, 0444); | ||
103 | MODULE_PARM_DESC(shutdown_secs, "Shutdown time (s), <= zero to disable."); | ||
104 | static int stall_cpu; | ||
105 | module_param(stall_cpu, int, 0444); | ||
106 | MODULE_PARM_DESC(stall_cpu, "Stall duration (s), zero to disable."); | ||
107 | static int stall_cpu_holdoff = 10; | ||
108 | module_param(stall_cpu_holdoff, int, 0444); | ||
109 | MODULE_PARM_DESC(stall_cpu_holdoff, "Time to wait before starting stall (s)."); | ||
110 | static int stat_interval = 60; | ||
111 | module_param(stat_interval, int, 0644); | ||
112 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); | ||
113 | static int stutter = 5; | ||
114 | module_param(stutter, int, 0444); | ||
115 | MODULE_PARM_DESC(stutter, "Number of seconds to run/halt test"); | ||
116 | static int test_boost = 1; | ||
117 | module_param(test_boost, int, 0444); | ||
118 | MODULE_PARM_DESC(test_boost, "Test RCU prio boost: 0=no, 1=maybe, 2=yes."); | ||
119 | static int test_boost_duration = 4; | ||
120 | module_param(test_boost_duration, int, 0444); | ||
121 | MODULE_PARM_DESC(test_boost_duration, "Duration of each boost test, seconds."); | ||
122 | static int test_boost_interval = 7; | ||
123 | module_param(test_boost_interval, int, 0444); | ||
124 | MODULE_PARM_DESC(test_boost_interval, "Interval between boost tests, seconds."); | ||
125 | static bool test_no_idle_hz = true; | ||
126 | module_param(test_no_idle_hz, bool, 0444); | ||
127 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); | ||
128 | static char *torture_type = "rcu"; | 96 | static char *torture_type = "rcu"; |
129 | module_param(torture_type, charp, 0444); | 97 | module_param(torture_type, charp, 0444); |
130 | MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)"); | 98 | MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)"); |
131 | static bool verbose; | ||
132 | module_param(verbose, bool, 0444); | ||
133 | MODULE_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) \ |