Commit 6efebf84 authored by Paul E. McKenney's avatar Paul E. McKenney

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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
parent 1a4762b9
...@@ -3099,7 +3099,7 @@ If you block forever in one of a given domain's SRCU read-side critical ...@@ -3099,7 +3099,7 @@ If you block forever in one of a given domain's SRCU read-side critical
sections, then that domain's grace periods will also be blocked forever. sections, then that domain's grace periods will also be blocked forever.
Of course, one good way to block forever is to deadlock, which can Of course, one good way to block forever is to deadlock, which can
happen if any operation in a given domain's SRCU read-side critical happen if any operation in a given domain's SRCU read-side critical
section can block waiting, either directly or indirectly, for that domain's section can wait, either directly or indirectly, for that domain's
grace period to elapse. grace period to elapse.
For example, this results in a self-deadlock: For example, this results in a self-deadlock:
...@@ -3139,12 +3139,18 @@ API, which, in combination with <tt>srcu_read_unlock()</tt>, ...@@ -3139,12 +3139,18 @@ API, which, in combination with <tt>srcu_read_unlock()</tt>,
guarantees a full memory barrier. guarantees a full memory barrier.
<p> <p>
Also unlike other RCU flavors, SRCU's callbacks-wait function Also unlike other RCU flavors, <tt>synchronize_srcu()</tt> may <b>not</b>
<tt>srcu_barrier()</tt> may be invoked from CPU-hotplug notifiers, be invoked from CPU-hotplug notifiers, due to the fact that SRCU grace
though this is not necessarily a good idea. periods make use of timers and the possibility of timers being temporarily
The reason that this is possible is that SRCU is insensitive &ldquo;stranded&rdquo; on the outgoing CPU.
to whether or not a CPU is online, which means that <tt>srcu_barrier()</tt> This stranding of timers means that timers posted to the outgoing CPU
need not exclude CPU-hotplug operations. 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 <tt>srcu_barrier()</tt>
from being invoked from CPU-hotplug notifiers.
<p> <p>
SRCU also differs from other RCU flavors in that SRCU's expedited and SRCU also differs from other RCU flavors in that SRCU's expedited and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment