<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/kernel/rcu/tree_exp.h, branch v4.18</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Merge branches 'exp.2018.05.15a', 'fixes.2018.05.15a', 'lock.2018.05.15a' and 'torture.2018.05.15a' into HEAD</title>
<updated>2018-05-15T17:33:05+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2018-05-15T17:33:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=22df7316ac71dc1ac57415349938737d2a229c59'/>
<id>22df7316ac71dc1ac57415349938737d2a229c59</id>
<content type='text'>
exp.2018.05.15a: Parallelize expedited grace-period initialization.
fixes.2018.05.15a: Miscellaneous fixes.
lock.2018.05.15a: Decrease lock contention on root rcu_node structure,
	which is a step towards merging RCU flavors.
torture.2018.05.15a: Torture-test updates.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
exp.2018.05.15a: Parallelize expedited grace-period initialization.
fixes.2018.05.15a: Miscellaneous fixes.
lock.2018.05.15a: Decrease lock contention on root rcu_node structure,
	which is a step towards merging RCU flavors.
torture.2018.05.15a: Torture-test updates.
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Remove deprecated RCU debugfs tracing code</title>
<updated>2018-05-15T17:27:23+00:00</updated>
<author>
<name>Byungchul Park</name>
<email>byungchul.park@lge.com</email>
</author>
<published>2018-03-02T07:39:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6fba2b3767ea6e3e1204855031492415cc4dce4f'/>
<id>6fba2b3767ea6e3e1204855031492415cc4dce4f</id>
<content type='text'>
Commit ae91aa0adb14 ("rcu: Remove debugfs tracing") removed the
RCU debugfs tracing code, but did not remove the no-longer used
-&gt;exp_workdone{0,1,2,3} fields in the srcu_data structure.  This commit
therefore removes these fields along with the code that uselessly
updates them.

Signed-off-by: Byungchul Park &lt;byungchul.park@lge.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit ae91aa0adb14 ("rcu: Remove debugfs tracing") removed the
RCU debugfs tracing code, but did not remove the no-longer used
-&gt;exp_workdone{0,1,2,3} fields in the srcu_data structure.  This commit
therefore removes these fields along with the code that uselessly
updates them.

Signed-off-by: Byungchul Park &lt;byungchul.park@lge.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: exp: Protect all sync_rcu_preempt_exp_done() with rcu_node lock</title>
<updated>2018-05-15T17:26:07+00:00</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2018-03-09T01:14:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=55ebfce0605a4dce35467dfb1dc1b3ad26fe9f86'/>
<id>55ebfce0605a4dce35467dfb1dc1b3ad26fe9f86</id>
<content type='text'>
Currently some callsites of sync_rcu_preempt_exp_done() are not called
with the corresponding rcu_node's -&gt;lock held, which could introduces
bugs as per Paul:

o	CPU 0 in sync_rcu_preempt_exp_done() reads -&gt;exp_tasks and
	sees that it is NULL.

o	CPU 1 blocks within an RCU read-side critical section, so
	it enqueues the task and points -&gt;exp_tasks at it and
	clears CPU 1's bit in -&gt;expmask.

o	All other CPUs clear their bits in -&gt;expmask.

o	CPU 0 reads -&gt;expmask, sees that it is zero, so incorrectly
	concludes that all quiescent states have completed, despite
	the fact that -&gt;exp_tasks is non-NULL.

To fix this, sync_rcu_preempt_exp_unlocked() is introduced to replace
lockless callsites of sync_rcu_preempt_exp_done().

Further, a lockdep annotation is added into sync_rcu_preempt_exp_done()
to prevent mis-use in the future.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently some callsites of sync_rcu_preempt_exp_done() are not called
with the corresponding rcu_node's -&gt;lock held, which could introduces
bugs as per Paul:

o	CPU 0 in sync_rcu_preempt_exp_done() reads -&gt;exp_tasks and
	sees that it is NULL.

o	CPU 1 blocks within an RCU read-side critical section, so
	it enqueues the task and points -&gt;exp_tasks at it and
	clears CPU 1's bit in -&gt;expmask.

o	All other CPUs clear their bits in -&gt;expmask.

o	CPU 0 reads -&gt;expmask, sees that it is zero, so incorrectly
	concludes that all quiescent states have completed, despite
	the fact that -&gt;exp_tasks is non-NULL.

To fix this, sync_rcu_preempt_exp_unlocked() is introduced to replace
lockless callsites of sync_rcu_preempt_exp_done().

Further, a lockdep annotation is added into sync_rcu_preempt_exp_done()
to prevent mis-use in the future.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: exp: Fix "must hold exp_mutex" comments for QS reporting functions</title>
<updated>2018-05-15T17:26:01+00:00</updated>
<author>
<name>Boqun Feng</name>
<email>boqun.feng@gmail.com</email>
</author>
<published>2018-03-07T08:49:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7be8c56f8f8a58af92f8791c5a09d48e342d7101'/>
<id>7be8c56f8f8a58af92f8791c5a09d48e342d7101</id>
<content type='text'>
Since commit d9a3da0699b2 ("rcu: Add expedited grace-period support
for preemptible RCU"), there are comments for some funtions in
rcu_report_exp_rnp()'s call-chain saying that exp_mutex or its
predecessors needs to be held.

However, exp_mutex and its predecessors were used only to synchronize
between GPs, and it is clear that all variables visited by those functions
are under the protection of rcu_node's -&gt;lock. Moreover, those functions
are currently called without held exp_mutex, and seems that doesn't
introduce any trouble.

So this patch fixes this problem by updating the comments to match the
current code.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Fixes: d9a3da0699b2 ("rcu: Add expedited grace-period support for preemptible RCU")
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since commit d9a3da0699b2 ("rcu: Add expedited grace-period support
for preemptible RCU"), there are comments for some funtions in
rcu_report_exp_rnp()'s call-chain saying that exp_mutex or its
predecessors needs to be held.

However, exp_mutex and its predecessors were used only to synchronize
between GPs, and it is clear that all variables visited by those functions
are under the protection of rcu_node's -&gt;lock. Moreover, those functions
are currently called without held exp_mutex, and seems that doesn't
introduce any trouble.

So this patch fixes this problem by updating the comments to match the
current code.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Fixes: d9a3da0699b2 ("rcu: Add expedited grace-period support for preemptible RCU")
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Parallelize expedited grace-period initialization</title>
<updated>2018-05-15T17:25:44+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2018-02-02T06:05:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=25f3d7effab632eb10d145f1a5aebf6515a04b98'/>
<id>25f3d7effab632eb10d145f1a5aebf6515a04b98</id>
<content type='text'>
The latency of RCU expedited grace periods grows with increasing numbers
of CPUs, eventually failing to be all that expedited.  Much of the growth
in latency is in the initialization phase, so this commit uses workqueues
to carry out this initialization concurrently on a rcu_node-by-rcu_node
basis.

This change makes use of a new rcu_par_gp_wq because flushing a work
item from another work item running from the same workqueue can result
in deadlock.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The latency of RCU expedited grace periods grows with increasing numbers
of CPUs, eventually failing to be all that expedited.  Much of the growth
in latency is in the initialization phase, so this commit uses workqueues
to carry out this initialization concurrently on a rcu_node-by-rcu_node
basis.

This change makes use of a new rcu_par_gp_wq because flushing a work
item from another work item running from the same workqueue can result
in deadlock.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Create RCU-specific workqueues with rescuers</title>
<updated>2018-02-23T23:14:40+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2018-01-08T22:35:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=ad7c946b35ad455417fdd4bc0e17deda4011841b'/>
<id>ad7c946b35ad455417fdd4bc0e17deda4011841b</id>
<content type='text'>
RCU's expedited grace periods can participate in out-of-memory deadlocks
due to all available system_wq kthreads being blocked and there not being
memory available to create more.  This commit prevents such deadlocks
by allocating an RCU-specific workqueue_struct at early boot time, and
providing it with a rescuer to ensure forward progress.  This uses the
shiny new init_rescuer() function provided by Tejun (but indirectly).

This commit also causes SRCU to use this new RCU-specific
workqueue_struct.  Note that SRCU's use of workqueues never blocks them
waiting for readers, so this should be safe from a forward-progress
viewpoint.  Note that this moves SRCU from system_power_efficient_wq
to a normal workqueue.  In the unlikely event that this results in
measurable degradation, a separate power-efficient workqueue will be
creates for SRCU.

Reported-by: Prateek Sood &lt;prsood@codeaurora.org&gt;
Reported-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
RCU's expedited grace periods can participate in out-of-memory deadlocks
due to all available system_wq kthreads being blocked and there not being
memory available to create more.  This commit prevents such deadlocks
by allocating an RCU-specific workqueue_struct at early boot time, and
providing it with a rescuer to ensure forward progress.  This uses the
shiny new init_rescuer() function provided by Tejun (but indirectly).

This commit also causes SRCU to use this new RCU-specific
workqueue_struct.  Note that SRCU's use of workqueues never blocks them
waiting for readers, so this should be safe from a forward-progress
viewpoint.  Note that this moves SRCU from system_power_efficient_wq
to a normal workqueue.  In the unlikely event that this results in
measurable degradation, a separate power-efficient workqueue will be
creates for SRCU.

Reported-by: Prateek Sood &lt;prsood@codeaurora.org&gt;
Reported-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Make expedited RCU CPU selection avoid unnecessary stores</title>
<updated>2018-02-21T00:12:29+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2018-02-01T04:24:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=65963d246147c46aafda2b04523d6dbe6c457e7c'/>
<id>65963d246147c46aafda2b04523d6dbe6c457e7c</id>
<content type='text'>
This commit reworks the first loop in sync_rcu_exp_select_cpus()
to avoid doing unnecssary stores to other CPUs' rcu_data
structures.  This speeds up that first loop by roughly a factor of
two on an old x86 system.  In the case where the system is mostly
idle, this loop incurs a large fraction of the overhead of the
synchronize_rcu_expedited().  There is less benefit on busy systems
because the overhead of the smp_call_function_single() in the second
loop dominates in that case.

However, it is not unusual to do configuration chances involving
RCU grace periods (both expedited and normal) while the system is
mostly idle, so this optimization is worth doing.

While we are in the area, this commit also adds parentheses to arguments
used by the for_each_leaf_node_possible_cpu() macro.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit reworks the first loop in sync_rcu_exp_select_cpus()
to avoid doing unnecssary stores to other CPUs' rcu_data
structures.  This speeds up that first loop by roughly a factor of
two on an old x86 system.  In the case where the system is mostly
idle, this loop incurs a large fraction of the overhead of the
synchronize_rcu_expedited().  There is less benefit on busy systems
because the overhead of the smp_call_function_single() in the second
loop dominates in that case.

However, it is not unusual to do configuration chances involving
RCU grace periods (both expedited and normal) while the system is
mostly idle, so this optimization is worth doing.

While we are in the area, this commit also adds parentheses to arguments
used by the for_each_leaf_node_possible_cpu() macro.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Trace expedited GP delays due to transitioning CPUs</title>
<updated>2018-02-21T00:12:28+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2018-02-01T03:40:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7f5d42d05155523a4c42c2c5170f2a368217aed5'/>
<id>7f5d42d05155523a4c42c2c5170f2a368217aed5</id>
<content type='text'>
If a CPU is transitioning to or from offline state, an expedited
grace period may undergo a timed wait.  This timed wait can unduly
delay grace periods, so this commit adds a trace statement to make
it visible.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a CPU is transitioning to or from offline state, an expedited
grace period may undergo a timed wait.  This timed wait can unduly
delay grace periods, so this commit adds a trace statement to make
it visible.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Add more tracing of expedited grace periods</title>
<updated>2018-02-21T00:12:27+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2018-02-01T03:23:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9a414201ae7ea089699a0cbd36533345ca17233b'/>
<id>9a414201ae7ea089699a0cbd36533345ca17233b</id>
<content type='text'>
This commit adds more tracing of expedited grace periods to enable
improved debugging of slowdowns.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds more tracing of expedited grace periods to enable
improved debugging of slowdowns.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcu: Make expedited GPs correctly handle hardware CPU insertion</title>
<updated>2017-07-25T20:04:45+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2017-06-08T23:55:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=313517fc44fb2d8403654b2d3e511da7d1c78cd6'/>
<id>313517fc44fb2d8403654b2d3e511da7d1c78cd6</id>
<content type='text'>
The update of the -&gt;expmaskinitnext and of -&gt;ncpus are unsynchronized,
with the value of -&gt;ncpus being incremented long before the corresponding
-&gt;expmaskinitnext mask is updated.  If an RCU expedited grace period
sees -&gt;ncpus change, it will update the -&gt;expmaskinit masks from the new
-&gt;expmaskinitnext masks.  But it is possible that -&gt;ncpus has already
been updated, but the -&gt;expmaskinitnext masks still have their old values.
For the current expedited grace period, no harm done.  The CPU could not
have been online before the grace period started, so there is no need to
wait for its non-existent pre-existing readers.

But the next RCU expedited grace period is in a world of hurt.  The value
of -&gt;ncpus has already been updated, so this grace period will assume
that the -&gt;expmaskinitnext masks have not changed.  But they have, and
they won't be taken into account until the next never-been-online CPU
comes online.  This means that RCU will be ignoring some CPUs that it
should be paying attention to.

The solution is to update -&gt;ncpus and -&gt;expmaskinitnext while holding
the -&gt;lock for the rcu_node structure containing the -&gt;expmaskinitnext
mask.  Because smp_store_release() is now used to update -&gt;ncpus and
smp_load_acquire() is now used to locklessly read it, if the expedited
grace period sees -&gt;ncpus change, then the updating CPU has to
already be holding the corresponding -&gt;lock.  Therefore, when the
expedited grace period later acquires that -&gt;lock, it is guaranteed
to see the new value of -&gt;expmaskinitnext.

On the other hand, if the expedited grace period loads -&gt;ncpus just
before an update, earlier full memory barriers guarantee that
the incoming CPU isn't far enough along to be running any RCU readers.

This commit therefore makes the required change.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The update of the -&gt;expmaskinitnext and of -&gt;ncpus are unsynchronized,
with the value of -&gt;ncpus being incremented long before the corresponding
-&gt;expmaskinitnext mask is updated.  If an RCU expedited grace period
sees -&gt;ncpus change, it will update the -&gt;expmaskinit masks from the new
-&gt;expmaskinitnext masks.  But it is possible that -&gt;ncpus has already
been updated, but the -&gt;expmaskinitnext masks still have their old values.
For the current expedited grace period, no harm done.  The CPU could not
have been online before the grace period started, so there is no need to
wait for its non-existent pre-existing readers.

But the next RCU expedited grace period is in a world of hurt.  The value
of -&gt;ncpus has already been updated, so this grace period will assume
that the -&gt;expmaskinitnext masks have not changed.  But they have, and
they won't be taken into account until the next never-been-online CPU
comes online.  This means that RCU will be ignoring some CPUs that it
should be paying attention to.

The solution is to update -&gt;ncpus and -&gt;expmaskinitnext while holding
the -&gt;lock for the rcu_node structure containing the -&gt;expmaskinitnext
mask.  Because smp_store_release() is now used to update -&gt;ncpus and
smp_load_acquire() is now used to locklessly read it, if the expedited
grace period sees -&gt;ncpus change, then the updating CPU has to
already be holding the corresponding -&gt;lock.  Therefore, when the
expedited grace period later acquires that -&gt;lock, it is guaranteed
to see the new value of -&gt;expmaskinitnext.

On the other hand, if the expedited grace period loads -&gt;ncpus just
before an update, earlier full memory barriers guarantee that
the incoming CPU isn't far enough along to be running any RCU readers.

This commit therefore makes the required change.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
