Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

doc: CPU-hotplug notifiers cannot invoke synchronize_srcu() or srcu_barrier()

SRCU's synchronize_srcu() may not be invoked from CPU-hotplug notifiers,
due to the fact that SRCU grace periods make use of timers and the
possibility of timers being temporarily stranded on the outgoing CPU.
This stranding of timers means that timers posted to the outgoing CPU
will not fire until late in the CPU-hotplug process. The problem is
that if a notifier is waiting on an SRCU grace period, that grace period
is waiting on a timer, and that timer is stranded on the outgoing CPU,
then the notifier will never be awakened, in other words, deadlock has
occurred. This same situation of course also prohibits srcu_barrier()
from being invoked from CPU-hotplug notifiers.

This commit therefore updates the requirements to include this restriction.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>

+13 -7
+13 -7
Documentation/RCU/Design/Requirements/Requirements.html
··· 3099 3099 sections, then that domain's grace periods will also be blocked forever. 3100 3100 Of course, one good way to block forever is to deadlock, which can 3101 3101 happen if any operation in a given domain's SRCU read-side critical 3102 - section can block waiting, either directly or indirectly, for that domain's 3102 + section can wait, either directly or indirectly, for that domain's 3103 3103 grace period to elapse. 3104 3104 For example, this results in a self-deadlock: 3105 3105 ··· 3139 3139 guarantees a full memory barrier. 3140 3140 3141 3141 <p> 3142 - Also unlike other RCU flavors, SRCU's callbacks-wait function 3143 - <tt>srcu_barrier()</tt> may be invoked from CPU-hotplug notifiers, 3144 - though this is not necessarily a good idea. 3145 - The reason that this is possible is that SRCU is insensitive 3146 - to whether or not a CPU is online, which means that <tt>srcu_barrier()</tt> 3147 - need not exclude CPU-hotplug operations. 3142 + Also unlike other RCU flavors, <tt>synchronize_srcu()</tt> may <b>not</b> 3143 + be invoked from CPU-hotplug notifiers, due to the fact that SRCU grace 3144 + periods make use of timers and the possibility of timers being temporarily 3145 + &ldquo;stranded&rdquo; on the outgoing CPU. 3146 + This stranding of timers means that timers posted to the outgoing CPU 3147 + will not fire until late in the CPU-hotplug process. 3148 + The problem is that if a notifier is waiting on an SRCU grace period, 3149 + that grace period is waiting on a timer, and that timer is stranded on the 3150 + outgoing CPU, then the notifier will never be awakened, in other words, 3151 + deadlock has occurred. 3152 + This same situation of course also prohibits <tt>srcu_barrier()</tt> 3153 + from being invoked from CPU-hotplug notifiers. 3148 3154 3149 3155 <p> 3150 3156 SRCU also differs from other RCU flavors in that SRCU's expedited and