History

rcu: Prevent RCU callbacks from executing before scheduler initialized

This is a port of commit #b0d3041 from TREE_RCU to TREE_PREEMPT_RCU. Under some rare but real combinations of configuration parameters, RCU callbacks are posted during early boot that use kernel facilities that are not yet initialized. Therefore, when these callbacks are invoked, hard hangs and crashes ensue. This commit therefore prevents RCU callbacks from being invoked until after the scheduler is fully up and running, as in after multiple tasks have been spawned. It might well turn out that a better approach is to identify the specific RCU callbacks that are causing this problem, but that discussion will wait until such time as someone really needs an RCU callback to be invoked (as opposed to merely registered) during early boot.

Paul E. McKenney committed 14 years ago

Commit 768dfff1 parent afef2052 files · +12 −7Browse files

Showing the changes to kernel (1 of 2 files). Show all

Unified · Split

kernel/rcutiny_plugin.h+12−3
@@ -914,7 +914,8 @@ static void rcu_preempt_process_callbacks(void) · 913 unmodified lines
914914 static void invoke_rcu_callbacks(void)
915915 {
916916 have_rcu_kthread_work = 1;
917− wake_up(&rcu_kthread_wq);
917+ if (rcu_kthread_task != NULL)
918+ wake_up(&rcu_kthread_wq);
918919 }
919920
920921 #ifdef CONFIG_RCU_TRACE
@@ -975,12 +976,16 @@ early_initcall(rcu_spawn_kthreads); · 54 unmodified lines
975976
976977 #else /* #ifdef CONFIG_RCU_BOOST */
977978
979+/* Hold off callback invocation until early_initcall() time. */
980+static int rcu_scheduler_fully_active __read_mostly;
981+
978982 /*
979983 * Start up softirq processing of callbacks.
980984 */
981985 void invoke_rcu_callbacks(void)
982986 {
983− raise_softirq(RCU_SOFTIRQ);
987+ if (rcu_scheduler_fully_active)
988+ raise_softirq(RCU_SOFTIRQ);
984989 }
985990
986991 #ifdef CONFIG_RCU_TRACE
@@ -995,10 +1000,14 @@ static bool rcu_is_callbacks_kthread(void) · 8 unmodified lines
9951000
9961001 #endif /* #ifdef CONFIG_RCU_TRACE */
9971002
998−void rcu_init(void)
1003+static int __init rcu_scheduler_really_started(void)
9991004 {
1005+ rcu_scheduler_fully_active = 1;
10001006 open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
1007+ raise_softirq(RCU_SOFTIRQ); /* Invoke any callbacks from early boot. */
1008+ return 0;
10011009 }
1010+early_initcall(rcu_scheduler_really_started);
10021011
10031012 #endif /* #else #ifdef CONFIG_RCU_BOOST */
10041013

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t