rcu: Provide diagnostic option to slow down grace-period initialization

Grace-period initialization normally proceeds quite quickly, so
that it is very difficult to reproduce races against grace-period
initialization.  This commit therefore allows grace-period
initialization to be artificially slowed down, increasing
race-reproduction probability.  A pair of new Kconfig parameters are
provided, CONFIG_RCU_TORTURE_TEST_SLOW_INIT to enable the slowdowns, and
CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY to specify the number of jiffies
of slowdown to apply.  A boot-time parameter named rcutree.gp_init_delay
allows boot-time delay to be specified.  By default, no delay will be
applied even if CONFIG_RCU_TORTURE_TEST_SLOW_INIT is set.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
このコミットが含まれているのは:
Paul E. McKenney
2015-01-22 18:24:08 -08:00
コミット 37745d2810
3個のファイルの変更40行の追加0行の削除

ファイルの表示

@@ -160,6 +160,12 @@ static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp);
static int kthread_prio = CONFIG_RCU_KTHREAD_PRIO;
module_param(kthread_prio, int, 0644);
/* Delay in jiffies for grace-period initialization delays. */
static int gp_init_delay = IS_ENABLED(CONFIG_RCU_TORTURE_TEST_SLOW_INIT)
? CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY
: 0;
module_param(gp_init_delay, int, 0644);
/*
* Track the rcutorture test sequence number and the update version
* number within a given test. The rcutorture_testseq is incremented
@@ -1769,6 +1775,10 @@ static int rcu_gp_init(struct rcu_state *rsp)
raw_spin_unlock_irq(&rnp->lock);
cond_resched_rcu_qs();
ACCESS_ONCE(rsp->gp_activity) = jiffies;
if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_SLOW_INIT) &&
gp_init_delay > 0 &&
!(rsp->gpnum % (rcu_num_nodes * 10)))
schedule_timeout_uninterruptible(gp_init_delay);
}
mutex_unlock(&rsp->onoff_mutex);