Re: PROBLEM: 3.0-rc kernels unbootable since -rc3

Paul E. McKenney
2011-07-10T23:15:06Z

On Sun, Jul 10, 2011 at 10:50:48PM +0100, julie Sullivan wrote:
> > Very cool!  Thank you very much for the testing --
>
> My pleasure
>
> > I will put together an
> > upstreamable commit with your Tested-by.

And here is what I am proposing sending upstream. I have your Tested-by,
but had to make a small but very real change in order to make it work
under all configurations that I test under. So could you please try
the attached patch out? I am particularly interested in how it works
out when CONFIG_RCU_BOOST=n.

Thanx, Paul

------------------------------------------------------------------------

rcu: Prevent RCU callbacks from executing during early boot

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 up and running.

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 during early boot.

Reported-by: julie Sullivan <kernelmail.jms@gmail.com>
Tested-by: julie Sullivan <kernelmail.jms@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 7e59ffb..4c0210f 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1467,7 +1467,7 @@ static void rcu_process_callbacks(struct softirq_action *unused)
*/
static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
{
- if (likely(!rsp->boost)) {
+ if (likely(rcu_scheduler_active && !rsp->boost)) {
rcu_do_batch(rsp, rdp);
return;
}
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 14dc7dd..ca3c6dc 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -1703,7 +1703,7 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags)

static void invoke_rcu_callbacks_kthread(void)
{
- WARN_ON_ONCE(1);
+ WARN_ON_ONCE(rcu_scheduler_active);
}

static void rcu_preempt_boost_start_gp(struct rcu_node *rnp)