Commit c1a76c0b authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

rcutorture: Add torture tests for RCU Tasks Trace



This commit adds the definitions required to torture the tracing flavor
of RCU tasks.

Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent d5f177d3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ config RCU_PERF_TEST
	select SRCU
	select TASKS_RCU
	select TASKS_RUDE_RCU
	select TASKS_TRACE_RCU
	default n
	help
	  This option provides a kernel module that runs performance
@@ -48,6 +49,7 @@ config RCU_TORTURE_TEST
	select SRCU
	select TASKS_RCU
	select TASKS_RUDE_RCU
	select TASKS_TRACE_RCU
	default n
	help
	  This option provides a kernel module that runs torture tests
+1 −0
Original line number Diff line number Diff line
@@ -442,6 +442,7 @@ enum rcutorture_type {
	RCU_FLAVOR,
	RCU_TASKS_FLAVOR,
	RCU_TASKS_RUDE_FLAVOR,
	RCU_TASKS_TRACING_FLAVOR,
	RCU_TRIVIAL_FLAVOR,
	SRCU_FLAVOR,
	INVALID_RCU_FLAVOR
+43 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include <linux/sched/sysctl.h>
#include <linux/oom.h>
#include <linux/tick.h>
#include <linux/rcupdate_trace.h>

#include "rcu.h"

@@ -757,6 +758,45 @@ static struct rcu_torture_ops tasks_rude_ops = {
	.name		= "tasks-rude"
};

/*
 * Definitions for tracing RCU-tasks torture testing.
 */

static int tasks_tracing_torture_read_lock(void)
{
	rcu_read_lock_trace();
	return 0;
}

static void tasks_tracing_torture_read_unlock(int idx)
{
	rcu_read_unlock_trace();
}

static void rcu_tasks_tracing_torture_deferred_free(struct rcu_torture *p)
{
	call_rcu_tasks_trace(&p->rtort_rcu, rcu_torture_cb);
}

static struct rcu_torture_ops tasks_tracing_ops = {
	.ttype		= RCU_TASKS_TRACING_FLAVOR,
	.init		= rcu_sync_torture_init,
	.readlock	= tasks_tracing_torture_read_lock,
	.read_delay	= srcu_read_delay,  /* just reuse srcu's version. */
	.readunlock	= tasks_tracing_torture_read_unlock,
	.get_gp_seq	= rcu_no_completed,
	.deferred_free	= rcu_tasks_tracing_torture_deferred_free,
	.sync		= synchronize_rcu_tasks_trace,
	.exp_sync	= synchronize_rcu_tasks_trace,
	.call		= call_rcu_tasks_trace,
	.cb_barrier	= rcu_barrier_tasks_trace,
	.fqs		= NULL,
	.stats		= NULL,
	.irq_capable	= 1,
	.slow_gps	= 1,
	.name		= "tasks-tracing"
};

static unsigned long rcutorture_seq_diff(unsigned long new, unsigned long old)
{
	if (!cur_ops->gp_diff)
@@ -1323,6 +1363,7 @@ static bool rcu_torture_one_read(struct torture_random_state *trsp)
				  rcu_read_lock_bh_held() ||
				  rcu_read_lock_sched_held() ||
				  srcu_read_lock_held(srcu_ctlp) ||
				  rcu_read_lock_trace_held() ||
				  torturing_tasks());
	if (p == NULL) {
		/* Wait for rcu_torture_writer to get underway */
@@ -2440,7 +2481,8 @@ rcu_torture_init(void)
	int firsterr = 0;
	static struct rcu_torture_ops *torture_ops[] = {
		&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops,
		&busted_srcud_ops, &tasks_ops, &tasks_rude_ops, &trivial_ops,
		&busted_srcud_ops, &tasks_ops, &tasks_rude_ops,
		&tasks_tracing_ops, &trivial_ops,
	};

	if (!torture_init_begin(torture_type, verbose))
+1 −0
Original line number Diff line number Diff line
@@ -15,3 +15,4 @@ TASKS01
TASKS02
TASKS03
RUDE01
TRACE01
+10 −0
Original line number Diff line number Diff line
CONFIG_SMP=y
CONFIG_NR_CPUS=4
CONFIG_HOTPLUG_CPU=y
CONFIG_PREEMPT_NONE=y
CONFIG_PREEMPT_VOLUNTARY=n
CONFIG_PREEMPT=n
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
#CHECK#CONFIG_PROVE_RCU=y
CONFIG_RCU_EXPERT=y
Loading