From ede317202201d4b22bd1127e9b5bcd527c920dc8 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed, 10 Mar 2021 15:09:02 +0100
Subject: [PATCH 104/158] rcu: Delay RCU-selftests

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(-)

Index: linux-5.15.19-rt29/include/linux/rcupdate.h
===================================================================
@ linux-5.15.19-rt29/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);
Index: linux-5.15.19-rt29/init/main.c
===================================================================
--- linux-5.15.19-rt29.orig/init/main.c
+++ linux-5.15.19-rt29/init/main.c
@ linux-5.15.19-rt29/include/linux/rcupdate.h:1607 @ static noinline void __init kernel_init_
 
 	rcu_init_tasks_generic();
 	do_pre_smp_initcalls();
+	rcu_tasks_initiate_self_tests();
 	lockup_detector_init();
 
 	smp_init();
Index: linux-5.15.19-rt29/kernel/rcu/tasks.h
===================================================================
--- linux-5.15.19-rt29.orig/kernel/rcu/tasks.h
+++ linux-5.15.19-rt29/kernel/rcu/tasks.h
@ linux-5.15.19-rt29/include/linux/rcupdate.h:1350 @ 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
@ linux-5.15.19-rt29/include/linux/rcupdate.h:1387 @ 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)
 {
@ linux-5.15.19-rt29/include/linux/rcupdate.h:1402 @ 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 */