Sometimes, the kernel will boot too fast for rcu_tasks_verify_self_tests to have all required grace periods. Wait extra jiffies for rcu_tasks_verify_self_tests so as not to punish people who make Linux boot faster. Although 'wait extra jiffies' approach may slow down the Linux boot, but the CONFIG_PROVE_RCU option is only enabled for experts and for test only. I also considered temporarily reduce the gp_sleep and init_fract before rcu_tasks_verify_self_tests, but we can only guess those values from experience. Reported-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Suggested-by: Paul E. McKenney <paulmck@xxxxxxxxxx> Tested-by: Zhouyi Zhou <zhouzhouyi@xxxxxxxxx> Signed-off-by: Zhouyi Zhou <zhouzhouyi@xxxxxxxxx> --- kernel/rcu/tasks.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index bd9f2e24f5c7..b1be85da29ec 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1766,7 +1766,38 @@ static int rcu_tasks_verify_self_tests(void) { int ret = 0; int i; + int delay = 0; + + for (i = 0; i < ARRAY_SIZE(tests); i++) { + if (!tests[i].notrun) { // still hanging. + ret = -1; + } + } + + if (!ret) + return ret; + +#ifdef CONFIG_TASKS_RCU + delay = rcu_tasks.gp_sleep; + if (delay < rcu_tasks.init_fract) + delay = rcu_tasks.init_fract; +#endif + +#ifdef CONFIG_TASKS_RUDE_RCU + if (delay < rcu_tasks_rude.gp_sleep) + delay = rcu_tasks_rude.gp_sleep; +#endif + +#ifdef CONFIG_TASKS_TRACE_RCU + if (delay < rcu_tasks_trace.gp_sleep) + delay = rcu_tasks_trace.gp_sleep; + if (delay < rcu_tasks_trace.init_fract) + delay = rcu_tasks_trace.init_fract; +#endif + pr_info("wait extra %d jiffies for rcu tasks self tests\n", 2*delay); + schedule_timeout_uninterruptible(2*delay); + + ret = 0; for (i = 0; i < ARRAY_SIZE(tests); i++) { if (!tests[i].notrun) { // still hanging. -- 2.25.1