OpenCloudOS-Kernel/kernel/rcu
Frederic Weisbecker 84a5feebba rcu/nocb: Fix rcuog wake-up from offline softirq
[ Upstream commit f7345ccc62a4b880cf76458db5f320725f28e400 ]

After a CPU has set itself offline and before it eventually calls
rcutree_report_cpu_dead(), there are still opportunities for callbacks
to be enqueued, for example from a softirq. When that happens on NOCB,
the rcuog wake-up is deferred through an IPI to an online CPU in order
not to call into the scheduler and risk arming the RT-bandwidth after
hrtimers have been migrated out and disabled.

But performing a synchronized IPI from a softirq is buggy as reported in
the following scenario:

        WARNING: CPU: 1 PID: 26 at kernel/smp.c:633 smp_call_function_single
        Modules linked in: rcutorture torture
        CPU: 1 UID: 0 PID: 26 Comm: migration/1 Not tainted 6.11.0-rc1-00012-g9139f93209d1 #1
        Stopper: multi_cpu_stop+0x0/0x320 <- __stop_cpus+0xd0/0x120
        RIP: 0010:smp_call_function_single
        <IRQ>
        swake_up_one_online
        __call_rcu_nocb_wake
        __call_rcu_common
        ? rcu_torture_one_read
        call_timer_fn
        __run_timers
        run_timer_softirq
        handle_softirqs
        irq_exit_rcu
        ? tick_handle_periodic
        sysvec_apic_timer_interrupt
        </IRQ>

Fix this with forcing deferred rcuog wake up through the NOCB timer when
the CPU is offline. The actual wake up will happen from
rcutree_report_cpu_dead().

Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202409231644.4c55582d-lkp@intel.com
Fixes: 9139f93209d1 ("rcu/nocb: Fix RT throttling hrtimer armed from offline CPU")
Reviewed-by: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-10-17 15:24:30 +02:00
..
Kconfig rcu: Employ jiffies-based backstop to callback time limit 2023-05-11 13:42:39 -07:00
Kconfig.debug rcu: Allow up to five minutes expedited RCU CPU stall-warning timeouts 2023-01-09 12:09:52 -08:00
Makefile rcuperf: Change rcuperf to rcuscale 2020-08-24 18:39:24 -07:00
rcu.h rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
rcu_segcblist.c rcu: Throttle callback invocation based on number of ready callbacks 2023-01-03 17:28:34 -08:00
rcu_segcblist.h rcu: Throttle callback invocation based on number of ready callbacks 2023-01-03 17:28:34 -08:00
rcuscale.c rcuscale: Provide clear error when async specified without primitives 2024-10-10 11:57:31 +02:00
rcutorture.c rcutorture: Fix rcu_torture_fwd_cb_cr() data race 2024-08-14 13:58:41 +02:00
refscale.c refscale: Add a "jiffies" test 2023-07-14 15:01:04 -07:00
srcutiny.c rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
srcutree.c rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
sync.c rcu/sync: Use call_rcu_hurry() instead of call_rcu 2022-11-29 14:04:33 -08:00
tasks.h rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
tiny.c rcu: Dump memory object info if callback function is invalid 2024-08-29 17:33:23 +02:00
tree.c rcu/nocb: Make IRQs disablement symmetric 2024-10-17 15:24:30 +02:00
tree.h rcu/nocb: Remove buggy bypass lock contention mitigation 2024-09-08 07:54:44 +02:00
tree_exp.h rcu/exp: Handle RCU expedited grace period kworker allocation failure 2024-03-26 18:19:17 -04:00
tree_nocb.h rcu/nocb: Fix rcuog wake-up from offline softirq 2024-10-17 15:24:30 +02:00
tree_plugin.h rcu: Mark additional concurrent load from ->cpu_no_qs.b.exp 2023-05-11 13:42:39 -07:00
tree_stall.h rcu: Fix buffer overflow in print_cpu_stall_info() 2024-06-12 11:11:32 +02:00
update.c Merge branch 'stall.2023.01.09a' into HEAD 2023-02-02 16:40:07 -08:00