1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://github.com/behlendorf/spl/>.
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 *****************************************************************************
24 * Solaris Porting LAyer Tests (SPLAT) Read/Writer Lock Tests.
25 \*****************************************************************************/
27 #include <sys/rwlock.h>
28 #include <sys/taskq.h>
29 #include <sys/random.h>
30 #include "splat-internal.h"
32 #define SPLAT_RWLOCK_NAME "rwlock"
33 #define SPLAT_RWLOCK_DESC "Kernel RW Lock Tests"
35 #define SPLAT_RWLOCK_TEST1_ID 0x0701
36 #define SPLAT_RWLOCK_TEST1_NAME "N-rd/1-wr"
37 #define SPLAT_RWLOCK_TEST1_DESC "Multiple readers one writer"
39 #define SPLAT_RWLOCK_TEST2_ID 0x0702
40 #define SPLAT_RWLOCK_TEST2_NAME "0-rd/N-wr"
41 #define SPLAT_RWLOCK_TEST2_DESC "Multiple writers"
43 #define SPLAT_RWLOCK_TEST3_ID 0x0703
44 #define SPLAT_RWLOCK_TEST3_NAME "held"
45 #define SPLAT_RWLOCK_TEST3_DESC "RW_{LOCK|READ|WRITE}_HELD"
47 #define SPLAT_RWLOCK_TEST4_ID 0x0704
48 #define SPLAT_RWLOCK_TEST4_NAME "tryenter"
49 #define SPLAT_RWLOCK_TEST4_DESC "Tryenter"
51 #define SPLAT_RWLOCK_TEST5_ID 0x0705
52 #define SPLAT_RWLOCK_TEST5_NAME "rw_downgrade"
53 #define SPLAT_RWLOCK_TEST5_DESC "Write downgrade"
55 #define SPLAT_RWLOCK_TEST6_ID 0x0706
56 #define SPLAT_RWLOCK_TEST6_NAME "rw_tryupgrade"
57 #define SPLAT_RWLOCK_TEST6_DESC "Read upgrade"
59 #define SPLAT_RWLOCK_TEST_MAGIC 0x115599DDUL
60 #define SPLAT_RWLOCK_TEST_NAME "rwlock_test"
61 #define SPLAT_RWLOCK_TEST_TASKQ "rwlock_taskq"
62 #define SPLAT_RWLOCK_TEST_COUNT 8
64 #define SPLAT_RWLOCK_RELEASE_INIT 0
65 #define SPLAT_RWLOCK_RELEASE_WR 1
66 #define SPLAT_RWLOCK_RELEASE_RD 2
68 typedef struct rw_priv
{
69 unsigned long rw_magic
;
73 wait_queue_head_t rw_waitq
;
82 typedef struct rw_thr
{
85 struct task_struct
*rwt_thread
;
88 void splat_init_rw_priv(rw_priv_t
*rwp
, struct file
*file
)
90 rwp
->rw_magic
= SPLAT_RWLOCK_TEST_MAGIC
;
92 rw_init(&rwp
->rw_rwlock
, SPLAT_RWLOCK_TEST_NAME
, RW_DEFAULT
, NULL
);
93 spin_lock_init(&rwp
->rw_lock
);
94 init_waitqueue_head(&rwp
->rw_waitq
);
95 rwp
->rw_completed
= 0;
98 rwp
->rw_release
= SPLAT_RWLOCK_RELEASE_INIT
;
104 splat_rwlock_wr_thr(void *arg
)
106 rw_thr_t
*rwt
= (rw_thr_t
*)arg
;
107 rw_priv_t
*rwp
= rwt
->rwt_rwp
;
110 ASSERT(rwp
->rw_magic
== SPLAT_RWLOCK_TEST_MAGIC
);
112 get_random_bytes((void *)&rnd
, 1);
113 msleep((unsigned int)rnd
);
115 splat_vprint(rwp
->rw_file
, rwt
->rwt_name
,
116 "%s trying to acquire rwlock (%d holding/%d waiting)\n",
117 rwt
->rwt_thread
->comm
, rwp
->rw_holders
, rwp
->rw_waiters
);
118 spin_lock(&rwp
->rw_lock
);
120 spin_unlock(&rwp
->rw_lock
);
121 rw_enter(&rwp
->rw_rwlock
, RW_WRITER
);
123 spin_lock(&rwp
->rw_lock
);
126 spin_unlock(&rwp
->rw_lock
);
127 splat_vprint(rwp
->rw_file
, rwt
->rwt_name
,
128 "%s acquired rwlock (%d holding/%d waiting)\n",
129 rwt
->rwt_thread
->comm
, rwp
->rw_holders
, rwp
->rw_waiters
);
131 /* Wait for control thread to signal we can release the write lock */
132 wait_event_interruptible(rwp
->rw_waitq
, splat_locked_test(&rwp
->rw_lock
,
133 rwp
->rw_release
== SPLAT_RWLOCK_RELEASE_WR
));
135 spin_lock(&rwp
->rw_lock
);
138 spin_unlock(&rwp
->rw_lock
);
139 splat_vprint(rwp
->rw_file
, rwt
->rwt_name
,
140 "%s dropped rwlock (%d holding/%d waiting)\n",
141 rwt
->rwt_thread
->comm
, rwp
->rw_holders
, rwp
->rw_waiters
);
143 rw_exit(&rwp
->rw_rwlock
);
149 splat_rwlock_rd_thr(void *arg
)
151 rw_thr_t
*rwt
= (rw_thr_t
*)arg
;
152 rw_priv_t
*rwp
= rwt
->rwt_rwp
;
155 ASSERT(rwp
->rw_magic
== SPLAT_RWLOCK_TEST_MAGIC
);
157 get_random_bytes((void *)&rnd
, 1);
158 msleep((unsigned int)rnd
);
160 /* Don't try and take the semaphore until after someone has it */
161 wait_event_interruptible(rwp
->rw_waitq
,
162 splat_locked_test(&rwp
->rw_lock
, rwp
->rw_holders
> 0));
164 splat_vprint(rwp
->rw_file
, rwt
->rwt_name
,
165 "%s trying to acquire rwlock (%d holding/%d waiting)\n",
166 rwt
->rwt_thread
->comm
, rwp
->rw_holders
, rwp
->rw_waiters
);
167 spin_lock(&rwp
->rw_lock
);
169 spin_unlock(&rwp
->rw_lock
);
170 rw_enter(&rwp
->rw_rwlock
, RW_READER
);
172 spin_lock(&rwp
->rw_lock
);
175 spin_unlock(&rwp
->rw_lock
);
176 splat_vprint(rwp
->rw_file
, rwt
->rwt_name
,
177 "%s acquired rwlock (%d holding/%d waiting)\n",
178 rwt
->rwt_thread
->comm
, rwp
->rw_holders
, rwp
->rw_waiters
);
180 /* Wait for control thread to signal we can release the read lock */
181 wait_event_interruptible(rwp
->rw_waitq
, splat_locked_test(&rwp
->rw_lock
,
182 rwp
->rw_release
== SPLAT_RWLOCK_RELEASE_RD
));
184 spin_lock(&rwp
->rw_lock
);
187 spin_unlock(&rwp
->rw_lock
);
188 splat_vprint(rwp
->rw_file
, rwt
->rwt_name
,
189 "%s dropped rwlock (%d holding/%d waiting)\n",
190 rwt
->rwt_thread
->comm
, rwp
->rw_holders
, rwp
->rw_waiters
);
192 rw_exit(&rwp
->rw_rwlock
);
198 splat_rwlock_test1(struct file
*file
, void *arg
)
200 int i
, count
= 0, rc
= 0;
201 rw_thr_t rwt
[SPLAT_RWLOCK_TEST_COUNT
];
204 rwp
= (rw_priv_t
*)kmalloc(sizeof(*rwp
), GFP_KERNEL
);
208 splat_init_rw_priv(rwp
, file
);
210 /* Create some threads, the exact number isn't important just as
211 * long as we know how many we managed to create and should expect. */
212 for (i
= 0; i
< SPLAT_RWLOCK_TEST_COUNT
; i
++) {
213 rwt
[i
].rwt_rwp
= rwp
;
214 rwt
[i
].rwt_name
= SPLAT_RWLOCK_TEST1_NAME
;
216 /* The first thread will be the writer */
218 rwt
[i
].rwt_thread
= kthread_create(splat_rwlock_wr_thr
,
219 &rwt
[i
], "%s/%d", SPLAT_RWLOCK_TEST_NAME
, i
);
221 rwt
[i
].rwt_thread
= kthread_create(splat_rwlock_rd_thr
,
222 &rwt
[i
], "%s/%d", SPLAT_RWLOCK_TEST_NAME
, i
);
224 if (!IS_ERR(rwt
[i
].rwt_thread
)) {
225 wake_up_process(rwt
[i
].rwt_thread
);
230 /* Wait for the writer */
231 while (splat_locked_test(&rwp
->rw_lock
, rwp
->rw_holders
== 0)) {
232 wake_up_interruptible(&rwp
->rw_waitq
);
236 /* Wait for 'count-1' readers */
237 while (splat_locked_test(&rwp
->rw_lock
, rwp
->rw_waiters
< count
- 1)) {
238 wake_up_interruptible(&rwp
->rw_waitq
);
242 /* Verify there is only one lock holder */
243 if (splat_locked_test(&rwp
->rw_lock
, rwp
->rw_holders
) != 1) {
244 splat_vprint(file
, SPLAT_RWLOCK_TEST1_NAME
, "Only 1 holder "
245 "expected for rwlock (%d holding/%d waiting)\n",
246 rwp
->rw_holders
, rwp
->rw_waiters
);
250 /* Verify 'count-1' readers */
251 if (splat_locked_test(&rwp
->rw_lock
, rwp
->rw_waiters
!= count
- 1)) {
252 splat_vprint(file
, SPLAT_RWLOCK_TEST1_NAME
, "Only %d waiters "
253 "expected for rwlock (%d holding/%d waiting)\n",
254 count
- 1, rwp
->rw_holders
, rwp
->rw_waiters
);
258 /* Signal the writer to release, allows readers to acquire */
259 spin_lock(&rwp
->rw_lock
);
260 rwp
->rw_release
= SPLAT_RWLOCK_RELEASE_WR
;
261 wake_up_interruptible(&rwp
->rw_waitq
);
262 spin_unlock(&rwp
->rw_lock
);
264 /* Wait for 'count-1' readers to hold the lock */
265 while (splat_locked_test(&rwp
->rw_lock
, rwp
->rw_holders
< count
- 1)) {
266 wake_up_interruptible(&rwp
->rw_waitq
);
270 /* Verify there are 'count-1' readers */
271 if (splat_locked_test(&rwp
->rw_lock
, rwp
->rw_holders
!= count
- 1)) {
272 splat_vprint(file
, SPLAT_RWLOCK_TEST1_NAME
, "Only %d holders "
273 "expected for rwlock (%d holding/%d waiting)\n",
274 count
- 1, rwp
->rw_holders
, rwp
->rw_waiters
);
278 /* Release 'count-1' readers */
279 spin_lock(&rwp
->rw_lock
);
280 rwp
->rw_release
= SPLAT_RWLOCK_RELEASE_RD
;
281 wake_up_interruptible(&rwp
->rw_waitq
);
282 spin_unlock(&rwp
->rw_lock
);
284 /* Wait for the test to complete */
285 while (splat_locked_test(&rwp
->rw_lock
,
286 rwp
->rw_holders
>0 || rwp
->rw_waiters
>0))
289 rw_destroy(&(rwp
->rw_rwlock
));
296 splat_rwlock_test2_func(void *arg
)
298 rw_priv_t
*rwp
= (rw_priv_t
*)arg
;
300 ASSERT(rwp
->rw_magic
== SPLAT_RWLOCK_TEST_MAGIC
);
302 /* Read the value before sleeping and write it after we wake up to
303 * maximize the chance of a race if rwlocks are not working properly */
304 rw_enter(&rwp
->rw_rwlock
, RW_WRITER
);
306 set_current_state(TASK_INTERRUPTIBLE
);
307 schedule_timeout(HZ
/ 100); /* 1/100 of a second */
308 VERIFY(rwp
->rw_rc
== rc
);
310 rw_exit(&rwp
->rw_rwlock
);
314 splat_rwlock_test2(struct file
*file
, void *arg
)
318 int i
, rc
= 0, tq_count
= 256;
320 rwp
= (rw_priv_t
*)kmalloc(sizeof(*rwp
), GFP_KERNEL
);
324 splat_init_rw_priv(rwp
, file
);
326 /* Create several threads allowing tasks to race with each other */
327 tq
= taskq_create(SPLAT_RWLOCK_TEST_TASKQ
, num_online_cpus(),
328 maxclsyspri
, 50, INT_MAX
, TASKQ_PREPOPULATE
);
335 * Schedule N work items to the work queue each of which enters the
336 * writer rwlock, sleeps briefly, then exits the writer rwlock. On a
337 * multiprocessor box these work items will be handled by all available
338 * CPUs. The task function checks to ensure the tracked shared variable
339 * is always only incremented by one. Additionally, the rwlock itself
340 * is instrumented such that if any two processors are in the
341 * critical region at the same time the system will panic. If the
342 * rwlock is implemented right this will never happy, that's a pass.
344 for (i
= 0; i
< tq_count
; i
++) {
345 if (!taskq_dispatch(tq
,splat_rwlock_test2_func
,rwp
,TQ_SLEEP
)) {
346 splat_vprint(file
, SPLAT_RWLOCK_TEST2_NAME
,
347 "Failed to queue task %d\n", i
);
354 if (rwp
->rw_rc
== tq_count
) {
355 splat_vprint(file
, SPLAT_RWLOCK_TEST2_NAME
, "%d racing threads "
356 "correctly entered/exited the rwlock %d times\n",
357 num_online_cpus(), rwp
->rw_rc
);
359 splat_vprint(file
, SPLAT_RWLOCK_TEST2_NAME
, "%d racing threads "
360 "only processed %d/%d w rwlock work items\n",
361 num_online_cpus(), rwp
->rw_rc
, tq_count
);
366 rw_destroy(&(rwp
->rw_rwlock
));
372 #define splat_rwlock_test3_helper(rwp,rex1,rex2,wex1,wex2,held_func,rc) \
374 int result, _rc1_, _rc2_, _rc3_, _rc4_; \
377 rw_enter(&(rwp)->rw_rwlock, RW_READER); \
378 _rc1_ = ((result = held_func(&(rwp)->rw_rwlock)) != rex1); \
379 splat_vprint(file, SPLAT_RWLOCK_TEST3_NAME, "%s" #held_func \
380 " returned %d (expected %d) when RW_READER\n", \
381 _rc1_ ? "Fail " : "", result, rex1); \
382 rw_exit(&(rwp)->rw_rwlock); \
383 _rc2_ = ((result = held_func(&(rwp)->rw_rwlock)) != rex2); \
384 splat_vprint(file, SPLAT_RWLOCK_TEST3_NAME, "%s" #held_func \
385 " returned %d (expected %d) when !RW_READER\n", \
386 _rc2_ ? "Fail " : "", result, rex2); \
388 rw_enter(&(rwp)->rw_rwlock, RW_WRITER); \
389 _rc3_ = ((result = held_func(&(rwp)->rw_rwlock)) != wex1); \
390 splat_vprint(file, SPLAT_RWLOCK_TEST3_NAME, "%s" #held_func \
391 " returned %d (expected %d) when RW_WRITER\n", \
392 _rc3_ ? "Fail " : "", result, wex1); \
393 rw_exit(&(rwp)->rw_rwlock); \
394 _rc4_ = ((result = held_func(&(rwp)->rw_rwlock)) != wex2); \
395 splat_vprint(file, SPLAT_RWLOCK_TEST3_NAME, "%s" #held_func \
396 " returned %d (expected %d) when !RW_WRITER\n", \
397 _rc4_ ? "Fail " : "", result, wex2); \
399 rc = ((_rc1_ || _rc2_ || _rc3_ || _rc4_) ? -EINVAL : 0); \
403 splat_rwlock_test3(struct file
*file
, void *arg
)
408 rwp
= (rw_priv_t
*)kmalloc(sizeof(*rwp
), GFP_KERNEL
);
412 splat_init_rw_priv(rwp
, file
);
414 splat_rwlock_test3_helper(rwp
, 1, 0, 1, 0, RW_LOCK_HELD
, rc1
);
415 splat_rwlock_test3_helper(rwp
, 1, 0, 0, 0, RW_READ_HELD
, rc2
);
416 splat_rwlock_test3_helper(rwp
, 0, 0, 1, 0, RW_WRITE_HELD
, rc3
);
418 rw_destroy(&rwp
->rw_rwlock
);
421 return ((rc1
|| rc2
|| rc3
) ? -EINVAL
: 0);
425 splat_rwlock_test4_func(void *arg
)
427 rw_priv_t
*rwp
= (rw_priv_t
*)arg
;
428 ASSERT(rwp
->rw_magic
== SPLAT_RWLOCK_TEST_MAGIC
);
430 if (rw_tryenter(&rwp
->rw_rwlock
, rwp
->rw_type
)) {
432 rw_exit(&rwp
->rw_rwlock
);
439 splat_rwlock_test4_name(krw_t type
)
442 case RW_NONE
: return "RW_NONE";
443 case RW_WRITER
: return "RW_WRITER";
444 case RW_READER
: return "RW_READER";
451 splat_rwlock_test4_type(taskq_t
*tq
, rw_priv_t
*rwp
, int expected_rc
,
452 krw_t holder_type
, krw_t try_type
)
456 /* Schedule a task function which will try and acquire the rwlock
457 * using type try_type while the rwlock is being held as holder_type.
458 * The result must match expected_rc for the test to pass */
459 rwp
->rw_rc
= -EINVAL
;
460 rwp
->rw_type
= try_type
;
462 if (holder_type
== RW_WRITER
|| holder_type
== RW_READER
)
463 rw_enter(&rwp
->rw_rwlock
, holder_type
);
465 id
= taskq_dispatch(tq
, splat_rwlock_test4_func
, rwp
, TQ_SLEEP
);
467 splat_vprint(rwp
->rw_file
, SPLAT_RWLOCK_TEST4_NAME
, "%s",
468 "taskq_dispatch() failed\n");
473 taskq_wait_id(tq
, id
);
475 if (rwp
->rw_rc
!= expected_rc
)
478 splat_vprint(rwp
->rw_file
, SPLAT_RWLOCK_TEST4_NAME
,
479 "%srw_tryenter(%s) returned %d (expected %d) when %s\n",
480 rc
? "Fail " : "", splat_rwlock_test4_name(try_type
),
481 rwp
->rw_rc
, expected_rc
,
482 splat_rwlock_test4_name(holder_type
));
484 if (holder_type
== RW_WRITER
|| holder_type
== RW_READER
)
485 rw_exit(&rwp
->rw_rwlock
);
491 splat_rwlock_test4(struct file
*file
, void *arg
)
495 int rc
= 0, rc1
, rc2
, rc3
, rc4
, rc5
, rc6
;
497 rwp
= (rw_priv_t
*)kmalloc(sizeof(*rwp
), GFP_KERNEL
);
501 tq
= taskq_create(SPLAT_RWLOCK_TEST_TASKQ
, 1, maxclsyspri
,
502 50, INT_MAX
, TASKQ_PREPOPULATE
);
508 splat_init_rw_priv(rwp
, file
);
510 /* Validate all combinations of rw_tryenter() contention */
511 rc1
= splat_rwlock_test4_type(tq
, rwp
, -EBUSY
, RW_WRITER
, RW_WRITER
);
512 rc2
= splat_rwlock_test4_type(tq
, rwp
, -EBUSY
, RW_WRITER
, RW_READER
);
513 rc3
= splat_rwlock_test4_type(tq
, rwp
, -EBUSY
, RW_READER
, RW_WRITER
);
514 rc4
= splat_rwlock_test4_type(tq
, rwp
, 0, RW_READER
, RW_READER
);
515 rc5
= splat_rwlock_test4_type(tq
, rwp
, 0, RW_NONE
, RW_WRITER
);
516 rc6
= splat_rwlock_test4_type(tq
, rwp
, 0, RW_NONE
, RW_READER
);
518 if (rc1
|| rc2
|| rc3
|| rc4
|| rc5
|| rc6
)
523 rw_destroy(&(rwp
->rw_rwlock
));
530 splat_rwlock_test5(struct file
*file
, void *arg
)
535 rwp
= (rw_priv_t
*)kmalloc(sizeof(*rwp
), GFP_KERNEL
);
539 splat_init_rw_priv(rwp
, file
);
541 rw_enter(&rwp
->rw_rwlock
, RW_WRITER
);
542 if (!RW_WRITE_HELD(&rwp
->rw_rwlock
)) {
543 splat_vprint(file
, SPLAT_RWLOCK_TEST5_NAME
,
544 "rwlock should be write lock: %d\n",
545 RW_WRITE_HELD(&rwp
->rw_rwlock
));
549 rw_downgrade(&rwp
->rw_rwlock
);
550 if (!RW_READ_HELD(&rwp
->rw_rwlock
)) {
551 splat_vprint(file
, SPLAT_RWLOCK_TEST5_NAME
,
552 "rwlock should be read lock: %d\n",
553 RW_READ_HELD(&rwp
->rw_rwlock
));
558 splat_vprint(file
, SPLAT_RWLOCK_TEST5_NAME
, "%s",
559 "rwlock properly downgraded\n");
561 rw_exit(&rwp
->rw_rwlock
);
562 rw_destroy(&rwp
->rw_rwlock
);
569 splat_rwlock_test6(struct file
*file
, void *arg
)
574 rwp
= (rw_priv_t
*)kmalloc(sizeof(*rwp
), GFP_KERNEL
);
578 splat_init_rw_priv(rwp
, file
);
580 rw_enter(&rwp
->rw_rwlock
, RW_READER
);
581 if (!RW_READ_HELD(&rwp
->rw_rwlock
)) {
582 splat_vprint(file
, SPLAT_RWLOCK_TEST6_NAME
,
583 "rwlock should be read lock: %d\n",
584 RW_READ_HELD(&rwp
->rw_rwlock
));
589 #if defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
590 /* With one reader upgrade should never fail. */
591 rc
= rw_tryupgrade(&rwp
->rw_rwlock
);
593 splat_vprint(file
, SPLAT_RWLOCK_TEST6_NAME
,
594 "rwlock failed upgrade from reader: %d\n",
595 RW_READ_HELD(&rwp
->rw_rwlock
));
600 if (RW_READ_HELD(&rwp
->rw_rwlock
) || !RW_WRITE_HELD(&rwp
->rw_rwlock
)) {
601 splat_vprint(file
, SPLAT_RWLOCK_TEST6_NAME
, "rwlock should "
602 "have 0 (not %d) reader and 1 (not %d) writer\n",
603 RW_READ_HELD(&rwp
->rw_rwlock
),
604 RW_WRITE_HELD(&rwp
->rw_rwlock
));
609 splat_vprint(file
, SPLAT_RWLOCK_TEST6_NAME
, "%s",
610 "rwlock properly upgraded\n");
613 splat_vprint(file
, SPLAT_RWLOCK_TEST6_NAME
, "%s",
614 "rw_tryupgrade() is disabled for this arch\n");
617 rw_exit(&rwp
->rw_rwlock
);
618 rw_destroy(&rwp
->rw_rwlock
);
625 splat_rwlock_init(void)
627 splat_subsystem_t
*sub
;
629 sub
= kmalloc(sizeof(*sub
), GFP_KERNEL
);
633 memset(sub
, 0, sizeof(*sub
));
634 strncpy(sub
->desc
.name
, SPLAT_RWLOCK_NAME
, SPLAT_NAME_SIZE
);
635 strncpy(sub
->desc
.desc
, SPLAT_RWLOCK_DESC
, SPLAT_DESC_SIZE
);
636 INIT_LIST_HEAD(&sub
->subsystem_list
);
637 INIT_LIST_HEAD(&sub
->test_list
);
638 spin_lock_init(&sub
->test_lock
);
639 sub
->desc
.id
= SPLAT_SUBSYSTEM_RWLOCK
;
641 SPLAT_TEST_INIT(sub
, SPLAT_RWLOCK_TEST1_NAME
, SPLAT_RWLOCK_TEST1_DESC
,
642 SPLAT_RWLOCK_TEST1_ID
, splat_rwlock_test1
);
643 SPLAT_TEST_INIT(sub
, SPLAT_RWLOCK_TEST2_NAME
, SPLAT_RWLOCK_TEST2_DESC
,
644 SPLAT_RWLOCK_TEST2_ID
, splat_rwlock_test2
);
645 SPLAT_TEST_INIT(sub
, SPLAT_RWLOCK_TEST3_NAME
, SPLAT_RWLOCK_TEST3_DESC
,
646 SPLAT_RWLOCK_TEST3_ID
, splat_rwlock_test3
);
647 SPLAT_TEST_INIT(sub
, SPLAT_RWLOCK_TEST4_NAME
, SPLAT_RWLOCK_TEST4_DESC
,
648 SPLAT_RWLOCK_TEST4_ID
, splat_rwlock_test4
);
649 SPLAT_TEST_INIT(sub
, SPLAT_RWLOCK_TEST5_NAME
, SPLAT_RWLOCK_TEST5_DESC
,
650 SPLAT_RWLOCK_TEST5_ID
, splat_rwlock_test5
);
651 SPLAT_TEST_INIT(sub
, SPLAT_RWLOCK_TEST6_NAME
, SPLAT_RWLOCK_TEST6_DESC
,
652 SPLAT_RWLOCK_TEST6_ID
, splat_rwlock_test6
);
658 splat_rwlock_fini(splat_subsystem_t
*sub
)
661 SPLAT_TEST_FINI(sub
, SPLAT_RWLOCK_TEST6_ID
);
662 SPLAT_TEST_FINI(sub
, SPLAT_RWLOCK_TEST5_ID
);
663 SPLAT_TEST_FINI(sub
, SPLAT_RWLOCK_TEST4_ID
);
664 SPLAT_TEST_FINI(sub
, SPLAT_RWLOCK_TEST3_ID
);
665 SPLAT_TEST_FINI(sub
, SPLAT_RWLOCK_TEST2_ID
);
666 SPLAT_TEST_FINI(sub
, SPLAT_RWLOCK_TEST1_ID
);
671 splat_rwlock_id(void) {
672 return SPLAT_SUBSYSTEM_RWLOCK
;