Commit 9e250225 authored by Paul E. McKenney's avatar Paul E. McKenney

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: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent daeda23d
...@@ -35,13 +35,18 @@ ...@@ -35,13 +35,18 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/compiler.h> #include <linux/compiler.h>
/* Definitions for a non-string torture-test module parameter. */
#define torture_param(type, name, init, msg) \
static type name = init; \
module_param(name, type, 0444); \
MODULE_PARM_DESC(name, msg);
/* Low-rider random number generator. */
struct torture_random_state { struct torture_random_state {
unsigned long trs_state; unsigned long trs_state;
long trs_count; long trs_count;
}; };
#define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 } #define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 }
unsigned long torture_random(struct torture_random_state *trsp); unsigned long torture_random(struct torture_random_state *trsp);
#endif /* __LINUX_TORTURE_H */ #endif /* __LINUX_TORTURE_H */
...@@ -59,78 +59,43 @@ MODULE_ALIAS("rcutorture"); ...@@ -59,78 +59,43 @@ MODULE_ALIAS("rcutorture");
#endif #endif
#define MODULE_PARAM_PREFIX "rcutorture." #define MODULE_PARAM_PREFIX "rcutorture."
static int fqs_duration; torture_param(int, fqs_duration, 0,
module_param(fqs_duration, int, 0444); "Duration of fqs bursts (us), 0 to disable");
MODULE_PARM_DESC(fqs_duration, "Duration of fqs bursts (us), 0 to disable"); torture_param(int, fqs_holdoff, 0, "Holdoff time within fqs bursts (us)");
static int fqs_holdoff; torture_param(int, fqs_stutter, 3, "Wait time between fqs bursts (s)");
module_param(fqs_holdoff, int, 0444); torture_param(bool, gp_exp, false, "Use expedited GP wait primitives");
MODULE_PARM_DESC(fqs_holdoff, "Holdoff time within fqs bursts (us)"); torture_param(bool, gp_normal, false,
static int fqs_stutter = 3; "Use normal (non-expedited) GP wait primitives");
module_param(fqs_stutter, int, 0444); torture_param(int, irqreader, 1, "Allow RCU readers from irq handlers");
MODULE_PARM_DESC(fqs_stutter, "Wait time between fqs bursts (s)"); torture_param(int, n_barrier_cbs, 0,
static bool gp_exp; "# of callbacks/kthreads for barrier testing");
module_param(gp_exp, bool, 0444); torture_param(int, nfakewriters, 4, "Number of RCU fake writer threads");
MODULE_PARM_DESC(gp_exp, "Use expedited GP wait primitives"); torture_param(int, nreaders, -1, "Number of RCU reader threads");
static bool gp_normal; torture_param(int, object_debug, 0,
module_param(gp_normal, bool, 0444); "Enable debug-object double call_rcu() testing");
MODULE_PARM_DESC(gp_normal, "Use normal (non-expedited) GP wait primitives"); torture_param(int, onoff_holdoff, 0, "Time after boot before CPU hotplugs (s)");
static int irqreader = 1; torture_param(int, onoff_interval, 0,
module_param(irqreader, int, 0444); "Time between CPU hotplugs (s), 0=disable");
MODULE_PARM_DESC(irqreader, "Allow RCU readers from irq handlers"); torture_param(int, shuffle_interval, 3, "Number of seconds between shuffles");
static int n_barrier_cbs; torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable.");
module_param(n_barrier_cbs, int, 0444); torture_param(int, stall_cpu, 0, "Stall duration (s), zero to disable.");
MODULE_PARM_DESC(n_barrier_cbs, "# of callbacks/kthreads for barrier testing"); torture_param(int, stall_cpu_holdoff, 10,
static int nfakewriters = 4; "Time to wait before starting stall (s).");
module_param(nfakewriters, int, 0444); torture_param(int, stat_interval, 60,
MODULE_PARM_DESC(nfakewriters, "Number of RCU fake writer threads"); "Number of seconds between stats printk()s");
static int nreaders = -1; torture_param(int, stutter, 5, "Number of seconds to run/halt test");
module_param(nreaders, int, 0444); torture_param(int, test_boost, 1, "Test RCU prio boost: 0=no, 1=maybe, 2=yes.");
MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); torture_param(int, test_boost_duration, 4,
static int object_debug; "Duration of each boost test, seconds.");
module_param(object_debug, int, 0444); torture_param(int, test_boost_interval, 7,
MODULE_PARM_DESC(object_debug, "Enable debug-object double call_rcu() testing"); "Interval between boost tests, seconds.");
static int onoff_holdoff; torture_param(bool, test_no_idle_hz, true,
module_param(onoff_holdoff, int, 0444); "Test support for tickless idle CPUs");
MODULE_PARM_DESC(onoff_holdoff, "Time after boot before CPU hotplugs (s)"); torture_param(bool, verbose, false, "Enable verbose debugging printk()s");
static int onoff_interval;
module_param(onoff_interval, int, 0444);
MODULE_PARM_DESC(onoff_interval, "Time between CPU hotplugs (s), 0=disable");
static int shuffle_interval = 3;
module_param(shuffle_interval, int, 0444);
MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
static int shutdown_secs;
module_param(shutdown_secs, int, 0444);
MODULE_PARM_DESC(shutdown_secs, "Shutdown time (s), <= zero to disable.");
static int stall_cpu;
module_param(stall_cpu, int, 0444);
MODULE_PARM_DESC(stall_cpu, "Stall duration (s), zero to disable.");
static int stall_cpu_holdoff = 10;
module_param(stall_cpu_holdoff, int, 0444);
MODULE_PARM_DESC(stall_cpu_holdoff, "Time to wait before starting stall (s).");
static int stat_interval = 60;
module_param(stat_interval, int, 0644);
MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s");
static int stutter = 5;
module_param(stutter, int, 0444);
MODULE_PARM_DESC(stutter, "Number of seconds to run/halt test");
static int test_boost = 1;
module_param(test_boost, int, 0444);
MODULE_PARM_DESC(test_boost, "Test RCU prio boost: 0=no, 1=maybe, 2=yes.");
static int test_boost_duration = 4;
module_param(test_boost_duration, int, 0444);
MODULE_PARM_DESC(test_boost_duration, "Duration of each boost test, seconds.");
static int test_boost_interval = 7;
module_param(test_boost_interval, int, 0444);
MODULE_PARM_DESC(test_boost_interval, "Interval between boost tests, seconds.");
static bool test_no_idle_hz = true;
module_param(test_no_idle_hz, bool, 0444);
MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs");
static char *torture_type = "rcu"; static char *torture_type = "rcu";
module_param(torture_type, charp, 0444); module_param(torture_type, charp, 0444);
MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)"); MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, ...)");
static bool verbose;
module_param(verbose, bool, 0444);
MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s");
#define TORTURE_FLAG "-torture:" #define TORTURE_FLAG "-torture:"
#define PRINTK_STRING(s) \ #define PRINTK_STRING(s) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment