Skip to content

Commit d089f48

Browse files
committed
Merge tag 'core-rcu-2021-02-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RCU updates from Ingo Molnar: "These are the latest RCU updates for v5.12: - Documentation updates. - Miscellaneous fixes. - kfree_rcu() updates: Addition of mem_dump_obj() to provide allocator return addresses to more easily locate bugs. This has a couple of RCU-related commits, but is mostly MM. Was pulled in with akpm's agreement. - Per-callback-batch tracking of numbers of callbacks, which enables better debugging information and smarter reactions to large numbers of callbacks. - The first round of changes to allow CPUs to be runtime switched from and to callback-offloaded state. - CONFIG_PREEMPT_RT-related changes. - RCU CPU stall warning updates. - Addition of polling grace-period APIs for SRCU. - Torture-test and torture-test scripting updates, including a "torture everything" script that runs rcutorture, locktorture, scftorture, rcuscale, and refscale. Plus does an allmodconfig build. - nolibc fixes for the torture tests" * tag 'core-rcu-2021-02-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (130 commits) percpu_ref: Dump mem_dump_obj() info upon reference-count underflow rcu: Make call_rcu() print mem_dump_obj() info for double-freed callback mm: Make mem_obj_dump() vmalloc() dumps include start and length mm: Make mem_dump_obj() handle vmalloc() memory mm: Make mem_dump_obj() handle NULL and zero-sized pointers mm: Add mem_dump_obj() to print source of memory block tools/rcutorture: Fix position of -lgcc in mkinitrd.sh tools/nolibc: Fix position of -lgcc in the documented example tools/nolibc: Emit detailed error for missing alternate syscall number definitions tools/nolibc: Remove incorrect definitions of __ARCH_WANT_* tools/nolibc: Get timeval, timespec and timezone from linux/time.h tools/nolibc: Implement poll() based on ppoll() tools/nolibc: Implement fork() based on clone() tools/nolibc: Make getpgrp() fall back to getpgid(0) tools/nolibc: Make dup2() rely on dup3() when available tools/nolibc: Add the definition for dup() rcutorture: Add rcutree.use_softirq=0 to RUDE01 and TASKS01 torture: Maintain torture-specific set of CPUs-online books torture: Clean up after torture-test CPU hotplugging rcutorture: Make object_debug also double call_rcu() heap object ...
2 parents 3f6ec19 + 2b392cb commit d089f48

63 files changed

Lines changed: 3108 additions & 763 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/RCU/Design/Expedited-Grace-Periods/Expedited-Grace-Periods.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sections.
3838
RCU-preempt Expedited Grace Periods
3939
===================================
4040

41-
``CONFIG_PREEMPT=y`` kernels implement RCU-preempt.
41+
``CONFIG_PREEMPTION=y`` kernels implement RCU-preempt.
4242
The overall flow of the handling of a given CPU by an RCU-preempt
4343
expedited grace period is shown in the following diagram:
4444

@@ -112,7 +112,7 @@ things.
112112
RCU-sched Expedited Grace Periods
113113
---------------------------------
114114

115-
``CONFIG_PREEMPT=n`` kernels implement RCU-sched. The overall flow of
115+
``CONFIG_PREEMPTION=n`` kernels implement RCU-sched. The overall flow of
116116
the handling of a given CPU by an RCU-sched expedited grace period is
117117
shown in the following diagram:
118118

‎Documentation/RCU/Design/Requirements/Requirements.rst‎

Lines changed: 374 additions & 358 deletions
Large diffs are not rendered by default.

‎Documentation/RCU/checklist.rst‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ over a rather long period of time, but improvements are always welcome!
7070
is less readable and prevents lockdep from detecting locking issues.
7171

7272
Letting RCU-protected pointers "leak" out of an RCU read-side
73-
critical section is every bid as bad as letting them leak out
73+
critical section is every bit as bad as letting them leak out
7474
from under a lock. Unless, of course, you have arranged some
7575
other means of protection, such as a lock or a reference count
7676
-before- letting them out of the RCU read-side critical section.
@@ -129,9 +129,7 @@ over a rather long period of time, but improvements are always welcome!
129129
accesses. The rcu_dereference() primitive ensures that
130130
the CPU picks up the pointer before it picks up the data
131131
that the pointer points to. This really is necessary
132-
on Alpha CPUs. If you don't believe me, see:
133-
134-
http://www.openvms.compaq.com/wizard/wiz_2637.html
132+
on Alpha CPUs.
135133

136134
The rcu_dereference() primitive is also an excellent
137135
documentation aid, letting the person reading the
@@ -214,9 +212,9 @@ over a rather long period of time, but improvements are always welcome!
214212
the rest of the system.
215213

216214
7. As of v4.20, a given kernel implements only one RCU flavor,
217-
which is RCU-sched for PREEMPT=n and RCU-preempt for PREEMPT=y.
215+
which is RCU-sched for PREEMPTION=n and RCU-preempt for PREEMPTION=y.
218216
If the updater uses call_rcu() or synchronize_rcu(),
219-
then the corresponding readers my use rcu_read_lock() and
217+
then the corresponding readers may use rcu_read_lock() and
220218
rcu_read_unlock(), rcu_read_lock_bh() and rcu_read_unlock_bh(),
221219
or any pair of primitives that disables and re-enables preemption,
222220
for example, rcu_read_lock_sched() and rcu_read_unlock_sched().

‎Documentation/RCU/rcubarrier.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RCU (read-copy update) is a synchronization mechanism that can be thought
99
of as a replacement for read-writer locking (among other things), but with
1010
very low-overhead readers that are immune to deadlock, priority inversion,
1111
and unbounded latency. RCU read-side critical sections are delimited
12-
by rcu_read_lock() and rcu_read_unlock(), which, in non-CONFIG_PREEMPT
12+
by rcu_read_lock() and rcu_read_unlock(), which, in non-CONFIG_PREEMPTION
1313
kernels, generate no code whatsoever.
1414

1515
This means that RCU writers are unaware of the presence of concurrent
@@ -329,10 +329,10 @@ Answer: This cannot happen. The reason is that on_each_cpu() has its last
329329
to smp_call_function() and further to smp_call_function_on_cpu(),
330330
causing this latter to spin until the cross-CPU invocation of
331331
rcu_barrier_func() has completed. This by itself would prevent
332-
a grace period from completing on non-CONFIG_PREEMPT kernels,
332+
a grace period from completing on non-CONFIG_PREEMPTION kernels,
333333
since each CPU must undergo a context switch (or other quiescent
334334
state) before the grace period can complete. However, this is
335-
of no use in CONFIG_PREEMPT kernels.
335+
of no use in CONFIG_PREEMPTION kernels.
336336

337337
Therefore, on_each_cpu() disables preemption across its call
338338
to smp_call_function() and also across the local call to

‎Documentation/RCU/stallwarn.rst‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ warnings:
2525

2626
- A CPU looping with bottom halves disabled.
2727

28-
- For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel
28+
- For !CONFIG_PREEMPTION kernels, a CPU looping anywhere in the kernel
2929
without invoking schedule(). If the looping in the kernel is
3030
really expected and desirable behavior, you might need to add
3131
some calls to cond_resched().
@@ -44,7 +44,7 @@ warnings:
4444
result in the ``rcu_.*kthread starved for`` console-log message,
4545
which will include additional debugging information.
4646

47-
- A CPU-bound real-time task in a CONFIG_PREEMPT kernel, which might
47+
- A CPU-bound real-time task in a CONFIG_PREEMPTION kernel, which might
4848
happen to preempt a low-priority task in the middle of an RCU
4949
read-side critical section. This is especially damaging if
5050
that low-priority task is not permitted to run on any other CPU,
@@ -92,7 +92,9 @@ warnings:
9292
buggy timer hardware through bugs in the interrupt or exception
9393
path (whether hardware, firmware, or software) through bugs
9494
in Linux's timer subsystem through bugs in the scheduler, and,
95-
yes, even including bugs in RCU itself.
95+
yes, even including bugs in RCU itself. It can also result in
96+
the ``rcu_.*timer wakeup didn't happen for`` console-log message,
97+
which will include additional debugging information.
9698

9799
- A bug in the RCU implementation.
98100

@@ -292,6 +294,25 @@ kthread is waiting for a short timeout, the "state" precedes value of the
292294
task_struct ->state field, and the "cpu" indicates that the grace-period
293295
kthread last ran on CPU 5.
294296

297+
If the relevant grace-period kthread does not wake from FQS wait in a
298+
reasonable time, then the following additional line is printed::
299+
300+
kthread timer wakeup didn't happen for 23804 jiffies! g7076 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402
301+
302+
The "23804" indicates that kthread's timer expired more than 23 thousand
303+
jiffies ago. The rest of the line has meaning similar to the kthread
304+
starvation case.
305+
306+
Additionally, the following line is printed::
307+
308+
Possible timer handling issue on cpu=4 timer-softirq=11142
309+
310+
Here "cpu" indicates that the grace-period kthread last ran on CPU 4,
311+
where it queued the fqs timer. The number following the "timer-softirq"
312+
is the current ``TIMER_SOFTIRQ`` count on cpu 4. If this value does not
313+
change on successive RCU CPU stall warnings, there is further reason to
314+
suspect a timer problem.
315+
295316

296317
Multiple Warnings From One Stall
297318
================================

‎Documentation/RCU/whatisRCU.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ Quick Quiz #1:
683683
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
684684
This section presents a "toy" RCU implementation that is based on
685685
"classic RCU". It is also short on performance (but only for updates) and
686-
on features such as hotplug CPU and the ability to run in CONFIG_PREEMPT
686+
on features such as hotplug CPU and the ability to run in CONFIG_PREEMPTION
687687
kernels. The definitions of rcu_dereference() and rcu_assign_pointer()
688688
are the same as those shown in the preceding section, so they are omitted.
689689
::
@@ -739,7 +739,7 @@ Quick Quiz #2:
739739
Quick Quiz #3:
740740
If it is illegal to block in an RCU read-side
741741
critical section, what the heck do you do in
742-
PREEMPT_RT, where normal spinlocks can block???
742+
CONFIG_PREEMPT_RT, where normal spinlocks can block???
743743

744744
:ref:`Answers to Quick Quiz <8_whatisRCU>`
745745

@@ -1093,7 +1093,7 @@ Quick Quiz #2:
10931093
overhead is **negative**.
10941094

10951095
Answer:
1096-
Imagine a single-CPU system with a non-CONFIG_PREEMPT
1096+
Imagine a single-CPU system with a non-CONFIG_PREEMPTION
10971097
kernel where a routing table is used by process-context
10981098
code, but can be updated by irq-context code (for example,
10991099
by an "ICMP REDIRECT" packet). The usual way of handling
@@ -1120,10 +1120,10 @@ Answer:
11201120
Quick Quiz #3:
11211121
If it is illegal to block in an RCU read-side
11221122
critical section, what the heck do you do in
1123-
PREEMPT_RT, where normal spinlocks can block???
1123+
CONFIG_PREEMPT_RT, where normal spinlocks can block???
11241124

11251125
Answer:
1126-
Just as PREEMPT_RT permits preemption of spinlock
1126+
Just as CONFIG_PREEMPT_RT permits preemption of spinlock
11271127
critical sections, it permits preemption of RCU
11281128
read-side critical sections. It also permits
11291129
spinlocks blocking while in RCU read-side critical

‎Documentation/admin-guide/kernel-parameters.txt‎

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,6 +4078,10 @@
40784078
value, meaning that RCU_SOFTIRQ is used by default.
40794079
Specify rcutree.use_softirq=0 to use rcuc kthreads.
40804080

4081+
But note that CONFIG_PREEMPT_RT=y kernels disable
4082+
this kernel boot parameter, forcibly setting it
4083+
to zero.
4084+
40814085
rcutree.rcu_fanout_exact= [KNL]
40824086
Disable autobalancing of the rcu_node combining
40834087
tree. This is used by rcutorture, and might
@@ -4165,12 +4169,6 @@
41654169
Set wakeup interval for idle CPUs that have
41664170
RCU callbacks (RCU_FAST_NO_HZ=y).
41674171

4168-
rcutree.rcu_idle_lazy_gp_delay= [KNL]
4169-
Set wakeup interval for idle CPUs that have
4170-
only "lazy" RCU callbacks (RCU_FAST_NO_HZ=y).
4171-
Lazy RCU callbacks are those which RCU can
4172-
prove do nothing more than free memory.
4173-
41744172
rcutree.rcu_kick_kthreads= [KNL]
41754173
Cause the grace-period kthread to get an extra
41764174
wake_up() if it sleeps three times longer than
@@ -4324,6 +4322,14 @@
43244322
stress RCU, they don't participate in the actual
43254323
test, hence the "fake".
43264324

4325+
rcutorture.nocbs_nthreads= [KNL]
4326+
Set number of RCU callback-offload togglers.
4327+
Zero (the default) disables toggling.
4328+
4329+
rcutorture.nocbs_toggle= [KNL]
4330+
Set the delay in milliseconds between successive
4331+
callback-offload toggling attempts.
4332+
43274333
rcutorture.nreaders= [KNL]
43284334
Set number of RCU readers. The value -1 selects
43294335
N-1, where N is the number of CPUs. A value
@@ -4456,6 +4462,13 @@
44564462
only normal grace-period primitives. No effect
44574463
on CONFIG_TINY_RCU kernels.
44584464

4465+
But note that CONFIG_PREEMPT_RT=y kernels enables
4466+
this kernel boot parameter, forcibly setting
4467+
it to the value one, that is, converting any
4468+
post-boot attempt at an expedited RCU grace
4469+
period to instead use normal non-expedited
4470+
grace-period processing.
4471+
44594472
rcupdate.rcu_task_ipi_delay= [KNL]
44604473
Set time in jiffies during which RCU tasks will
44614474
avoid sending IPIs, starting with the beginning
@@ -4543,6 +4556,12 @@
45434556
refscale.verbose= [KNL]
45444557
Enable additional printk() statements.
45454558

4559+
refscale.verbose_batched= [KNL]
4560+
Batch the additional printk() statements. If zero
4561+
(the default) or negative, print everything. Otherwise,
4562+
print every Nth verbose statement, where N is the value
4563+
specified.
4564+
45464565
relax_domain_level=
45474566
[KNL, SMP] Set scheduler's default relax_domain_level.
45484567
See Documentation/admin-guide/cgroup-v1/cpusets.rst.
@@ -5317,6 +5336,14 @@
53175336
are running concurrently, especially on systems
53185337
with rotating-rust storage.
53195338

5339+
torture.verbose_sleep_frequency= [KNL]
5340+
Specifies how many verbose printk()s should be
5341+
emitted between each sleep. The default of zero
5342+
disables verbose-printk() sleeping.
5343+
5344+
torture.verbose_sleep_duration= [KNL]
5345+
Duration of each verbose-printk() sleep in jiffies.
5346+
53205347
tp720= [HW,PS2]
53215348

53225349
tpm_suspend_pcr=[HW,TPM]

‎include/linux/cpu.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ static inline void cpu_maps_update_done(void)
111111
#endif /* CONFIG_SMP */
112112
extern struct bus_type cpu_subsys;
113113

114+
extern int lockdep_is_cpus_held(void);
115+
114116
#ifdef CONFIG_HOTPLUG_CPU
115117
extern void cpus_write_lock(void);
116118
extern void cpus_write_unlock(void);

‎include/linux/list.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ static inline void hlist_add_before(struct hlist_node *n,
901901
}
902902

903903
/**
904-
* hlist_add_behing - add a new entry after the one specified
904+
* hlist_add_behind - add a new entry after the one specified
905905
* @n: new entry to be added
906906
* @prev: hlist node to add it after, which must be non-NULL
907907
*/

‎include/linux/mm.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,5 +3177,7 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping,
31773177

31783178
extern int sysctl_nr_trim_pages;
31793179

3180+
void mem_dump_obj(void *object);
3181+
31803182
#endif /* __KERNEL__ */
31813183
#endif /* _LINUX_MM_H */

0 commit comments

Comments
 (0)