<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/Documentation/RCU, branch v3.2</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/Documentation/RCU?h=v3.2</id>
<link rel='self' href='https://git.amat.us/linux/atom/Documentation/RCU?h=v3.2'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2011-09-29T04:38:28Z</updated>
<entry>
<title>rcu: Document interpretation of RCU-lockdep splats</title>
<updated>2011-09-29T04:38:28Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2011-07-22T00:10:40Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d7bd2d68aa2ee2738a10c8ad9346b805e4ab2e1c'/>
<id>urn:sha1:d7bd2d68aa2ee2738a10c8ad9346b805e4ab2e1c</id>
<content type='text'>
There has been quite a bit of confusion about what RCU-lockdep splats
mean, so this commit adds some documentation describing how to
interpret them.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Update documentation for additional RCU lockdep functions</title>
<updated>2011-09-29T04:38:25Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2011-07-08T16:07:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8cd889cbb6dd13b47c2ea448a22c49c270ab94a2'/>
<id>urn:sha1:8cd889cbb6dd13b47c2ea448a22c49c270ab94a2</id>
<content type='text'>
Add documentation for rcu_dereference_bh_check(),
rcu_dereference_sched_check(), srcu_dereference_check(), and
rcu_dereference_index_check().

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Not necessary to pass rcu_read_lock_held() to rcu_dereference_protected()</title>
<updated>2011-09-29T04:38:23Z</updated>
<author>
<name>Michal Hocko</name>
<email>mhocko@suse.cz</email>
</author>
<published>2011-07-08T15:48:24Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e5177ec77d503636d0b609671c9d408b981add17'/>
<id>urn:sha1:e5177ec77d503636d0b609671c9d408b981add17</id>
<content type='text'>
Since ca5ecddf (rcu: define __rcu address space modifier for sparse)
rcu_dereference_check() use rcu_read_lock_held() as a part of condition
automatically.  Therefore, callers of rcu_dereference_check() no longer
need to pass rcu_read_lock_held() to rcu_dereference_check().

Signed-off-by: Michal Hocko &lt;mhocko@suse.cz&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Simplify quiescent-state accounting</title>
<updated>2011-09-29T04:38:22Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paul.mckenney@linaro.org</email>
</author>
<published>2011-06-27T07:17:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e4cc1f22b2f4e9b0207a8cdb63e56dcf99e82d35'/>
<id>urn:sha1:e4cc1f22b2f4e9b0207a8cdb63e56dcf99e82d35</id>
<content type='text'>
There is often a delay between the time that a CPU passes through a
quiescent state and the time that this quiescent state is reported to the
RCU core.  It is quite possible that the grace period ended before the
quiescent state could be reported, for example, some other CPU might have
deduced that this CPU passed through dyntick-idle mode.  It is critically
important that quiescent state be counted only against the grace period
that was in effect at the time that the quiescent state was detected.

Previously, this was handled by recording the number of the last grace
period to complete when passing through a quiescent state.  The RCU
core then checks this number against the current value, and rejects
the quiescent state if there is a mismatch.  However, one additional
possibility must be accounted for, namely that the quiescent state was
recorded after the prior grace period completed but before the current
grace period started.  In this case, the RCU core must reject the
quiescent state, but the recorded number will match.  This is handled
when the CPU becomes aware of a new grace period -- at that point,
it invalidates any prior quiescent state.

This works, but is a bit indirect.  The new approach records the current
grace period, and the RCU core checks to see (1) that this is still the
current grace period and (2) that this grace period has not yet ended.
This approach simplifies reasoning about correctness, and this commit
changes over to this new approach.

Signed-off-by: Paul E. McKenney &lt;paul.mckenney@linaro.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Fix RCU's NMI documentation</title>
<updated>2011-09-29T04:36:44Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2011-06-08T00:05:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b15a2e7d16cc6f6082d8c6a85349e48588763ffc'/>
<id>urn:sha1:b15a2e7d16cc6f6082d8c6a85349e48588763ffc</id>
<content type='text'>
It has long been the case that the architecture must call nmi_enter()
and nmi_exit() rather than irq_enter() and irq_exit() in order to
permit RCU read-side critical sections in NMIs.  Catch the documentation
up with reality.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
</content>
</entry>
<entry>
<title>rcu: Catch rcutorture up to new RCU API additions</title>
<updated>2011-09-29T04:36:43Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2011-06-07T23:59:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bdf2a4364904d6cf2f59b16b0bd86fdc5a2c6152'/>
<id>urn:sha1:bdf2a4364904d6cf2f59b16b0bd86fdc5a2c6152</id>
<content type='text'>
Now that the RCU API contains synchronize_rcu_bh(), synchronize_sched(),
call_rcu_sched(), and rcu_bh_expedited()...

Make rcutorture test synchronize_rcu_bh(), getting rid of the old
rcu_bh_torture_synchronize() workaround.  Similarly, make rcutorture test
synchronize_sched(), getting rid of the old sched_torture_synchronize()
workaround.  Make rcutorture test call_rcu_sched() instead of wrappering
synchronize_sched().  Also add testing of rcu_bh_expedited().

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Update rcutorture documentation</title>
<updated>2011-09-29T04:36:39Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paul.mckenney@linaro.org</email>
</author>
<published>2011-06-05T17:07:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=63cd758e07743b71ed76ba7db7f93986a7591a65'/>
<id>urn:sha1:63cd758e07743b71ed76ba7db7f93986a7591a65</id>
<content type='text'>
Update rcutorture documentation to account for boosting, new types of
RCU torture testing that have been added over the past few years, and
the memory-barrier testing that was added an embarrassingly long time
ago.

Signed-off-by: Paul E. McKenney &lt;paul.mckenney@linaro.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Update documentation to flag RCU_BOOST trace information</title>
<updated>2011-09-29T04:36:35Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paul.mckenney@linaro.org</email>
</author>
<published>2011-06-16T06:07:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d5988af53102f3b73e5e0788be024ccfa51869de'/>
<id>urn:sha1:d5988af53102f3b73e5e0788be024ccfa51869de</id>
<content type='text'>
Call out the RCU_TRACE information that is provided only in kernels
built with RCU_BOOST.

Signed-off-by: Paul E. McKenney &lt;paul.mckenney@linaro.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>doc: fix wrong arch/i386 references</title>
<updated>2011-06-13T11:43:05Z</updated>
<author>
<name>Wanlong Gao</name>
<email>wanlong.gao@gmail.com</email>
</author>
<published>2011-06-13T09:53:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=25eb650a690b95cb0e2cf0c3b03f4900a59e0135'/>
<id>urn:sha1:25eb650a690b95cb0e2cf0c3b03f4900a59e0135</id>
<content type='text'>
Change all "arch/i386" to "arch/x86" in Documentaion/,
since the directory has changed.

Also update the files which have changed their filename
in the meantime accordingly.

Signed-off-by: Wanlong Gao &lt;wanlong.gao@gmail.com&gt;
[jkosina@suse.cz: reword changelog]
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>rcu: Decrease memory-barrier usage based on semi-formal proof</title>
<updated>2011-05-26T16:42:23Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2010-09-07T17:38:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=23b5c8fa01b723c70a20d6e4ef4ff54c7656d6e1'/>
<id>urn:sha1:23b5c8fa01b723c70a20d6e4ef4ff54c7656d6e1</id>
<content type='text'>
(Note: this was reverted, and is now being re-applied in pieces, with
this being the fifth and final piece.  See below for the reason that
it is now felt to be safe to re-apply this.)

Commit d09b62d fixed grace-period synchronization, but left some smp_mb()
invocations in rcu_process_callbacks() that are no longer needed, but
sheer paranoia prevented them from being removed.  This commit removes
them and provides a proof of correctness in their absence.  It also adds
a memory barrier to rcu_report_qs_rsp() immediately before the update to
rsp-&gt;completed in order to handle the theoretical possibility that the
compiler or CPU might move massive quantities of code into a lock-based
critical section.  This also proves that the sheer paranoia was not
entirely unjustified, at least from a theoretical point of view.

In addition, the old dyntick-idle synchronization depended on the fact
that grace periods were many milliseconds in duration, so that it could
be assumed that no dyntick-idle CPU could reorder a memory reference
across an entire grace period.  Unfortunately for this design, the
addition of expedited grace periods breaks this assumption, which has
the unfortunate side-effect of requiring atomic operations in the
functions that track dyntick-idle state for RCU.  (There is some hope
that the algorithms used in user-level RCU might be applied here, but
some work is required to handle the NMIs that user-space applications
can happily ignore.  For the short term, better safe than sorry.)

This proof assumes that neither compiler nor CPU will allow a lock
acquisition and release to be reordered, as doing so can result in
deadlock.  The proof is as follows:

1.	A given CPU declares a quiescent state under the protection of
	its leaf rcu_node's lock.

2.	If there is more than one level of rcu_node hierarchy, the
	last CPU to declare a quiescent state will also acquire the
	-&gt;lock of the next rcu_node up in the hierarchy,  but only
	after releasing the lower level's lock.  The acquisition of this
	lock clearly cannot occur prior to the acquisition of the leaf
	node's lock.

3.	Step 2 repeats until we reach the root rcu_node structure.
	Please note again that only one lock is held at a time through
	this process.  The acquisition of the root rcu_node's -&gt;lock
	must occur after the release of that of the leaf rcu_node.

4.	At this point, we set the -&gt;completed field in the rcu_state
	structure in rcu_report_qs_rsp().  However, if the rcu_node
	hierarchy contains only one rcu_node, then in theory the code
	preceding the quiescent state could leak into the critical
	section.  We therefore precede the update of -&gt;completed with a
	memory barrier.  All CPUs will therefore agree that any updates
	preceding any report of a quiescent state will have happened
	before the update of -&gt;completed.

5.	Regardless of whether a new grace period is needed, rcu_start_gp()
	will propagate the new value of -&gt;completed to all of the leaf
	rcu_node structures, under the protection of each rcu_node's -&gt;lock.
	If a new grace period is needed immediately, this propagation
	will occur in the same critical section that -&gt;completed was
	set in, but courtesy of the memory barrier in #4 above, is still
	seen to follow any pre-quiescent-state activity.

6.	When a given CPU invokes __rcu_process_gp_end(), it becomes
	aware of the end of the old grace period and therefore makes
	any RCU callbacks that were waiting on that grace period eligible
	for invocation.

	If this CPU is the same one that detected the end of the grace
	period, and if there is but a single rcu_node in the hierarchy,
	we will still be in the single critical section.  In this case,
	the memory barrier in step #4 guarantees that all callbacks will
	be seen to execute after each CPU's quiescent state.

	On the other hand, if this is a different CPU, it will acquire
	the leaf rcu_node's -&gt;lock, and will again be serialized after
	each CPU's quiescent state for the old grace period.

On the strength of this proof, this commit therefore removes the memory
barriers from rcu_process_callbacks() and adds one to rcu_report_qs_rsp().
The effect is to reduce the number of memory barriers by one and to
reduce the frequency of execution from about once per scheduling tick
per CPU to once per grace period.

This was reverted do to hangs found during testing by Yinghai Lu and
Ingo Molnar.  Frederic Weisbecker supplied Yinghai with tracing that
located the underlying problem, and Frederic also provided the fix.

The underlying problem was that the HARDIRQ_ENTER() macro from
lib/locking-selftest.c invoked irq_enter(), which in turn invokes
rcu_irq_enter(), but HARDIRQ_EXIT() invoked __irq_exit(), which
does not invoke rcu_irq_exit().  This situation resulted in calls
to rcu_irq_enter() that were not balanced by the required calls to
rcu_irq_exit().  Therefore, after these locking selftests completed,
RCU's dyntick-idle nesting count was a large number (for example,
72), which caused RCU to to conclude that the affected CPU was not in
dyntick-idle mode when in fact it was.

RCU would therefore incorrectly wait for this dyntick-idle CPU, resulting
in hangs.

In contrast, with Frederic's patch, which replaces the irq_enter()
in HARDIRQ_ENTER() with an __irq_enter(), these tests don't ever call
either rcu_irq_enter() or rcu_irq_exit(), which works because the CPU
running the test is already marked as not being in dyntick-idle mode.
This means that the rcu_irq_enter() and rcu_irq_exit() calls and RCU
then has no problem working out which CPUs are in dyntick-idle mode and
which are not.

The reason that the imbalance was not noticed before the barrier patch
was applied is that the old implementation of rcu_enter_nohz() ignored
the nesting depth.  This could still result in delays, but much shorter
ones.  Whenever there was a delay, RCU would IPI the CPU with the
unbalanced nesting level, which would eventually result in rcu_enter_nohz()
being called, which in turn would force RCU to see that the CPU was in
dyntick-idle mode.

The reason that very few people noticed the problem is that the mismatched
irq_enter() vs. __irq_exit() occured only when the kernel was built with
CONFIG_DEBUG_LOCKING_API_SELFTESTS.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Reviewed-by: Josh Triplett &lt;josh@joshtriplett.org&gt;
</content>
</entry>
</feed>
