]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rcu-tasks: Add trc_inspect_reader() checks for exiting critical section
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 28 Jul 2021 18:32:28 +0000 (11:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Sep 2023 07:18:14 +0000 (09:18 +0200)
commitd93ba6e46e5f60a59d045fbc537232b835ee64ca
tree9defd50d3f50bce1e9869d5877ffbdd32b3cf9bf
parent3e22624f8fd39f0571d388130f0cc44ff551fa12
rcu-tasks: Add trc_inspect_reader() checks for exiting critical section

commit 18f08e758f34e6dfe0668bee51bd2af7adacf381 upstream.

Currently, trc_inspect_reader() treats a task exiting its RCU Tasks
Trace read-side critical section the same as being within that critical
section.  However, this can fail because that task might have already
checked its .need_qs field, which means that it might never decrement
the all-important trc_n_readers_need_end counter.  Of course, for that
to happen, the task would need to never again execute an RCU Tasks Trace
read-side critical section, but this really could happen if the system's
last trampoline was removed.  Note that exit from such a critical section
cannot be treated as a quiescent state due to the possibility of nested
critical sections.  This means that if trc_inspect_reader() sees a
negative nesting value, it must set up to try again later.

This commit therefore ignores tasks that are exiting their RCU Tasks
Trace read-side critical sections so that they will be rechecked later.

[ paulmck: Apply feedback from Neeraj Upadhyay and Boqun Feng. ]

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