]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rcu-tasks: Wait for trc_read_check_handler() IPIs
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 30 Jul 2021 19:17:59 +0000 (12:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Sep 2023 07:17:08 +0000 (09:17 +0200)
commit8046fb611f707a3518831a0c186fbb67574970a0
tree9b8d8781c7ac739f6a84dbc99bf60661db76ed31
parentda22db901cc1188c69fa1e6ccfa16f29ee69380d
rcu-tasks: Wait for trc_read_check_handler() IPIs

commit cbe0d8d91415c9692fe88191940d98952b6855d9 upstream.

Currently, RCU Tasks Trace initializes the trc_n_readers_need_end counter
to the value one, increments it before each trc_read_check_handler()
IPI, then decrements it within trc_read_check_handler() if the target
task was in a quiescent state (or if the target task moved to some other
CPU while the IPI was in flight), complaining if the new value was zero.
The rationale for complaining is that the initial value of one must be
decremented away before zero can be reached, and this decrement has not
yet happened.

Except that trc_read_check_handler() is initiated with an asynchronous
smp_call_function_single(), which might be significantly delayed.  This
can result in false-positive complaints about the counter reaching zero.

This commit therefore waits for in-flight IPI handlers to complete before
decrementing away the initial value of one from the trc_n_readers_need_end
counter.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/rcu/tasks.h