<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/rcu/tree.c, branch linux-5.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-04-17T14:12:03Z</updated>
<entry>
<title>rcu: Make rcu_barrier() account for offline no-CBs CPUs</title>
<updated>2020-04-17T14:12:03Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-02-11T14:17:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=395d7759806ce7502441b77b0dda45a14ef1a004'/>
<id>urn:sha1:395d7759806ce7502441b77b0dda45a14ef1a004</id>
<content type='text'>
commit 127e29815b4b2206c0a97ac1d83f92ffc0e25c34 upstream.

Currently, rcu_barrier() ignores offline CPUs,  However, it is possible
for an offline no-CBs CPU to have callbacks queued, and rcu_barrier()
must wait for those callbacks.  This commit therefore makes rcu_barrier()
directly invoke the rcu_barrier_func() with interrupts disabled for such
CPUs.  This requires passing the CPU number into this function so that
it can entrain the rcu_barrier() callback onto the correct CPU's callback
list, given that the code must instead execute on the current CPU.

While in the area, this commit fixes a bug where the first CPU's callback
might have been invoked before rcu_segcblist_entrain() returned, which
would also result in an early wakeup.

Fixes: 5d6742b37727 ("rcu/nocb: Use rcu_segcblist for no-CBs CPUs")
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
[ paulmck: Apply optimization feedback from Boqun Feng. ]
Cc: &lt;stable@vger.kernel.org&gt; # 5.5.x
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>rcu: Fix data-race due to atomic_t copy-by-value</title>
<updated>2020-02-24T07:38:00Z</updated>
<author>
<name>Marco Elver</name>
</author>
<published>2019-10-09T15:57:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=708d5ca30ff954393c7d934b415238c85bef8942'/>
<id>urn:sha1:708d5ca30ff954393c7d934b415238c85bef8942</id>
<content type='text'>
[ Upstream commit 6cf539a87a61a4fbc43f625267dbcbcf283872ed ]

This fixes a data-race where `atomic_t dynticks` is copied by value. The
copy is performed non-atomically, resulting in a data-race if `dynticks`
is updated concurrently.

This data-race was found with KCSAN:
==================================================================
BUG: KCSAN: data-race in dyntick_save_progress_counter / rcu_irq_enter

write to 0xffff989dbdbe98e0 of 4 bytes by task 10 on cpu 3:
 atomic_add_return include/asm-generic/atomic-instrumented.h:78 [inline]
 rcu_dynticks_snap kernel/rcu/tree.c:310 [inline]
 dyntick_save_progress_counter+0x43/0x1b0 kernel/rcu/tree.c:984
 force_qs_rnp+0x183/0x200 kernel/rcu/tree.c:2286
 rcu_gp_fqs kernel/rcu/tree.c:1601 [inline]
 rcu_gp_fqs_loop+0x71/0x880 kernel/rcu/tree.c:1653
 rcu_gp_kthread+0x22c/0x3b0 kernel/rcu/tree.c:1799
 kthread+0x1b5/0x200 kernel/kthread.c:255
 &lt;snip&gt;

read to 0xffff989dbdbe98e0 of 4 bytes by task 154 on cpu 7:
 rcu_nmi_enter_common kernel/rcu/tree.c:828 [inline]
 rcu_irq_enter+0xda/0x240 kernel/rcu/tree.c:870
 irq_enter+0x5/0x50 kernel/softirq.c:347
 &lt;snip&gt;

Reported by Kernel Concurrency Sanitizer on:
CPU: 7 PID: 154 Comm: kworker/7:1H Not tainted 5.3.0+ #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
Workqueue: kblockd blk_mq_run_work_fn
==================================================================

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Cc: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Cc: Josh Triplett &lt;josh@joshtriplett.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branches 'doc.2019.10.29a', 'fixes.2019.10.30a', 'nohz.2019.10.28a', 'replace.2019.10.30a', 'torture.2019.10.05a' and 'lkmm.2019.10.05a' into HEAD</title>
<updated>2019-10-30T15:47:13Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2019-10-30T15:47:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8dcdfb7096a304130ab36fbb0f2961deaf863e5a'/>
<id>urn:sha1:8dcdfb7096a304130ab36fbb0f2961deaf863e5a</id>
<content type='text'>
doc.2019.10.29a: RCU documentation updates.
fixes.2019.10.30a: RCU miscellaneous fixes.
nohz.2019.10.28a: RCU NO_HZ and NO_HZ_FULL updates.
replace.2019.10.30a: Replace rcu_swap_protected() with rcu_replace().
torture.2019.10.05a: RCU torture-test updates.

lkmm.2019.10.05a: Linux kernel memory model updates.
</content>
</entry>
<entry>
<title>rcu: Ensure that -&gt;rcu_urgent_qs is set before resched IPI</title>
<updated>2019-10-30T15:34:35Z</updated>
<author>
<name>Joel Fernandes (Google)</name>
</author>
<published>2019-08-16T02:59:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=05ef9e9eb3dade21413680f41eb0170778e8ae2b'/>
<id>urn:sha1:05ef9e9eb3dade21413680f41eb0170778e8ae2b</id>
<content type='text'>
The RCU-specific resched_cpu() function sends a resched IPI to the
specified CPU, which can be used to force the tick on for a given
nohz_full CPU.  This is needed when this nohz_full CPU is looping in the
kernel while blocking the current grace period.  However, for the tick
to actually be forced on in all cases, that CPU's rcu_data structure's
-&gt;rcu_urgent_qs flag must be set beforehand.  This commit therefore
causes rcu_implicit_dynticks_qs() to set this flag prior to invoking
resched_cpu() on a holdout nohz_full CPU.

Signed-off-by: Joel Fernandes (Google) &lt;joel@joelfernandes.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu: Make kernel-mode nohz_full CPUs invoke the RCU core processing</title>
<updated>2019-10-28T14:02:21Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2019-09-14T10:39:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dd7dafd1ad50aa9ed7958235431f243ea131ee7d'/>
<id>urn:sha1:dd7dafd1ad50aa9ed7958235431f243ea131ee7d</id>
<content type='text'>
If a nohz_full CPU is idle or executing in userspace, it makes good sense
to keep it out of RCU core processing.  After all, the RCU grace-period
kthread can see its quiescent states and all of its callbacks are
offloaded, so there is nothing for RCU core processing to do.

However, if a nohz_full CPU is executing in kernel space, the RCU
grace-period kthread cannot do anything for it, so such a CPU must report
its own quiescent states.  This commit therefore makes nohz_full CPUs
skip RCU core processing only if the scheduler-clock interrupt caught
them in idle or in userspace.

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu: Confine -&gt;core_needs_qs accesses to the corresponding CPU</title>
<updated>2019-10-28T14:02:21Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2019-09-13T21:09:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ed93dfc6bc0084485ccad1ff6bd2ea81ab2c03cd'/>
<id>urn:sha1:ed93dfc6bc0084485ccad1ff6bd2ea81ab2c03cd</id>
<content type='text'>
Commit 671a63517cf9 ("rcu: Avoid unnecessary softirq when system
is idle") fixed a bug that could result in an indefinite number of
unnecessary invocations of the RCU_SOFTIRQ handler at the trailing edge
of a scheduler-clock interrupt.  However, the fix introduced off-CPU
stores to -&gt;core_needs_qs.  These writes did not conflict with the
on-CPU stores because the CPU's leaf rcu_node structure's -&gt;lock was
held across all such stores.  However, the loads from -&gt;core_needs_qs
were not promoted to READ_ONCE() and, worse yet, the code loading from
-&gt;core_needs_qs was written assuming that it was only ever updated by
the corresponding CPU.  So operation has been robust, but only by luck.
This situation is therefore an accident waiting to happen.

This commit therefore takes a different approach.  Instead of clearing
-&gt;core_needs_qs from the grace-period kthread's force-quiescent-state
processing, it modifies the rcu_pending() function to suppress the
rcu_sched_clock_irq() function's call to invoke_rcu_core() if there is no
grace period in progress.  This avoids the infinite needless RCU_SOFTIRQ
handlers while still keeping all accesses to -&gt;core_needs_qs local to
the corresponding CPU.

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu: Reset CPU hints when reporting a quiescent state</title>
<updated>2019-10-28T14:02:21Z</updated>
<author>
<name>Joel Fernandes (Google)</name>
</author>
<published>2019-09-05T17:26:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=516e5ae0c94016294d3ef175454215b235d03945'/>
<id>urn:sha1:516e5ae0c94016294d3ef175454215b235d03945</id>
<content type='text'>
In some cases, tracing shows that need_heavy_qs is still set even though
urgent_qs was cleared upon reporting of a quiescent state.  One such
case is when the softirq reports that a CPU has passed quiescent state.

Commit 671a63517cf9 ("rcu: Avoid unnecessary softirq when system is
idle") fixed a bug where core_needs_qs was not being cleared.  In order
to avoid running into similar situations with the urgent-grace-period
flags, this commit causes rcu_disable_urgency_upon_qs(), previously
rcu_disable_tick_upon_qs(), to clear the urgency hints, -&gt;rcu_urgent_qs
and -&gt;rcu_need_heavy_qs.  Note that it is possible for CPUs to go
offline with these urgency hints still set.  This is handled because
rcu_disable_urgency_upon_qs() is also invoked during the online process.

Because these hints can be cleared both by the corresponding CPU and by
the grace-period kthread, this commit also adds a number of READ_ONCE()
and WRITE_ONCE() calls.

Tested overnight with rcutorture running for 60 minutes on all
configurations of RCU.

Signed-off-by: "Joel Fernandes (Google)" &lt;joel@joelfernandes.org&gt;
[ paulmck: Clear urgency flags in rcu_disable_urgency_upon_qs(). ]
[ paulmck: Remove -&gt;core_needs_qs from the set cleared at quiescent state. ]
[ paulmck: Make rcu_disable_urgency_upon_qs static per kbuild test robot. ]
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu: Force nohz_full tick on upon irq enter instead of exit</title>
<updated>2019-10-28T14:02:21Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2019-08-15T20:24:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b200a0489517d9e5a52e983183e890f573454ebd'/>
<id>urn:sha1:b200a0489517d9e5a52e983183e890f573454ebd</id>
<content type='text'>
There is interrupt-exit code that forces on the tick for nohz_full CPUs
failing to respond to the current grace period in a timely fashion.
However, this code must compare -&gt;dynticks_nmi_nesting to the value 2
in the interrupt-exit fastpath.  This commit therefore moves this code
to the interrupt-entry fastpath, where a lighter-weight comparison to
zero may be used.

Reported-by: Joel Fernandes &lt;joel@joelfernandes.org&gt;
[ paulmck: Apply Joel Fernandes TICK_DEP_MASK_RCU-&gt;TICK_DEP_BIT_RCU fix. ]
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu: Force tick on for nohz_full CPUs not reaching quiescent states</title>
<updated>2019-10-28T14:02:21Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2019-08-12T23:14:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=66e4c33b51bc515ca803c0948cf1525b53ffd631'/>
<id>urn:sha1:66e4c33b51bc515ca803c0948cf1525b53ffd631</id>
<content type='text'>
CPUs running for long time periods in the kernel in nohz_full mode
might leave the scheduling-clock interrupt disabled for then full
duration of their in-kernel execution.  This can (among other things)
delay grace periods.  This commit therefore forces the tick back on
for any nohz_full CPU that is failing to pass through a quiescent state
upon return from interrupt, which the resched_cpu() will induce.

Reported-by: Joel Fernandes &lt;joel@joelfernandes.org&gt;
[ paulmck: Clear -&gt;rcu_forced_tick as reported by Joel Fernandes testing. ]
[ paulmck: Apply Joel Fernandes TICK_DEP_MASK_RCU-&gt;TICK_DEP_BIT_RCU fix. ]
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn</title>
<updated>2019-10-05T17:46:05Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2019-08-04T20:17:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=79ba7ff5a9925f5c170f51ed7a96d1475eb6c27f'/>
<id>urn:sha1:79ba7ff5a9925f5c170f51ed7a96d1475eb6c27f</id>
<content type='text'>
During an actual call_rcu() flood, there would be frequent trips to
userspace (in-kernel call_rcu() floods must be otherwise housebroken).
Userspace execution on nohz_full CPUs implies an RCU dyntick idle/not-idle
transition pair, so this commit adds emulation of that pair.

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
</feed>
