Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 1 | /* |
Paul E. McKenney | 29766f1 | 2006-06-27 02:54:02 -0700 | [diff] [blame] | 2 | * Read-Copy Update module-based torture test facility |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | * |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 18 | * Copyright (C) IBM Corporation, 2005, 2006 |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 19 | * |
| 20 | * Authors: Paul E. McKenney <paulmck@us.ibm.com> |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 21 | * Josh Triplett <josh@freedesktop.org> |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 22 | * |
| 23 | * See also: Documentation/RCU/torture.txt |
| 24 | */ |
| 25 | #include <linux/types.h> |
| 26 | #include <linux/kernel.h> |
| 27 | #include <linux/init.h> |
| 28 | #include <linux/module.h> |
| 29 | #include <linux/kthread.h> |
| 30 | #include <linux/err.h> |
| 31 | #include <linux/spinlock.h> |
| 32 | #include <linux/smp.h> |
| 33 | #include <linux/rcupdate.h> |
| 34 | #include <linux/interrupt.h> |
| 35 | #include <linux/sched.h> |
| 36 | #include <asm/atomic.h> |
| 37 | #include <linux/bitops.h> |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 38 | #include <linux/completion.h> |
| 39 | #include <linux/moduleparam.h> |
| 40 | #include <linux/percpu.h> |
| 41 | #include <linux/notifier.h> |
Rafael J. Wysocki | 8314418 | 2007-07-17 04:03:35 -0700 | [diff] [blame] | 42 | #include <linux/freezer.h> |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 43 | #include <linux/cpu.h> |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 44 | #include <linux/delay.h> |
| 45 | #include <linux/byteorder/swabb.h> |
| 46 | #include <linux/stat.h> |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 47 | #include <linux/srcu.h> |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 48 | |
| 49 | MODULE_LICENSE("GPL"); |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 50 | MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com> and " |
| 51 | "Josh Triplett <josh@freedesktop.org>"); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 52 | |
Josh Triplett | 4802211 | 2006-10-03 23:26:16 +0200 | [diff] [blame] | 53 | static int nreaders = -1; /* # reader threads, defaults to 2*ncpus */ |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 54 | static int nfakewriters = 4; /* # fake writer threads */ |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 55 | static int stat_interval; /* Interval between stats, in seconds. */ |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 56 | /* Defaults to "only at end of test". */ |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 57 | static int verbose; /* Print more debug info. */ |
| 58 | static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ |
| 59 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ |
Josh Triplett | 20d2e42 | 2006-10-04 02:17:15 -0700 | [diff] [blame] | 60 | static char *torture_type = "rcu"; /* What RCU implementation to torture. */ |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 61 | |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 62 | module_param(nreaders, int, 0444); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 63 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 64 | module_param(nfakewriters, int, 0444); |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 65 | MODULE_PARM_DESC(nfakewriters, "Number of RCU fake writer threads"); |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 66 | module_param(stat_interval, int, 0444); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 67 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 68 | module_param(verbose, bool, 0444); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 69 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 70 | module_param(test_no_idle_hz, bool, 0444); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 71 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 72 | module_param(shuffle_interval, int, 0444); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 73 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); |
Josh Triplett | d6ad671 | 2007-03-06 01:42:13 -0800 | [diff] [blame] | 74 | module_param(torture_type, charp, 0444); |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 75 | MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, srcu)"); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 76 | |
| 77 | #define TORTURE_FLAG "-torture:" |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 78 | #define PRINTK_STRING(s) \ |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 79 | do { printk(KERN_ALERT "%s" TORTURE_FLAG s "\n", torture_type); } while (0) |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 80 | #define VERBOSE_PRINTK_STRING(s) \ |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 81 | do { if (verbose) printk(KERN_ALERT "%s" TORTURE_FLAG s "\n", torture_type); } while (0) |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 82 | #define VERBOSE_PRINTK_ERRSTRING(s) \ |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 83 | do { if (verbose) printk(KERN_ALERT "%s" TORTURE_FLAG "!!! " s "\n", torture_type); } while (0) |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 84 | |
| 85 | static char printk_buf[4096]; |
| 86 | |
| 87 | static int nrealreaders; |
| 88 | static struct task_struct *writer_task; |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 89 | static struct task_struct **fakewriter_tasks; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 90 | static struct task_struct **reader_tasks; |
| 91 | static struct task_struct *stats_task; |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 92 | static struct task_struct *shuffler_task; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 93 | |
| 94 | #define RCU_TORTURE_PIPE_LEN 10 |
| 95 | |
| 96 | struct rcu_torture { |
| 97 | struct rcu_head rtort_rcu; |
| 98 | int rtort_pipe_count; |
| 99 | struct list_head rtort_free; |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 100 | int rtort_mbtest; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | static int fullstop = 0; /* stop generating callbacks at test end. */ |
| 104 | static LIST_HEAD(rcu_torture_freelist); |
| 105 | static struct rcu_torture *rcu_torture_current = NULL; |
| 106 | static long rcu_torture_current_version = 0; |
| 107 | static struct rcu_torture rcu_tortures[10 * RCU_TORTURE_PIPE_LEN]; |
| 108 | static DEFINE_SPINLOCK(rcu_torture_lock); |
| 109 | static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_count) = |
| 110 | { 0 }; |
| 111 | static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_batch) = |
| 112 | { 0 }; |
| 113 | static atomic_t rcu_torture_wcount[RCU_TORTURE_PIPE_LEN + 1]; |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 114 | static atomic_t n_rcu_torture_alloc; |
| 115 | static atomic_t n_rcu_torture_alloc_fail; |
| 116 | static atomic_t n_rcu_torture_free; |
| 117 | static atomic_t n_rcu_torture_mberror; |
| 118 | static atomic_t n_rcu_torture_error; |
Josh Triplett | e303373 | 2006-10-04 02:17:14 -0700 | [diff] [blame] | 119 | static struct list_head rcu_torture_removed; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 120 | |
| 121 | /* |
| 122 | * Allocate an element from the rcu_tortures pool. |
| 123 | */ |
Adrian Bunk | 97a41e2 | 2006-01-08 01:02:17 -0800 | [diff] [blame] | 124 | static struct rcu_torture * |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 125 | rcu_torture_alloc(void) |
| 126 | { |
| 127 | struct list_head *p; |
| 128 | |
Ingo Molnar | adac166 | 2006-01-25 19:50:12 +0100 | [diff] [blame] | 129 | spin_lock_bh(&rcu_torture_lock); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 130 | if (list_empty(&rcu_torture_freelist)) { |
| 131 | atomic_inc(&n_rcu_torture_alloc_fail); |
Ingo Molnar | adac166 | 2006-01-25 19:50:12 +0100 | [diff] [blame] | 132 | spin_unlock_bh(&rcu_torture_lock); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 133 | return NULL; |
| 134 | } |
| 135 | atomic_inc(&n_rcu_torture_alloc); |
| 136 | p = rcu_torture_freelist.next; |
| 137 | list_del_init(p); |
Ingo Molnar | adac166 | 2006-01-25 19:50:12 +0100 | [diff] [blame] | 138 | spin_unlock_bh(&rcu_torture_lock); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 139 | return container_of(p, struct rcu_torture, rtort_free); |
| 140 | } |
| 141 | |
| 142 | /* |
| 143 | * Free an element to the rcu_tortures pool. |
| 144 | */ |
| 145 | static void |
| 146 | rcu_torture_free(struct rcu_torture *p) |
| 147 | { |
| 148 | atomic_inc(&n_rcu_torture_free); |
Ingo Molnar | adac166 | 2006-01-25 19:50:12 +0100 | [diff] [blame] | 149 | spin_lock_bh(&rcu_torture_lock); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 150 | list_add_tail(&p->rtort_free, &rcu_torture_freelist); |
Ingo Molnar | adac166 | 2006-01-25 19:50:12 +0100 | [diff] [blame] | 151 | spin_unlock_bh(&rcu_torture_lock); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 152 | } |
| 153 | |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 154 | struct rcu_random_state { |
| 155 | unsigned long rrs_state; |
Josh Triplett | 75cfef3 | 2006-10-04 02:17:12 -0700 | [diff] [blame] | 156 | long rrs_count; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 157 | }; |
| 158 | |
| 159 | #define RCU_RANDOM_MULT 39916801 /* prime */ |
| 160 | #define RCU_RANDOM_ADD 479001701 /* prime */ |
| 161 | #define RCU_RANDOM_REFRESH 10000 |
| 162 | |
| 163 | #define DEFINE_RCU_RANDOM(name) struct rcu_random_state name = { 0, 0 } |
| 164 | |
| 165 | /* |
| 166 | * Crude but fast random-number generator. Uses a linear congruential |
Paul E. McKenney | c17ac85 | 2007-10-16 23:27:19 -0700 | [diff] [blame] | 167 | * generator, with occasional help from cpu_clock(). |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 168 | */ |
Josh Triplett | 75cfef3 | 2006-10-04 02:17:12 -0700 | [diff] [blame] | 169 | static unsigned long |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 170 | rcu_random(struct rcu_random_state *rrsp) |
| 171 | { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 172 | if (--rrsp->rrs_count < 0) { |
Paul E. McKenney | c17ac85 | 2007-10-16 23:27:19 -0700 | [diff] [blame] | 173 | rrsp->rrs_state += |
| 174 | (unsigned long)cpu_clock(raw_smp_processor_id()); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 175 | rrsp->rrs_count = RCU_RANDOM_REFRESH; |
| 176 | } |
| 177 | rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD; |
| 178 | return swahw32(rrsp->rrs_state); |
| 179 | } |
| 180 | |
| 181 | /* |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 182 | * Operations vector for selecting different types of tests. |
| 183 | */ |
| 184 | |
| 185 | struct rcu_torture_ops { |
| 186 | void (*init)(void); |
| 187 | void (*cleanup)(void); |
| 188 | int (*readlock)(void); |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 189 | void (*readdelay)(struct rcu_random_state *rrsp); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 190 | void (*readunlock)(int idx); |
| 191 | int (*completed)(void); |
| 192 | void (*deferredfree)(struct rcu_torture *p); |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 193 | void (*sync)(void); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 194 | int (*stats)(char *page); |
| 195 | char *name; |
| 196 | }; |
| 197 | static struct rcu_torture_ops *cur_ops = NULL; |
| 198 | |
| 199 | /* |
| 200 | * Definitions for rcu torture testing. |
| 201 | */ |
| 202 | |
Josh Triplett | a49a4af | 2006-09-29 01:59:30 -0700 | [diff] [blame] | 203 | static int rcu_torture_read_lock(void) __acquires(RCU) |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 204 | { |
| 205 | rcu_read_lock(); |
| 206 | return 0; |
| 207 | } |
| 208 | |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 209 | static void rcu_read_delay(struct rcu_random_state *rrsp) |
| 210 | { |
| 211 | long delay; |
| 212 | const long longdelay = 200; |
| 213 | |
| 214 | /* We want there to be long-running readers, but not all the time. */ |
| 215 | |
| 216 | delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay); |
| 217 | if (!delay) |
| 218 | udelay(longdelay); |
| 219 | } |
| 220 | |
Josh Triplett | a49a4af | 2006-09-29 01:59:30 -0700 | [diff] [blame] | 221 | static void rcu_torture_read_unlock(int idx) __releases(RCU) |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 222 | { |
| 223 | rcu_read_unlock(); |
| 224 | } |
| 225 | |
| 226 | static int rcu_torture_completed(void) |
| 227 | { |
| 228 | return rcu_batches_completed(); |
| 229 | } |
| 230 | |
| 231 | static void |
| 232 | rcu_torture_cb(struct rcu_head *p) |
| 233 | { |
| 234 | int i; |
| 235 | struct rcu_torture *rp = container_of(p, struct rcu_torture, rtort_rcu); |
| 236 | |
| 237 | if (fullstop) { |
| 238 | /* Test is ending, just drop callbacks on the floor. */ |
| 239 | /* The next initialization will pick up the pieces. */ |
| 240 | return; |
| 241 | } |
| 242 | i = rp->rtort_pipe_count; |
| 243 | if (i > RCU_TORTURE_PIPE_LEN) |
| 244 | i = RCU_TORTURE_PIPE_LEN; |
| 245 | atomic_inc(&rcu_torture_wcount[i]); |
| 246 | if (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) { |
| 247 | rp->rtort_mbtest = 0; |
| 248 | rcu_torture_free(rp); |
| 249 | } else |
| 250 | cur_ops->deferredfree(rp); |
| 251 | } |
| 252 | |
| 253 | static void rcu_torture_deferred_free(struct rcu_torture *p) |
| 254 | { |
| 255 | call_rcu(&p->rtort_rcu, rcu_torture_cb); |
| 256 | } |
| 257 | |
| 258 | static struct rcu_torture_ops rcu_ops = { |
| 259 | .init = NULL, |
| 260 | .cleanup = NULL, |
| 261 | .readlock = rcu_torture_read_lock, |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 262 | .readdelay = rcu_read_delay, |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 263 | .readunlock = rcu_torture_read_unlock, |
| 264 | .completed = rcu_torture_completed, |
| 265 | .deferredfree = rcu_torture_deferred_free, |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 266 | .sync = synchronize_rcu, |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 267 | .stats = NULL, |
| 268 | .name = "rcu" |
| 269 | }; |
| 270 | |
Josh Triplett | e303373 | 2006-10-04 02:17:14 -0700 | [diff] [blame] | 271 | static void rcu_sync_torture_deferred_free(struct rcu_torture *p) |
| 272 | { |
| 273 | int i; |
| 274 | struct rcu_torture *rp; |
| 275 | struct rcu_torture *rp1; |
| 276 | |
| 277 | cur_ops->sync(); |
| 278 | list_add(&p->rtort_free, &rcu_torture_removed); |
| 279 | list_for_each_entry_safe(rp, rp1, &rcu_torture_removed, rtort_free) { |
| 280 | i = rp->rtort_pipe_count; |
| 281 | if (i > RCU_TORTURE_PIPE_LEN) |
| 282 | i = RCU_TORTURE_PIPE_LEN; |
| 283 | atomic_inc(&rcu_torture_wcount[i]); |
| 284 | if (++rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) { |
| 285 | rp->rtort_mbtest = 0; |
| 286 | list_del(&rp->rtort_free); |
| 287 | rcu_torture_free(rp); |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | static void rcu_sync_torture_init(void) |
| 293 | { |
| 294 | INIT_LIST_HEAD(&rcu_torture_removed); |
| 295 | } |
| 296 | |
Josh Triplett | 20d2e42 | 2006-10-04 02:17:15 -0700 | [diff] [blame] | 297 | static struct rcu_torture_ops rcu_sync_ops = { |
| 298 | .init = rcu_sync_torture_init, |
| 299 | .cleanup = NULL, |
| 300 | .readlock = rcu_torture_read_lock, |
| 301 | .readdelay = rcu_read_delay, |
| 302 | .readunlock = rcu_torture_read_unlock, |
| 303 | .completed = rcu_torture_completed, |
| 304 | .deferredfree = rcu_sync_torture_deferred_free, |
| 305 | .sync = synchronize_rcu, |
| 306 | .stats = NULL, |
| 307 | .name = "rcu_sync" |
| 308 | }; |
| 309 | |
Paul E. McKenney | c32e066 | 2006-06-27 02:54:04 -0700 | [diff] [blame] | 310 | /* |
| 311 | * Definitions for rcu_bh torture testing. |
| 312 | */ |
| 313 | |
Josh Triplett | a49a4af | 2006-09-29 01:59:30 -0700 | [diff] [blame] | 314 | static int rcu_bh_torture_read_lock(void) __acquires(RCU_BH) |
Paul E. McKenney | c32e066 | 2006-06-27 02:54:04 -0700 | [diff] [blame] | 315 | { |
| 316 | rcu_read_lock_bh(); |
| 317 | return 0; |
| 318 | } |
| 319 | |
Josh Triplett | a49a4af | 2006-09-29 01:59:30 -0700 | [diff] [blame] | 320 | static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH) |
Paul E. McKenney | c32e066 | 2006-06-27 02:54:04 -0700 | [diff] [blame] | 321 | { |
| 322 | rcu_read_unlock_bh(); |
| 323 | } |
| 324 | |
| 325 | static int rcu_bh_torture_completed(void) |
| 326 | { |
| 327 | return rcu_batches_completed_bh(); |
| 328 | } |
| 329 | |
| 330 | static void rcu_bh_torture_deferred_free(struct rcu_torture *p) |
| 331 | { |
| 332 | call_rcu_bh(&p->rtort_rcu, rcu_torture_cb); |
| 333 | } |
| 334 | |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 335 | struct rcu_bh_torture_synchronize { |
| 336 | struct rcu_head head; |
| 337 | struct completion completion; |
| 338 | }; |
| 339 | |
| 340 | static void rcu_bh_torture_wakeme_after_cb(struct rcu_head *head) |
| 341 | { |
| 342 | struct rcu_bh_torture_synchronize *rcu; |
| 343 | |
| 344 | rcu = container_of(head, struct rcu_bh_torture_synchronize, head); |
| 345 | complete(&rcu->completion); |
| 346 | } |
| 347 | |
| 348 | static void rcu_bh_torture_synchronize(void) |
| 349 | { |
| 350 | struct rcu_bh_torture_synchronize rcu; |
| 351 | |
| 352 | init_completion(&rcu.completion); |
| 353 | call_rcu_bh(&rcu.head, rcu_bh_torture_wakeme_after_cb); |
| 354 | wait_for_completion(&rcu.completion); |
| 355 | } |
| 356 | |
Paul E. McKenney | c32e066 | 2006-06-27 02:54:04 -0700 | [diff] [blame] | 357 | static struct rcu_torture_ops rcu_bh_ops = { |
| 358 | .init = NULL, |
| 359 | .cleanup = NULL, |
| 360 | .readlock = rcu_bh_torture_read_lock, |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 361 | .readdelay = rcu_read_delay, /* just reuse rcu's version. */ |
Paul E. McKenney | c32e066 | 2006-06-27 02:54:04 -0700 | [diff] [blame] | 362 | .readunlock = rcu_bh_torture_read_unlock, |
| 363 | .completed = rcu_bh_torture_completed, |
| 364 | .deferredfree = rcu_bh_torture_deferred_free, |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 365 | .sync = rcu_bh_torture_synchronize, |
Paul E. McKenney | c32e066 | 2006-06-27 02:54:04 -0700 | [diff] [blame] | 366 | .stats = NULL, |
| 367 | .name = "rcu_bh" |
| 368 | }; |
| 369 | |
Josh Triplett | 11a1470 | 2006-10-04 02:17:16 -0700 | [diff] [blame] | 370 | static struct rcu_torture_ops rcu_bh_sync_ops = { |
| 371 | .init = rcu_sync_torture_init, |
| 372 | .cleanup = NULL, |
| 373 | .readlock = rcu_bh_torture_read_lock, |
| 374 | .readdelay = rcu_read_delay, /* just reuse rcu's version. */ |
| 375 | .readunlock = rcu_bh_torture_read_unlock, |
| 376 | .completed = rcu_bh_torture_completed, |
| 377 | .deferredfree = rcu_sync_torture_deferred_free, |
| 378 | .sync = rcu_bh_torture_synchronize, |
| 379 | .stats = NULL, |
| 380 | .name = "rcu_bh_sync" |
| 381 | }; |
| 382 | |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 383 | /* |
| 384 | * Definitions for srcu torture testing. |
| 385 | */ |
| 386 | |
| 387 | static struct srcu_struct srcu_ctl; |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 388 | |
| 389 | static void srcu_torture_init(void) |
| 390 | { |
| 391 | init_srcu_struct(&srcu_ctl); |
Josh Triplett | e303373 | 2006-10-04 02:17:14 -0700 | [diff] [blame] | 392 | rcu_sync_torture_init(); |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | static void srcu_torture_cleanup(void) |
| 396 | { |
| 397 | synchronize_srcu(&srcu_ctl); |
| 398 | cleanup_srcu_struct(&srcu_ctl); |
| 399 | } |
| 400 | |
Josh Triplett | 012d3ca | 2006-12-06 20:40:19 -0800 | [diff] [blame] | 401 | static int srcu_torture_read_lock(void) __acquires(&srcu_ctl) |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 402 | { |
| 403 | return srcu_read_lock(&srcu_ctl); |
| 404 | } |
| 405 | |
| 406 | static void srcu_read_delay(struct rcu_random_state *rrsp) |
| 407 | { |
| 408 | long delay; |
| 409 | const long uspertick = 1000000 / HZ; |
| 410 | const long longdelay = 10; |
| 411 | |
| 412 | /* We want there to be long-running readers, but not all the time. */ |
| 413 | |
| 414 | delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay * uspertick); |
| 415 | if (!delay) |
| 416 | schedule_timeout_interruptible(longdelay); |
| 417 | } |
| 418 | |
Josh Triplett | 012d3ca | 2006-12-06 20:40:19 -0800 | [diff] [blame] | 419 | static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl) |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 420 | { |
| 421 | srcu_read_unlock(&srcu_ctl, idx); |
| 422 | } |
| 423 | |
| 424 | static int srcu_torture_completed(void) |
| 425 | { |
| 426 | return srcu_batches_completed(&srcu_ctl); |
| 427 | } |
| 428 | |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 429 | static void srcu_torture_synchronize(void) |
| 430 | { |
| 431 | synchronize_srcu(&srcu_ctl); |
| 432 | } |
| 433 | |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 434 | static int srcu_torture_stats(char *page) |
| 435 | { |
| 436 | int cnt = 0; |
| 437 | int cpu; |
| 438 | int idx = srcu_ctl.completed & 0x1; |
| 439 | |
| 440 | cnt += sprintf(&page[cnt], "%s%s per-CPU(idx=%d):", |
| 441 | torture_type, TORTURE_FLAG, idx); |
| 442 | for_each_possible_cpu(cpu) { |
| 443 | cnt += sprintf(&page[cnt], " %d(%d,%d)", cpu, |
| 444 | per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[!idx], |
| 445 | per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[idx]); |
| 446 | } |
| 447 | cnt += sprintf(&page[cnt], "\n"); |
| 448 | return cnt; |
| 449 | } |
| 450 | |
| 451 | static struct rcu_torture_ops srcu_ops = { |
| 452 | .init = srcu_torture_init, |
| 453 | .cleanup = srcu_torture_cleanup, |
| 454 | .readlock = srcu_torture_read_lock, |
| 455 | .readdelay = srcu_read_delay, |
| 456 | .readunlock = srcu_torture_read_unlock, |
| 457 | .completed = srcu_torture_completed, |
Josh Triplett | e303373 | 2006-10-04 02:17:14 -0700 | [diff] [blame] | 458 | .deferredfree = rcu_sync_torture_deferred_free, |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 459 | .sync = srcu_torture_synchronize, |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 460 | .stats = srcu_torture_stats, |
| 461 | .name = "srcu" |
| 462 | }; |
| 463 | |
Josh Triplett | 4b6c2cc | 2006-10-04 02:17:16 -0700 | [diff] [blame] | 464 | /* |
| 465 | * Definitions for sched torture testing. |
| 466 | */ |
| 467 | |
| 468 | static int sched_torture_read_lock(void) |
| 469 | { |
| 470 | preempt_disable(); |
| 471 | return 0; |
| 472 | } |
| 473 | |
| 474 | static void sched_torture_read_unlock(int idx) |
| 475 | { |
| 476 | preempt_enable(); |
| 477 | } |
| 478 | |
| 479 | static int sched_torture_completed(void) |
| 480 | { |
| 481 | return 0; |
| 482 | } |
| 483 | |
| 484 | static void sched_torture_synchronize(void) |
| 485 | { |
| 486 | synchronize_sched(); |
| 487 | } |
| 488 | |
| 489 | static struct rcu_torture_ops sched_ops = { |
| 490 | .init = rcu_sync_torture_init, |
| 491 | .cleanup = NULL, |
| 492 | .readlock = sched_torture_read_lock, |
| 493 | .readdelay = rcu_read_delay, /* just reuse rcu's version. */ |
| 494 | .readunlock = sched_torture_read_unlock, |
| 495 | .completed = sched_torture_completed, |
| 496 | .deferredfree = rcu_sync_torture_deferred_free, |
| 497 | .sync = sched_torture_synchronize, |
| 498 | .stats = NULL, |
| 499 | .name = "sched" |
| 500 | }; |
| 501 | |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 502 | /* |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 503 | * RCU torture writer kthread. Repeatedly substitutes a new structure |
| 504 | * for that pointed to by rcu_torture_current, freeing the old structure |
| 505 | * after a series of grace periods (the "pipeline"). |
| 506 | */ |
| 507 | static int |
| 508 | rcu_torture_writer(void *arg) |
| 509 | { |
| 510 | int i; |
| 511 | long oldbatch = rcu_batches_completed(); |
| 512 | struct rcu_torture *rp; |
| 513 | struct rcu_torture *old_rp; |
| 514 | static DEFINE_RCU_RANDOM(rand); |
| 515 | |
| 516 | VERBOSE_PRINTK_STRING("rcu_torture_writer task started"); |
Ingo Molnar | dbdf65b | 2005-11-13 16:07:22 -0800 | [diff] [blame] | 517 | set_user_nice(current, 19); |
| 518 | |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 519 | do { |
| 520 | schedule_timeout_uninterruptible(1); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 521 | if ((rp = rcu_torture_alloc()) == NULL) |
| 522 | continue; |
| 523 | rp->rtort_pipe_count = 0; |
| 524 | udelay(rcu_random(&rand) & 0x3ff); |
| 525 | old_rp = rcu_torture_current; |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 526 | rp->rtort_mbtest = 1; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 527 | rcu_assign_pointer(rcu_torture_current, rp); |
| 528 | smp_wmb(); |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 529 | if (old_rp) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 530 | i = old_rp->rtort_pipe_count; |
| 531 | if (i > RCU_TORTURE_PIPE_LEN) |
| 532 | i = RCU_TORTURE_PIPE_LEN; |
| 533 | atomic_inc(&rcu_torture_wcount[i]); |
| 534 | old_rp->rtort_pipe_count++; |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 535 | cur_ops->deferredfree(old_rp); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 536 | } |
| 537 | rcu_torture_current_version++; |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 538 | oldbatch = cur_ops->completed(); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 539 | } while (!kthread_should_stop() && !fullstop); |
| 540 | VERBOSE_PRINTK_STRING("rcu_torture_writer task stopping"); |
| 541 | while (!kthread_should_stop()) |
| 542 | schedule_timeout_uninterruptible(1); |
| 543 | return 0; |
| 544 | } |
| 545 | |
| 546 | /* |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 547 | * RCU torture fake writer kthread. Repeatedly calls sync, with a random |
| 548 | * delay between calls. |
| 549 | */ |
| 550 | static int |
| 551 | rcu_torture_fakewriter(void *arg) |
| 552 | { |
| 553 | DEFINE_RCU_RANDOM(rand); |
| 554 | |
| 555 | VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task started"); |
| 556 | set_user_nice(current, 19); |
| 557 | |
| 558 | do { |
| 559 | schedule_timeout_uninterruptible(1 + rcu_random(&rand)%10); |
| 560 | udelay(rcu_random(&rand) & 0x3ff); |
| 561 | cur_ops->sync(); |
| 562 | } while (!kthread_should_stop() && !fullstop); |
| 563 | |
| 564 | VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task stopping"); |
| 565 | while (!kthread_should_stop()) |
| 566 | schedule_timeout_uninterruptible(1); |
| 567 | return 0; |
| 568 | } |
| 569 | |
| 570 | /* |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 571 | * RCU torture reader kthread. Repeatedly dereferences rcu_torture_current, |
| 572 | * incrementing the corresponding element of the pipeline array. The |
| 573 | * counter in the element should never be greater than 1, otherwise, the |
| 574 | * RCU implementation is broken. |
| 575 | */ |
| 576 | static int |
| 577 | rcu_torture_reader(void *arg) |
| 578 | { |
| 579 | int completed; |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 580 | int idx; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 581 | DEFINE_RCU_RANDOM(rand); |
| 582 | struct rcu_torture *p; |
| 583 | int pipe_count; |
| 584 | |
| 585 | VERBOSE_PRINTK_STRING("rcu_torture_reader task started"); |
Ingo Molnar | dbdf65b | 2005-11-13 16:07:22 -0800 | [diff] [blame] | 586 | set_user_nice(current, 19); |
| 587 | |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 588 | do { |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 589 | idx = cur_ops->readlock(); |
| 590 | completed = cur_ops->completed(); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 591 | p = rcu_dereference(rcu_torture_current); |
| 592 | if (p == NULL) { |
| 593 | /* Wait for rcu_torture_writer to get underway */ |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 594 | cur_ops->readunlock(idx); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 595 | schedule_timeout_interruptible(HZ); |
| 596 | continue; |
| 597 | } |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 598 | if (p->rtort_mbtest == 0) |
| 599 | atomic_inc(&n_rcu_torture_mberror); |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 600 | cur_ops->readdelay(&rand); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 601 | preempt_disable(); |
| 602 | pipe_count = p->rtort_pipe_count; |
| 603 | if (pipe_count > RCU_TORTURE_PIPE_LEN) { |
| 604 | /* Should not happen, but... */ |
| 605 | pipe_count = RCU_TORTURE_PIPE_LEN; |
| 606 | } |
| 607 | ++__get_cpu_var(rcu_torture_count)[pipe_count]; |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 608 | completed = cur_ops->completed() - completed; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 609 | if (completed > RCU_TORTURE_PIPE_LEN) { |
| 610 | /* Should not happen, but... */ |
| 611 | completed = RCU_TORTURE_PIPE_LEN; |
| 612 | } |
| 613 | ++__get_cpu_var(rcu_torture_batch)[completed]; |
| 614 | preempt_enable(); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 615 | cur_ops->readunlock(idx); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 616 | schedule(); |
| 617 | } while (!kthread_should_stop() && !fullstop); |
| 618 | VERBOSE_PRINTK_STRING("rcu_torture_reader task stopping"); |
| 619 | while (!kthread_should_stop()) |
| 620 | schedule_timeout_uninterruptible(1); |
| 621 | return 0; |
| 622 | } |
| 623 | |
| 624 | /* |
| 625 | * Create an RCU-torture statistics message in the specified buffer. |
| 626 | */ |
| 627 | static int |
| 628 | rcu_torture_printk(char *page) |
| 629 | { |
| 630 | int cnt = 0; |
| 631 | int cpu; |
| 632 | int i; |
| 633 | long pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 }; |
| 634 | long batchsummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 }; |
| 635 | |
KAMEZAWA Hiroyuki | 0a94502 | 2006-03-28 01:56:37 -0800 | [diff] [blame] | 636 | for_each_possible_cpu(cpu) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 637 | for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { |
| 638 | pipesummary[i] += per_cpu(rcu_torture_count, cpu)[i]; |
| 639 | batchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i]; |
| 640 | } |
| 641 | } |
| 642 | for (i = RCU_TORTURE_PIPE_LEN - 1; i >= 0; i--) { |
| 643 | if (pipesummary[i] != 0) |
| 644 | break; |
| 645 | } |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 646 | cnt += sprintf(&page[cnt], "%s%s ", torture_type, TORTURE_FLAG); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 647 | cnt += sprintf(&page[cnt], |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 648 | "rtc: %p ver: %ld tfle: %d rta: %d rtaf: %d rtf: %d " |
| 649 | "rtmbe: %d", |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 650 | rcu_torture_current, |
| 651 | rcu_torture_current_version, |
| 652 | list_empty(&rcu_torture_freelist), |
| 653 | atomic_read(&n_rcu_torture_alloc), |
| 654 | atomic_read(&n_rcu_torture_alloc_fail), |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 655 | atomic_read(&n_rcu_torture_free), |
| 656 | atomic_read(&n_rcu_torture_mberror)); |
| 657 | if (atomic_read(&n_rcu_torture_mberror) != 0) |
| 658 | cnt += sprintf(&page[cnt], " !!!"); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 659 | cnt += sprintf(&page[cnt], "\n%s%s ", torture_type, TORTURE_FLAG); |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 660 | if (i > 1) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 661 | cnt += sprintf(&page[cnt], "!!! "); |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 662 | atomic_inc(&n_rcu_torture_error); |
| 663 | } |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 664 | cnt += sprintf(&page[cnt], "Reader Pipe: "); |
| 665 | for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) |
| 666 | cnt += sprintf(&page[cnt], " %ld", pipesummary[i]); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 667 | cnt += sprintf(&page[cnt], "\n%s%s ", torture_type, TORTURE_FLAG); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 668 | cnt += sprintf(&page[cnt], "Reader Batch: "); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 669 | for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 670 | cnt += sprintf(&page[cnt], " %ld", batchsummary[i]); |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 671 | cnt += sprintf(&page[cnt], "\n%s%s ", torture_type, TORTURE_FLAG); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 672 | cnt += sprintf(&page[cnt], "Free-Block Circulation: "); |
| 673 | for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { |
| 674 | cnt += sprintf(&page[cnt], " %d", |
| 675 | atomic_read(&rcu_torture_wcount[i])); |
| 676 | } |
| 677 | cnt += sprintf(&page[cnt], "\n"); |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 678 | if (cur_ops->stats) |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 679 | cnt += cur_ops->stats(&page[cnt]); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 680 | return cnt; |
| 681 | } |
| 682 | |
| 683 | /* |
| 684 | * Print torture statistics. Caller must ensure that there is only |
| 685 | * one call to this function at a given time!!! This is normally |
| 686 | * accomplished by relying on the module system to only have one copy |
| 687 | * of the module loaded, and then by giving the rcu_torture_stats |
| 688 | * kthread full control (or the init/cleanup functions when rcu_torture_stats |
| 689 | * thread is not running). |
| 690 | */ |
| 691 | static void |
| 692 | rcu_torture_stats_print(void) |
| 693 | { |
| 694 | int cnt; |
| 695 | |
| 696 | cnt = rcu_torture_printk(printk_buf); |
| 697 | printk(KERN_ALERT "%s", printk_buf); |
| 698 | } |
| 699 | |
| 700 | /* |
| 701 | * Periodically prints torture statistics, if periodic statistics printing |
| 702 | * was specified via the stat_interval module parameter. |
| 703 | * |
| 704 | * No need to worry about fullstop here, since this one doesn't reference |
| 705 | * volatile state or register callbacks. |
| 706 | */ |
| 707 | static int |
| 708 | rcu_torture_stats(void *arg) |
| 709 | { |
| 710 | VERBOSE_PRINTK_STRING("rcu_torture_stats task started"); |
| 711 | do { |
| 712 | schedule_timeout_interruptible(stat_interval * HZ); |
| 713 | rcu_torture_stats_print(); |
| 714 | } while (!kthread_should_stop()); |
| 715 | VERBOSE_PRINTK_STRING("rcu_torture_stats task stopping"); |
| 716 | return 0; |
| 717 | } |
| 718 | |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 719 | static int rcu_idle_cpu; /* Force all torture tasks off this CPU */ |
| 720 | |
| 721 | /* Shuffle tasks such that we allow @rcu_idle_cpu to become idle. A special case |
| 722 | * is when @rcu_idle_cpu = -1, when we allow the tasks to run on all CPUs. |
| 723 | */ |
Paul E. McKenney | b2896d2 | 2006-10-04 02:17:03 -0700 | [diff] [blame] | 724 | static void rcu_torture_shuffle_tasks(void) |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 725 | { |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 726 | cpumask_t tmp_mask; |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 727 | int i; |
| 728 | |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 729 | cpus_setall(tmp_mask); |
Gautham R Shenoy | 86ef5c9 | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 730 | get_online_cpus(); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 731 | |
| 732 | /* No point in shuffling if there is only one online CPU (ex: UP) */ |
| 733 | if (num_online_cpus() == 1) { |
Gautham R Shenoy | 86ef5c9 | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 734 | put_online_cpus(); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 735 | return; |
| 736 | } |
| 737 | |
| 738 | if (rcu_idle_cpu != -1) |
| 739 | cpu_clear(rcu_idle_cpu, tmp_mask); |
| 740 | |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 741 | set_cpus_allowed_ptr(current, &tmp_mask); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 742 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 743 | if (reader_tasks) { |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 744 | for (i = 0; i < nrealreaders; i++) |
| 745 | if (reader_tasks[i]) |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 746 | set_cpus_allowed_ptr(reader_tasks[i], |
| 747 | &tmp_mask); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 748 | } |
| 749 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 750 | if (fakewriter_tasks) { |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 751 | for (i = 0; i < nfakewriters; i++) |
| 752 | if (fakewriter_tasks[i]) |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 753 | set_cpus_allowed_ptr(fakewriter_tasks[i], |
| 754 | &tmp_mask); |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 755 | } |
| 756 | |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 757 | if (writer_task) |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 758 | set_cpus_allowed_ptr(writer_task, &tmp_mask); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 759 | |
| 760 | if (stats_task) |
Mike Travis | f70316d | 2008-04-04 18:11:06 -0700 | [diff] [blame] | 761 | set_cpus_allowed_ptr(stats_task, &tmp_mask); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 762 | |
| 763 | if (rcu_idle_cpu == -1) |
| 764 | rcu_idle_cpu = num_online_cpus() - 1; |
| 765 | else |
| 766 | rcu_idle_cpu--; |
| 767 | |
Gautham R Shenoy | 86ef5c9 | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 768 | put_online_cpus(); |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | /* Shuffle tasks across CPUs, with the intent of allowing each CPU in the |
| 772 | * system to become idle at a time and cut off its timer ticks. This is meant |
| 773 | * to test the support for such tickless idle CPU in RCU. |
| 774 | */ |
| 775 | static int |
| 776 | rcu_torture_shuffle(void *arg) |
| 777 | { |
| 778 | VERBOSE_PRINTK_STRING("rcu_torture_shuffle task started"); |
| 779 | do { |
| 780 | schedule_timeout_interruptible(shuffle_interval * HZ); |
| 781 | rcu_torture_shuffle_tasks(); |
| 782 | } while (!kthread_should_stop()); |
| 783 | VERBOSE_PRINTK_STRING("rcu_torture_shuffle task stopping"); |
| 784 | return 0; |
| 785 | } |
| 786 | |
Paul E. McKenney | 95c3832 | 2006-03-24 03:15:58 -0800 | [diff] [blame] | 787 | static inline void |
| 788 | rcu_torture_print_module_parms(char *tag) |
| 789 | { |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 790 | printk(KERN_ALERT "%s" TORTURE_FLAG |
| 791 | "--- %s: nreaders=%d nfakewriters=%d " |
Paul E. McKenney | 95c3832 | 2006-03-24 03:15:58 -0800 | [diff] [blame] | 792 | "stat_interval=%d verbose=%d test_no_idle_hz=%d " |
| 793 | "shuffle_interval = %d\n", |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 794 | torture_type, tag, nrealreaders, nfakewriters, |
| 795 | stat_interval, verbose, test_no_idle_hz, shuffle_interval); |
Paul E. McKenney | 95c3832 | 2006-03-24 03:15:58 -0800 | [diff] [blame] | 796 | } |
| 797 | |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 798 | static void |
| 799 | rcu_torture_cleanup(void) |
| 800 | { |
| 801 | int i; |
| 802 | |
| 803 | fullstop = 1; |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 804 | if (shuffler_task) { |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 805 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_shuffle task"); |
| 806 | kthread_stop(shuffler_task); |
| 807 | } |
| 808 | shuffler_task = NULL; |
| 809 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 810 | if (writer_task) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 811 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_writer task"); |
| 812 | kthread_stop(writer_task); |
| 813 | } |
| 814 | writer_task = NULL; |
| 815 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 816 | if (reader_tasks) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 817 | for (i = 0; i < nrealreaders; i++) { |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 818 | if (reader_tasks[i]) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 819 | VERBOSE_PRINTK_STRING( |
| 820 | "Stopping rcu_torture_reader task"); |
| 821 | kthread_stop(reader_tasks[i]); |
| 822 | } |
| 823 | reader_tasks[i] = NULL; |
| 824 | } |
| 825 | kfree(reader_tasks); |
| 826 | reader_tasks = NULL; |
| 827 | } |
| 828 | rcu_torture_current = NULL; |
| 829 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 830 | if (fakewriter_tasks) { |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 831 | for (i = 0; i < nfakewriters; i++) { |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 832 | if (fakewriter_tasks[i]) { |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 833 | VERBOSE_PRINTK_STRING( |
| 834 | "Stopping rcu_torture_fakewriter task"); |
| 835 | kthread_stop(fakewriter_tasks[i]); |
| 836 | } |
| 837 | fakewriter_tasks[i] = NULL; |
| 838 | } |
| 839 | kfree(fakewriter_tasks); |
| 840 | fakewriter_tasks = NULL; |
| 841 | } |
| 842 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 843 | if (stats_task) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 844 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_stats task"); |
| 845 | kthread_stop(stats_task); |
| 846 | } |
| 847 | stats_task = NULL; |
| 848 | |
| 849 | /* Wait for all RCU callbacks to fire. */ |
Srivatsa Vaddagiri | 89d46b8 | 2005-12-12 00:37:06 -0800 | [diff] [blame] | 850 | rcu_barrier(); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 851 | |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 852 | rcu_torture_stats_print(); /* -After- the stats thread is stopped! */ |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 853 | |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 854 | if (cur_ops->cleanup) |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 855 | cur_ops->cleanup(); |
Paul E. McKenney | 95c3832 | 2006-03-24 03:15:58 -0800 | [diff] [blame] | 856 | if (atomic_read(&n_rcu_torture_error)) |
| 857 | rcu_torture_print_module_parms("End of test: FAILURE"); |
| 858 | else |
| 859 | rcu_torture_print_module_parms("End of test: SUCCESS"); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 860 | } |
| 861 | |
Josh Triplett | 6f8bc50 | 2007-05-08 00:25:24 -0700 | [diff] [blame] | 862 | static int __init |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 863 | rcu_torture_init(void) |
| 864 | { |
| 865 | int i; |
| 866 | int cpu; |
| 867 | int firsterr = 0; |
Josh Triplett | ade5fb8 | 2007-05-08 00:33:22 -0700 | [diff] [blame] | 868 | static struct rcu_torture_ops *torture_ops[] = |
| 869 | { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, |
| 870 | &srcu_ops, &sched_ops, }; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 871 | |
| 872 | /* Process args and tell the world that the torturer is on the job. */ |
Josh Triplett | ade5fb8 | 2007-05-08 00:33:22 -0700 | [diff] [blame] | 873 | for (i = 0; i < ARRAY_SIZE(torture_ops); i++) { |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 874 | cur_ops = torture_ops[i]; |
Josh Triplett | ade5fb8 | 2007-05-08 00:33:22 -0700 | [diff] [blame] | 875 | if (strcmp(torture_type, cur_ops->name) == 0) |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 876 | break; |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 877 | } |
Josh Triplett | ade5fb8 | 2007-05-08 00:33:22 -0700 | [diff] [blame] | 878 | if (i == ARRAY_SIZE(torture_ops)) { |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 879 | printk(KERN_ALERT "rcutorture: invalid torture type: \"%s\"\n", |
| 880 | torture_type); |
| 881 | return (-EINVAL); |
| 882 | } |
Josh Triplett | c8e5b16 | 2007-05-08 00:33:20 -0700 | [diff] [blame] | 883 | if (cur_ops->init) |
Paul E. McKenney | 72e9bb5 | 2006-06-27 02:54:03 -0700 | [diff] [blame] | 884 | cur_ops->init(); /* no "goto unwind" prior to this point!!! */ |
| 885 | |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 886 | if (nreaders >= 0) |
| 887 | nrealreaders = nreaders; |
| 888 | else |
| 889 | nrealreaders = 2 * num_online_cpus(); |
Paul E. McKenney | 95c3832 | 2006-03-24 03:15:58 -0800 | [diff] [blame] | 890 | rcu_torture_print_module_parms("Start of test"); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 891 | fullstop = 0; |
| 892 | |
| 893 | /* Set up the freelist. */ |
| 894 | |
| 895 | INIT_LIST_HEAD(&rcu_torture_freelist); |
Ahmed S. Darwish | 788e770 | 2007-05-08 00:33:14 -0700 | [diff] [blame] | 896 | for (i = 0; i < ARRAY_SIZE(rcu_tortures); i++) { |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 897 | rcu_tortures[i].rtort_mbtest = 0; |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 898 | list_add_tail(&rcu_tortures[i].rtort_free, |
| 899 | &rcu_torture_freelist); |
| 900 | } |
| 901 | |
| 902 | /* Initialize the statistics so that each run gets its own numbers. */ |
| 903 | |
| 904 | rcu_torture_current = NULL; |
| 905 | rcu_torture_current_version = 0; |
| 906 | atomic_set(&n_rcu_torture_alloc, 0); |
| 907 | atomic_set(&n_rcu_torture_alloc_fail, 0); |
| 908 | atomic_set(&n_rcu_torture_free, 0); |
Paul E. McKenney | 996417d | 2005-11-18 01:10:50 -0800 | [diff] [blame] | 909 | atomic_set(&n_rcu_torture_mberror, 0); |
| 910 | atomic_set(&n_rcu_torture_error, 0); |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 911 | for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) |
| 912 | atomic_set(&rcu_torture_wcount[i], 0); |
KAMEZAWA Hiroyuki | 0a94502 | 2006-03-28 01:56:37 -0800 | [diff] [blame] | 913 | for_each_possible_cpu(cpu) { |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 914 | for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { |
| 915 | per_cpu(rcu_torture_count, cpu)[i] = 0; |
| 916 | per_cpu(rcu_torture_batch, cpu)[i] = 0; |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | /* Start up the kthreads. */ |
| 921 | |
| 922 | VERBOSE_PRINTK_STRING("Creating rcu_torture_writer task"); |
| 923 | writer_task = kthread_run(rcu_torture_writer, NULL, |
| 924 | "rcu_torture_writer"); |
| 925 | if (IS_ERR(writer_task)) { |
| 926 | firsterr = PTR_ERR(writer_task); |
| 927 | VERBOSE_PRINTK_ERRSTRING("Failed to create writer"); |
| 928 | writer_task = NULL; |
| 929 | goto unwind; |
| 930 | } |
Josh Triplett | b772e1d | 2006-10-04 02:17:13 -0700 | [diff] [blame] | 931 | fakewriter_tasks = kzalloc(nfakewriters * sizeof(fakewriter_tasks[0]), |
| 932 | GFP_KERNEL); |
| 933 | if (fakewriter_tasks == NULL) { |
| 934 | VERBOSE_PRINTK_ERRSTRING("out of memory"); |
| 935 | firsterr = -ENOMEM; |
| 936 | goto unwind; |
| 937 | } |
| 938 | for (i = 0; i < nfakewriters; i++) { |
| 939 | VERBOSE_PRINTK_STRING("Creating rcu_torture_fakewriter task"); |
| 940 | fakewriter_tasks[i] = kthread_run(rcu_torture_fakewriter, NULL, |
| 941 | "rcu_torture_fakewriter"); |
| 942 | if (IS_ERR(fakewriter_tasks[i])) { |
| 943 | firsterr = PTR_ERR(fakewriter_tasks[i]); |
| 944 | VERBOSE_PRINTK_ERRSTRING("Failed to create fakewriter"); |
| 945 | fakewriter_tasks[i] = NULL; |
| 946 | goto unwind; |
| 947 | } |
| 948 | } |
Josh Triplett | 2860aab | 2006-10-04 02:17:11 -0700 | [diff] [blame] | 949 | reader_tasks = kzalloc(nrealreaders * sizeof(reader_tasks[0]), |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 950 | GFP_KERNEL); |
| 951 | if (reader_tasks == NULL) { |
| 952 | VERBOSE_PRINTK_ERRSTRING("out of memory"); |
| 953 | firsterr = -ENOMEM; |
| 954 | goto unwind; |
| 955 | } |
| 956 | for (i = 0; i < nrealreaders; i++) { |
| 957 | VERBOSE_PRINTK_STRING("Creating rcu_torture_reader task"); |
| 958 | reader_tasks[i] = kthread_run(rcu_torture_reader, NULL, |
| 959 | "rcu_torture_reader"); |
| 960 | if (IS_ERR(reader_tasks[i])) { |
| 961 | firsterr = PTR_ERR(reader_tasks[i]); |
| 962 | VERBOSE_PRINTK_ERRSTRING("Failed to create reader"); |
| 963 | reader_tasks[i] = NULL; |
| 964 | goto unwind; |
| 965 | } |
| 966 | } |
| 967 | if (stat_interval > 0) { |
| 968 | VERBOSE_PRINTK_STRING("Creating rcu_torture_stats task"); |
| 969 | stats_task = kthread_run(rcu_torture_stats, NULL, |
| 970 | "rcu_torture_stats"); |
| 971 | if (IS_ERR(stats_task)) { |
| 972 | firsterr = PTR_ERR(stats_task); |
| 973 | VERBOSE_PRINTK_ERRSTRING("Failed to create stats"); |
| 974 | stats_task = NULL; |
| 975 | goto unwind; |
| 976 | } |
| 977 | } |
Srivatsa Vaddagiri | d84f520 | 2006-01-08 01:03:42 -0800 | [diff] [blame] | 978 | if (test_no_idle_hz) { |
| 979 | rcu_idle_cpu = num_online_cpus() - 1; |
| 980 | /* Create the shuffler thread */ |
| 981 | shuffler_task = kthread_run(rcu_torture_shuffle, NULL, |
| 982 | "rcu_torture_shuffle"); |
| 983 | if (IS_ERR(shuffler_task)) { |
| 984 | firsterr = PTR_ERR(shuffler_task); |
| 985 | VERBOSE_PRINTK_ERRSTRING("Failed to create shuffler"); |
| 986 | shuffler_task = NULL; |
| 987 | goto unwind; |
| 988 | } |
| 989 | } |
Paul E. McKenney | a241ec6 | 2005-10-30 15:03:12 -0800 | [diff] [blame] | 990 | return 0; |
| 991 | |
| 992 | unwind: |
| 993 | rcu_torture_cleanup(); |
| 994 | return firsterr; |
| 995 | } |
| 996 | |
| 997 | module_init(rcu_torture_init); |
| 998 | module_exit(rcu_torture_cleanup); |