Skip to content

Commit 101db7b

Browse files
committed
rcu: Add rcutorture tests for srcu_read_lock_raw()
This commit adds simple rcutorture tests for srcu_read_lock_raw() and srcu_read_unlock_raw(). It does not test doing srcu_read_lock_raw() in an exception handler and releasing it in the corresponding process context. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent f220242 commit 101db7b

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

‎kernel/rcutorture.c‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,30 @@ static struct rcu_torture_ops srcu_ops = {
632632
.name = "srcu"
633633
};
634634

635+
static int srcu_torture_read_lock_raw(void) __acquires(&srcu_ctl)
636+
{
637+
return srcu_read_lock_raw(&srcu_ctl);
638+
}
639+
640+
static void srcu_torture_read_unlock_raw(int idx) __releases(&srcu_ctl)
641+
{
642+
srcu_read_unlock_raw(&srcu_ctl, idx);
643+
}
644+
645+
static struct rcu_torture_ops srcu_raw_ops = {
646+
.init = srcu_torture_init,
647+
.cleanup = srcu_torture_cleanup,
648+
.readlock = srcu_torture_read_lock_raw,
649+
.read_delay = srcu_read_delay,
650+
.readunlock = srcu_torture_read_unlock_raw,
651+
.completed = srcu_torture_completed,
652+
.deferred_free = rcu_sync_torture_deferred_free,
653+
.sync = srcu_torture_synchronize,
654+
.cb_barrier = NULL,
655+
.stats = srcu_torture_stats,
656+
.name = "srcu_raw"
657+
};
658+
635659
static void srcu_torture_synchronize_expedited(void)
636660
{
637661
synchronize_srcu_expedited(&srcu_ctl);
@@ -1591,7 +1615,7 @@ rcu_torture_init(void)
15911615
static struct rcu_torture_ops *torture_ops[] =
15921616
{ &rcu_ops, &rcu_sync_ops, &rcu_expedited_ops,
15931617
&rcu_bh_ops, &rcu_bh_sync_ops, &rcu_bh_expedited_ops,
1594-
&srcu_ops, &srcu_expedited_ops,
1618+
&srcu_ops, &srcu_raw_ops, &srcu_expedited_ops,
15951619
&sched_ops, &sched_sync_ops, &sched_expedited_ops, };
15961620

15971621
mutex_lock(&fullstop_mutex);

0 commit comments

Comments
 (0)