aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/tree.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-01-22 21:24:08 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-03-11 16:22:38 -0400
commit37745d281069682d901f00c0121949a7d224195f (patch)
tree0c15fd487faa046a257336b4205572b066873ca7 /kernel/rcu/tree.c
parent237a0f2193c6daf9b1edd7fd15d55e680f268952 (diff)
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>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r--kernel/rcu/tree.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 3b7e4133ca99..b42001fd55fb 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -160,6 +160,12 @@ static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp);
160static int kthread_prio = CONFIG_RCU_KTHREAD_PRIO; 160static int kthread_prio = CONFIG_RCU_KTHREAD_PRIO;
161module_param(kthread_prio, int, 0644); 161module_param(kthread_prio, int, 0644);
162 162
163/* Delay in jiffies for grace-period initialization delays. */
164static int gp_init_delay = IS_ENABLED(CONFIG_RCU_TORTURE_TEST_SLOW_INIT)
165 ? CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY
166 : 0;
167module_param(gp_init_delay, int, 0644);
168
163/* 169/*
164 * Track the rcutorture test sequence number and the update version 170 * Track the rcutorture test sequence number and the update version
165 * number within a given test. The rcutorture_testseq is incremented 171 * number within a given test. The rcutorture_testseq is incremented
@@ -1769,6 +1775,10 @@ static int rcu_gp_init(struct rcu_state *rsp)
1769 raw_spin_unlock_irq(&rnp->lock); 1775 raw_spin_unlock_irq(&rnp->lock);
1770 cond_resched_rcu_qs(); 1776 cond_resched_rcu_qs();
1771 ACCESS_ONCE(rsp->gp_activity) = jiffies; 1777 ACCESS_ONCE(rsp->gp_activity) = jiffies;
1778 if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_SLOW_INIT) &&
1779 gp_init_delay > 0 &&
1780 !(rsp->gpnum % (rcu_num_nodes * 10)))
1781 schedule_timeout_uninterruptible(gp_init_delay);
1772 } 1782 }
1773 1783
1774 mutex_unlock(&rsp->onoff_mutex); 1784 mutex_unlock(&rsp->onoff_mutex);