Skip to content

Commit 7d9d077

Browse files
committed
Merge tag 'rcu.2022.07.26a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull RCU updates from Paul McKenney: - Documentation updates - Miscellaneous fixes - Callback-offload updates, perhaps most notably a new RCU_NOCB_CPU_DEFAULT_ALL Kconfig option that causes all CPUs to be offloaded at boot time, regardless of kernel boot parameters. This is useful to battery-powered systems such as ChromeOS and Android. In addition, a new RCU_NOCB_CPU_CB_BOOST kernel boot parameter prevents offloaded callbacks from interfering with real-time workloads and with energy-efficiency mechanisms - Polled grace-period updates, perhaps most notably making these APIs account for both normal and expedited grace periods - Tasks RCU updates, perhaps most notably reducing the CPU overhead of RCU tasks trace grace periods by more than a factor of two on a system with 15,000 tasks. The reduction is expected to increase with the number of tasks, so it seems reasonable to hypothesize that a system with 150,000 tasks might see a 20-fold reduction in CPU overhead - Torture-test updates - Updates that merge RCU's dyntick-idle tracking into context tracking, thus reducing the overhead of transitioning to kernel mode from either idle or nohz_full userspace execution for kernels that track context independently of RCU. This is expected to be helpful primarily for kernels built with CONFIG_NO_HZ_FULL=y * tag 'rcu.2022.07.26a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: (98 commits) rcu: Add irqs-disabled indicator to expedited RCU CPU stall warnings rcu: Diagnose extended sync_rcu_do_polled_gp() loops rcu: Put panic_on_rcu_stall() after expedited RCU CPU stall warnings rcutorture: Test polled expedited grace-period primitives rcu: Add polled expedited grace-period primitives rcutorture: Verify that polled GP API sees synchronous grace periods rcu: Make Tiny RCU grace periods visible to polled APIs rcu: Make polled grace-period API account for expedited grace periods rcu: Switch polled grace-period APIs to ->gp_seq_polled rcu/nocb: Avoid polling when my_rdp->nocb_head_rdp list is empty rcu/nocb: Add option to opt rcuo kthreads out of RT priority rcu: Add nocb_cb_kthread check to rcu_is_callbacks_kthread() rcu/nocb: Add an option to offload all CPUs on boot rcu/nocb: Fix NOCB kthreads spawn failure with rcu_nocb_rdp_deoffload() direct call rcu/nocb: Invert rcu_state.barrier_mutex VS hotplug lock locking order rcu/nocb: Add/del rdp to iterate from rcuog itself rcu/tree: Add comment to describe GP-done condition in fqs loop rcu: Initialize first_gp_fqs at declaration in rcu_gp_fqs() rcu/kvfree: Remove useless monitor_todo flag rcu: Cleanup RCU urgency state for offline CPU ...
2 parents c2a24a7 + 34bc7b4 commit 7d9d077

76 files changed

Lines changed: 2124 additions & 1279 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/Requirements/Requirements.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,10 +1844,10 @@ that meets this requirement.
18441844

18451845
Furthermore, NMI handlers can be interrupted by what appear to RCU to be
18461846
normal interrupts. One way that this can happen is for code that
1847-
directly invokes rcu_irq_enter() and rcu_irq_exit() to be called
1847+
directly invokes ct_irq_enter() and ct_irq_exit() to be called
18481848
from an NMI handler. This astonishing fact of life prompted the current
1849-
code structure, which has rcu_irq_enter() invoking
1850-
rcu_nmi_enter() and rcu_irq_exit() invoking rcu_nmi_exit().
1849+
code structure, which has ct_irq_enter() invoking
1850+
ct_nmi_enter() and ct_irq_exit() invoking ct_nmi_exit().
18511851
And yes, I also learned of this requirement the hard way.
18521852

18531853
Loadable Modules
@@ -2195,7 +2195,7 @@ scheduling-clock interrupt be enabled when RCU needs it to be:
21952195
sections, and RCU believes this CPU to be idle, no problem. This
21962196
sort of thing is used by some architectures for light-weight
21972197
exception handlers, which can then avoid the overhead of
2198-
rcu_irq_enter() and rcu_irq_exit() at exception entry and
2198+
ct_irq_enter() and ct_irq_exit() at exception entry and
21992199
exit, respectively. Some go further and avoid the entireties of
22002200
irq_enter() and irq_exit().
22012201
Just make very sure you are running some of your tests with
@@ -2226,7 +2226,7 @@ scheduling-clock interrupt be enabled when RCU needs it to be:
22262226
+-----------------------------------------------------------------------+
22272227
| **Answer**: |
22282228
+-----------------------------------------------------------------------+
2229-
| One approach is to do ``rcu_irq_exit();rcu_irq_enter();`` every so |
2229+
| One approach is to do ``ct_irq_exit();ct_irq_enter();`` every so |
22302230
| often. But given that long-running interrupt handlers can cause other |
22312231
| problems, not least for response time, shouldn't you work to keep |
22322232
| your interrupt handler's runtime within reasonable bounds? |

Documentation/RCU/stallwarn.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ warnings:
9797
which will include additional debugging information.
9898

9999
- A low-level kernel issue that either fails to invoke one of the
100-
variants of rcu_user_enter(), rcu_user_exit(), rcu_idle_enter(),
101-
rcu_idle_exit(), rcu_irq_enter(), or rcu_irq_exit() on the one
100+
variants of rcu_eqs_enter(true), rcu_eqs_exit(true), ct_idle_enter(),
101+
ct_idle_exit(), ct_irq_enter(), or ct_irq_exit() on the one
102102
hand, or that invokes one of them too many times on the other.
103103
Historically, the most frequent issue has been an omission
104104
of either irq_enter() or irq_exit(), which in turn invoke
105-
rcu_irq_enter() or rcu_irq_exit(), respectively. Building your
105+
ct_irq_enter() or ct_irq_exit(), respectively. Building your
106106
kernel with CONFIG_RCU_EQS_DEBUG=y can help track down these types
107107
of issues, which sometimes arise in architecture-specific code.
108108

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3667,6 +3667,9 @@
36673667
just as if they had also been called out in the
36683668
rcu_nocbs= boot parameter.
36693669

3670+
Note that this argument takes precedence over
3671+
the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option.
3672+
36703673
noiotrap [SH] Disables trapped I/O port accesses.
36713674

36723675
noirqdebug [X86-32] Disables the code which attempts to detect and
@@ -4560,6 +4563,9 @@
45604563
no-callback mode from boot but the mode may be
45614564
toggled at runtime via cpusets.
45624565

4566+
Note that this argument takes precedence over
4567+
the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option.
4568+
45634569
rcu_nocb_poll [KNL]
45644570
Rather than requiring that offloaded CPUs
45654571
(specified by rcu_nocbs= above) explicitly
@@ -4669,6 +4675,34 @@
46694675
When RCU_NOCB_CPU is set, also adjust the
46704676
priority of NOCB callback kthreads.
46714677

4678+
rcutree.rcu_divisor= [KNL]
4679+
Set the shift-right count to use to compute
4680+
the callback-invocation batch limit bl from
4681+
the number of callbacks queued on this CPU.
4682+
The result will be bounded below by the value of
4683+
the rcutree.blimit kernel parameter. Every bl
4684+
callbacks, the softirq handler will exit in
4685+
order to allow the CPU to do other work.
4686+
4687+
Please note that this callback-invocation batch
4688+
limit applies only to non-offloaded callback
4689+
invocation. Offloaded callbacks are instead
4690+
invoked in the context of an rcuoc kthread, which
4691+
scheduler will preempt as it does any other task.
4692+
4693+
rcutree.nocb_nobypass_lim_per_jiffy= [KNL]
4694+
On callback-offloaded (rcu_nocbs) CPUs,
4695+
RCU reduces the lock contention that would
4696+
otherwise be caused by callback floods through
4697+
use of the ->nocb_bypass list. However, in the
4698+
common non-flooded case, RCU queues directly to
4699+
the main ->cblist in order to avoid the extra
4700+
overhead of the ->nocb_bypass list and its lock.
4701+
But if there are too many callbacks queued during
4702+
a single jiffy, RCU pre-queues the callbacks into
4703+
the ->nocb_bypass queue. The definition of "too
4704+
many" is supplied by this kernel boot parameter.
4705+
46724706
rcutree.rcu_nocb_gp_stride= [KNL]
46734707
Set the number of NOCB callback kthreads in
46744708
each group, which defaults to the square root

Documentation/features/time/context-tracking/arch-support.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
2-
# Feature name: context-tracking
3-
# Kconfig: HAVE_CONTEXT_TRACKING
4-
# description: arch supports context tracking for NO_HZ_FULL
2+
# Feature name: user-context-tracking
3+
# Kconfig: HAVE_CONTEXT_TRACKING_USER
4+
# description: arch supports user context tracking for NO_HZ_FULL
55
#
66
-----------------------
77
| arch |status|

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5165,6 +5165,7 @@ F: include/linux/console*
51655165

51665166
CONTEXT TRACKING
51675167
M: Frederic Weisbecker <frederic@kernel.org>
5168+
M: "Paul E. McKenney" <paulmck@kernel.org>
51685169
S: Maintained
51695170
F: kernel/context_tracking.c
51705171
F: include/linux/context_tracking*

arch/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,18 +784,18 @@ config HAVE_ARCH_WITHIN_STACK_FRAMES
784784
and similar) by implementing an inline arch_within_stack_frames(),
785785
which is used by CONFIG_HARDENED_USERCOPY.
786786

787-
config HAVE_CONTEXT_TRACKING
787+
config HAVE_CONTEXT_TRACKING_USER
788788
bool
789789
help
790790
Provide kernel/user boundaries probes necessary for subsystems
791791
that need it, such as userspace RCU extended quiescent state.
792792
Syscalls need to be wrapped inside user_exit()-user_enter(), either
793793
optimized behind static key or through the slow path using TIF_NOHZ
794794
flag. Exceptions handlers must be wrapped as well. Irqs are already
795-
protected inside rcu_irq_enter/rcu_irq_exit() but preemption or signal
795+
protected inside ct_irq_enter/ct_irq_exit() but preemption or signal
796796
handling on irq exit still need to be protected.
797797

798-
config HAVE_CONTEXT_TRACKING_OFFSTACK
798+
config HAVE_CONTEXT_TRACKING_USER_OFFSTACK
799799
bool
800800
help
801801
Architecture neither relies on exception_enter()/exception_exit()
@@ -807,7 +807,7 @@ config HAVE_CONTEXT_TRACKING_OFFSTACK
807807

808808
- Critical entry code isn't preemptible (or better yet:
809809
not interruptible).
810-
- No use of RCU read side critical sections, unless rcu_nmi_enter()
810+
- No use of RCU read side critical sections, unless ct_nmi_enter()
811811
got called.
812812
- No use of instrumentation, unless instrumentation_begin() got
813813
called.

arch/arm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ config ARM
8484
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARM_LPAE
8585
select HAVE_ARM_SMCCC if CPU_V7
8686
select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
87-
select HAVE_CONTEXT_TRACKING
87+
select HAVE_CONTEXT_TRACKING_USER
8888
select HAVE_C_RECORDMCOUNT
8989
select HAVE_BUILDTIME_MCOUNT_SORT
9090
select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL

arch/arm/kernel/entry-common.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "entry-header.S"
2929

3030
saved_psr .req r8
31-
#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
31+
#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING_USER)
3232
saved_pc .req r9
3333
#define TRACE(x...) x
3434
#else
@@ -38,7 +38,7 @@ saved_pc .req lr
3838

3939
.section .entry.text,"ax",%progbits
4040
.align 5
41-
#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING) || \
41+
#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING_USER) || \
4242
IS_ENABLED(CONFIG_DEBUG_RSEQ))
4343
/*
4444
* This is the fast syscall return path. We do as little as possible here,

arch/arm/kernel/entry-header.S

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,25 +366,25 @@ ALT_UP_B(.L1_\@)
366366
* between user and kernel mode.
367367
*/
368368
.macro ct_user_exit, save = 1
369-
#ifdef CONFIG_CONTEXT_TRACKING
369+
#ifdef CONFIG_CONTEXT_TRACKING_USER
370370
.if \save
371371
stmdb sp!, {r0-r3, ip, lr}
372-
bl context_tracking_user_exit
372+
bl user_exit_callable
373373
ldmia sp!, {r0-r3, ip, lr}
374374
.else
375-
bl context_tracking_user_exit
375+
bl user_exit_callable
376376
.endif
377377
#endif
378378
.endm
379379

380380
.macro ct_user_enter, save = 1
381-
#ifdef CONFIG_CONTEXT_TRACKING
381+
#ifdef CONFIG_CONTEXT_TRACKING_USER
382382
.if \save
383383
stmdb sp!, {r0-r3, ip, lr}
384-
bl context_tracking_user_enter
384+
bl user_enter_callable
385385
ldmia sp!, {r0-r3, ip, lr}
386386
.else
387-
bl context_tracking_user_enter
387+
bl user_enter_callable
388388
.endif
389389
#endif
390390
.endm

arch/arm/mach-imx/cpuidle-imx6q.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2012 Freescale Semiconductor, Inc.
44
*/
55

6+
#include <linux/context_tracking.h>
67
#include <linux/cpuidle.h>
78
#include <linux/module.h>
89
#include <asm/cpuidle.h>
@@ -24,9 +25,9 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
2425
imx6_set_lpm(WAIT_UNCLOCKED);
2526
raw_spin_unlock(&cpuidle_lock);
2627

27-
rcu_idle_enter();
28+
ct_idle_enter();
2829
cpu_do_idle();
29-
rcu_idle_exit();
30+
ct_idle_exit();
3031

3132
raw_spin_lock(&cpuidle_lock);
3233
if (num_idle_cpus-- == num_online_cpus())

0 commit comments

Comments
 (0)