rcutorture: Split out beginning and end from rcu_torture_one_read()
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 5 Feb 2025 20:49:32 +0000 (12:49 -0800)
committerJoel Fernandes <joelagnelf@nvidia.com>
Tue, 8 Apr 2025 18:55:38 +0000 (14:55 -0400)
commite73e5b7c1acd51fc5000dc476ceb76184b6ca253
tree65329c79125ba36aaf169519f4a6a6b3961d9a3c
parent75d8bf48a8bef2628243d0d76599c710412ba25b
rcutorture: Split out beginning and end from rcu_torture_one_read()

The rcu_torture_one_read() function is designed for RCU readers that are
confined to a task, such that a single thread of control extends from the
beginning of a given RCU read-side critical section to its end.  This does
not suffice for things like srcu_down_read() and srcu_up_read(), where
the critical section might start at task level and end in a timer handler.

This commit therefore creates separate init_rcu_torture_one_read_state(),
rcu_torture_one_read_start(), and rcu_torture_one_read_end() functions,
along with a rcu_torture_one_read_state structure to coordinate their
actions.  These will be used to create tests for srcu_down_read()
and friends.

One caution:  The caller to rcu_torture_one_read_start() must enter the
initial read-side critical section prior to the call.  This enables use
of non-standard primitives such as srcu_down_read() while still using
the same validation code.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
kernel/rcu/rcutorture.c