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

Unified · Split

2 files
  1. include/linux/rcutiny.h +0 −4
  2. kernel/rcutiny_plugin.h +12 −3
include/linux/rcutiny.h+0−4
@@ -27,13 +27,9 @@ · 26 unmodified lines
27 27
28#include <linux/cache.h>28#include <linux/cache.h>
29 29
30#ifdef CONFIG_RCU_BOOST
31static inline void rcu_init(void)30static inline void rcu_init(void)
32{31{
33}32}
34#else /* #ifdef CONFIG_RCU_BOOST */
35void rcu_init(void);
36#endif /* #else #ifdef CONFIG_RCU_BOOST */
37 33
38static inline void rcu_barrier_bh(void)34static inline void rcu_barrier_bh(void)
39{35{
kernel/rcutiny_plugin.h+12−3
@@ -914,7 +914,8 @@ static void rcu_preempt_process_callbacks(void) · 913 unmodified lines
914static void invoke_rcu_callbacks(void)914static void invoke_rcu_callbacks(void)
915{915{
916 have_rcu_kthread_work = 1;916 have_rcu_kthread_work = 1;
917 wake_up(&rcu_kthread_wq);917 if (rcu_kthread_task != NULL)
918 wake_up(&rcu_kthread_wq);
918}919}
919 920
920#ifdef CONFIG_RCU_TRACE921#ifdef CONFIG_RCU_TRACE
@@ -975,12 +976,16 @@ early_initcall(rcu_spawn_kthreads); · 54 unmodified lines
975 976
976#else /* #ifdef CONFIG_RCU_BOOST */977#else /* #ifdef CONFIG_RCU_BOOST */
977 978
979/* Hold off callback invocation until early_initcall() time. */
980static int rcu_scheduler_fully_active __read_mostly;
981
978/*982/*
979 * Start up softirq processing of callbacks.983 * Start up softirq processing of callbacks.
980 */984 */
981void invoke_rcu_callbacks(void)985void invoke_rcu_callbacks(void)
982{986{
983 raise_softirq(RCU_SOFTIRQ);987 if (rcu_scheduler_fully_active)
988 raise_softirq(RCU_SOFTIRQ);
984}989}
985 990
986#ifdef CONFIG_RCU_TRACE991#ifdef CONFIG_RCU_TRACE
@@ -995,10 +1000,14 @@ static bool rcu_is_callbacks_kthread(void) · 8 unmodified lines
995 1000
996#endif /* #ifdef CONFIG_RCU_TRACE */1001#endif /* #ifdef CONFIG_RCU_TRACE */
997 1002
998void rcu_init(void)1003static int __init rcu_scheduler_really_started(void)
999{1004{
1005 rcu_scheduler_fully_active = 1;
1000 open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);1006 open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
1007 raise_softirq(RCU_SOFTIRQ); /* Invoke any callbacks from early boot. */
1008 return 0;
1001}1009}
1010early_initcall(rcu_scheduler_really_started);
1002 1011
1003#endif /* #else #ifdef CONFIG_RCU_BOOST */1012#endif /* #else #ifdef CONFIG_RCU_BOOST */
1004 1013

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