Centos-kernel-stream-9/kernel
Waiman Long 86f4f43dc8 rcu: Move rcu_dynticks_eqs_online() to rcu_cpu_starting()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2065994

commit 2caebefb00f03b5ba13d44aa6cc3723759b43822
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Wed, 28 Jul 2021 12:38:42 -0700

    rcu: Move rcu_dynticks_eqs_online() to rcu_cpu_starting()

    The purpose of rcu_dynticks_eqs_online() is to adjust the ->dynticks
    counter of an incoming CPU when required.  It is currently invoked
    from rcutree_prepare_cpu(), which runs before the incoming CPU is
    running, and thus on some other CPU.  This makes the per-CPU accesses in
    rcu_dynticks_eqs_online() iffy at best, and it all "works" only because
    the running CPU cannot possibly be in dyntick-idle mode, which means
    that rcu_dynticks_eqs_online() never has any effect.

    It is currently OK for rcu_dynticks_eqs_online() to have no effect, but
    only because the CPU-offline process just happens to leave ->dynticks in
    the correct state.  After all, if ->dynticks were in the wrong state on a
    just-onlined CPU, rcutorture would complain bitterly the next time that
    CPU went idle, at least in kernels built with CONFIG_RCU_EQS_DEBUG=y,
    for example, those built by rcutorture scenario TREE04.  One could
    argue that this means that rcu_dynticks_eqs_online() is unnecessary,
    however, removing it would make the CPU-online process vulnerable to
    slight changes in the CPU-offline process.

    One could also ask why it is safe to move the rcu_dynticks_eqs_online()
    call so late in the CPU-online process.  Indeed, there was a time when it
    would not have been safe, which does much to explain its current location.
    However, the marking of a CPU as online from an RCU perspective has long
    since moved from rcutree_prepare_cpu() to rcu_cpu_starting(), and all
    that is required is that ->dynticks be set correctly by the time that
    the CPU is marked as online from an RCU perspective.  After all, the RCU
    grace-period kthread does not check to see if offline CPUs are also idle.
    (In case you were curious, this is one reason why there is quiescent-state
    reporting as part of the offlining process.)

    This commit therefore moves the call to rcu_dynticks_eqs_online() from
    rcutree_prepare_cpu() to rcu_cpu_starting(), this latter being guaranteed
    to be running on the incoming CPU.  The call to this function must of
    course be placed before this rcu_cpu_starting() announces this CPU's
    presence to RCU.

    Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

Signed-off-by: Waiman Long <longman@redhat.com>
2022-03-24 17:15:42 -04:00
..
bpf Merge: bpf, arm64: Use emit_addr_mov_i64() for BPF_PSEUDO_FUNC 2022-02-24 16:23:23 +00:00
cgroup Merge: cgroup-v1: Require capabilities to set release_agent (CVE-2022-0492) 2022-02-24 16:29:01 +00:00
configs
debug kernel: debug: Fix unreachable code in gdb_serial_stub() 2021-07-12 11:03:35 -05:00
dma dma/pool: create dma atomic pool only if dma zone has managed pages 2022-01-24 03:05:38 -05:00
entry KVM: rseq: Update rseq when processing NOTIFY_RESUME on xfer to KVM guest 2021-12-08 10:43:17 +01:00
events Merge: mm: update generic MM code to upstream v5.15 2021-12-15 11:00:36 -03:00
gcov Kconfig: Introduce ARCH_WANTS_NO_INSTR and CC_HAS_NO_PROFILE_FN_ATTR 2021-06-22 11:07:18 -07:00
irq genirq: Fix kernel doc indentation 2022-01-11 18:23:31 -05:00
kcsan Merge branch 'kcsan.2021.05.18a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu 2021-07-04 12:29:16 -07:00
livepatch Merge: ftrace: do CPU checking after preemption disabled 2022-01-12 16:59:34 +00:00
locking locking/semaphore: Add might_sleep() to down_*() family 2021-11-12 14:23:25 -05:00
power workqueue: Introduce show_one_worker_pool and show_one_workqueue. 2022-01-17 10:39:01 -05:00
printk printk: restore flushing of NMI buffers on remote CPUs after NMI backtraces 2022-01-11 09:48:02 -05:00
rcu rcu: Move rcu_dynticks_eqs_online() to rcu_cpu_starting() 2022-03-24 17:15:42 -04:00
sched Merge: kernel/sched/sched.h: Exclude cpuidle from KABI 2022-02-22 14:44:01 +00:00
time clocksource: Reduce the default clocksource_watchdog() retries to 2 2022-01-18 14:00:12 -05:00
trace Merge: blktrace: switch trace spinlock to a raw spinlock 2022-02-16 22:00:27 +00:00
.gitignore
Kconfig.freezer
Kconfig.hz
Kconfig.locks locking/rwlock: Provide RT variant 2021-09-27 16:18:59 -04:00
Kconfig.preempt preempt: Restore preemption model selection configs 2021-11-29 09:21:58 -05:00
Makefile kernel: Add redhat code 2022-01-27 09:03:54 -05:00
acct.c kernel: remove spurious blkdev.h includes 2021-12-06 16:42:47 +08:00
async.c
audit.c
audit.h audit: remove trailing spaces and tabs 2021-06-10 20:59:05 -04:00
audit_fsnotify.c
audit_tree.c audit: move put_tree() to avoid trim_trees refcount underflow and UAF 2021-10-19 09:57:53 -04:00
audit_watch.c
auditfilter.c
auditsc.c audit: remove trailing spaces and tabs 2021-06-10 20:59:05 -04:00
backtracetest.c
bounds.c
capability.c
cfi.c cfi: Use rcu_read_{un}lock_sched_notrace 2021-08-11 13:11:12 -07:00
compat.c arch: remove compat_alloc_user_space 2021-11-29 11:43:39 -05:00
configs.c
context_tracking.c
cpu.c sched/scs: Reset task stack state in bringup_cpu() 2021-12-13 16:07:52 -05:00
cpu_pm.c
crash_core.c kernel/crash_core: suppress unknown crashkernel parameter warning 2022-01-03 17:58:21 +01:00
crash_dump.c
cred.c ucounts: Move get_ucounts from cred_alloc_blank to key_change_session_keyring 2021-11-05 13:50:32 +01:00
delayacct.c delayacct: Add sysctl to enable at runtime 2021-05-12 11:43:25 +02:00
dma.c
exec_domain.c
exit.c Merge: sched: backports from 5.16 merge window 2021-12-22 10:22:13 -03:00
extable.c
fail_function.c
fork.c Merge: sched: backports from 5.16 merge window 2021-12-22 10:22:13 -03:00
freezer.c sched: Add get_current_state() 2021-06-18 11:43:08 +02:00
futex.c futex: Avoid redundant task lookup 2021-11-12 14:23:27 -05:00
gen_kheaders.sh kbuild: clean up ${quiet} checks in shell scripts 2021-05-27 04:01:50 +09:00
groups.c
hung_task.c Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
iomem.c
irq_work.c irq_work: Handle some irq_work in a per-CPU thread on PREEMPT_RT 2021-12-13 16:07:50 -05:00
jump_label.c jump_label: Fix jump_label_text_reserved() vs __init 2021-07-05 10:46:20 +02:00
kallsyms.c module: add printk formats to add module build ID to stacktraces 2021-07-08 11:48:22 -07:00
kcmp.c
kcov.c
kexec.c kexec: avoid compat_alloc_user_space 2021-11-29 11:43:35 -05:00
kexec_core.c printk: remove safe buffers 2022-01-11 09:45:30 -05:00
kexec_elf.c
kexec_file.c
kexec_internal.h
kheaders.c
kmod.c
kprobes.c sched: Move kprobes cleanup out of finish_task_switch() 2021-12-13 16:07:49 -05:00
ksysfs.c
kthread.c kthread: Move prio/affinite change into the newly created thread 2021-12-13 16:07:45 -05:00
latencytop.c
module-internal.h
module.c modules: add rhelversion MODULE_INFO tag 2021-08-30 10:50:55 -04:00
module_signature.c
module_signing.c KEYS: Make use of platform keyring for module signature verify 2021-08-30 14:29:38 -04:00
notifier.c
nsproxy.c memcg: enable accounting for new namesapces and struct nsproxy 2021-11-29 11:41:20 -05:00
padata.c padata: Replace deprecated CPU-hotplug functions. 2021-12-09 09:04:11 -05:00
panic.c printk: remove safe buffers 2022-01-11 09:45:30 -05:00
params.c params: lift param_set_uint_minmax to common code 2021-12-06 16:38:54 +08:00
pid.c
pid_namespace.c memcg: enable accounting for new namesapces and struct nsproxy 2021-11-29 11:41:20 -05:00
profile.c
ptrace.c sched: Change task_struct::state 2021-06-18 11:43:09 +02:00
range.c
reboot.c reboot: Add hardware protection power-off 2021-06-21 13:08:36 +01:00
regset.c
relay.c
resource.c kernel/resource: disallow access to exclusive system RAM regions 2021-11-30 20:23:19 +01:00
resource_kunit.c
rh_messages.c kernel/rh_taint.c: Update to new messaging 2022-01-10 13:31:06 -05:00
rh_shadowman.c kernel: Add redhat code 2022-01-27 09:03:54 -05:00
rh_taint.c redhat: Add mark_driver_deprecated() 2021-10-05 17:14:59 +02:00
rseq.c KVM: rseq: Update rseq when processing NOTIFY_RESUME on xfer to KVM guest 2021-12-08 10:43:17 +01:00
scftorture.c scftorture: Avoid NULL pointer exception on early exit 2021-11-12 14:23:13 -05:00
scs.c
seccomp.c seccomp: Fix setting loaded filter count during TSYNC 2021-08-11 11:48:28 -07:00
signal.c Merge: Enable AMX(TMUL) for Sapphire Rapids 2021-12-22 19:34:58 -03:00
smp.c sched: Improve wake_up_all_idle_cpus() take #2 2021-12-13 16:07:50 -05:00
smpboot.c smpboot: Replace deprecated CPU-hotplug functions. 2021-11-12 14:23:23 -05:00
smpboot.h
softirq.c genirq: Change force_irqthreads to a static key 2022-01-11 18:23:31 -05:00
stackleak.c
stacktrace.c
static_call.c static_call: Fix static_call_text_reserved() vs __init 2021-07-05 10:46:33 +02:00
stop_machine.c
sys.c kernel/fork: factor out replacing the current MM exe_file 2021-11-29 11:40:30 -05:00
sys_ni.c compat: remove some compat entry points 2021-11-29 11:43:38 -05:00
sysctl-test.c kernel/sysctl-test: Remove some casts which are no-longer required 2021-06-23 16:41:24 -06:00
sysctl.c sysctl: introduce new proc handler proc_dobool 2022-02-01 18:04:57 -05:00
task_work.c
taskstats.c
test_kprobes.c
torture.c torture: Replace deprecated CPU-hotplug functions. 2021-11-12 14:23:24 -05:00
tracepoint.c tracepoint: Use rcu get state and cond sync for static call updates 2021-08-06 10:54:41 -04:00
tsacct.c
ucount.c ucount: Make get_ucount a safe get_user replacement 2022-02-01 13:23:49 +01:00
uid16.c
uid16.h
umh.c
up.c
user-return-notifier.c
user.c
user_namespace.c memcg: enable accounting for new namesapces and struct nsproxy 2021-11-29 11:41:20 -05:00
usermode_driver.c Merge branch 'work.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2021-07-03 11:41:14 -07:00
utsname.c
utsname_sysctl.c
watch_queue.c
watchdog.c kernel: watchdog: modify the explanation related to watchdog thread 2021-06-29 10:53:46 -07:00
watchdog_hld.c
workqueue.c workqueue, kasan: avoid alloc_pages() when recording stack 2022-01-17 10:39:01 -05:00
workqueue_internal.h workqueue: Assign a color to barrier work items 2022-01-17 10:39:00 -05:00