Skip to content

Commit 3d6e43c

Browse files
committed
rcutorture: Add torture tests for RCU Tasks Rude
This commit adds the definitions required to torture the rude flavor of RCU tasks. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent c84aad7 commit 3d6e43c

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

kernel/rcu/Kconfig.debug

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ config RCU_PERF_TEST
2929
select TORTURE_TEST
3030
select SRCU
3131
select TASKS_RCU
32+
select TASKS_RUDE_RCU
3233
default n
3334
help
3435
This option provides a kernel module that runs performance
@@ -46,6 +47,7 @@ config RCU_TORTURE_TEST
4647
select TORTURE_TEST
4748
select SRCU
4849
select TASKS_RCU
50+
select TASKS_RUDE_RCU
4951
default n
5052
help
5153
This option provides a kernel module that runs torture tests

kernel/rcu/rcu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ void rcu_request_urgent_qs_task(struct task_struct *t);
441441
enum rcutorture_type {
442442
RCU_FLAVOR,
443443
RCU_TASKS_FLAVOR,
444+
RCU_TASKS_RUDE_FLAVOR,
444445
RCU_TRIVIAL_FLAVOR,
445446
SRCU_FLAVOR,
446447
INVALID_RCU_FLAVOR

kernel/rcu/rcutorture.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,33 @@ static struct rcu_torture_ops trivial_ops = {
730730
.name = "trivial"
731731
};
732732

733+
/*
734+
* Definitions for rude RCU-tasks torture testing.
735+
*/
736+
737+
static void rcu_tasks_rude_torture_deferred_free(struct rcu_torture *p)
738+
{
739+
call_rcu_tasks_rude(&p->rtort_rcu, rcu_torture_cb);
740+
}
741+
742+
static struct rcu_torture_ops tasks_rude_ops = {
743+
.ttype = RCU_TASKS_RUDE_FLAVOR,
744+
.init = rcu_sync_torture_init,
745+
.readlock = rcu_torture_read_lock_trivial,
746+
.read_delay = rcu_read_delay, /* just reuse rcu's version. */
747+
.readunlock = rcu_torture_read_unlock_trivial,
748+
.get_gp_seq = rcu_no_completed,
749+
.deferred_free = rcu_tasks_rude_torture_deferred_free,
750+
.sync = synchronize_rcu_tasks_rude,
751+
.exp_sync = synchronize_rcu_tasks_rude,
752+
.call = call_rcu_tasks_rude,
753+
.cb_barrier = rcu_barrier_tasks_rude,
754+
.fqs = NULL,
755+
.stats = NULL,
756+
.irq_capable = 1,
757+
.name = "tasks-rude"
758+
};
759+
733760
static unsigned long rcutorture_seq_diff(unsigned long new, unsigned long old)
734761
{
735762
if (!cur_ops->gp_diff)
@@ -739,7 +766,7 @@ static unsigned long rcutorture_seq_diff(unsigned long new, unsigned long old)
739766

740767
static bool __maybe_unused torturing_tasks(void)
741768
{
742-
return cur_ops == &tasks_ops;
769+
return cur_ops == &tasks_ops || cur_ops == &tasks_rude_ops;
743770
}
744771

745772
/*
@@ -2413,7 +2440,7 @@ rcu_torture_init(void)
24132440
int firsterr = 0;
24142441
static struct rcu_torture_ops *torture_ops[] = {
24152442
&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops,
2416-
&busted_srcud_ops, &tasks_ops, &trivial_ops,
2443+
&busted_srcud_ops, &tasks_ops, &tasks_rude_ops, &trivial_ops,
24172444
};
24182445

24192446
if (!torture_init_begin(torture_type, verbose))

tools/testing/selftests/rcutorture/configs/rcu/CFLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ TINY02
1414
TASKS01
1515
TASKS02
1616
TASKS03
17+
RUDE01
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONFIG_SMP=y
2+
CONFIG_NR_CPUS=2
3+
CONFIG_HOTPLUG_CPU=y
4+
CONFIG_PREEMPT_NONE=n
5+
CONFIG_PREEMPT_VOLUNTARY=n
6+
CONFIG_PREEMPT=y
7+
CONFIG_DEBUG_LOCK_ALLOC=y
8+
CONFIG_PROVE_LOCKING=y
9+
#CHECK#CONFIG_PROVE_RCU=y
10+
CONFIG_RCU_EXPERT=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rcutorture.torture_type=tasks-rude

0 commit comments

Comments
 (0)