Subject: rcu: Delay RCU-selftests
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed Mar 10 15:09:02 2021 +0100

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Delay RCU-selftests until ksoftirqd is up and running.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 include/linux/rcupdate.h |    7 +++++++
 init/main.c              |    1 +
 kernel/rcu/tasks.h       |    9 ++-------
 3 files changed, 10 insertions(+), 7 deletions(-)
---
@ include/linux/rcupdate.h:97 @ void rcu_init_tasks_generic(void);
 static inline void rcu_init_tasks_generic(void) { }
 #endif
 
+#if defined(CONFIG_PROVE_RCU) && defined(CONFIG_TASKS_RCU_GENERIC)
+void rcu_tasks_initiate_self_tests(void);
+#else
+static inline void rcu_tasks_initiate_self_tests(void) {}
+#endif
+
+
 #ifdef CONFIG_RCU_STALL_COMMON
 void rcu_sysrq_start(void);
 void rcu_sysrq_end(void);
--- a/init/main.c
+++ b/init/main.c
@ include/linux/rcupdate.h:1605 @ static noinline void __init kernel_init_
 
 	rcu_init_tasks_generic();
 	do_pre_smp_initcalls();
+	rcu_tasks_initiate_self_tests();
 	lockup_detector_init();
 
 	smp_init();
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@ include/linux/rcupdate.h:1351 @ static void test_rcu_tasks_callback(stru
 	rttd->notrun = true;
 }
 
-static void rcu_tasks_initiate_self_tests(void)
+void rcu_tasks_initiate_self_tests(void)
 {
 	pr_info("Running RCU-tasks wait API self tests\n");
 #ifdef CONFIG_TASKS_RCU
@ include/linux/rcupdate.h:1388 @ static int rcu_tasks_verify_self_tests(v
 	return ret;
 }
 late_initcall(rcu_tasks_verify_self_tests);
-#else /* #ifdef CONFIG_PROVE_RCU */
-static void rcu_tasks_initiate_self_tests(void) { }
-#endif /* #else #ifdef CONFIG_PROVE_RCU */
+#endif /* #ifdef CONFIG_PROVE_RCU */
 
 void __init rcu_init_tasks_generic(void)
 {
@ include/linux/rcupdate.h:1403 @ void __init rcu_init_tasks_generic(void)
 #ifdef CONFIG_TASKS_TRACE_RCU
 	rcu_spawn_tasks_trace_kthread();
 #endif
-
-	// Run the self-tests.
-	rcu_tasks_initiate_self_tests();
 }
 
 #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */