Skip to content

Commit e5a3878

Browse files
committed
Merge tag 'rcu.next.v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux
Pull RCU updates from Boqun Feng: - Eliminate deadlocks involving do_exit() and RCU tasks, by Paul: Instead of SRCU read side critical sections, now a percpu list is used in do_exit() for scaning yet-to-exit tasks - Fix a deadlock due to the dependency between workqueue and RCU expedited grace period, reported by Anna-Maria Behnsen and Thomas Gleixner and fixed by Frederic: Now RCU expedited always uses its own kthread worker instead of a workqueue - RCU NOCB updates, code cleanups, unnecessary barrier removals and minor bug fixes - Maintain real-time response in rcu_tasks_postscan() and a minor fix for tasks trace quiescence check - Misc updates, comments and readibility improvement, boot time parameter for lazy RCU and rcutorture improvement - Documentation updates * tag 'rcu.next.v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux: (34 commits) rcu-tasks: Maintain real-time response in rcu_tasks_postscan() rcu-tasks: Eliminate deadlocks involving do_exit() and RCU tasks rcu-tasks: Maintain lists to eliminate RCU-tasks/do_exit() deadlocks rcu-tasks: Initialize data to eliminate RCU-tasks/do_exit() deadlocks rcu-tasks: Initialize callback lists at rcu_init() time rcu-tasks: Add data to eliminate RCU-tasks/do_exit() deadlocks rcu-tasks: Repair RCU Tasks Trace quiescence check rcu/sync: remove un-used rcu_sync_enter_start function rcutorture: Suppress rtort_pipe_count warnings until after stalls srcu: Improve comments about acceleration leak rcu: Provide a boot time parameter to control lazy RCU rcu: Rename jiffies_till_flush to jiffies_lazy_flush doc: Update checklist.rst discussion of callback execution doc: Clarify use of slab constructors and SLAB_TYPESAFE_BY_RCU context_tracking: Fix kerneldoc headers for __ct_user_{enter,exit}() doc: Add EARLY flag to early-parsed kernel boot parameters doc: Add CONFIG_RCU_STRICT_GRACE_PERIOD to checklist.rst doc: Make checklist.rst note that spinlocks are implied RCU readers doc: Make whatisRCU.rst note that spinlocks are RCU readers doc: Spinlocks are implied RCU readers ...
2 parents 1ddeeb2 + 3add00b commit e5a3878

24 files changed

+687
-560
lines changed

Documentation/RCU/checklist.rst

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ over a rather long period of time, but improvements are always welcome!
6868
rcu_read_lock_sched(), or by the appropriate update-side lock.
6969
Explicit disabling of preemption (preempt_disable(), for example)
7070
can serve as rcu_read_lock_sched(), but is less readable and
71-
prevents lockdep from detecting locking issues.
71+
prevents lockdep from detecting locking issues. Acquiring a
72+
spinlock also enters an RCU read-side critical section.
7273

7374
Please note that you *cannot* rely on code known to be built
7475
only in non-preemptible kernels. Such code can and will break,
@@ -382,16 +383,17 @@ over a rather long period of time, but improvements are always welcome!
382383
must use whatever locking or other synchronization is required
383384
to safely access and/or modify that data structure.
384385

385-
Do not assume that RCU callbacks will be executed on the same
386-
CPU that executed the corresponding call_rcu() or call_srcu().
387-
For example, if a given CPU goes offline while having an RCU
388-
callback pending, then that RCU callback will execute on some
389-
surviving CPU. (If this was not the case, a self-spawning RCU
390-
callback would prevent the victim CPU from ever going offline.)
391-
Furthermore, CPUs designated by rcu_nocbs= might well *always*
392-
have their RCU callbacks executed on some other CPUs, in fact,
393-
for some real-time workloads, this is the whole point of using
394-
the rcu_nocbs= kernel boot parameter.
386+
Do not assume that RCU callbacks will be executed on
387+
the same CPU that executed the corresponding call_rcu(),
388+
call_srcu(), call_rcu_tasks(), call_rcu_tasks_rude(), or
389+
call_rcu_tasks_trace(). For example, if a given CPU goes offline
390+
while having an RCU callback pending, then that RCU callback
391+
will execute on some surviving CPU. (If this was not the case,
392+
a self-spawning RCU callback would prevent the victim CPU from
393+
ever going offline.) Furthermore, CPUs designated by rcu_nocbs=
394+
might well *always* have their RCU callbacks executed on some
395+
other CPUs, in fact, for some real-time workloads, this is the
396+
whole point of using the rcu_nocbs= kernel boot parameter.
395397

396398
In addition, do not assume that callbacks queued in a given order
397399
will be invoked in that order, even if they all are queued on the
@@ -444,7 +446,7 @@ over a rather long period of time, but improvements are always welcome!
444446
real-time workloads than is synchronize_rcu_expedited().
445447

446448
It is also permissible to sleep in RCU Tasks Trace read-side
447-
critical, which are delimited by rcu_read_lock_trace() and
449+
critical section, which are delimited by rcu_read_lock_trace() and
448450
rcu_read_unlock_trace(). However, this is a specialized flavor
449451
of RCU, and you should not use it without first checking with
450452
its current users. In most cases, you should instead use SRCU.
@@ -490,6 +492,12 @@ over a rather long period of time, but improvements are always welcome!
490492
since the last time that you passed that same object to
491493
call_rcu() (or friends).
492494

495+
CONFIG_RCU_STRICT_GRACE_PERIOD:
496+
combine with KASAN to check for pointers leaked out
497+
of RCU read-side critical sections. This Kconfig
498+
option is tough on both performance and scalability,
499+
and so is limited to four-CPU systems.
500+
493501
__rcu sparse checks:
494502
tag the pointer to the RCU-protected data structure
495503
with __rcu, and sparse will warn you if you access that

Documentation/RCU/rcu_dereference.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ member of the rcu_dereference() to use in various situations:
408408
RCU flavors, an RCU read-side critical section is entered
409409
using rcu_read_lock(), anything that disables bottom halves,
410410
anything that disables interrupts, or anything that disables
411-
preemption.
411+
preemption. Please note that spinlock critical sections
412+
are also implied RCU read-side critical sections, even when
413+
they are preemptible, as they are in kernels built with
414+
CONFIG_PREEMPT_RT=y.
412415

413416
2. If the access might be within an RCU read-side critical section
414417
on the one hand, or protected by (say) my_lock on the other,

Documentation/RCU/whatisRCU.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,25 @@ rcu_read_lock()
172172
critical section. Reference counts may be used in conjunction
173173
with RCU to maintain longer-term references to data structures.
174174

175+
Note that anything that disables bottom halves, preemption,
176+
or interrupts also enters an RCU read-side critical section.
177+
Acquiring a spinlock also enters an RCU read-side critical
178+
sections, even for spinlocks that do not disable preemption,
179+
as is the case in kernels built with CONFIG_PREEMPT_RT=y.
180+
Sleeplocks do *not* enter RCU read-side critical sections.
181+
175182
rcu_read_unlock()
176183
^^^^^^^^^^^^^^^^^
177184
void rcu_read_unlock(void);
178185

179186
This temporal primitives is used by a reader to inform the
180187
reclaimer that the reader is exiting an RCU read-side critical
181-
section. Note that RCU read-side critical sections may be nested
182-
and/or overlapping.
188+
section. Anything that enables bottom halves, preemption,
189+
or interrupts also exits an RCU read-side critical section.
190+
Releasing a spinlock also exits an RCU read-side critical section.
191+
192+
Note that RCU read-side critical sections may be nested and/or
193+
overlapping.
183194

184195
synchronize_rcu()
185196
^^^^^^^^^^^^^^^^^
@@ -952,8 +963,8 @@ unfortunately any spinlock in a ``SLAB_TYPESAFE_BY_RCU`` object must be
952963
initialized after each and every call to kmem_cache_alloc(), which renders
953964
reference-free spinlock acquisition completely unsafe. Therefore, when
954965
using ``SLAB_TYPESAFE_BY_RCU``, make proper use of a reference counter.
955-
(Those willing to use a kmem_cache constructor may also use locking,
956-
including cache-friendly sequence locking.)
966+
(Those willing to initialize their locks in a kmem_cache constructor
967+
may also use locking, including cache-friendly sequence locking.)
957968

958969
With traditional reference counting -- such as that implemented by the
959970
kref library in Linux -- there is typically code that runs when the last

Documentation/admin-guide/kernel-parameters.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ is applicable::
108108
CMA Contiguous Memory Area support is enabled.
109109
DRM Direct Rendering Management support is enabled.
110110
DYNAMIC_DEBUG Build in debug messages and enable them at runtime
111+
EARLY Parameter processed too early to be embedded in initrd.
111112
EDD BIOS Enhanced Disk Drive Services (EDD) is enabled
112113
EFI EFI Partitioning (GPT) is enabled
113114
EVM Extended Verification Module

0 commit comments

Comments
 (0)