* [PATCH 0/3] 2.6.17 rcutorture: add ops vector to test multiple RCUs
@ 2006-06-26 18:48 Paul E. McKenney
2006-06-26 18:52 ` [PATCH 1/3] rcutorture: catchup doc fixes for idle-hz tests Paul E. McKenney
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Paul E. McKenney @ 2006-06-26 18:48 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, matthltc, dipankar, arjan, ioe-lkml, greg, pbadari,
mrmacman_g4, hugh, vatsa
This series contains the following:
o Catch-up updates to the rcutorture documentation.
o Ops vector for rcutorture to allow it to test multiple RCU
implementations (e.g., both call_rcu() and call_rcu_bh()
currently in mainline).
o Add operations to allow the _bh variant of RCU to be tested.
Thanx, Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] rcutorture: catchup doc fixes for idle-hz tests
2006-06-26 18:48 [PATCH 0/3] 2.6.17 rcutorture: add ops vector to test multiple RCUs Paul E. McKenney
@ 2006-06-26 18:52 ` Paul E. McKenney
2006-06-26 18:55 ` [PATCH 2/3] rcutorture: add ops vector and Classic RCU ops Paul E. McKenney
2006-06-26 18:58 ` [PATCH 0/3] rcutorture: add call_rcu_bh() operations Paul E. McKenney
2 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2006-06-26 18:52 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, matthltc, dipankar, arjan, ioe-lkml, greg, pbadari,
mrmacman_g4, hugh, vatsa
This just catches the RCU torture documentation up with the recent
fixes that test RCU for architectures that turn of the scheduling-clock
interrupt for idle CPUs and the addition of a SUCCESS/FAILURE
indication, fixing up an obsolete comment as well.
Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
---
Documentation/RCU/torture.txt | 12 +++++++++++-
kernel/rcutorture.c | 2 +-
2 files changed, 12 insertions(+), 2 deletions(-)
diff -urpNa -X dontdiff linux-2.6.17/Documentation/RCU/torture.txt linux-2.6.17-torturedoc/Documentation/RCU/torture.txt
--- linux-2.6.17/Documentation/RCU/torture.txt 2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-torturedoc/Documentation/RCU/torture.txt 2006-06-24 11:34:36.000000000 -0700
@@ -35,6 +35,15 @@ stat_interval The number of seconds betw
be printed -only- when the module is unloaded, and this
is the default.
+shuffle_interval
+ The number of seconds to keep the test threads affinitied
+ to a particular subset of the CPUs. Used in conjunction
+ with test_no_idle_hz.
+
+test_no_idle_hz Whether or not to test the ability of RCU to operate in
+ a kernel that disables the scheduling-clock interrupt to
+ idle CPUs. Boolean parameter, "1" to test, "0" otherwise.
+
verbose Enable debug printk()s. Default is disabled.
@@ -119,4 +128,5 @@ The following script may be used to tort
The output can be manually inspected for the error flag of "!!!".
One could of course create a more elaborate script that automatically
-checked for such errors.
+checked for such errors. The "rmmod" command forces a "SUCCESS" or
+"FAILURE" indication to be printk()ed.
diff -urpNa -X dontdiff linux-2.6.17/kernel/rcutorture.c linux-2.6.17-torturedoc/kernel/rcutorture.c
--- linux-2.6.17/kernel/rcutorture.c 2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-torturedoc/kernel/rcutorture.c 2006-06-23 16:28:08.000000000 -0700
@@ -1,5 +1,5 @@
/*
- * Read-Copy Update /proc-based torture test facility
+ * Read-Copy Update module-based torture test facility
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] rcutorture: add ops vector and Classic RCU ops
2006-06-26 18:48 [PATCH 0/3] 2.6.17 rcutorture: add ops vector to test multiple RCUs Paul E. McKenney
2006-06-26 18:52 ` [PATCH 1/3] rcutorture: catchup doc fixes for idle-hz tests Paul E. McKenney
@ 2006-06-26 18:55 ` Paul E. McKenney
2006-06-26 18:58 ` [PATCH 0/3] rcutorture: add call_rcu_bh() operations Paul E. McKenney
2 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2006-06-26 18:55 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, matthltc, dipankar, arjan, ioe-lkml, greg, pbadari,
mrmacman_g4, hugh, vatsa
Add an ops vector to rcutorture, and add the ops for Classic RCU.
Update the rcutorture documentation to reflect slight change to the
dmesg formats.
Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
---
Documentation/RCU/torture.txt | 22 +++--
kernel/rcutorture.c | 163 ++++++++++++++++++++++++++++++------------
2 files changed, 133 insertions(+), 52 deletions(-)
diff -urpNa -X dontdiff linux-2.6.17-torturedoc/Documentation/RCU/torture.txt linux-2.6.17-tortureops/Documentation/RCU/torture.txt
--- linux-2.6.17-torturedoc/Documentation/RCU/torture.txt 2006-06-24 11:34:36.000000000 -0700
+++ linux-2.6.17-tortureops/Documentation/RCU/torture.txt 2006-06-23 18:20:15.000000000 -0700
@@ -7,7 +7,7 @@ The CONFIG_RCU_TORTURE_TEST config optio
implementations. It creates an rcutorture kernel module that can
be loaded to run a torture test. The test periodically outputs
status messages via printk(), which can be examined via the dmesg
-command (perhaps grepping for "rcutorture"). The test is started
+command (perhaps grepping for "torture"). The test is started
when the module is loaded, and stops when the module is unloaded.
However, actually setting this config option to "y" results in the system
@@ -44,6 +44,10 @@ test_no_idle_hz Whether or not to test t
a kernel that disables the scheduling-clock interrupt to
idle CPUs. Boolean parameter, "1" to test, "0" otherwise.
+torture_type The type of RCU to test: "rcu" for the rcu_read_lock()
+ API, "rcu_bh" for the rcu_read_lock_bh() API, and "srcu"
+ for the "srcu_read_lock()" API.
+
verbose Enable debug printk()s. Default is disabled.
@@ -51,14 +55,14 @@ OUTPUT
The statistics output is as follows:
- rcutorture: --- Start of test: nreaders=16 stat_interval=0 verbose=0
- rcutorture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915
- rcutorture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0
- rcutorture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0
- rcutorture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0
- rcutorture: --- End of test
+ rcu-torture: --- Start of test: nreaders=16 stat_interval=0 verbose=0
+ rcu-torture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915
+ rcu-torture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0
+ rcu-torture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0
+ rcu-torture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0
+ rcu-torture: --- End of test
-The command "dmesg | grep rcutorture:" will extract this information on
+The command "dmesg | grep torture:" will extract this information on
most systems. On more esoteric configurations, it may be necessary to
use other commands to access the output of the printk()s used by
the RCU torture test. The printk()s use KERN_ALERT, so they should
@@ -124,7 +128,7 @@ The following script may be used to tort
modprobe rcutorture
sleep 100
rmmod rcutorture
- dmesg | grep rcutorture:
+ dmesg | grep torture:
The output can be manually inspected for the error flag of "!!!".
One could of course create a more elaborate script that automatically
diff -urpNa -X dontdiff linux-2.6.17-torturedoc/kernel/rcutorture.c linux-2.6.17-tortureops/kernel/rcutorture.c
--- linux-2.6.17-torturedoc/kernel/rcutorture.c 2006-06-23 16:28:08.000000000 -0700
+++ linux-2.6.17-tortureops/kernel/rcutorture.c 2006-06-24 11:51:47.000000000 -0700
@@ -53,6 +53,7 @@ static int stat_interval; /* Interval be
static int verbose; /* Print more debug info. */
static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */
static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/
+static char *torture_type = "rcu"; /* What to torture. */
module_param(nreaders, int, 0);
MODULE_PARM_DESC(nreaders, "Number of RCU reader threads");
@@ -64,13 +65,16 @@ module_param(test_no_idle_hz, bool, 0);
MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs");
module_param(shuffle_interval, int, 0);
MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
-#define TORTURE_FLAG "rcutorture: "
+module_param(torture_type, charp, 0);
+MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu)");
+
+#define TORTURE_FLAG "-torture:"
#define PRINTK_STRING(s) \
- do { printk(KERN_ALERT TORTURE_FLAG s "\n"); } while (0)
+ do { printk(KERN_ALERT "%s" TORTURE_FLAG s "\n", torture_type); } while (0)
#define VERBOSE_PRINTK_STRING(s) \
- do { if (verbose) printk(KERN_ALERT TORTURE_FLAG s "\n"); } while (0)
+ do { if (verbose) printk(KERN_ALERT "%s" TORTURE_FLAG s "\n", torture_type); } while (0)
#define VERBOSE_PRINTK_ERRSTRING(s) \
- do { if (verbose) printk(KERN_ALERT TORTURE_FLAG "!!! " s "\n"); } while (0)
+ do { if (verbose) printk(KERN_ALERT "%s" TORTURE_FLAG "!!! " s "\n", torture_type); } while (0)
static char printk_buf[4096];
@@ -139,28 +143,6 @@ rcu_torture_free(struct rcu_torture *p)
spin_unlock_bh(&rcu_torture_lock);
}
-static void
-rcu_torture_cb(struct rcu_head *p)
-{
- int i;
- struct rcu_torture *rp = container_of(p, struct rcu_torture, rtort_rcu);
-
- if (fullstop) {
- /* Test is ending, just drop callbacks on the floor. */
- /* The next initialization will pick up the pieces. */
- return;
- }
- i = rp->rtort_pipe_count;
- if (i > RCU_TORTURE_PIPE_LEN)
- i = RCU_TORTURE_PIPE_LEN;
- atomic_inc(&rcu_torture_wcount[i]);
- if (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {
- rp->rtort_mbtest = 0;
- rcu_torture_free(rp);
- } else
- call_rcu(p, rcu_torture_cb);
-}
-
struct rcu_random_state {
unsigned long rrs_state;
unsigned long rrs_count;
@@ -191,6 +173,83 @@ rcu_random(struct rcu_random_state *rrsp
}
/*
+ * Operations vector for selecting different types of tests.
+ */
+
+struct rcu_torture_ops {
+ void (*init)(void);
+ void (*cleanup)(void);
+ int (*readlock)(void);
+ void (*readunlock)(int idx);
+ int (*completed)(void);
+ void (*deferredfree)(struct rcu_torture *p);
+ int (*stats)(char *page);
+ char *name;
+};
+static struct rcu_torture_ops *cur_ops = NULL;
+
+/*
+ * Definitions for rcu torture testing.
+ */
+
+static int rcu_torture_read_lock(void)
+{
+ rcu_read_lock();
+ return 0;
+}
+
+static void rcu_torture_read_unlock(int idx)
+{
+ rcu_read_unlock();
+}
+
+static int rcu_torture_completed(void)
+{
+ return rcu_batches_completed();
+}
+
+static void
+rcu_torture_cb(struct rcu_head *p)
+{
+ int i;
+ struct rcu_torture *rp = container_of(p, struct rcu_torture, rtort_rcu);
+
+ if (fullstop) {
+ /* Test is ending, just drop callbacks on the floor. */
+ /* The next initialization will pick up the pieces. */
+ return;
+ }
+ i = rp->rtort_pipe_count;
+ if (i > RCU_TORTURE_PIPE_LEN)
+ i = RCU_TORTURE_PIPE_LEN;
+ atomic_inc(&rcu_torture_wcount[i]);
+ if (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {
+ rp->rtort_mbtest = 0;
+ rcu_torture_free(rp);
+ } else
+ cur_ops->deferredfree(rp);
+}
+
+static void rcu_torture_deferred_free(struct rcu_torture *p)
+{
+ call_rcu(&p->rtort_rcu, rcu_torture_cb);
+}
+
+static struct rcu_torture_ops rcu_ops = {
+ .init = NULL,
+ .cleanup = NULL,
+ .readlock = rcu_torture_read_lock,
+ .readunlock = rcu_torture_read_unlock,
+ .completed = rcu_torture_completed,
+ .deferredfree = rcu_torture_deferred_free,
+ .stats = NULL,
+ .name = "rcu"
+};
+
+static struct rcu_torture_ops *torture_ops[] =
+ { &rcu_ops, NULL };
+
+/*
* RCU torture writer kthread. Repeatedly substitutes a new structure
* for that pointed to by rcu_torture_current, freeing the old structure
* after a series of grace periods (the "pipeline").
@@ -209,8 +268,6 @@ rcu_torture_writer(void *arg)
do {
schedule_timeout_uninterruptible(1);
- if (rcu_batches_completed() == oldbatch)
- continue;
if ((rp = rcu_torture_alloc()) == NULL)
continue;
rp->rtort_pipe_count = 0;
@@ -225,10 +282,10 @@ rcu_torture_writer(void *arg)
i = RCU_TORTURE_PIPE_LEN;
atomic_inc(&rcu_torture_wcount[i]);
old_rp->rtort_pipe_count++;
- call_rcu(&old_rp->rtort_rcu, rcu_torture_cb);
+ cur_ops->deferredfree(old_rp);
}
rcu_torture_current_version++;
- oldbatch = rcu_batches_completed();
+ oldbatch = cur_ops->completed();
} while (!kthread_should_stop() && !fullstop);
VERBOSE_PRINTK_STRING("rcu_torture_writer task stopping");
while (!kthread_should_stop())
@@ -246,6 +303,7 @@ static int
rcu_torture_reader(void *arg)
{
int completed;
+ int idx;
DEFINE_RCU_RANDOM(rand);
struct rcu_torture *p;
int pipe_count;
@@ -254,12 +312,12 @@ rcu_torture_reader(void *arg)
set_user_nice(current, 19);
do {
- rcu_read_lock();
- completed = rcu_batches_completed();
+ idx = cur_ops->readlock();
+ completed = cur_ops->completed();
p = rcu_dereference(rcu_torture_current);
if (p == NULL) {
/* Wait for rcu_torture_writer to get underway */
- rcu_read_unlock();
+ cur_ops->readunlock(idx);
schedule_timeout_interruptible(HZ);
continue;
}
@@ -273,14 +331,14 @@ rcu_torture_reader(void *arg)
pipe_count = RCU_TORTURE_PIPE_LEN;
}
++__get_cpu_var(rcu_torture_count)[pipe_count];
- completed = rcu_batches_completed() - completed;
+ completed = cur_ops->completed() - completed;
if (completed > RCU_TORTURE_PIPE_LEN) {
/* Should not happen, but... */
completed = RCU_TORTURE_PIPE_LEN;
}
++__get_cpu_var(rcu_torture_batch)[completed];
preempt_enable();
- rcu_read_unlock();
+ cur_ops->readunlock(idx);
schedule();
} while (!kthread_should_stop() && !fullstop);
VERBOSE_PRINTK_STRING("rcu_torture_reader task stopping");
@@ -311,7 +369,7 @@ rcu_torture_printk(char *page)
if (pipesummary[i] != 0)
break;
}
- cnt += sprintf(&page[cnt], "rcutorture: ");
+ cnt += sprintf(&page[cnt], "%s%s ", torture_type, TORTURE_FLAG);
cnt += sprintf(&page[cnt],
"rtc: %p ver: %ld tfle: %d rta: %d rtaf: %d rtf: %d "
"rtmbe: %d",
@@ -324,7 +382,7 @@ rcu_torture_printk(char *page)
atomic_read(&n_rcu_torture_mberror));
if (atomic_read(&n_rcu_torture_mberror) != 0)
cnt += sprintf(&page[cnt], " !!!");
- cnt += sprintf(&page[cnt], "\nrcutorture: ");
+ cnt += sprintf(&page[cnt], "\n%s%s ", torture_type, TORTURE_FLAG);
if (i > 1) {
cnt += sprintf(&page[cnt], "!!! ");
atomic_inc(&n_rcu_torture_error);
@@ -332,17 +390,19 @@ rcu_torture_printk(char *page)
cnt += sprintf(&page[cnt], "Reader Pipe: ");
for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)
cnt += sprintf(&page[cnt], " %ld", pipesummary[i]);
- cnt += sprintf(&page[cnt], "\nrcutorture: ");
+ cnt += sprintf(&page[cnt], "\n%s%s ", torture_type, TORTURE_FLAG);
cnt += sprintf(&page[cnt], "Reader Batch: ");
- for (i = 0; i < RCU_TORTURE_PIPE_LEN; i++)
+ for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)
cnt += sprintf(&page[cnt], " %ld", batchsummary[i]);
- cnt += sprintf(&page[cnt], "\nrcutorture: ");
+ cnt += sprintf(&page[cnt], "\n%s%s ", torture_type, TORTURE_FLAG);
cnt += sprintf(&page[cnt], "Free-Block Circulation: ");
for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {
cnt += sprintf(&page[cnt], " %d",
atomic_read(&rcu_torture_wcount[i]));
}
cnt += sprintf(&page[cnt], "\n");
+ if (cur_ops->stats != NULL)
+ cnt += cur_ops->stats(&page[cnt]);
return cnt;
}
@@ -444,11 +504,11 @@ rcu_torture_shuffle(void *arg)
static inline void
rcu_torture_print_module_parms(char *tag)
{
- printk(KERN_ALERT TORTURE_FLAG "--- %s: nreaders=%d "
+ printk(KERN_ALERT "%s" TORTURE_FLAG "--- %s: nreaders=%d "
"stat_interval=%d verbose=%d test_no_idle_hz=%d "
"shuffle_interval = %d\n",
- tag, nrealreaders, stat_interval, verbose, test_no_idle_hz,
- shuffle_interval);
+ torture_type, tag, nrealreaders, stat_interval, verbose,
+ test_no_idle_hz, shuffle_interval);
}
static void
@@ -493,6 +553,9 @@ rcu_torture_cleanup(void)
rcu_barrier();
rcu_torture_stats_print(); /* -After- the stats thread is stopped! */
+
+ if (cur_ops->cleanup != NULL)
+ cur_ops->cleanup();
if (atomic_read(&n_rcu_torture_error))
rcu_torture_print_module_parms("End of test: FAILURE");
else
@@ -508,6 +571,20 @@ rcu_torture_init(void)
/* Process args and tell the world that the torturer is on the job. */
+ for (i = 0; cur_ops = torture_ops[i], cur_ops != NULL; i++) {
+ cur_ops = torture_ops[i];
+ if (strcmp(torture_type, cur_ops->name) == 0) {
+ break;
+ }
+ }
+ if (cur_ops == NULL) {
+ printk(KERN_ALERT "rcutorture: invalid torture type: \"%s\"\n",
+ torture_type);
+ return (-EINVAL);
+ }
+ if (cur_ops->init != NULL)
+ cur_ops->init(); /* no "goto unwind" prior to this point!!! */
+
if (nreaders >= 0)
nrealreaders = nreaders;
else
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/3] rcutorture: add call_rcu_bh() operations
2006-06-26 18:48 [PATCH 0/3] 2.6.17 rcutorture: add ops vector to test multiple RCUs Paul E. McKenney
2006-06-26 18:52 ` [PATCH 1/3] rcutorture: catchup doc fixes for idle-hz tests Paul E. McKenney
2006-06-26 18:55 ` [PATCH 2/3] rcutorture: add ops vector and Classic RCU ops Paul E. McKenney
@ 2006-06-26 18:58 ` Paul E. McKenney
2006-06-26 19:17 ` Paul E. McKenney
2 siblings, 1 reply; 5+ messages in thread
From: Paul E. McKenney @ 2006-06-26 18:58 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, matthltc, dipankar, arjan, ioe-lkml, greg, pbadari,
mrmacman_g4, hugh, vatsa
Add operations for the call_rcu_bh() variant of RCU. Also add an
rcu_batches_completed_bh() function, which is needed by rcutorture.
Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
---
include/linux/rcupdate.h | 1 +
kernel/rcupdate.c | 10 ++++++++++
kernel/rcutorture.c | 40 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 49 insertions(+), 2 deletions(-)
diff -urpNa -X dontdiff linux-2.6.17-tortureops/include/linux/rcupdate.h linux-2.6.17-torturercu_bh/include/linux/rcupdate.h
--- linux-2.6.17-tortureops/include/linux/rcupdate.h 2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-torturercu_bh/include/linux/rcupdate.h 2006-06-23 22:45:12.000000000 -0700
@@ -258,6 +258,7 @@ extern void rcu_init(void);
extern void rcu_check_callbacks(int cpu, int user);
extern void rcu_restart_cpu(int cpu);
extern long rcu_batches_completed(void);
+extern long rcu_batches_completed_bh(void);
/* Exported interfaces */
extern void FASTCALL(call_rcu(struct rcu_head *head,
diff -urpNa -X dontdiff linux-2.6.17-tortureops/kernel/rcupdate.c linux-2.6.17-torturercu_bh/kernel/rcupdate.c
--- linux-2.6.17-tortureops/kernel/rcupdate.c 2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-torturercu_bh/kernel/rcupdate.c 2006-06-23 22:40:09.000000000 -0700
@@ -182,6 +182,15 @@ long rcu_batches_completed(void)
return rcu_ctrlblk.completed;
}
+/*
+ * Return the number of RCU batches processed thus far. Useful
+ * for debug and statistics.
+ */
+long rcu_batches_completed_bh(void)
+{
+ return rcu_bh_ctrlblk.completed;
+}
+
static void rcu_barrier_callback(struct rcu_head *notused)
{
if (atomic_dec_and_test(&rcu_barrier_cpu_count))
@@ -627,6 +636,7 @@ module_param(qlowmark, int, 0);
module_param(rsinterval, int, 0);
#endif
EXPORT_SYMBOL_GPL(rcu_batches_completed);
+EXPORT_SYMBOL_GPL(rcu_batches_completed_bh);
EXPORT_SYMBOL_GPL_FUTURE(call_rcu); /* WARNING: GPL-only in April 2006. */
EXPORT_SYMBOL_GPL_FUTURE(call_rcu_bh); /* WARNING: GPL-only in April 2006. */
EXPORT_SYMBOL_GPL(synchronize_rcu);
diff -urpNa -X dontdiff linux-2.6.17-tortureops/kernel/rcutorture.c linux-2.6.17-torturercu_bh/kernel/rcutorture.c
--- linux-2.6.17-tortureops/kernel/rcutorture.c 2006-06-24 11:51:47.000000000 -0700
+++ linux-2.6.17-torturercu_bh/kernel/rcutorture.c 2006-06-24 11:52:08.000000000 -0700
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(test_no_idle_hz, "Test
module_param(shuffle_interval, int, 0);
MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
module_param(torture_type, charp, 0);
-MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu)");
+MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh)");
#define TORTURE_FLAG "-torture:"
#define PRINTK_STRING(s) \
@@ -246,8 +246,44 @@ static struct rcu_torture_ops rcu_ops =
.name = "rcu"
};
+/*
+ * Definitions for rcu_bh torture testing.
+ */
+
+static int rcu_bh_torture_read_lock(void)
+{
+ rcu_read_lock_bh();
+ return 0;
+}
+
+static void rcu_bh_torture_read_unlock(int idx)
+{
+ rcu_read_unlock_bh();
+}
+
+static int rcu_bh_torture_completed(void)
+{
+ return rcu_batches_completed_bh();
+}
+
+static void rcu_bh_torture_deferred_free(struct rcu_torture *p)
+{
+ call_rcu_bh(&p->rtort_rcu, rcu_torture_cb);
+}
+
+static struct rcu_torture_ops rcu_bh_ops = {
+ .init = NULL,
+ .cleanup = NULL,
+ .readlock = rcu_bh_torture_read_lock,
+ .readunlock = rcu_bh_torture_read_unlock,
+ .completed = rcu_bh_torture_completed,
+ .deferredfree = rcu_bh_torture_deferred_free,
+ .stats = NULL,
+ .name = "rcu_bh"
+};
+
static struct rcu_torture_ops *torture_ops[] =
- { &rcu_ops, NULL };
+ { &rcu_ops, &rcu_bh_ops, NULL };
/*
* RCU torture writer kthread. Repeatedly substitutes a new structure
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] rcutorture: add call_rcu_bh() operations
2006-06-26 18:58 ` [PATCH 0/3] rcutorture: add call_rcu_bh() operations Paul E. McKenney
@ 2006-06-26 19:17 ` Paul E. McKenney
0 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2006-06-26 19:17 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, matthltc, dipankar, arjan, ioe-lkml, greg, pbadari,
mrmacman_g4, hugh, vatsa
And that subject line should of course be:
[PATCH 3/3] rcutorture: add call_rcu_bh() operations
I guess I need to start using quilt or something... :-/
Thanx, Paul
On Mon, Jun 26, 2006 at 11:58:12AM -0700, Paul E. McKenney wrote:
> Add operations for the call_rcu_bh() variant of RCU. Also add an
> rcu_batches_completed_bh() function, which is needed by rcutorture.
>
> Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
> ---
>
> include/linux/rcupdate.h | 1 +
> kernel/rcupdate.c | 10 ++++++++++
> kernel/rcutorture.c | 40 ++++++++++++++++++++++++++++++++++++++--
> 3 files changed, 49 insertions(+), 2 deletions(-)
>
> diff -urpNa -X dontdiff linux-2.6.17-tortureops/include/linux/rcupdate.h linux-2.6.17-torturercu_bh/include/linux/rcupdate.h
> --- linux-2.6.17-tortureops/include/linux/rcupdate.h 2006-06-17 18:49:35.000000000 -0700
> +++ linux-2.6.17-torturercu_bh/include/linux/rcupdate.h 2006-06-23 22:45:12.000000000 -0700
> @@ -258,6 +258,7 @@ extern void rcu_init(void);
> extern void rcu_check_callbacks(int cpu, int user);
> extern void rcu_restart_cpu(int cpu);
> extern long rcu_batches_completed(void);
> +extern long rcu_batches_completed_bh(void);
>
> /* Exported interfaces */
> extern void FASTCALL(call_rcu(struct rcu_head *head,
> diff -urpNa -X dontdiff linux-2.6.17-tortureops/kernel/rcupdate.c linux-2.6.17-torturercu_bh/kernel/rcupdate.c
> --- linux-2.6.17-tortureops/kernel/rcupdate.c 2006-06-17 18:49:35.000000000 -0700
> +++ linux-2.6.17-torturercu_bh/kernel/rcupdate.c 2006-06-23 22:40:09.000000000 -0700
> @@ -182,6 +182,15 @@ long rcu_batches_completed(void)
> return rcu_ctrlblk.completed;
> }
>
> +/*
> + * Return the number of RCU batches processed thus far. Useful
> + * for debug and statistics.
> + */
> +long rcu_batches_completed_bh(void)
> +{
> + return rcu_bh_ctrlblk.completed;
> +}
> +
> static void rcu_barrier_callback(struct rcu_head *notused)
> {
> if (atomic_dec_and_test(&rcu_barrier_cpu_count))
> @@ -627,6 +636,7 @@ module_param(qlowmark, int, 0);
> module_param(rsinterval, int, 0);
> #endif
> EXPORT_SYMBOL_GPL(rcu_batches_completed);
> +EXPORT_SYMBOL_GPL(rcu_batches_completed_bh);
> EXPORT_SYMBOL_GPL_FUTURE(call_rcu); /* WARNING: GPL-only in April 2006. */
> EXPORT_SYMBOL_GPL_FUTURE(call_rcu_bh); /* WARNING: GPL-only in April 2006. */
> EXPORT_SYMBOL_GPL(synchronize_rcu);
> diff -urpNa -X dontdiff linux-2.6.17-tortureops/kernel/rcutorture.c linux-2.6.17-torturercu_bh/kernel/rcutorture.c
> --- linux-2.6.17-tortureops/kernel/rcutorture.c 2006-06-24 11:51:47.000000000 -0700
> +++ linux-2.6.17-torturercu_bh/kernel/rcutorture.c 2006-06-24 11:52:08.000000000 -0700
> @@ -66,7 +66,7 @@ MODULE_PARM_DESC(test_no_idle_hz, "Test
> module_param(shuffle_interval, int, 0);
> MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
> module_param(torture_type, charp, 0);
> -MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu)");
> +MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh)");
>
> #define TORTURE_FLAG "-torture:"
> #define PRINTK_STRING(s) \
> @@ -246,8 +246,44 @@ static struct rcu_torture_ops rcu_ops =
> .name = "rcu"
> };
>
> +/*
> + * Definitions for rcu_bh torture testing.
> + */
> +
> +static int rcu_bh_torture_read_lock(void)
> +{
> + rcu_read_lock_bh();
> + return 0;
> +}
> +
> +static void rcu_bh_torture_read_unlock(int idx)
> +{
> + rcu_read_unlock_bh();
> +}
> +
> +static int rcu_bh_torture_completed(void)
> +{
> + return rcu_batches_completed_bh();
> +}
> +
> +static void rcu_bh_torture_deferred_free(struct rcu_torture *p)
> +{
> + call_rcu_bh(&p->rtort_rcu, rcu_torture_cb);
> +}
> +
> +static struct rcu_torture_ops rcu_bh_ops = {
> + .init = NULL,
> + .cleanup = NULL,
> + .readlock = rcu_bh_torture_read_lock,
> + .readunlock = rcu_bh_torture_read_unlock,
> + .completed = rcu_bh_torture_completed,
> + .deferredfree = rcu_bh_torture_deferred_free,
> + .stats = NULL,
> + .name = "rcu_bh"
> +};
> +
> static struct rcu_torture_ops *torture_ops[] =
> - { &rcu_ops, NULL };
> + { &rcu_ops, &rcu_bh_ops, NULL };
>
> /*
> * RCU torture writer kthread. Repeatedly substitutes a new structure
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-06-26 19:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-26 18:48 [PATCH 0/3] 2.6.17 rcutorture: add ops vector to test multiple RCUs Paul E. McKenney
2006-06-26 18:52 ` [PATCH 1/3] rcutorture: catchup doc fixes for idle-hz tests Paul E. McKenney
2006-06-26 18:55 ` [PATCH 2/3] rcutorture: add ops vector and Classic RCU ops Paul E. McKenney
2006-06-26 18:58 ` [PATCH 0/3] rcutorture: add call_rcu_bh() operations Paul E. McKenney
2006-06-26 19:17 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox