rcu: Narrow early boot window of illegal synchronous grace periods

The current preemptible RCU implementation goes through three phases
during bootup.  In the first phase, there is only one CPU that is
running with preemption disabled, so that a no-op is a synchronous
grace period.  In the second phase, the scheduler is running, but
RCU has not yet gotten its kthreads spawned (and, for expedited grace
periods, workqueues are not yet running.  During this time, any
attempt to do a synchronous grace period will hang the system (or
complain bitterly, depending).  In the third and final phase, RCU
is fully operational and everything works normally.

This has been OK for some time, but there has recently been some
synchronous grace periods showing up during the second dead-zone
phase.  This commit therefore narrows the second phase.

As soon as kthreads can be spawned, expedited grace period kthreads are
created, and normal grace periods are unconditionally mapped to expedited
grace periods.  These kthreads are stopped once RCU is fully
operational.  Expedited grace periods then go back to using workqueues,
and, if other settings permit, normal grace periods are enabled.

Reported-by: "Zheng, Lv" <lv.zheng@intel.com>
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
7 files changed