linux/kernel/rcu
Frederic Weisbecker 3dfdfaff2d rcu: Robustify rcu_is_cpu_rrupt_from_idle()
RCU relies on the context tracking nesting counter in order to determine
if it is running in extended quiescent state.

However the context tracking nesting counter is not completely
synchronized with the actual context tracking state:

* The nesting counter is set to 1 or incremented further _after_ the
  actual state is set to RCU watching.

* The nesting counter is set to 0 or decremented further _before_ the
  actual state is set to RCU not watching.

Therefore it is safe to assume that if ct_nesting() > 0, RCU is
watching. But if ct_nesting() <= 0, RCU is not watching except for tiny
windows.

This hasn't been a problem so far because rcu_is_cpu_rrupt_from_idle()
has only been called from interrupts. However the code is confusing
and abuses the role of the context tracking nesting counter while there
are more accurate indicators available.

Clarify and robustify accordingly.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org>
2025-06-25 08:37:17 +05:30
..
Kconfig srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT 2025-03-28 21:19:17 -07:00
Kconfig.debug rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool 2025-02-05 07:14:40 -08:00
Makefile rcuperf: Change rcuperf to rcuscale 2020-08-24 18:39:24 -07:00
rcu_segcblist.c rcu/nocb: Simplify (de-)offloading state machine 2024-09-09 00:03:55 +05:30
rcu_segcblist.h rcu: Remove unused declaration rcu_segcblist_offload() 2024-10-22 15:36:56 +02:00
rcu.h Merge branches 'rcu/misc-for-6.16', 'rcu/seq-counters-for-6.16' and 'rcu/torture-for-6.16' into rcu/for-next 2025-05-16 11:18:16 -04:00
rcuscale.c rcuscale: using kcalloc() to relpace kmalloc() 2025-05-16 09:00:54 -04:00
rcutorture.c Another set of timer API cleanups: 2025-05-27 08:31:21 -07:00
refscale.c refscale: Add srcu_read_lock_fast() support using "srcu-fast" 2025-02-05 07:12:05 -08:00
srcutiny.c Merge branches 'docs.2025.02.04a', 'lazypreempt.2025.03.04a', 'misc.2025.03.04a', 'srcu.2025.02.05a' and 'torture.2025.02.05a' 2025-03-04 18:47:32 -08:00
srcutree.c srcu: Use rcu_seq_done_exact() for polling API 2025-04-08 14:55:55 -04:00
sync.c rcu: Eliminate lockless accesses to rcu_sync->gp_count 2024-07-04 13:48:57 -07:00
tasks.h treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
tiny.c RCU pull request for v6.15 2025-03-24 19:41:37 -07:00
tree_exp.h rcu: Remove swake_up_one_online() bandaid 2025-05-16 09:00:54 -04:00
tree_nocb.h treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
tree_plugin.h rcu/nocb: Add Safe checks for access offloaded rdp 2025-05-16 09:00:54 -04:00
tree_stall.h kernel/rcu/tree_stall: add /sys/kernel/rcu_stall_count 2025-06-05 22:02:25 -07:00
tree.c rcu: Robustify rcu_is_cpu_rrupt_from_idle() 2025-06-25 08:37:17 +05:30
tree.h Merge branches 'rcu/misc-for-6.16', 'rcu/seq-counters-for-6.16' and 'rcu/torture-for-6.16' into rcu/for-next 2025-05-16 11:18:16 -04:00
update.c torture: Add dowarn argument to torture_sched_setaffinity() 2024-12-14 16:38:23 +01:00