On 4/29/2025 6:08 AM, Frederic Weisbecker wrote:
> 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 <frede...@kernel.org>
> ---
This seems like an important change but not urgent or fixing a bug, so I will
put it in my rcu/dev branch as well so it is easy for Neeraj to take.
thanks,
- Joel