RCU: Track rcu_dereference() in RCU read-side critical section
The variables protected by an RCU read-side critical section are
sometimes hard to figure out, especially when the critical section is
long or has some function calls in it. However, figuring out which
variable a RCU read-side critical section protects could save
us a lot of time for code reviewing, bug fixing or performance tuning.
This patch therefore uses the LOCKED_ACCESS to collect the information
of relationship between rcu_dereference*() and rcu_read_lock*() by
doing:
Step 0: define a locked_access_class for RCU.
Step 1: set the content of rcu_*_lock_key and __srcu_key to the
address of the locked_access_class for RCU.
Step 2: add locked_access_point() in __rcu_dereference_check()
After that we can figure out not only in which RCU read-side critical
section but also after which rcu_read_lock*() called an
rcu_dereference*() is called.
This feature is controlled by a config option RCU_LOCKED_ACCESS.
Also clean up the initialization code of lockdep_maps for different
flavors of RCU a little bit.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 files changed